mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Fix enable/disable script button behavior (#24437)
This commit is contained in:
@@ -63,13 +63,16 @@ export abstract class ScriptableDialogBase<OptionsType extends ScriptableDialogO
|
|||||||
protected abstract get isDirty(): boolean;
|
protected abstract get isDirty(): boolean;
|
||||||
|
|
||||||
protected override onFormFieldChange(): void {
|
protected override onFormFieldChange(): void {
|
||||||
this._scriptButton.enabled = this.isDirty;
|
this.updateScriptButtonState();
|
||||||
this.dialogObject.okButton.enabled = this.isDirty;
|
this.dialogObject.okButton.enabled = this.isDirty;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async initialize(): Promise<void> {
|
protected override async initialize(): Promise<void> {
|
||||||
await this.initializeData();
|
await this.initializeData();
|
||||||
await this.initializeUI();
|
await this.initializeUI();
|
||||||
|
this.disposables.push(this.modelView.onValidityChanged(() => {
|
||||||
|
this.updateScriptButtonState();
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override updateLoadingStatus(isLoading: boolean, loadingText?: string, loadingCompletedText?: string): void {
|
protected override updateLoadingStatus(isLoading: boolean, loadingText?: string, loadingCompletedText?: string): void {
|
||||||
@@ -131,4 +134,8 @@ export abstract class ScriptableDialogBase<OptionsType extends ScriptableDialogO
|
|||||||
this.updateLoadingStatus(false, localizedConstants.GeneratingScriptText, localizedConstants.GeneratingScriptCompletedText);
|
this.updateLoadingStatus(false, localizedConstants.GeneratingScriptText, localizedConstants.GeneratingScriptCompletedText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private updateScriptButtonState(): void {
|
||||||
|
this._scriptButton.enabled = this.isDirty && this.modelView.valid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user