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 yq...@apache.org on 2019/03/04 09:35:17 UTC
[hadoop] branch trunk updated: HDFS-14182. Datanode usage histogram
is clicked to show ip list. Contributed by fengchuang.
This is an automated email from the ASF dual-hosted git repository.
yqlin pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new 18ea0c1 HDFS-14182. Datanode usage histogram is clicked to show ip list. Contributed by fengchuang.
18ea0c1 is described below
commit 18ea0c14933c3e33617647eae2e3076cda1232c0
Author: Yiqun Lin <yq...@apache.org>
AuthorDate: Mon Mar 4 17:34:24 2019 +0800
HDFS-14182. Datanode usage histogram is clicked to show ip list. Contributed by fengchuang.
---
.../hadoop-hdfs/src/main/webapps/hdfs/dfshealth.js | 47 +++++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.js b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.js
index 5b2838c..4e8b362 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.js
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.js
@@ -303,10 +303,13 @@
.attr("class", "bar")
.attr("transform", function(d) { return "translate(" + x(d.x0) + "," + y(d.length) + ")"; });
+ window.liveNodes = dnData.LiveNodes;
+
bar.append("rect")
.attr("x", 1)
.attr("width", x(bins[0].x1) - x(bins[0].x0) - 1)
- .attr("height", function(d) { return height - y(d.length); });
+ .attr("height", function(d) { return height - y(d.length); })
+ .attr("onclick", function (d) { return "open_hostip_list(" + d.x0 + "," + d.x1 + ")"; });
bar.append("text")
.attr("dy", ".75em")
@@ -425,3 +428,45 @@
load_page();
});
})();
+
+function open_hostip_list(x0, x1) {
+ close_hostip_list();
+ var ips = new Array();
+ for (var i = 0; i < liveNodes.length; i++) {
+ var dn = liveNodes[i];
+ var index = (dn.usedSpace / dn.capacity) * 100.0;
+ if (index == 0) {
+ index = 1;
+ }
+ //More than 100% do not care,so not record in 95%-100% bar
+ if (index > x0 && index <= x1) {
+ ips.push(dn.infoAddr.split(":")[0]);
+ }
+ }
+ var ipsText = '';
+ for (var i = 0; i < ips.length; i++) {
+ ipsText += ips[i] + '\n';
+ }
+ var histogram_div = document.getElementById('datanode-usage-histogram');
+ histogram_div.setAttribute('style', 'position: relative');
+ var ips_div = document.createElement("textarea");
+ ips_div.setAttribute('id', 'datanode_ips');
+ ips_div.setAttribute('rows', '8');
+ ips_div.setAttribute('cols', '14');
+ ips_div.setAttribute('style', 'position: absolute;top: 0px;right: -38px;');
+ ips_div.setAttribute('readonly', 'readonly');
+ histogram_div.appendChild(ips_div);
+
+ var close_div = document.createElement("div");
+ histogram_div.appendChild(close_div);
+ close_div.setAttribute('id', 'close_ips');
+ close_div.setAttribute('style', 'position: absolute;top: 0px;right: -62px;width:20px;height;20px');
+ close_div.setAttribute('onclick', 'close_hostip_list()');
+ close_div.innerHTML = "X";
+ ips_div.innerHTML = ipsText;
+}
+
+function close_hostip_list() {
+ $("#datanode_ips").remove();
+ $("#close_ips").remove();
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org