Преглед изворни кода

fix(singlestat): rerender singlestat and reevaluate thresholds on render, fixes #4920

Torkel Ödegaard пре 9 година
родитељ
комит
c7e7a0cd16
1 измењених фајлова са 7 додато и 6 уклоњено
  1. 7 6
      public/app/plugins/panel/singlestat/module.ts

+ 7 - 6
public/app/plugins/panel/singlestat/module.ts

@@ -91,11 +91,6 @@ class SingleStatCtrl extends MetricsPanelCtrl {
     var data: any = {};
     this.setValues(data);
 
-    data.thresholds = this.panel.thresholds.split(',').map(function(strVale) {
-      return Number(strVale.trim());
-    });
-
-    data.colorMap = this.panel.colors;
     this.data = data;
     this.render();
   }
@@ -435,8 +430,14 @@ class SingleStatCtrl extends MetricsPanelCtrl {
 
     function render() {
       if (!ctrl.data) { return; }
-      ctrl.setValues(ctrl.data);
       data = ctrl.data;
+
+      // get thresholds
+      data.thresholds = panel.thresholds.split(',').map(function(strVale) {
+        return Number(strVale.trim());
+      });
+      data.colorMap = panel.colors;
+
       setElementHeight();
 
       var body = panel.gauge.show ? '' : getBigValueHtml();