Explorar o código

Fixed number formating issue when InfluxDB return MAX float64, Fixes #1402

Torkel Ödegaard %!s(int64=10) %!d(string=hai) anos
pai
achega
31e5271921
Modificáronse 2 ficheiros con 5 adicións e 0 borrados
  1. 4 0
      src/app/components/kbn.js
  2. 1 0
      src/test/specs/kbn-format-specs.js

+ 4 - 0
src/app/components/kbn.js

@@ -326,11 +326,15 @@ function($, _, moment) {
       }
 
       var steps = 0;
+      var limit = extArray.length;
 
       while (Math.abs(size) >= factor) {
         steps++;
         size /= factor;
+
+        if (steps >= limit) { return "NA"; }
       }
+
       if (steps > 0) {
         decimals = scaledDecimals + (3 * steps);
       }

+ 1 - 0
src/test/specs/kbn-format-specs.js

@@ -25,6 +25,7 @@ define([
 
   describeValueFormat('none', 2.75e-10, 0, 10, '3e-10');
   describeValueFormat('none', 0, 0, 2, '0');
+  describeValueFormat('bytes', -1.57e+308, -1.57e+308, 2, 'NA');
 
   describeValueFormat('ns', 25, 1, 0, '25 ns');
   describeValueFormat('ns', 2558, 50, 0, '2.56 µs');