|
|
@@ -302,6 +302,34 @@ export class DashboardModel {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ removePanel(panel, ask?) {
|
|
|
+ // confirm deletion
|
|
|
+ if (ask !== false) {
|
|
|
+ var text2, confirmText;
|
|
|
+ if (panel.alert) {
|
|
|
+ text2 = "Panel includes an alert rule, removing panel will also remove alert rule";
|
|
|
+ confirmText = "YES";
|
|
|
+ }
|
|
|
+
|
|
|
+ appEvents.emit('confirm-modal', {
|
|
|
+ title: 'Remove Panel',
|
|
|
+ text: 'Are you sure you want to remove this panel?',
|
|
|
+ text2: text2,
|
|
|
+ icon: 'fa-trash',
|
|
|
+ confirmText: confirmText,
|
|
|
+ yesText: 'Remove',
|
|
|
+ onConfirm: () => {
|
|
|
+ this.removePanel(panel, false);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var index = _.indexOf(this.panels, panel);
|
|
|
+ this.panels.splice(index, 1);
|
|
|
+ this.events.emit('panel-removed', panel);
|
|
|
+ }
|
|
|
+
|
|
|
isTimezoneUtc() {
|
|
|
return this.getTimezone() === 'utc';
|
|
|
}
|