diff --git a/pkg/services/alerting/result_handler.go b/pkg/services/alerting/result_handler.go index 1298a5dda36..972fbd3a461 100644 --- a/pkg/services/alerting/result_handler.go +++ b/pkg/services/alerting/result_handler.go @@ -31,17 +31,15 @@ func (handler *DefaultResultHandler) Handle(evalContext *EvalContext) error { executionError := "" annotationData := simplejson.New() - if evalContext.Firing { - annotationData = simplejson.NewFromAny(evalContext.EvalMatches) + if len(evalContext.EvalMatches) > 0 { + annotationData.Set("evalMatches", simplejson.NewFromAny(evalContext.EvalMatches)) } if evalContext.Error != nil { executionError = evalContext.Error.Error() - annotationData.Set("errorMessage", executionError) - } - - if evalContext.NoDataFound { - annotationData.Set("no_data", true) + annotationData.Set("error", executionError) + } else if evalContext.NoDataFound { + annotationData.Set("noData", true) } countStateResult(evalContext.Rule.State) diff --git a/public/app/features/alerting/alert_tab_ctrl.ts b/public/app/features/alerting/alert_tab_ctrl.ts index b21e5363ad8..63d192099c0 100644 --- a/public/app/features/alerting/alert_tab_ctrl.ts +++ b/public/app/features/alerting/alert_tab_ctrl.ts @@ -81,14 +81,23 @@ export class AlertTabCtrl { this.alertHistory = _.map(res, ah => { ah.time = moment(ah.time).format('MMM D, YYYY HH:mm:ss'); ah.stateModel = alertDef.getStateDisplayModel(ah.newState); - ah.metrics = alertDef.joinEvalMatches(ah.data, ', '); + ah.reason = ""; - if (ah.data.errorMessage) { - ah.metrics = "Error: " + ah.data.errorMessage; + if (_.isArray(ah.data)) { + ah.reason = "Conditions"; + ah.metrics = alertDef.joinEvalMatches(ah.data, ', '); + } else if (_.isArray(ah.data.evalMatches)) { + ah.metrics = alertDef.joinEvalMatches(ah.data.evalMatches, ', '); } - if (ah.data.no_data) { - ah.metrics = "(due to no data)"; + if (ah.data.error) { + ah.metrics = "" + ah.data.error; + ah.reason = "Error"; + } + + if (ah.data.noData || ah.data.no_data) { + ah.metrics = ""; + ah.reason = "No Data"; } return ah; diff --git a/public/app/features/alerting/partials/alert_tab.html b/public/app/features/alerting/partials/alert_tab.html index 4c63c4507fc..b18f49c69a1 100644 --- a/public/app/features/alerting/partials/alert_tab.html +++ b/public/app/features/alerting/partials/alert_tab.html @@ -148,16 +148,20 @@
  1. +
    +
    +
    +
    - {{ah.stateModel.text}} - {{ah.metrics}} + {{ah.stateModel.text}} + {{ah.time}}
    - {{ah.time}} +  {{ah.metrics}}
    diff --git a/public/sass/components/edit_sidemenu.scss b/public/sass/components/edit_sidemenu.scss index d7844ab6f36..5da2f6a21ce 100644 --- a/public/sass/components/edit_sidemenu.scss +++ b/public/sass/components/edit_sidemenu.scss @@ -26,6 +26,7 @@ display: block; color: $text-color; margin: 0 0 1.5rem 1rem; + white-space: nowrap; } }