From 9ad186bcc9ca151ccb8ba7762e9042aba15095b6 Mon Sep 17 00:00:00 2001 From: Patrick O'Carroll Date: Mon, 13 Nov 2017 10:30:11 +0100 Subject: [PATCH] not ok option to alert list, fixes: #9754 --- pkg/services/sqlstore/alert.go | 7 ++++++- public/app/features/alerting/alert_list_ctrl.ts | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/services/sqlstore/alert.go b/pkg/services/sqlstore/alert.go index 33a4cae53c2..6e4714cd6d9 100644 --- a/pkg/services/sqlstore/alert.go +++ b/pkg/services/sqlstore/alert.go @@ -94,7 +94,12 @@ func HandleAlertsQuery(query *m.GetAlertsQuery) error { if i > 0 { sql.WriteString(" OR ") } - sql.WriteString("state = ? ") + if strings.HasPrefix(v, "not") { + sql.WriteString("state <> ? ") + v = v[4:] + } else { + sql.WriteString("state = ? ") + } params = append(params, v) } sql.WriteString(")") diff --git a/public/app/features/alerting/alert_list_ctrl.ts b/public/app/features/alerting/alert_list_ctrl.ts index 66c959bd260..62f239f16fa 100644 --- a/public/app/features/alerting/alert_list_ctrl.ts +++ b/public/app/features/alerting/alert_list_ctrl.ts @@ -11,6 +11,7 @@ export class AlertListCtrl { stateFilters = [ {text: 'All', value: null}, {text: 'OK', value: 'ok'}, + {text: 'Not OK', value: 'not_ok'}, {text: 'Alerting', value: 'alerting'}, {text: 'No Data', value: 'no_data'}, {text: 'Paused', value: 'paused'},