Files
azuredatastudio/extensions/resource-deployment/src/ui/dialogBase.ts
Arvind Ranasaria 9cf80113fc controller dropdown field to SQL MIAA and Postgres deployment. (#12217)
* saving first draft

* throw if no controllers

* cleanup

* bug fixes

* bug fixes and caching controller access

* pr comments and bug fixes.

* fixes

* fixes

* comment fix

* remove debug prints

* comment fixes

* remove debug logs

* inputValueTransformer returns string|Promise

* PR feedback

* pr fixes

* remove _ from protected fields

* anonymous to full methods

* small fixes
2020-09-15 14:47:49 -07:00

42 lines
1.3 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 * as azdata from 'azdata';
import * as vscode from 'vscode';
export abstract class DialogBase {
protected _toDispose: vscode.Disposable[] = [];
protected _dialogObject: azdata.window.Dialog;
constructor(dialogTitle: string, dialogName: string, isWide: boolean = false) {
this._dialogObject = azdata.window.createModelViewDialog(dialogTitle, dialogName, isWide);
this._toDispose.push(this._dialogObject.cancelButton.onClick(() => this.onCancelButtonClicked()));
this._toDispose.push(this._dialogObject.okButton.onClick(() => this.onOkButtonClicked()));
}
protected abstract initialize(): void;
public open(): void {
this.initialize();
azdata.window.openDialog(this._dialogObject);
}
private onCancelButtonClicked(): void {
this.dispose();
}
private async onOkButtonClicked(): Promise<void> {
await this.onComplete();
this.dispose();
}
protected async onComplete(): Promise<void> {
}
protected dispose(): void {
this._toDispose.forEach(disposable => disposable.dispose());
}
}