Skip to content

Commit

Permalink
Fix enable/disable script button behavior (#24437) (#24450)
Browse files Browse the repository at this point in the history
  • Loading branch information
barbaravaldez committed Sep 15, 2023
1 parent e53551b commit cc42d84
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion extensions/mssql/src/ui/scriptableDialogBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,16 @@ export abstract class ScriptableDialogBase<OptionsType extends ScriptableDialogO
protected abstract get isDirty(): boolean;

protected override onFormFieldChange(): void {
this._scriptButton.enabled = this.isDirty;
this.updateScriptButtonState();
this.dialogObject.okButton.enabled = this.isDirty;
}

protected override async initialize(): Promise<void> {
await this.initializeData();
await this.initializeUI();
this.disposables.push(this.modelView.onValidityChanged(() => {
this.updateScriptButtonState();
}));
}

protected override updateLoadingStatus(isLoading: boolean, loadingText?: string, loadingCompletedText?: string): void {
Expand Down Expand Up @@ -131,4 +134,8 @@ export abstract class ScriptableDialogBase<OptionsType extends ScriptableDialogO
this.updateLoadingStatus(false, localizedConstants.GeneratingScriptText, localizedConstants.GeneratingScriptCompletedText);
}
}

private updateScriptButtonState(): void {
this._scriptButton.enabled = this.isDirty && this.modelView.valid;
}
}

0 comments on commit cc42d84

Please sign in to comment.