mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 09:35:36 -05:00
Enable basic wizard API (#1450)
This commit is contained in:
@@ -8,14 +8,17 @@
|
||||
import * as sqlops from 'sqlops';
|
||||
import { OptionsDialog } from 'sql/base/browser/ui/modal/optionsDialog';
|
||||
import { DialogModal } from 'sql/platform/dialog/dialogModal';
|
||||
import { Dialog } from 'sql/platform/dialog/dialogTypes';
|
||||
import { WizardModal } from 'sql/platform/dialog/wizardModal';
|
||||
import { Dialog, Wizard, DialogTab } from 'sql/platform/dialog/dialogTypes';
|
||||
import { IModalOptions } from 'sql/base/browser/ui/modal/modal';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
const defaultOptions: IModalOptions = { hasBackButton: true, isWide: false };
|
||||
const defaultOptions: IModalOptions = { hasBackButton: false, isWide: false };
|
||||
const defaultWizardOptions: IModalOptions = { hasBackButton: false, isWide: true };
|
||||
|
||||
export class CustomDialogService {
|
||||
private _dialogModals = new Map<Dialog, DialogModal>();
|
||||
private _wizardModals = new Map<Wizard, WizardModal>();
|
||||
|
||||
constructor( @IInstantiationService private _instantiationService: IInstantiationService) { }
|
||||
|
||||
@@ -26,10 +29,24 @@ export class CustomDialogService {
|
||||
dialogModal.open();
|
||||
}
|
||||
|
||||
public showWizard(wizard: Wizard, options?: IModalOptions): void {
|
||||
let wizardModal = this._instantiationService.createInstance(WizardModal, wizard, 'WizardPage', options || defaultWizardOptions);
|
||||
this._wizardModals.set(wizard, wizardModal);
|
||||
wizardModal.render();
|
||||
wizardModal.open();
|
||||
}
|
||||
|
||||
public closeDialog(dialog: Dialog): void {
|
||||
let dialogModal = this._dialogModals.get(dialog);
|
||||
if (dialogModal) {
|
||||
dialogModal.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
public closeWizard(wizard: Wizard): void {
|
||||
let wizardModal = this._wizardModals.get(wizard);
|
||||
if (wizardModal) {
|
||||
wizardModal.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user