mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 11:01:37 -05:00
Rearrange done and cancel buttons and dispose dialogs correctly (#1420)
This commit is contained in:
@@ -55,6 +55,7 @@ export abstract class ComponentBase extends Disposable implements IComponent, On
|
|||||||
if (this.modelStore) {
|
if (this.modelStore) {
|
||||||
this.modelStore.unregisterComponent(this);
|
this.modelStore.unregisterComponent(this);
|
||||||
}
|
}
|
||||||
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
|
|||||||
@@ -66,12 +66,10 @@ export class DialogModal extends Modal {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this._cancelButton = this.addDialogButton(this._dialog.cancelButton, () => this.cancel(), false);
|
|
||||||
this.updateButtonElement(this._cancelButton, this._dialog.cancelButton);
|
|
||||||
this._dialog.cancelButton.registerClickEvent(this._onCancel.event);
|
|
||||||
this._doneButton = this.addDialogButton(this._dialog.okButton, () => this.done(), false);
|
this._doneButton = this.addDialogButton(this._dialog.okButton, () => this.done(), false);
|
||||||
this.updateButtonElement(this._doneButton, this._dialog.okButton);
|
|
||||||
this._dialog.okButton.registerClickEvent(this._onDone.event);
|
this._dialog.okButton.registerClickEvent(this._onDone.event);
|
||||||
|
this._cancelButton = this.addDialogButton(this._dialog.cancelButton, () => this.cancel(), false);
|
||||||
|
this._dialog.cancelButton.registerClickEvent(this._onCancel.event);
|
||||||
}
|
}
|
||||||
|
|
||||||
private addDialogButton(button: DialogButton, onSelect: () => void = () => undefined, registerClickEvent: boolean = true): Button {
|
private addDialogButton(button: DialogButton, onSelect: () => void = () => undefined, registerClickEvent: boolean = true): Button {
|
||||||
@@ -84,6 +82,7 @@ export class DialogModal extends Modal {
|
|||||||
this.updateButtonElement(buttonElement, button);
|
this.updateButtonElement(buttonElement, button);
|
||||||
});
|
});
|
||||||
attachButtonStyler(buttonElement, this._themeService);
|
attachButtonStyler(buttonElement, this._themeService);
|
||||||
|
this.updateButtonElement(buttonElement, button);
|
||||||
return buttonElement;
|
return buttonElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,9 +19,8 @@ import { Disposable } from 'vs/base/common/lifecycle';
|
|||||||
import Event, { Emitter } from 'vs/base/common/event';
|
import Event, { Emitter } from 'vs/base/common/event';
|
||||||
|
|
||||||
export class DialogPane extends Disposable implements IThemable {
|
export class DialogPane extends Disposable implements IThemable {
|
||||||
private _activeTabIndex: number;
|
|
||||||
private _tabbedPanel: TabbedPanel;
|
private _tabbedPanel: TabbedPanel;
|
||||||
private _moduleRef: NgModuleRef<{}>;
|
private _moduleRefs: NgModuleRef<{}>[] = [];
|
||||||
|
|
||||||
// Validation
|
// Validation
|
||||||
private _modelViewValidityMap = new Map<string, boolean>();
|
private _modelViewValidityMap = new Map<string, boolean>();
|
||||||
@@ -72,7 +71,6 @@ export class DialogPane extends Disposable implements IThemable {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this._activeTabIndex = 0;
|
|
||||||
return this._body;
|
return this._body;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,7 +87,7 @@ export class DialogPane extends Disposable implements IThemable {
|
|||||||
validityChangedCallback: (valid: boolean) => this._setValidity(modelViewId, valid)
|
validityChangedCallback: (valid: boolean) => this._setValidity(modelViewId, valid)
|
||||||
} as DialogComponentParams,
|
} as DialogComponentParams,
|
||||||
undefined,
|
undefined,
|
||||||
(moduleRef) => this._moduleRef = moduleRef);
|
(moduleRef) => this._moduleRefs.push(moduleRef));
|
||||||
}
|
}
|
||||||
|
|
||||||
public show(): void {
|
public show(): void {
|
||||||
@@ -125,6 +123,6 @@ export class DialogPane extends Disposable implements IThemable {
|
|||||||
|
|
||||||
public dispose() {
|
public dispose() {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
this._moduleRef.destroy();
|
this._moduleRefs.forEach(moduleRef => moduleRef.destroy());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user