You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by gi...@apache.org on 2019/03/05 19:01:39 UTC
[hadoop] branch HDFS-13891 updated: HDFS-14334. RBF: Use human
readable format for long numbers in the Router UI. Contributed by Inigo
Goiri.
This is an automated email from the ASF dual-hosted git repository.
gifuma pushed a commit to branch HDFS-13891
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/HDFS-13891 by this push:
new bddb4cb HDFS-14334. RBF: Use human readable format for long numbers in the Router UI. Contributed by Inigo Goiri.
bddb4cb is described below
commit bddb4cb01b74c220fa6e9c36cd566f3539f0c7e4
Author: Giovanni Matteo Fumarola <gi...@apache.org>
AuthorDate: Tue Mar 5 11:01:11 2019 -0800
HDFS-14334. RBF: Use human readable format for long numbers in the Router UI. Contributed by Inigo Goiri.
---
.../src/main/webapps/router/federationhealth.html | 16 ++++++++--------
.../hadoop-hdfs/src/main/webapps/static/dfs-dust.js | 16 ++++++++++++++++
2 files changed, 24 insertions(+), 8 deletions(-)
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 0f089fe..c591698 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 @@
</div>
</div>
</td>
- <td>{numOfFiles}</td>
- <td>{numOfBlocks}</td>
- <td>{numOfBlocksMissing}</td>
- <td>{numOfBlocksUnderReplicated}</td>
+ <td>{numOfFiles|fmt_human_number}</td>
+ <td>{numOfBlocks|fmt_human_number}</td>
+ <td>{numOfBlocksMissing|fmt_human_number}</td>
+ <td>{numOfBlocksUnderReplicated|fmt_human_number}</td>
<td>{numOfActiveDatanodes}</td>
<td>{numOfDeadDatanodes}</td>
<td>{numOfDecommissioningDatanodes}</td>
@@ -244,10 +244,10 @@
</div>
</div>
</td>
- <td>{numOfFiles}</td>
- <td>{numOfBlocks}</td>
- <td>{numOfBlocksMissing}</td>
- <td>{numOfBlocksUnderReplicated}</td>
+ <td>{numOfFiles|fmt_human_number}</td>
+ <td>{numOfBlocks|fmt_human_number}</td>
+ <td>{numOfBlocksMissing|fmt_human_number}</td>
+ <td>{numOfBlocksUnderReplicated|fmt_human_number}</td>
<td>{numOfActiveDatanodes}</td>
<td>{numOfDeadDatanodes}</td>
<td>{numOfDecommissioningDatanodes}</td>
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 316a994..7772d72 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);
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org