From 09cdf3e9e1d38cdf95200409e57a0dae30f2bca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 18 Aug 2016 11:37:35 +0200 Subject: [PATCH] feat(alerting): show execution errors in alert list --- pkg/models/alert.go | 2 +- pkg/services/alerting/result_handler.go | 2 +- public/app/features/alerting/alert_def.ts | 22 +++++++++++++------ .../alerting/partials/alert_list.html | 7 +++--- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/pkg/models/alert.go b/pkg/models/alert.go index 9becbafb6ce..b7d0c3e0c1c 100644 --- a/pkg/models/alert.go +++ b/pkg/models/alert.go @@ -11,7 +11,7 @@ type AlertSeverityType string const ( AlertStatePending AlertStateType = "pending" - AlertStateExeuctionError AlertStateType = "exeuction_error" + AlertStateExeuctionError AlertStateType = "execution_error" AlertStatePaused AlertStateType = "paused" AlertStateCritical AlertStateType = "critical" AlertStateWarning AlertStateType = "warning" diff --git a/pkg/services/alerting/result_handler.go b/pkg/services/alerting/result_handler.go index c6dfdfeb2a3..09c77c8edd7 100644 --- a/pkg/services/alerting/result_handler.go +++ b/pkg/services/alerting/result_handler.go @@ -29,7 +29,7 @@ func NewResultHandler() *DefaultResultHandler { func (handler *DefaultResultHandler) Handle(ctx *EvalContext) { oldState := ctx.Rule.State - exeuctionError := " " + exeuctionError := "" if ctx.Error != nil { handler.log.Error("Alert Rule Result Error", "ruleId", ctx.Rule.Id, "error", ctx.Error) ctx.Rule.State = m.AlertStateExeuctionError diff --git a/public/app/features/alerting/alert_def.ts b/public/app/features/alerting/alert_def.ts index 6d8c24125cf..0b8efbe9889 100644 --- a/public/app/features/alerting/alert_def.ts +++ b/public/app/features/alerting/alert_def.ts @@ -61,28 +61,36 @@ function getStateDisplayModel(state) { iconClass: 'icon-gf icon-gf-critical', stateClass: 'alert-state-critical' }; - } - case 'warning': { + } + case 'warning': { return { text: 'WARNING', iconClass: 'icon-gf icon-gf-warning', stateClass: 'alert-state-warning' }; - } - case 'pending': { + } + case 'pending': { return { text: 'PENDING', iconClass: "fa fa-question", stateClass: 'alert-state-warning' }; - } - case 'paused': { + } + case 'execution_error': { + return { + text: 'EXECUTION ERROR', + iconClass: 'icon-gf icon-gf-critical', + stateClass: 'alert-state-critical' + }; + } + + case 'paused': { return { text: 'paused', iconClass: "fa fa-pause", stateClass: 'alert-state-paused' }; - } + } } } diff --git a/public/app/features/alerting/partials/alert_list.html b/public/app/features/alerting/partials/alert_list.html index 1f1820ed0fe..a8678bc4cdc 100644 --- a/public/app/features/alerting/partials/alert_list.html +++ b/public/app/features/alerting/partials/alert_list.html @@ -33,9 +33,6 @@ -
- Execution Error -
@@ -49,7 +46,9 @@ {{alert.stateModel.text}} for {{alert.newStateDateAgo}} -
+
+
+ {{alert.executionError}}