Skip to content

Commit fe4a0a9

Browse files
committed
fix(alerting): added confirm modal in UI, when deleting alert
1 parent 24a2545 commit fe4a0a9

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

pkg/services/alerting/engine.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ func (e *Engine) handleResponse(result *EvalContext) {
144144
}
145145
}()
146146

147-
e.log.Info("rule", "nil", result.Rule == nil)
148147
e.log.Debug("Alert Rule Result", "ruleId", result.Rule.Id, "firing", result.Firing)
149148
e.resultHandler.Handle(result)
150149
}

public/app/features/alerting/alert_tab_ctrl.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {QueryPart} from 'app/core/components/query_part/query_part';
66
import alertDef from './alert_def';
77
import config from 'app/core/config';
88
import moment from 'moment';
9+
import appEvents from 'app/core/app_events';
910

1011
export class AlertTabCtrl {
1112
panel: any;
@@ -302,10 +303,20 @@ export class AlertTabCtrl {
302303
}
303304

304305
delete() {
305-
this.alert = this.panel.alert = {enabled: false};
306-
this.panel.thresholds = [];
307-
this.conditionModels = [];
308-
this.panelCtrl.render();
306+
appEvents.emit('confirm-modal', {
307+
title: 'Delete Alert',
308+
text: 'Are you sure you want to delete this alert rule?',
309+
text2: 'You need to save dashboard for the delete to take effect',
310+
icon: 'fa-trash',
311+
yesText: 'Delete',
312+
onConfirm: () => {
313+
this.alert = this.panel.alert = {enabled: false};
314+
this.panel.thresholds = [];
315+
this.conditionModels = [];
316+
this.panelCtrl.render();
317+
}
318+
});
319+
309320
}
310321

311322
enable() {

0 commit comments

Comments
 (0)