Преглед на файлове

feat(alerting): adds alert state go ui

bergquist преди 9 години
родител
ревизия
3ecc13506c
променени са 4 файла, в които са добавени 8 реда и са изтрити 1 реда
  1. 1 0
      pkg/api/alerting.go
  2. 1 0
      pkg/api/dtos/alerting.go
  3. 2 0
      pkg/services/sqlstore/alert_rule_test.go
  4. 4 1
      public/app/features/alerts/partials/alerts_page.html

+ 1 - 0
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,
 		})
 	}
 

+ 1 - 0
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"`
 }

+ 2 - 0
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() {

+ 4 - 1
public/app/features/alerts/partials/alerts_page.html

@@ -10,13 +10,16 @@
     <thead>
       <th><strong>Name</strong></th>
       <th style="width: 68px"></th>
+      <th style="width: 68px"></th>
       <th style="width: 28px"></th>
-
     </thead>
     <tr ng-repeat="alert in ctrl.alerts">
       <td>
 				{{alert.title}}
       </td>
+      <td>
+				{{alert.state}}
+      </td>
       <td class="text-center">
 				<a href="/dashboard/{{alert.dashboardUri}}" class="btn btn-inverse btn-small">
           Go to dashboard