Fix wizard not displaying error messages (#8545)

This commit is contained in:
Charles Gagnon
2019-12-03 17:40:19 -08:00
committed by GitHub
parent 7f16a4d857
commit 6cce532ca4
2 changed files with 25 additions and 12 deletions

View File

@@ -481,19 +481,23 @@ export abstract class Modal extends Disposable implements IThemable {
this._messageDetail.innerText = description;
}
DOM.removeNode(this._messageDetail);
if (this._messageSummaryText) {
if (this._useDefaultMessageBoxLocation) {
DOM.prepend(this._modalContent, (this._messageElement));
}
} else {
// Set the focus manually otherwise it'll escape the dialog to something behind it
this.setInitialFocusedElement();
DOM.removeNode(this._messageElement);
}
this.messagesElementVisible = !!this._messageSummaryText;
this.updateExpandMessageState();
}
}
protected set messagesElementVisible(visible: boolean) {
if (visible) {
if (this._useDefaultMessageBoxLocation) {
DOM.prepend(this._modalContent, (this._messageElement));
}
} else {
// Set the focus manually otherwise it'll escape the dialog to something behind it
this.setInitialFocusedElement();
DOM.removeNode(this._messageElement);
}
}
/**
* Set spinner element to show or hide
*/

View File

@@ -36,6 +36,7 @@ export class WizardModal extends Modal {
private _body: HTMLElement;
private _pageContainer: HTMLElement;
private _mpContainer: HTMLElement;
// Buttons
private _previousButton: Button;
@@ -130,9 +131,8 @@ export class WizardModal extends Modal {
this.initializeNavigation(this._body);
const mpContainer = append(this._body, $('div.dialog-message-and-page-container'));
mpContainer.append(this._messageElement);
this._pageContainer = append(mpContainer, $('div.dialogModal-page-container'));
this._mpContainer = append(this._body, $('div.dialog-message-and-page-container'));
this._pageContainer = append(this._mpContainer, $('div.dialogModal-page-container'));
this._wizard.pages.forEach(page => {
this.registerPage(page);
@@ -152,6 +152,15 @@ export class WizardModal extends Modal {
this.updatePageNumbers();
}
protected set messagesElementVisible(visible: boolean) {
if (visible) {
this._mpContainer.prepend(this._messageElement);
} else {
// Let base class handle it
super.messagesElementVisible = false;
}
}
private updatePageNumbers(): void {
this._wizard.pages.forEach((page, index) => {
let dialogPane = this._dialogPanes.get(page);