Kaynağa Gözat

feat(alerting): rename alerting dashboard names

bergquist 9 yıl önce
ebeveyn
işleme
55e83a3d62

+ 4 - 4
pkg/models/alerts.go

@@ -43,13 +43,13 @@ func (cmd *SaveDashboardCommand) GetAlertModels() *[]AlertRule {
 				OrgId:       cmd.Result.OrgId,
 				PanelId:     panel.Get("id").MustInt64(),
 				Id:          alerting.Get("id").MustInt64(),
-				QueryRefId:  alerting.Get("query_ref").MustString(),
-				WarnLevel:   alerting.Get("warn_level").MustString(),
-				CritLevel:   alerting.Get("crit_level").MustString(),
+				QueryRefId:  alerting.Get("queryRef").MustString(),
+				WarnLevel:   alerting.Get("warnLevel").MustString(),
+				CritLevel:   alerting.Get("critLevel").MustString(),
 				Interval:    alerting.Get("interval").MustString(),
 				Title:       alerting.Get("title").MustString(),
 				Description: alerting.Get("description").MustString(),
-				QueryRange:  alerting.Get("query_range").MustString(),
+				QueryRange:  alerting.Get("queryRange").MustString(),
 				Aggregator:  alerting.Get("aggregator").MustString(),
 			}
 

+ 4 - 4
pkg/models/alerts_test.go

@@ -67,12 +67,12 @@ func TestAlertModel(t *testing.T) {
           "stack": false,
           "steppedLine": false,
           "alerting": {
-						"query_ref": "A",
-						"warn_level": "> 30",
-						"crit_level": "> 50",
+						"queryRef": "A",
+						"warnLevel": "> 30",
+						"critLevel": "> 50",
 						"title": "desktop visiter alerts",
 						"description": "Restart the webservers",
-						"query_range": "5m",
+						"queryRange": "5m",
 						"aggregator": "avg",
 						"interval": "10"
           },

+ 2 - 2
public/app/plugins/panel/graph/module.ts

@@ -313,11 +313,11 @@ class GraphCtrl extends MetricsPanelCtrl {
 
   convertThresholdsToAlerts() {
     if (this.panel.grid && this.panel.grid.thresholds1) {
-      this.panel.alerting.warn_level = '< ' + this.panel.grid.threshold1;
+      this.panel.alerting.warnLevel = '< ' + this.panel.grid.threshold1;
     }
 
     if (this.panel.grid && this.panel.grid.thresholds2) {
-      this.panel.alerting.crit_level = '< ' + this.panel.grid.threshold2;
+      this.panel.alerting.critLevel = '< ' + this.panel.grid.threshold2;
     }
   }
 

+ 4 - 4
public/app/plugins/panel/graph/partials/tab_alerting.html

@@ -8,7 +8,7 @@
       <span class="gf-form-label">Query to watch</span>
       <div class="gf-form-select-wrapper">
         <select class="gf-form-input gf-size-auto"
-          ng-model="ctrl.panel.alerting.query_ref"
+          ng-model="ctrl.panel.alerting.queryRef"
           ng-options="target.refId as target.refId for target in ctrl.panel.targets"></select>
       </div>
     </div>
@@ -17,11 +17,11 @@
 		<p ng-show="ctrl.panel.grid.threshold1 || ctrl.panel.grid.threshold2">We noticed you have existing threshholds.<a href="#" ng-click="ctrl.convertThresholdsToAlert()">Convert them</a></p>
     <div class="gf-form">
       <span class="gf-form-label width-7">Warn level</span>
-      <input class="gf-form-input max-width-7" type="text" ng-model="ctrl.panel.alerting.warn_level"></input>
+      <input class="gf-form-input max-width-7" type="text" ng-model="ctrl.panel.alerting.warnLevel"></input>
     </div>
     <div class="gf-form">
       <span class="gf-form-label width-7">Critical level</span>
-      <input class="gf-form-input max-width-7" type="text" ng-model="ctrl.panel.alerting.crit_level"></input>
+      <input class="gf-form-input max-width-7" type="text" ng-model="ctrl.panel.alerting.critLevel"></input>
     </div>
   </div>
 
@@ -39,7 +39,7 @@
     <div class="gf-form">
       <span class="gf-form-label width-10">Query range</span>
       <input class="gf-form-input max-width-10" type="text"
-        ng-model="ctrl.panel.alerting.query_range" placeholder="10m"></input>
+        ng-model="ctrl.panel.alerting.queryRange" placeholder="10m"></input>
     </div>
 
     <div class="gf-form">