HDFS-11198. NN UI should link DN web address using hostnames. Contributed by Weiwei Yang.

This commit is contained in:
Kihwal Lee 2016-12-06 08:06:50 -06:00
parent 7b988e8899
commit 4dd4f3a4bb
2 changed files with 7 additions and 13 deletions

View File

@ -314,13 +314,7 @@
{#LiveNodes} {#LiveNodes}
<tr> <tr>
<td ng-value="{state}-{name}" class="dfshealth-node-icon dfshealth-node-{state}">{name} ({xferaddr})</td> <td ng-value="{state}-{name}" class="dfshealth-node-icon dfshealth-node-{state}">{name} ({xferaddr})</td>
<td ng-value="{state}-{name}"> <td ng-value="{state}-{name}"><a href='//{dnWebAddress}'>{dnWebAddress}</a></td>
{@select key=secureMode}
{@eq value="off"}<a href='//{infoAddr}'>{infoAddr}</a>{/eq}
{@eq value="on"}<a href='//{infoSecureAddr}'>{infoSecureAddr}</a>{/eq}
{@default}<a href='//{infoAddr}'>{infoAddr}</a>{/default}
{/select}
</td>
<td ng-value="{lastContact}">{lastContact}s</td> <td ng-value="{lastContact}">{lastContact}s</td>
<td ng-value="{usedPercentage}"> <td ng-value="{usedPercentage}">
<div> <div>

View File

@ -212,12 +212,12 @@
var n = nodes[i]; var n = nodes[i];
n.usedPercentage = Math.round((n.used + n.nonDfsUsedSpace) * 1.0 / n.capacity * 100); n.usedPercentage = Math.round((n.used + n.nonDfsUsedSpace) * 1.0 / n.capacity * 100);
var addr = n.infoSecureAddr; var port = n.infoAddr.split(":")[1];
var position = addr.lastIndexOf(":"); var securePort = n.infoSecureAddr.split(":")[1];
var port = addr.substring(position + 1, addr.length); var dnHost = n.name.split(":")[0];
n.secureMode = "off"; n.dnWebAddress = dnHost + ":" + port;
if (port != 0) { if (securePort != 0) {
n.secureMode = "on"; n.dnWebAddress = dnHost + ":" + securePort;
} }
if (n.adminState === "In Service") { if (n.adminState === "In Service") {