HDFS-13844. Fix the fmt_bytes function in the dfs-dust.js. Contributed by yanghuafeng.

This commit is contained in:
Inigo Goiri 2018-09-17 14:37:25 -07:00
parent 23a6137a40
commit d1541932db

View File

@ -20,7 +20,7 @@
var filters = { var filters = {
'fmt_bytes': function (v) { 'fmt_bytes': function (v) {
var UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'ZB']; var UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB'];
var prev = 0, i = 0; var prev = 0, i = 0;
while (Math.floor(v) > 0 && i < UNITS.length) { while (Math.floor(v) > 0 && i < UNITS.length) {
prev = v; prev = v;
@ -28,7 +28,7 @@
i += 1; i += 1;
} }
if (i > 0 && i < UNITS.length) { if (i > 0) {
v = prev; v = prev;
i -= 1; i -= 1;
} }