incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yus...@apache.org
Subject git commit: AMBARI-3372. HDFS health status hover and NameNode label changes when HA config'd. (xiwang via yusaku)
Date Sat, 28 Sep 2013 02:15:44 GMT
Updated Branches:
  refs/heads/trunk 4cfadcfca -> 3b93763f2


AMBARI-3372. HDFS health status hover and NameNode label changes when HA config'd. (xiwang
via yusaku)


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

Branch: refs/heads/trunk
Commit: 3b93763f2c232895d824eeda1710c0daf4ac9287
Parents: 4cfadcf
Author: Yusaku Sako <yusaku@hortonworks.com>
Authored: Fri Sep 27 19:15:12 2013 -0700
Committer: Yusaku Sako <yusaku@hortonworks.com>
Committed: Fri Sep 27 19:15:12 2013 -0700

----------------------------------------------------------------------
 ambari-web/app/mappers/status_mapper.js         | 42 +++++++++++++++++-
 .../app/views/main/dashboard/service/hdfs.js    | 46 +-------------------
 2 files changed, 41 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/3b93763f/ambari-web/app/mappers/status_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/status_mapper.js b/ambari-web/app/mappers/status_mapper.js
index 72698f6..307af35 100644
--- a/ambari-web/app/mappers/status_mapper.js
+++ b/ambari-web/app/mappers/status_mapper.js
@@ -102,7 +102,7 @@ App.statusMapper = App.QuickDataMapper.create({
     }
     if (hostComponent.get('isMaster')) {
       if (service.everyStartedOrMaintenance) {
-        service.everyStartedOrMaintenance = (!App.HostComponent.find().someProperty('componentName',
'SECONDARY_NAMENODE') && hostComponent.get('componentName') === 'NAMENODE' &&
App.HDFSService.find().filterProperty('activeNameNode.hostName').length > 0)
+        service.everyStartedOrMaintenance = (hostComponent.get('componentName') === 'NAMENODE'
&& !App.HostComponent.find().someProperty('componentName', 'SECONDARY_NAMENODE') &&
App.HDFSService.find().filterProperty('activeNameNode.hostName').length > 0)
           ? true : service.everyStartedOrMaintenance = ([App.HostComponentStatus.started,
App.HostComponentStatus.maintenance].contains(hostComponent.get('workStatus')));
       } else {
         service.everyStartedOrMaintenance = false;
@@ -128,7 +128,45 @@ App.statusMapper = App.QuickDataMapper.create({
 
       service.masterComponents.push(hostComponent);
 
-      service.toolTipContent += hostComponent.get("displayName") + " " + hostComponent.get("componentTextStatus")
+ "<br/>";
+      // set advanced nameNode display name for HA, active or standby NameNode
+      // this is useful on three places: hdfs health status hover tooltip, hdfs service summary
and NN component on host detail page
+      if (hostComponent.get('componentName') === 'NAMENODE' && !App.HostComponent.find().someProperty('componentName',
'SECONDARY_NAMENODE')) {
+        var hostName = hostComponent.get('host.hostName');
+        var services = App.Service.find();
+        var hdfs;
+        services.forEach(function (item) {
+          if (item.get("serviceName") == "HDFS") {
+            hdfs = App.HDFSService.find(item.get('id'));
+          }
+        }, this);
+        var activeNNText = Em.I18n.t('services.service.summary.nameNode.active');
+        var standbyNNText = Em.I18n.t('services.service.summary.nameNode.standby');
+        if (hdfs) {
+          if (hdfs.get('activeNameNode') && hdfs.get('activeNameNode').get('hostName'))
{
+            var activeHostname = hdfs.get('activeNameNode').get('hostName');
+          }
+          if (hdfs.get('standbyNameNode') && hdfs.get('standbyNameNode').get('hostName'))
{
+            var standbyHostname1 = hdfs.get('standbyNameNode').get('hostName');
+          }
+          if (hdfs.get('standbyNameNode2') && hdfs.get('standbyNameNode2').get('hostName'))
{
+            var standbyHostname2 = hdfs.get('standbyNameNode2').get('hostName');
+          }
+          if ( hostName == activeHostname) {
+            hostComponent.set('displayNameAdvanced', activeNNText);
+          } else if ( hostName == standbyHostname1 || hostName == standbyHostname2) {
+            hostComponent.set('displayNameAdvanced', standbyNNText);
+          } else {
+            hostComponent.set('displayNameAdvanced', null);
+          }
+        }
+      }
+
+      if (hostComponent.get("displayNameAdvanced")) {
+        service.toolTipContent += hostComponent.get("displayNameAdvanced") + " " + hostComponent.get("componentTextStatus")
+ "<br/>";
+      } else {
+        service.toolTipContent += hostComponent.get("displayName") + " " + hostComponent.get("componentTextStatus")
+ "<br/>";
+      }
+
     }
 
     if (hostComponent.get('workStatus') !== App.HostComponentStatus.stopped &&

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/3b93763f/ambari-web/app/views/main/dashboard/service/hdfs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/service/hdfs.js b/ambari-web/app/views/main/dashboard/service/hdfs.js
index 8d73e35..7a7239d 100644
--- a/ambari-web/app/views/main/dashboard/service/hdfs.js
+++ b/ambari-web/app/views/main/dashboard/service/hdfs.js
@@ -43,52 +43,8 @@ App.MainDashboardServiceHdfsView = App.MainDashboardServiceView.extend({
       var masters = this.get('parentView.service.hostComponents').filter(function(comp){
         return comp.get('isMaster') && comp.get('componentName') !== 'JOURNALNODE';
       });
-      // enabled HA
-      if (!masters.findProperty('componentName', 'SECONDARY_NAMENODE') || masters.findProperty('componentName',
'SECONDARY_NAMENODE').get('workStatus') == 'MAINTENANCE') {
-        masters = this.setNNDisplayName();
-      }
-      return masters;
-    }.property('service'),
-    setNNDisplayName: function () {
-      var masters = this.get('parentView.service.hostComponents').filter(function(comp){
-        return comp.get('isMaster') && comp.get('componentName') !== 'JOURNALNODE';
-      });
-      var hostName0 = masters[0].get('host.hostName');
-      var activeNN = this.get('parentView.service.activeNameNode');
-      var standbyNN1 = this.get('parentView.service.standbyNameNode');
-      var standbyNN2 = this.get('parentView.service.standbyNameNode2');
-      if (activeNN) {
-        // 0 is always active
-        if (hostName0 == activeNN.get('hostName')) {
-          masters[0].set('displayNameAdvanced', Em.I18n.t('services.service.summary.nameNode.active'));
-        } else {
-          masters[1].set('displayNameAdvanced', Em.I18n.t('services.service.summary.nameNode.active'));
-          var temp = masters[0];
-          masters[0] = masters[1];
-          masters[1] = temp;
-        }
-        if (standbyNN1) {
-          masters[1].set('displayNameAdvanced', Em.I18n.t('services.service.summary.nameNode.standby'));
-        } else {
-          masters[1].set('displayNameAdvanced', null);
-        }
-      } else if (!activeNN && standbyNN2 && standbyNN1) {
-        masters[0].set('displayNameAdvanced', Em.I18n.t('services.service.summary.nameNode.standby'));
-        masters[1].set('displayNameAdvanced', Em.I18n.t('services.service.summary.nameNode.standby'));
-      } else if (!activeNN && standbyNN1 && !standbyNN2) {
-        if (hostName0 == standbyNN1.get('hostName')) {
-          masters[0].set('displayNameAdvanced', Em.I18n.t('services.service.summary.nameNode.standby'));
-          masters[1].set('displayNameAdvanced', null);
-        } else {
-          masters[1].set('displayNameAdvanced', Em.I18n.t('services.service.summary.nameNode.standby'));
-          masters[0].set('displayNameAdvanced', null);
-        }
-      } else if (!activeNN && !standbyNN1 && !standbyNN2) {
-        masters[0].set('displayNameAdvanced', null);
-        masters[1].set('displayNameAdvanced', null);
-      }
       return masters;
-    }.observes('parentView.service.activeNameNode', 'parentView.service.standbyNameNode','parentView.service.standbyNameNode2')
+    }.property('service')
   }),
 
   dataNodesLive: function(){


Mime
View raw message