Przeglądaj źródła

Merge branch 'master' of github.com:torkelo/grafana

Torkel Ödegaard 12 lat temu
rodzic
commit
e2d7ead815

+ 27 - 25
src/app/directives/grafanaGraph.js

@@ -132,35 +132,13 @@ function (angular, $, kbn, moment, _) {
             }
             }
           };
           };
 
 
-          if (panel.grid.threshold1) {
-            var limit1 = panel.grid.thresholdLine ? panel.grid.threshold1 : (panel.grid.threshold2 || null);
-            options.grid.markings = [];
-            options.grid.markings.push({
-              yaxis: { from: panel.grid.threshold1, to: limit1 },
-              color: panel.grid.threshold1Color
-            });
-
-            if (panel.grid.threshold2) {
-              var limit2;
-              if (panel.grid.thresholdLine) {
-                limit2 = panel.grid.threshold2;
-              } else {
-                limit2 = panel.grid.threshold1 > panel.grid.threshold2 ?  -Infinity : +Infinity;
-              }
-              options.grid.markings.push({
-                yaxis: { from: panel.grid.threshold2, to: limit2 },
-                color: panel.grid.threshold2Color
-              });
-            }
-          }
-
-          addAnnotations(options);
-
           for (var i = 0; i < data.length; i++) {
           for (var i = 0; i < data.length; i++) {
-            var _d = data[i].getFlotPairs(panel.nullPointMode);
+            var _d = data[i].getFlotPairs(panel.nullPointMode, panel.y_formats);
             data[i].data = _d;
             data[i].data = _d;
           }
           }
 
 
+          addGridThresholds(options, panel);
+          addAnnotations(options);
           configureAxisOptions(data, options);
           configureAxisOptions(data, options);
 
 
           plot = $.plot(elem, data, options);
           plot = $.plot(elem, data, options);
@@ -210,6 +188,30 @@ function (angular, $, kbn, moment, _) {
           elem.html('<img src="' + url + '"></img>');
           elem.html('<img src="' + url + '"></img>');
         }
         }
 
 
+        function addGridThresholds(options, panel) {
+          if (panel.grid.threshold1) {
+            var limit1 = panel.grid.thresholdLine ? panel.grid.threshold1 : (panel.grid.threshold2 || null);
+            options.grid.markings = [];
+            options.grid.markings.push({
+              yaxis: { from: panel.grid.threshold1, to: limit1 },
+              color: panel.grid.threshold1Color
+            });
+
+            if (panel.grid.threshold2) {
+              var limit2;
+              if (panel.grid.thresholdLine) {
+                limit2 = panel.grid.threshold2;
+              } else {
+                limit2 = panel.grid.threshold1 > panel.grid.threshold2 ?  -Infinity : +Infinity;
+              }
+              options.grid.markings.push({
+                yaxis: { from: panel.grid.threshold2, to: limit2 },
+                color: panel.grid.threshold2Color
+              });
+            }
+          }
+        }
+
         function addAnnotations(options) {
         function addAnnotations(options) {
           if(!data.annotations || data.annotations.length === 0) {
           if(!data.annotations || data.annotations.length === 0) {
             return;
             return;

+ 1 - 1
src/app/panels/graphite/module.js

@@ -156,7 +156,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
       /** @scratch /panels/histogram/3
       /** @scratch /panels/histogram/3
        * stack:: Stack multiple series
        * stack:: Stack multiple series
        */
        */
-      stack         : true,
+      stack         : false,
       /** @scratch /panels/histogram/3
       /** @scratch /panels/histogram/3
        * legend:: Display the legond
        * legend:: Display the legond
        */
        */

+ 31 - 4
src/app/panels/graphite/timeSeries.js

@@ -1,7 +1,8 @@
 define([
 define([
-  'underscore'
+  'underscore',
+  'kbn'
 ],
 ],
-function (_) {
+function (_, kbn) {
   'use strict';
   'use strict';
 
 
   var ts = {};
   var ts = {};
@@ -12,7 +13,7 @@ function (_) {
     this.label = opts.info.alias;
     this.label = opts.info.alias;
   };
   };
 
 
-  ts.ZeroFilled.prototype.getFlotPairs = function (fillStyle) {
+  ts.ZeroFilled.prototype.getFlotPairs = function (fillStyle, yFormats) {
     var result = [];
     var result = [];
 
 
     this.color = this.info.color;
     this.color = this.info.color;
@@ -50,13 +51,39 @@ function (_) {
     }, this);
     }, this);
 
 
     if (result.length) {
     if (result.length) {
-      this.info.avg = (this.info.total / result.length).toFixed(2);
+      this.info.avg = (this.info.total / result.length);
       this.info.current = result[result.length-1][1];
       this.info.current = result[result.length-1][1];
+
+      var formater = getFormater(yFormats[this.yaxis - 1]);
+      this.info.avg = formater(this.info.avg);
+      this.info.current = formater(this.info.current);
+      this.info.min = formater(this.info.min);
+      this.info.max = formater(this.info.max);
+      this.info.total = formater(this.info.total);
     }
     }
 
 
     return result;
     return result;
   };
   };
 
 
+  function getFormater(yformat) {
+    switch(yformat) {
+    case 'bytes':
+      return kbn.byteFormat;
+    case 'short':
+      return kbn.shortFormat;
+    case 'ms':
+      return kbn.msFormat;
+    default:
+      return function(val) {
+        if (val % 1 === 0) {
+          return val;
+        }
+        else {
+          return val.toFixed(2);
+        }
+      };
+    }
+  }
 
 
   return ts;
   return ts;
 });
 });

Plik diff jest za duży
+ 0 - 0
src/css/bootstrap.dark.min.css


Plik diff jest za duży
+ 0 - 0
src/css/bootstrap.light.min.css


+ 4 - 4
src/css/less/grafana.less

@@ -173,7 +173,7 @@
   }
   }
   .close {
   .close {
     margin-right: 5px;
     margin-right: 5px;
-    color: white;
+    color: @linkColor;
     opacity: 0.7;
     opacity: 0.7;
     text-shadow: none;
     text-shadow: none;
   }
   }
@@ -310,7 +310,7 @@
 
 
 input[type=text].grafana-target-text-input {
 input[type=text].grafana-target-text-input {
   padding: 5px 7px;
   padding: 5px 7px;
-  border: 1px solid #050505;
+  border: 1px solid @grafanaTargetSegmentBorder;
   margin: 0px;
   margin: 0px;
   background: transparent;
   background: transparent;
   width: 80%;
   width: 80%;
@@ -341,9 +341,9 @@ input[type=text].func-param {
 .grafana-func-editor {
 .grafana-func-editor {
   min-width: 140px;
   min-width: 140px;
   .grafana-func-editor-header {
   .grafana-func-editor-header {
-    background: #41474c;
+    background: @grafanaTargetFuncHightlight;
     text-align: center;
     text-align: center;
-    border-bottom: 1px solid #353a3e;
+    border-bottom: 1px solid @grafanaTargetFuncBackground;
     padding: 3px 5px;
     padding: 3px 5px;
     white-space: nowrap;
     white-space: nowrap;
   }
   }

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików