diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/webapps/router/federationhealth.html b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/webapps/router/federationhealth.html
index 0f089fe3c2e..c591698e4b6 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/webapps/router/federationhealth.html
+++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/webapps/router/federationhealth.html
@@ -177,10 +177,10 @@
-
{numOfFiles} |
- {numOfBlocks} |
- {numOfBlocksMissing} |
- {numOfBlocksUnderReplicated} |
+ {numOfFiles|fmt_human_number} |
+ {numOfBlocks|fmt_human_number} |
+ {numOfBlocksMissing|fmt_human_number} |
+ {numOfBlocksUnderReplicated|fmt_human_number} |
{numOfActiveDatanodes} |
{numOfDeadDatanodes} |
{numOfDecommissioningDatanodes} |
@@ -244,10 +244,10 @@
- {numOfFiles} |
- {numOfBlocks} |
- {numOfBlocksMissing} |
- {numOfBlocksUnderReplicated} |
+ {numOfFiles|fmt_human_number} |
+ {numOfBlocks|fmt_human_number} |
+ {numOfBlocksMissing|fmt_human_number} |
+ {numOfBlocksUnderReplicated|fmt_human_number} |
{numOfActiveDatanodes} |
{numOfDeadDatanodes} |
{numOfDecommissioningDatanodes} |
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/dfs-dust.js b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/dfs-dust.js
index 316a9947ca9..7772d72aef8 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/dfs-dust.js
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/dfs-dust.js
@@ -96,6 +96,22 @@
'fmt_number': function (v) {
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);