From b36a80a73100951897d887bf606e414dd04c8cc2 Mon Sep 17 00:00:00 2001 From: Todd Lipcon Date: Thu, 24 May 2012 00:27:57 +0000 Subject: [PATCH] HDFS-1013. Miscellaneous improvements to HTML markup for web UIs. Contributed by Eugene Koontz. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1342103 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 + .../hadoop/hdfs/server/common/JspHelper.java | 6 +- .../server/namenode/NamenodeJspHelper.java | 65 ++++---- .../src/main/webapps/hdfs/dfshealth.jsp | 4 +- .../src/main/webapps/static/hadoop.css | 157 ++++++++++++++++++ 5 files changed, 197 insertions(+), 38 deletions(-) create mode 100644 hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/hadoop.css diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 1a8d98f7cf4..89acf1cf446 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -57,6 +57,9 @@ Release 2.0.1-alpha - UNRELEASED HDFS-3454. Balancer unconditionally logs InterruptedException at INFO level on shutdown if security is enabled. (eli) + HDFS-1013. Miscellaneous improvements to HTML markup for web UIs + (Eugene Koontz via todd) + OPTIMIZATIONS HDFS-2982. Startup performance suffers when there are many edit log diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/JspHelper.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/JspHelper.java index 5a13a612cb4..e3f9127e1f7 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/JspHelper.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/JspHelper.java @@ -438,9 +438,9 @@ public class JspHelper { /** Return a table containing version information. */ public static String getVersionTable() { - return "
" - + "\n
Version:" + VersionInfo.getVersion() + ", " + VersionInfo.getRevision() - + "\n
Compiled:" + VersionInfo.getDate() + " by " + VersionInfo.getUser() + " from " + VersionInfo.getBranch() + return "
" + + "\n " + + "\n " + "\n
Version:" + VersionInfo.getVersion() + ", " + VersionInfo.getRevision() + "
Compiled:" + VersionInfo.getDate() + " by " + VersionInfo.getUser() + " from " + VersionInfo.getBranch() + "
"; } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java index 3fdc2413dcf..f5eae8f8395 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java @@ -67,16 +67,16 @@ class NamenodeJspHelper { return ""; return "Safe mode is ON. " + fsn.getSafeModeTip() + "
"; } - + /** * returns security mode of the cluster (namenode) * @return "on" if security is on, and "off" otherwise */ - static String getSecurityModeText() { + static String getSecurityModeText() { if(UserGroupInformation.isSecurityEnabled()) { - return "Security is ON
"; + return "
Security is ON
"; } else { - return "Security is OFF
"; + return "
Security is OFF
"; } } @@ -99,22 +99,22 @@ class NamenodeJspHelper { long used = (totalMemory * 100) / commitedMemory; long usedNonHeap = (totalNonHeap * 100) / commitedNonHeap; - String str = inodes + " files and directories, " + blocks + " blocks = " + String str = "
" + inodes + " files and directories, " + blocks + " blocks = " + (inodes + blocks) + " total"; if (maxobjects != 0) { long pct = ((inodes + blocks) * 100) / maxobjects; str += " / " + maxobjects + " (" + pct + "%)"; } - str += ".
"; - str += "Heap Memory used " + StringUtils.byteDesc(totalMemory) + " is " - + " " + used + "% of Commited Heap Memory " + str += ".
"; + str += "
Heap Memory used " + StringUtils.byteDesc(totalMemory) + " is " + + " " + used + "% of Commited Heap Memory " + StringUtils.byteDesc(commitedMemory) + ". Max Heap Memory is " + StringUtils.byteDesc(maxMemory) + - ".
"; - str += "Non Heap Memory used " + StringUtils.byteDesc(totalNonHeap) + " is" + ".
"; + str += "
Non Heap Memory used " + StringUtils.byteDesc(totalNonHeap) + " is" + " " + usedNonHeap + "% of " + " Commited Non Heap Memory " + StringUtils.byteDesc(commitedNonHeap) + ". Max Non Heap Memory is " - + StringUtils.byteDesc(maxNonHeap) + ".
"; + + StringUtils.byteDesc(maxNonHeap) + ".
"; return str; } @@ -133,19 +133,17 @@ class NamenodeJspHelper { /** Return a table containing version information. */ static String getVersionTable(FSNamesystem fsn) { - return "
" - + "\n \n" + "\n \n \n \n \n
Started:" + fsn.getStartTime() - + "
Version:" + return "
" + + "\n \n" + "\n \n" + "\n \n" - + "\n \n" - + "\n
Started:" + fsn.getStartTime() + + "
Version:" + VersionInfo.getVersion() + ", " + VersionInfo.getRevision() - + "\n
Compiled:" + VersionInfo.getDate() + + "
Compiled:" + VersionInfo.getDate() + " by " + VersionInfo.getUser() + " from " + VersionInfo.getBranch() - + "\n
Upgrades:" - + getUpgradeStatusText(fsn) - + "\n
Cluster ID:" + fsn.getClusterId() - + "
Block Pool ID:" + fsn.getBlockPoolId() - + "
"; + + "
Upgrades:" + + getUpgradeStatusText(fsn) + + "
Cluster ID:" + fsn.getClusterId() + + "
Block Pool ID:" + fsn.getBlockPoolId() + + "
"; } /** @@ -157,14 +155,15 @@ class NamenodeJspHelper { if (missingBlocks > 0) { StringBuilder result = new StringBuilder(); - // Warning class is typically displayed in RED - result.append("
\n"); + // Warning class is typically displayed in RED. + result.append("
"); // opening tag of outer
. + result.append("\n"); result.append("WARNING : There are " + missingBlocks + " missing blocks. Please check the logs or run fsck in order to identify the missing blocks."); result.append(""); - result.append("
See the Hadoop FAQ for common causes and potential solutions."); - result.append("

\n"); + result.append("
See the Hadoop FAQ for common causes and potential solutions.
"); + result.append("
\n"); // closing tag of outer
. return result.toString(); } @@ -205,11 +204,11 @@ class NamenodeJspHelper { // FS Image storage configuration out.print("

" + nn.getRole() + " Storage:

"); - out.print("
\n" + out.print("
\n" + ""); StorageDirectory st = null; - for (Iterator it + for (Iterator it = fsImage.getStorage().dirIterator(); it.hasNext();) { st = it.next(); String dir = "" + st.getRoot(); @@ -224,10 +223,10 @@ class NamenodeJspHelper { String dir = "" + st.getRoot(); String type = "" + st.getStorageDirType(); out.print(""); + + ""); } - out.print("
Storage DirectoryTypeState
" + dir + "" + type - + "Failed
Failed

\n"); + out.print("
\n"); } void generateHealthReport(JspWriter out, NameNode nn, @@ -320,7 +319,7 @@ class NamenodeJspHelper { + "Number of Under-Replicated Blocks" + colTxt() + ":" + colTxt() + fsn.getBlockManager().getUnderReplicatedNotMissingBlocks(); } - out.print("
\n" + rowTxt() + colTxt() + out.print("
\n" + rowTxt() + colTxt() + "Configured Capacity" + colTxt() + ":" + colTxt() + StringUtils.byteDesc(total) + rowTxt() + colTxt() + "DFS Used" + colTxt() + ":" + colTxt() + StringUtils.byteDesc(used) + rowTxt() @@ -359,7 +358,7 @@ class NamenodeJspHelper { + "

\n"); if (live.isEmpty() && dead.isEmpty()) { - out.print("There are no datanodes in the cluster"); + out.print("There are no datanodes in the cluster."); } } } @@ -633,7 +632,7 @@ class NamenodeJspHelper { if (whatNodes.equals("LIVE")) { out.print("" + "Live Datanodes : " + live.size() + "" - + "

\n\n"); + + "

\n
\n"); counterReset(); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.jsp b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.jsp index 81e595d718e..275fd78c513 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.jsp +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.jsp @@ -39,10 +39,10 @@ - +Hadoop <%=namenodeRole%> <%=namenodeLabel%> - +

<%=namenodeRole%> '<%=namenodeLabel%>' (<%=namenodeState%>)

<%= NamenodeJspHelper.getVersionTable(fsn) %> diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/hadoop.css b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/hadoop.css new file mode 100644 index 00000000000..11c76ebdd36 --- /dev/null +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/hadoop.css @@ -0,0 +1,157 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +body { + background-color : #ffffff; + font-family : sans-serif; +} + +.small { + font-size : smaller; +} + +div#dfsnodetable tr#row1, div.dfstable td.col1 { + font-weight : bolder; +} + +div.dfstable th { + text-align:left; + vertical-align : top; +} + +div.dfstable td#col3 { + text-align : right; +} + +div#dfsnodetable caption { + text-align : left; +} + +div#dfsnodetable a#title { + font-size : larger; + font-weight : bolder; +} + +div#dfsnodetable td, th { + border-bottom-style : none; + padding-bottom : 4px; + padding-top : 4px; +} + +div#dfsnodetable A:link, A:visited { + text-decoration : none; +} + +div#dfsnodetable th.header, th.headerASC, th.headerDSC { + padding-bottom : 8px; + padding-top : 8px; +} +div#dfsnodetable th.header:hover, th.headerASC:hover, th.headerDSC:hover, + td.name:hover { + text-decoration : underline; + cursor : pointer; +} + +div#dfsnodetable td.blocks, td.size, td.pcused, td.adminstate, td.lastcontact { + text-align : right; +} + +div#dfsnodetable .rowNormal .header { + background-color : #ffffff; +} +div#dfsnodetable .rowAlt, .headerASC, .headerDSC { + background-color : lightyellow; +} + +.warning { + font-weight : bolder; + color : red; +} + +div.dfstable table { + white-space : pre; +} + +table.storage, table.nodes { + border-collapse: collapse; +} + +table.storage td { + padding:10px; + border:1px solid black; +} + +table.nodes td { + padding:0px; + border:1px solid black; +} + +div#dfsnodetable td, div#dfsnodetable th, div.dfstable td { + padding-left : 10px; + padding-right : 10px; +} + +td.perc_filled { + background-color:#AAAAFF; +} + +td.perc_nonfilled { + background-color:#FFFFFF; +} + +line.taskgraphline { + stroke-width:1;stroke-linecap:round; +} + +#quicklinks { + margin: 0; + padding: 2px 4px; + position: fixed; + top: 0; + right: 0; + text-align: right; + background-color: #eee; + font-weight: bold; +} + +#quicklinks ul { + margin: 0; + padding: 0; + list-style-type: none; + font-weight: normal; +} + +#quicklinks ul { + display: none; +} + +#quicklinks a { + font-size: smaller; + text-decoration: none; +} + +#quicklinks ul a { + text-decoration: underline; +} + +span.failed { + color:red; +} + +div.security { + width:100%; +}