mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Prevent the insights dialog from showing duplicate buttons (#2122)
This commit is contained in:
@@ -357,6 +357,21 @@ export abstract class Modal extends Disposable implements IThemable {
|
|||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a footer button matching the provided label
|
||||||
|
* @param label Label to show on the button
|
||||||
|
* @param onSelect The callback to call when the button is selected
|
||||||
|
*/
|
||||||
|
protected findFooterButton(label: string): Button {
|
||||||
|
return this._footerButtons.find(e => {
|
||||||
|
try {
|
||||||
|
return e && e.element.innerText === label;
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show an error in the error message element
|
* Show an error in the error message element
|
||||||
* @param err Text to show in the error message
|
* @param err Text to show in the error message
|
||||||
|
|||||||
@@ -295,8 +295,9 @@ export class InsightsDialogView extends Modal {
|
|||||||
for (let action of this._insight.actions.types) {
|
for (let action of this._insight.actions.types) {
|
||||||
let task = tasks.includes(action);
|
let task = tasks.includes(action);
|
||||||
let commandAction = MenuRegistry.getCommand(action);
|
let commandAction = MenuRegistry.getCommand(action);
|
||||||
if (task) {
|
let commandLabel = types.isString(commandAction.title) ? commandAction.title : commandAction.title.value;
|
||||||
let button = this.addFooterButton(types.isString(commandAction.title) ? commandAction.title : commandAction.title.value, () => {
|
if (task && !this.findFooterButton(commandLabel)) {
|
||||||
|
let button = this.addFooterButton(commandLabel, () => {
|
||||||
let element = this._topTable.getSelectedRows();
|
let element = this._topTable.getSelectedRows();
|
||||||
let resource: ListResource;
|
let resource: ListResource;
|
||||||
if (element && element.length > 0) {
|
if (element && element.length > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user