From fe4a0a98c1aa2bf643fa8d8a0b9d74fb81018be2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 30 Sep 2016 13:00:16 +0200 Subject: [PATCH] fix(alerting): added confirm modal in UI, when deleting alert --- pkg/services/alerting/engine.go | 1 - .../app/features/alerting/alert_tab_ctrl.ts | 19 +++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/pkg/services/alerting/engine.go b/pkg/services/alerting/engine.go index 16a2835e642..10b8af64119 100644 --- a/pkg/services/alerting/engine.go +++ b/pkg/services/alerting/engine.go @@ -144,7 +144,6 @@ func (e *Engine) handleResponse(result *EvalContext) { } }() - e.log.Info("rule", "nil", result.Rule == nil) e.log.Debug("Alert Rule Result", "ruleId", result.Rule.Id, "firing", result.Firing) e.resultHandler.Handle(result) } diff --git a/public/app/features/alerting/alert_tab_ctrl.ts b/public/app/features/alerting/alert_tab_ctrl.ts index ec0386ba5a9..7ae8477c5bf 100644 --- a/public/app/features/alerting/alert_tab_ctrl.ts +++ b/public/app/features/alerting/alert_tab_ctrl.ts @@ -6,6 +6,7 @@ import {QueryPart} from 'app/core/components/query_part/query_part'; import alertDef from './alert_def'; import config from 'app/core/config'; import moment from 'moment'; +import appEvents from 'app/core/app_events'; export class AlertTabCtrl { panel: any; @@ -302,10 +303,20 @@ export class AlertTabCtrl { } delete() { - this.alert = this.panel.alert = {enabled: false}; - this.panel.thresholds = []; - this.conditionModels = []; - this.panelCtrl.render(); + appEvents.emit('confirm-modal', { + title: 'Delete Alert', + text: 'Are you sure you want to delete this alert rule?', + text2: 'You need to save dashboard for the delete to take effect', + icon: 'fa-trash', + yesText: 'Delete', + onConfirm: () => { + this.alert = this.panel.alert = {enabled: false}; + this.panel.thresholds = []; + this.conditionModels = []; + this.panelCtrl.render(); + } + }); + } enable() {