You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2014/05/01 23:51:30 UTC

git commit: AMBARI-5652. Quick Links does not work if both NameNodes are in Standby. (xiwang via yusaku)

Repository: ambari
Updated Branches:
  refs/heads/branch-1.6.0 b9b1ad01c -> 39d2c680e


AMBARI-5652. Quick Links does not work if both NameNodes are in Standby. (xiwang via yusaku)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/39d2c680
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/39d2c680
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/39d2c680

Branch: refs/heads/branch-1.6.0
Commit: 39d2c680e6939cb3620f494befb0e3813101ddf8
Parents: b9b1ad0
Author: Yusaku Sako <yu...@hortonworks.com>
Authored: Thu May 1 14:50:54 2014 -0700
Committer: Yusaku Sako <yu...@hortonworks.com>
Committed: Thu May 1 14:51:10 2014 -0700

----------------------------------------------------------------------
 ambari-web/app/messages.js                      |   5 +-
 ambari-web/app/styles/application.less          |  10 +-
 .../main/dashboard/widgets/hbase_links.hbs      |  24 +++-
 .../main/dashboard/widgets/hdfs_links.hbs       |  24 ++--
 ambari-web/app/templates/main/service/item.hbs  |  26 +++--
 .../app/views/common/quick_view_link_view.js    | 110 +++++++++++++------
 6 files changed, 141 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/39d2c680/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index b1f78a7..afbdb95 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -2036,10 +2036,11 @@ Em.I18n.translations = {
 
   'common.combobox.placeholder': 'Filter...',
   'common.combobox.dropdown.1': 'Overridden properties',
-  //'common.combobox.dropdown.2': 'Modified properties',
-  //'common.combobox.dropdown.3': 'Properties needing restart',
 
   'quick.links.error.label': 'Hostname is undefined',
+  'quick.links.publicHostName': '{0} ({1})',
+  'quick.links.label.active': 'Active',
+  'quick.links.label.standby': 'Standby',
 
   'contact.administrator': 'Contact System Administrator for more information!',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/39d2c680/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 206e5bf..d80db03 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -2550,6 +2550,11 @@ width:100%;
       position: absolute;
     }
   }
+  .dropdown-submenu {
+    &> a:after {
+      border-left-color: #333;
+    }
+  }
   .nav li.dropdown.open {
     .dropdown-toggle{
       color: #005580;
@@ -2568,11 +2573,6 @@ width:100%;
       border-bottom-color: #005580;
     }
   }
-  .disabled-hdfs-quick-link {
-    pointer-events: none;
-    color: #808080;
-    cursor: default;
-  }
 }
 
 .service-content {

http://git-wip-us.apache.org/repos/asf/ambari/blob/39d2c680/ambari-web/app/templates/main/dashboard/widgets/hbase_links.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/dashboard/widgets/hbase_links.hbs b/ambari-web/app/templates/main/dashboard/widgets/hbase_links.hbs
index a4e5945..2726080 100644
--- a/ambari-web/app/templates/main/dashboard/widgets/hbase_links.hbs
+++ b/ambari-web/app/templates/main/dashboard/widgets/hbase_links.hbs
@@ -59,11 +59,25 @@
                 {{t common.more}}
                 <span class="caret"></span>
               </a>
-              <ul class="dropdown-menu">
-                {{#each view.quickLinks}}
-                  <li><a {{bindAttr href="url"}} target="_blank">{{label}}</a></li>
-                {{/each}}
-              </ul>
+                <ul class="dropdown-menu">
+                  {{#if view.quickLinksArray}}
+                     <!--there are multiple masters eg, HBase multiple masters or HDFS HA enabled-->
+                    {{#each quickLinks in view.quickLinksArray}}
+                      <li class="dropdown-submenu">
+                        <a href="javascript:void(null)">{{quickLinks.publicHostNameLabel}} &nbsp;</a>
+                        <ul class="dropdown-menu">
+                          {{#each quickLinks}}
+                            <li><a {{bindAttr href="url"}} {{bindAttr target="view.linkTarget"}}>{{label}}</a></li>
+                          {{/each}}
+                        </ul>
+                      </li>
+                    {{/each}}
+                  {{else}}
+                    {{#each view.quickLinks}}
+                        <li><a {{bindAttr href="url"}} {{bindAttr target="view.linkTarget"}}>{{label}}</a></li>
+                    {{/each}}
+                  {{/if}}
+                </ul>
             </div>
           {{/view}}
         {{/if}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/39d2c680/ambari-web/app/templates/main/dashboard/widgets/hdfs_links.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/dashboard/widgets/hdfs_links.hbs b/ambari-web/app/templates/main/dashboard/widgets/hdfs_links.hbs
index 56999da..707b220 100644
--- a/ambari-web/app/templates/main/dashboard/widgets/hdfs_links.hbs
+++ b/ambari-web/app/templates/main/dashboard/widgets/hdfs_links.hbs
@@ -85,15 +85,25 @@
               {{t common.more}}
               <span class="caret"></span>
             </a>
-            <ul class="dropdown-menu">
-              {{#each view.quickLinks}}
-                {{#if disabled}}
-                  <li><a class="disabled-hdfs-quick-link">{{label}}</a></li>
+              <ul class="dropdown-menu">
+                {{#if view.quickLinksArray}}
+                    <!--there are multiple masters eg, HBase multiple masters or HDFS HA enabled-->
+                  {{#each quickLinks in view.quickLinksArray}}
+                    <li class="dropdown-submenu">
+                      <a href="javascript:void(null)">{{quickLinks.publicHostNameLabel}} &nbsp;</a>
+                      <ul class="dropdown-menu">
+                        {{#each quickLinks}}
+                           <li><a {{bindAttr href="url"}} {{bindAttr target="view.linkTarget"}}>{{label}}</a></li>
+                        {{/each}}
+                      </ul>
+                    </li>
+                  {{/each}}
                 {{else}}
-                  <li><a {{bindAttr href="url"}} target="_blank">{{label}}</a></li>
+                  {{#each view.quickLinks}}
+                      <li><a {{bindAttr href="url"}} {{bindAttr target="view.linkTarget"}}>{{label}}</a></li>
+                  {{/each}}
                 {{/if}}
-              {{/each}}
-            </ul>
+              </ul>
           </div>
         {{/view}}
       {{/if}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/39d2c680/ambari-web/app/templates/main/service/item.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/service/item.hbs b/ambari-web/app/templates/main/service/item.hbs
index 9a116d9..1ba484e 100644
--- a/ambari-web/app/templates/main/service/item.hbs
+++ b/ambari-web/app/templates/main/service/item.hbs
@@ -24,14 +24,24 @@
           <li class="dropdown">
             <a class="dropdown-toggle" data-toggle="dropdown" href="#">{{t common.quickLinks}}<b class="caret"></b></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"}} {{bindAttr target="view.linkTarget"}}>{{label}}</a></li>
-                {{/if}}
-              {{/each}}
-            </ul>
+              {{#if view.quickLinksArray}}
+                <!--there are multiple masters eg, HBase multiple masters or HDFS HA enabled-->
+                {{#each quickLinks in view.quickLinksArray}}
+                   <li class="dropdown-submenu">
+                     <a href="javascript:void(null)">{{quickLinks.publicHostNameLabel}} &nbsp;</a>
+                     <ul class="dropdown-menu">
+                       {{#each quickLinks}}
+                         <li><a {{bindAttr href="url"}} {{bindAttr target="view.linkTarget"}}>{{label}}</a></li>
+                       {{/each}}
+                     </ul>
+                   </li>
+                {{/each}}
+              {{else}}
+                {{#each view.quickLinks}}
+                   <li><a {{bindAttr href="url"}} {{bindAttr target="view.linkTarget"}}>{{label}}</a></li>
+                {{/each}}
+              {{/if}}
+           </ul>
           </li>
         </ul>
       {{/view}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/39d2c680/ambari-web/app/views/common/quick_view_link_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/quick_view_link_view.js b/ambari-web/app/views/common/quick_view_link_view.js
index af147fc..d199d1b 100644
--- a/ambari-web/app/views/common/quick_view_link_view.js
+++ b/ambari-web/app/views/common/quick_view_link_view.js
@@ -82,20 +82,31 @@ App.QuickViewLinks = Em.View.extend({
     this.loadTags();
     var serviceName = this.get('content.serviceName');
     var components = this.get('content.hostComponents');
-    var host;
+    var hosts = [];
     var self = this;
     var version = App.get('currentStackVersionNumber');
     var quickLinks = [];
     switch (serviceName) {
       case "HDFS":
-        if (this.get('content.snameNode')) { // not HA
-          host = this.findComponentHost('NAMENODE');
+        var otherHost;
+        if (this.get('content.snameNode')) {
+          // not HA
+          hosts[0] = this.findComponentHost('NAMENODE');
         } else {
-          // HA
+          // HA enabled, need both two namenodes hosts
+          var nameNodes = components.filterProperty('componentName', 'NAMENODE');
+          nameNodes.forEach(function(item) {
+            hosts.push({'publicHostName': item.get('host.publicHostName')});
+          });
+          // assign each namenode status label
           if (this.get('content.activeNameNode')) {
-            host = this.get('content.activeNameNode.publicHostName');
-          } else {
-            host = 'noActiveNN';
+            hosts.findProperty('publicHostName', this.get('content.activeNameNode.publicHostName')).status = Em.I18n.t('quick.links.label.active');
+          }
+          if (this.get('content.standbyNameNode')) {
+            hosts.findProperty('publicHostName', this.get('content.standbyNameNode.publicHostName')).status = Em.I18n.t('quick.links.label.standby');
+          }
+          if (this.get('content.standbyNameNode2')) {
+            hosts.findProperty('publicHostName', this.get('content.standbyNameNode2.publicHostName')).status = Em.I18n.t('quick.links.label.standby');
           }
         }
         break;
@@ -104,61 +115,98 @@ App.QuickViewLinks = Em.View.extend({
       case "GANGLIA":
       case "NAGIOS":
       case "HUE":
-        host = App.singleNodeInstall ? App.singleNodeAlias : components.findProperty('isMaster', true).get("host").get("publicHostName");
+        hosts[0] = App.singleNodeInstall ? App.singleNodeAlias : components.findProperty('isMaster', true).get("host").get("publicHostName");
         break;
       case "HBASE":
-        var component;
+        var masterComponents = components.filterProperty('componentName', 'HBASE_MASTER');
+        var activeMaster, standbyMasters, otherMasters;
         if (App.supports.multipleHBaseMasters) {
-          component = components.filterProperty('componentName', 'HBASE_MASTER').findProperty('haStatus', 'true');
-        } else {
-          component = components.findProperty('componentName', 'HBASE_MASTER');
+          activeMaster = masterComponents.filterProperty('haStatus', 'true');
+          standbyMasters = masterComponents.filterProperty('haStatus', 'false');
+          otherMasters = masterComponents.filterProperty('haStatus', null);
         }
-        if (component) {
+        if (masterComponents) {
           if (App.singleNodeInstall) {
-            host = App.singleNodeAlias;
+            hosts[0] = App.singleNodeAlias;
+          } else if (masterComponents.length > 1) {
+            // need all hbase_masters hosts in quick links
+            if (activeMaster) {
+              activeMaster.forEach(function(item) {
+                hosts.push({'publicHostName': item.get('host.publicHostName'), 'status': Em.I18n.t('quick.links.label.active')});
+              });
+            }
+            if (standbyMasters) {
+              standbyMasters.forEach(function(item) {
+                hosts.push({'publicHostName': item.get('host.publicHostName'), 'status': Em.I18n.t('quick.links.label.standby')});
+              });
+            }
+            if (otherMasters) {
+              otherMasters.forEach(function(item) {
+                hosts.push({'publicHostName': item.get('host.publicHostName')});
+              });
+            }
           } else {
-            host = component.get('host.publicHostName');
+            hosts[0] = masterComponents[0].get('host.publicHostName');
           }
-        } else {
-          host = 'noActiveHbaseMaster';
         }
         break;
       case "YARN":
-        host = this.findComponentHost('RESOURCEMANAGER');
+        hosts[0] = this.findComponentHost('RESOURCEMANAGER');
         break;
       case "MAPREDUCE2":
-        host = this.findComponentHost('HISTORYSERVER');
+        hosts[0] = this.findComponentHost('HISTORYSERVER');
         break;
       case "FALCON":
-        host = this.findComponentHost('FALCON_SERVER');
+        hosts[0] = this.findComponentHost('FALCON_SERVER');
         break;
       case "STORM":
-        host = this.findComponentHost('NIMBUS');
+        hosts[0] = this.findComponentHost('NIMBUS');
         break;
     }
-    if (!host) {
+    if (!hosts) {
       quickLinks = [
         {
           label: this.t('quick.links.error.label'),
           url: 'javascript:alert("' + this.t('contact.administrator') + '");return false;'
         }
       ];
-    } else {
+      this.set('quickLinks', quickLinks);
+    } else if (hosts.length == 1) {
+
       quickLinks = this.get('content.quickLinks').map(function (item) {
-        if (host == 'noActiveNN' || host == 'noActiveHbaseMaster') {
-          item.set('disabled', true);
-        } else {
-          item.set('disabled', false);
+        var protocol = self.setProtocol(item.get('service_id'));
+        if (item.get('template')) {
+          var port = item.get('http_config') && self.setPort(item, protocol, version);
+          item.set('url', item.get('template').fmt(protocol, hosts[0], port));
+        }
+        return item;
+      });
+      this.set('quickLinks', quickLinks);
+    } else {
+      // multiple hbase masters or HDFS HA enabled
+      var quickLinksArray = [];
+      hosts.forEach(function(host){
+        var quickLinks = [];
+        self.get('content.quickLinks').forEach(function (item) {
+          var newItem = {};
           var protocol = self.setProtocol(item.get('service_id'));
           if (item.get('template')) {
             var port = item.get('http_config') && self.setPort(item, protocol, version);
-            item.set('url', item.get('template').fmt(protocol, host, port));
+            newItem.url = item.get('template').fmt(protocol, host.publicHostName, port);
+            newItem.label =  item.get('label');
           }
+          quickLinks.push(newItem);
+        });
+        if (host.status) {
+          quickLinks.set('publicHostNameLabel', Em.I18n.t('quick.links.publicHostName').format(host.publicHostName, host.status));
+        } else {
+          quickLinks.set('publicHostNameLabel', host.publicHostName);
         }
-        return item;
-      });
+        quickLinksArray.push(quickLinks);
+      }, this);
+
+      this.set('quickLinksArray', quickLinksArray);
     }
-    this.set('quickLinks', quickLinks);
   }.observes('App.currentStackVersionNumber', 'App.singleNodeInstall'),
 
   setProtocol: function (service_id) {