HDFS-14334. RBF: Use human readable format for long numbers in the Router UI. Contributed by Inigo Goiri.
This commit is contained in:
parent
fcabc8f0e4
commit
2a2d5eb441
|
@ -177,10 +177,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>{numOfFiles}</td>
|
<td>{numOfFiles|fmt_human_number}</td>
|
||||||
<td>{numOfBlocks}</td>
|
<td>{numOfBlocks|fmt_human_number}</td>
|
||||||
<td>{numOfBlocksMissing}</td>
|
<td>{numOfBlocksMissing|fmt_human_number}</td>
|
||||||
<td>{numOfBlocksUnderReplicated}</td>
|
<td>{numOfBlocksUnderReplicated|fmt_human_number}</td>
|
||||||
<td>{numOfActiveDatanodes}</td>
|
<td>{numOfActiveDatanodes}</td>
|
||||||
<td>{numOfDeadDatanodes}</td>
|
<td>{numOfDeadDatanodes}</td>
|
||||||
<td>{numOfDecommissioningDatanodes}</td>
|
<td>{numOfDecommissioningDatanodes}</td>
|
||||||
|
@ -244,10 +244,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>{numOfFiles}</td>
|
<td>{numOfFiles|fmt_human_number}</td>
|
||||||
<td>{numOfBlocks}</td>
|
<td>{numOfBlocks|fmt_human_number}</td>
|
||||||
<td>{numOfBlocksMissing}</td>
|
<td>{numOfBlocksMissing|fmt_human_number}</td>
|
||||||
<td>{numOfBlocksUnderReplicated}</td>
|
<td>{numOfBlocksUnderReplicated|fmt_human_number}</td>
|
||||||
<td>{numOfActiveDatanodes}</td>
|
<td>{numOfActiveDatanodes}</td>
|
||||||
<td>{numOfDeadDatanodes}</td>
|
<td>{numOfDeadDatanodes}</td>
|
||||||
<td>{numOfDecommissioningDatanodes}</td>
|
<td>{numOfDecommissioningDatanodes}</td>
|
||||||
|
|
|
@ -96,6 +96,22 @@
|
||||||
|
|
||||||
'fmt_number': function (v) {
|
'fmt_number': function (v) {
|
||||||
return v.toLocaleString();
|
return v.toLocaleString();
|
||||||
|
},
|
||||||
|
|
||||||
|
'fmt_human_number': function (v) {
|
||||||
|
var UNITS = ['', 'K', 'M'];
|
||||||
|
var prev = 0, i = 0;
|
||||||
|
while (Math.floor(v) > 0 && i < UNITS.length) {
|
||||||
|
prev = v;
|
||||||
|
v /= 1000;
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i > 0) {
|
||||||
|
v = prev;
|
||||||
|
i -= 1;
|
||||||
|
}
|
||||||
|
return Math.round(v * 100) / 100 + UNITS[i];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$.extend(dust.filters, filters);
|
$.extend(dust.filters, filters);
|
||||||
|
|
Loading…
Reference in New Issue