fix setCurrentPage (#12025)

* fix setCurrentPage

* Fix wrong import
This commit is contained in:
Amir Omidi
2020-08-31 12:36:38 -07:00
committed by GitHub
parent 404260b8a0
commit 61e5003931
3 changed files with 9 additions and 11 deletions

View File

@@ -211,8 +211,8 @@ export class MainThreadModelViewDialog implements MainThreadModelViewDialogShape
public $setWizardPage(wizardHandle: number, pageIndex: number): Thenable<void> { public $setWizardPage(wizardHandle: number, pageIndex: number): Thenable<void> {
let wizard = this.getWizard(wizardHandle); let wizard = this.getWizard(wizardHandle);
wizard.setCurrentPage(pageIndex); const modal = this._dialogService.getWizardModal(wizard);
return Promise.resolve(); return modal.showPage(pageIndex);
} }
public $openWizard(handle: number): Thenable<void> { public $openWizard(handle: number): Thenable<void> {

View File

@@ -34,16 +34,14 @@ export class CustomDialogService {
} }
public closeDialog(dialog: Dialog): void { public closeDialog(dialog: Dialog): void {
let dialogModal = this._dialogModals.get(dialog); this._dialogModals.get(dialog)?.cancel();
if (dialogModal) {
dialogModal.cancel();
}
} }
public closeWizard(wizard: Wizard): void { public closeWizard(wizard: Wizard): void {
let wizardModal = this._wizardModals.get(wizard); this._wizardModals.get(wizard)?.cancel();
if (wizardModal) { }
wizardModal.cancel();
} public getWizardModal(wizard: Wizard): WizardModal | undefined {
return this._wizardModals.get(wizard);
} }
} }

View File

@@ -176,7 +176,7 @@ export class WizardModal extends Modal {
page.onUpdate(() => this.setButtonsForPage(this._wizard.currentPage)); page.onUpdate(() => this.setButtonsForPage(this._wizard.currentPage));
} }
private async showPage(index: number, validate: boolean = true, focus: boolean = false): Promise<void> { public async showPage(index: number, validate: boolean = true, focus: boolean = false): Promise<void> {
let pageToShow = this._wizard.pages[index]; let pageToShow = this._wizard.pages[index];
if (!pageToShow) { if (!pageToShow) {
this.done(validate).catch(err => onUnexpectedError(err)); this.done(validate).catch(err => onUnexpectedError(err));