mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 01:25:36 -05:00
* removes more builder references * remove builder from profiler * formatting * fix profiler dailog * remove builder from oatuhdialog * remove the rest of builder references * formatting * add more strict null checks to base * enable strict tslint rules * fix formatting * fix compile error * fix the rest of the hygeny issues and add pipeline step * fix pipeline files
50 lines
2.0 KiB
TypeScript
50 lines
2.0 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import { DialogModal } from 'sql/platform/dialog/dialogModal';
|
|
import { WizardModal } from 'sql/platform/dialog/wizardModal';
|
|
import { Dialog, Wizard } from 'sql/platform/dialog/dialogTypes';
|
|
import { IModalOptions } from 'sql/workbench/browser/modal/modal';
|
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
|
|
|
const defaultOptions: IModalOptions = { hasBackButton: false, isWide: false, hasErrors: true };
|
|
const defaultWizardOptions: IModalOptions = { hasBackButton: false, isWide: true, hasErrors: true };
|
|
|
|
export class CustomDialogService {
|
|
private _dialogModals = new Map<Dialog, DialogModal>();
|
|
private _wizardModals = new Map<Wizard, WizardModal>();
|
|
|
|
constructor(@IInstantiationService private _instantiationService: IInstantiationService) { }
|
|
|
|
public showDialog(dialog: Dialog, dialogName?: string, options?: IModalOptions): void {
|
|
let name = dialogName ? dialogName : 'CustomDialog';
|
|
let dialogModal = this._instantiationService.createInstance(DialogModal, dialog, name, options || defaultOptions);
|
|
this._dialogModals.set(dialog, dialogModal);
|
|
dialogModal.render();
|
|
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();
|
|
}
|
|
}
|
|
}
|