Browse Source

webUI: increase the number of digits after the decimal point

adaptive-webui-19844
thalieht 8 years ago
parent
commit
e075274177
  1. 9
      src/webui/www/public/scripts/misc.js

9
src/webui/www/public/scripts/misc.js

@ -18,11 +18,18 @@ function friendlyUnit(value, isSpeed) { @@ -18,11 +18,18 @@ function friendlyUnit(value, isSpeed) {
value /= 1024.;
++i;
}
function friendlyUnitPrecision(sizeUnit) {
if (sizeUnit <= 2) return 1; // KiB, MiB
else if (sizeUnit === 3) return 2; // GiB
else return 3; // TiB, PiB, EiB
}
var ret;
if (i == 0)
ret = value + " " + units[i];
else
ret = (Math.floor(10 * value) / 10).toFixed(1) //Don't round up
ret = (Math.floor(10 * value) / 10).toFixed(friendlyUnitPrecision(i)) //Don't round up
+ " " + units[i];
if (isSpeed)

Loading…
Cancel
Save