Sfoglia il codice sorgente

AMBARI-3214. HDFS > QuickLinks should point to the links for the active NameNode. (xiwang via yusaku)

Yusaku Sako 11 anni fa
parent
commit
d6ad2991ce

+ 6 - 4
ambari-web/app/mappers/service_mapper.js

@@ -340,7 +340,7 @@ App.servicesMapper = App.QuickDataMapper.create({
         if ( component.host_components.length == 2) {
           var haState1;
           var haState2;
-          if (component.host_components[1].metrics && component.host_components[1].metrics.dfs) {
+          if (component.host_components[1].metrics.dfs) {
             haState2 = component.host_components[1].metrics.dfs.FSNamesystem.HAState;
           }
           if (component.host_components[0].metrics.dfs) {
@@ -391,9 +391,11 @@ App.servicesMapper = App.QuickDataMapper.create({
         item.nameNodeComponent = component;
         finalConfig = jQuery.extend(finalConfig, hdfsConfig);
         // Get the live, dead & decommission nodes from string json
-        var liveNodesJson = App.parseJSON(component.host_components[0].metrics.dfs.namenode.LiveNodes);
-        var deadNodesJson = App.parseJSON(component.host_components[0].metrics.dfs.namenode.DeadNodes);
-        var decommissionNodesJson = App.parseJSON(component.host_components[0].metrics.dfs.namenode.DecomNodes);
+        if (component.host_components[0].metrics.dfs && component.host_components[0].metrics.dfs.namenode) {
+          var liveNodesJson = App.parseJSON(component.host_components[0].metrics.dfs.namenode.LiveNodes);
+          var deadNodesJson = App.parseJSON(component.host_components[0].metrics.dfs.namenode.DeadNodes);
+          var decommissionNodesJson = App.parseJSON(component.host_components[0].metrics.dfs.namenode.DecomNodes);
+        }
         item.live_data_nodes = [];
         item.dead_data_nodes = [];
         item.decommission_data_nodes = [];

+ 11 - 1
ambari-web/app/styles/application.less

@@ -2008,6 +2008,11 @@ width:100%;
 
 .service-block {
   margin-top: 20px;
+  .disabled-hdfs-quick-link {
+    pointer-events: none;
+    color: #808080;
+    cursor: default;
+  }
 }
 
 .service-configuration {
@@ -2082,7 +2087,6 @@ table.graphs {
 }
 
 /*Dashboard Widgets Start*/
-
 #dashboard-widgets-container{
   h4{
     line-height: 30px;
@@ -2364,7 +2368,13 @@ table.graphs {
       .link-button{
         padding-top: 7px;
         padding-left: 70px;
+        .disabled-hdfs-quick-link {
+        pointer-events: none;
+        color: #808080;
+        cursor: default;
       }
+      }
+
       .widget-content{
         text-align: center;
         font-weight: none;

+ 5 - 1
ambari-web/app/templates/main/dashboard/service/hdfs.hbs

@@ -155,7 +155,11 @@
         </a>
         <ul class="dropdown-menu">
           {{#each view.quickLinks}}
-            <li><a {{bindAttr href="url"}} target="_blank">{{label}}</a></li>
+            {{#if disabled}}
+                <li><a class="disabled-hdfs-quick-link">{{label}}</a></li>
+            {{else}}
+                <li><a {{bindAttr href="url"}} target="_blank">{{label}}</a></li>
+            {{/if}}
           {{/each}}
         </ul>
       </div>

+ 4 - 0
ambari-web/app/templates/main/dashboard/widgets/hdfs_links.hbs

@@ -86,7 +86,11 @@
             </a>
             <ul class="dropdown-menu">
               {{#each view.quickLinks}}
+                {{#if disabled}}
+                  <li><a class="disabled-hdfs-quick-link">{{label}}</a></li>
+                {{else}}
                   <li><a {{bindAttr href="url"}} target="_blank">{{label}}</a></li>
+                {{/if}}
               {{/each}}
             </ul>
           </div>

+ 5 - 1
ambari-web/app/templates/main/service/info/summary.hbs

@@ -25,7 +25,11 @@
             <a class="dropdown-toggle" data-toggle="dropdown" href="#">{{t common.quickLinks}}<b class="caret"></b></a>
             <ul class="dropdown-menu">
               {{#each view.quickLinks}}
-                <a {{bindAttr href="url"}} {{bindAttr target="view.linkTarget"}}>{{label}}</a>
+                {{#if disabled}}
+                    <a class="disabled-hdfs-quick-link">{{label}}</a>
+                {{else}}
+                    <a {{bindAttr href="url"}} {{bindAttr target="view.linkTarget"}}>{{label}}</a>
+                {{/if}}
               {{/each}}
             </ul>
           </li>

+ 14 - 1
ambari-web/app/views/common/quick_view_link_view.js

@@ -99,7 +99,16 @@ App.QuickViewLinks = Em.View.extend({
 
     switch (serviceName) {
       case "HDFS":
-        host = App.singleNodeInstall ? App.singleNodeAlias : components.findProperty('componentName', 'NAMENODE').get('host.publicHostName');
+        if ( this.get('content.snameNode')) { // not HA
+          host = App.singleNodeInstall ? App.singleNodeAlias : components.findProperty('componentName', 'NAMENODE').get('host.publicHostName');
+        } else {
+          // HA
+          if (this.get('content.activeNameNode')) {
+            host = this.get('content.activeNameNode.hostName');
+          }else {
+            host = 'noActiveNN';
+          }
+        }
         break;
       case "MAPREDUCE":
       case "OOZIE":
@@ -140,6 +149,10 @@ App.QuickViewLinks = Em.View.extend({
       ];
     }
     return this.get('content.quickLinks').map(function (item) {
+      if (host == 'noActiveNN') {
+        item.set('disabled', true);
+        return item;
+      }
       var protocol = self.setProtocol(item.get('service_id'));
       if (item.get('template')) {
         item.set('url', item.get('template').fmt(protocol,host));