mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-30 09:35:39 -05:00
fix issue 7489 and disposable handling (#7491)
This commit is contained in:
@@ -23,7 +23,6 @@ export class DeploymentInputDialog extends DialogBase {
|
||||
private dialogInfo: DialogInfo) {
|
||||
super(dialogInfo.title, dialogInfo.name, false);
|
||||
this._dialogObject.okButton.label = localize('deploymentDialog.OKButtonText', 'Open Notebook');
|
||||
this._dialogObject.okButton.onClick(() => this.onComplete());
|
||||
}
|
||||
|
||||
protected initialize() {
|
||||
@@ -59,7 +58,7 @@ export class DeploymentInputDialog extends DialogBase {
|
||||
});
|
||||
}
|
||||
|
||||
private onComplete(): void {
|
||||
protected onComplete(): void {
|
||||
const model: Model = new Model();
|
||||
setModelValues(this.inputComponents, model);
|
||||
if (instanceOfNotebookBasedDialogInfo(this.dialogInfo)) {
|
||||
@@ -70,6 +69,5 @@ export class DeploymentInputDialog extends DialogBase {
|
||||
} else {
|
||||
vscode.commands.executeCommand(this.dialogInfo.command, model);
|
||||
}
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@ export abstract class DialogBase {
|
||||
|
||||
constructor(dialogTitle: string, dialogName: string, isWide: boolean = false) {
|
||||
this._dialogObject = azdata.window.createModelViewDialog(dialogTitle, dialogName, isWide);
|
||||
this._dialogObject.cancelButton.onClick(() => this.onCancel());
|
||||
this._toDispose.push(this._dialogObject.cancelButton.onClick(() => this.onCancelButtonClicked()));
|
||||
this._toDispose.push(this._dialogObject.okButton.onClick(() => this.onOkButtonClicked()));
|
||||
}
|
||||
|
||||
protected abstract initialize(): void;
|
||||
@@ -22,10 +23,17 @@ export abstract class DialogBase {
|
||||
azdata.window.openDialog(this._dialogObject);
|
||||
}
|
||||
|
||||
protected onCancel(): void {
|
||||
private onCancelButtonClicked(): void {
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
private onOkButtonClicked(): void {
|
||||
this.onComplete();
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
protected onComplete(): void { }
|
||||
|
||||
protected dispose(): void {
|
||||
this._toDispose.forEach(disposable => disposable.dispose());
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ export class ResourceTypePickerDialog extends DialogBase {
|
||||
super(localize('resourceTypePickerDialog.title', "Select the deployment options"), 'ResourceTypePickerDialog', true);
|
||||
this._selectedResourceType = resourceType;
|
||||
this._dialogObject.okButton.label = localize('deploymentDialog.OKButtonText', 'Select');
|
||||
this._dialogObject.okButton.onClick(() => this.onComplete());
|
||||
}
|
||||
|
||||
initialize() {
|
||||
@@ -259,8 +258,7 @@ export class ResourceTypePickerDialog extends DialogBase {
|
||||
return this._selectedResourceType.getProvider(options)!;
|
||||
}
|
||||
|
||||
private onComplete(): void {
|
||||
protected onComplete(): void {
|
||||
this.resourceTypeService.startDeployment(this.getCurrentProvider());
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user