From 3ecc13506c20b7c21c74a0212d385f97b90ef7b8 Mon Sep 17 00:00:00 2001 From: bergquist Date: Thu, 28 Apr 2016 08:53:34 +0200 Subject: [PATCH] feat(alerting): adds alert state go ui --- pkg/api/alerting.go | 1 + pkg/api/dtos/alerting.go | 1 + pkg/services/sqlstore/alert_rule_test.go | 2 ++ public/app/features/alerts/partials/alerts_page.html | 5 ++++- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/api/alerting.go b/pkg/api/alerting.go index c435b52fdd0..ea2efa58b4c 100644 --- a/pkg/api/alerting.go +++ b/pkg/api/alerting.go @@ -62,6 +62,7 @@ func GetAlerts(c *middleware.Context) Response { Description: alert.Description, QueryRange: alert.QueryRange, Aggregator: alert.Aggregator, + State: alert.State, }) } diff --git a/pkg/api/dtos/alerting.go b/pkg/api/dtos/alerting.go index 695d11c0b66..f18f5b0ba18 100644 --- a/pkg/api/dtos/alerting.go +++ b/pkg/api/dtos/alerting.go @@ -13,6 +13,7 @@ type AlertRuleDTO struct { Description string `json:"description"` QueryRange string `json:"queryRange"` Aggregator string `json:"aggregator"` + State string `json:"state"` DashbboardUri string `json:"dashboardUri"` } diff --git a/pkg/services/sqlstore/alert_rule_test.go b/pkg/services/sqlstore/alert_rule_test.go index dec3a94d9a4..64a7b30688c 100644 --- a/pkg/services/sqlstore/alert_rule_test.go +++ b/pkg/services/sqlstore/alert_rule_test.go @@ -28,6 +28,7 @@ func TestAlertingDataAccess(t *testing.T) { Description: "Alerting description", QueryRange: "5m", Aggregator: "avg", + State: "OK", }, } @@ -62,6 +63,7 @@ func TestAlertingDataAccess(t *testing.T) { So(alert.Description, ShouldEqual, "Alerting description") So(alert.QueryRange, ShouldEqual, "5m") So(alert.Aggregator, ShouldEqual, "avg") + So(alert.State, ShouldEqual, "OK") }) Convey("Alerts with same dashboard id and panel id should update", func() { diff --git a/public/app/features/alerts/partials/alerts_page.html b/public/app/features/alerts/partials/alerts_page.html index a34a4552535..2f0323a45e7 100644 --- a/public/app/features/alerts/partials/alerts_page.html +++ b/public/app/features/alerts/partials/alerts_page.html @@ -10,13 +10,16 @@ Name + - {{alert.title}} + + {{alert.state}} + Go to dashboard