make custom buttons already secondary (#16812)

* make custom buttons already secondary

* move the logic to a single place
This commit is contained in:
Alan Ren
2021-08-18 12:09:38 -07:00
committed by GitHub
parent 8aa0dffccf
commit 8c858f9990

View File

@@ -753,8 +753,7 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
if (dialog.customButtons) {
dialog.customButtons.forEach(button => {
button.secondary = true;
this.updateButton(button);
this.updateButton(button, true);
});
}
@@ -797,7 +796,11 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
});
}
public updateButton(button: azdata.window.Button): void {
public updateButton(button: azdata.window.Button, isCustomButton: boolean = false): void {
// Custom buttons are always secondary buttons.
if (isCustomButton) {
button.secondary = true;
}
let handle = this.getHandle(button);
this._proxy.$setButtonDetails(handle, {
label: button.label,
@@ -888,7 +891,9 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
public updateWizardPage(page: azdata.window.WizardPage): Thenable<void> {
let handle = this.getHandle(page);
if (page.customButtons) {
page.customButtons.forEach(button => this.updateButton(button));
page.customButtons.forEach(button => {
this.updateButton(button, true);
});
}
return this._proxy.$setWizardPageDetails(handle, {
content: page.content,
@@ -910,8 +915,7 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
this.updateButton(wizard.nextButton);
if (wizard.customButtons) {
wizard.customButtons.forEach(button => {
button.secondary = true;
this.updateButton(button);
this.updateButton(button, true);
});
}
return this._proxy.$setWizardDetails(handle, {