Prevent the insights dialog from showing duplicate buttons (#2122)

This commit is contained in:
Karl Burtram
2018-08-02 13:58:05 -04:00
committed by GitHub
parent 0d043207b9
commit 1a7f0673ea
2 changed files with 18 additions and 2 deletions

View File

@@ -357,6 +357,21 @@ export abstract class Modal extends Disposable implements IThemable {
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
* @param err Text to show in the error message