Updated Branches:
  refs/heads/trunk 028d36126 -> 074d8395e

AMBARI-3277. HDFS shows red when NameNode HA is enabled. (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/074d8395
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/074d8395
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/074d8395

Branch: refs/heads/trunk
Commit: 074d8395ea8f727fa54b58700ef5cab6382d0af9
Parents: 028d361
Author: Yusaku Sako <[email protected]>
Authored: Wed Sep 18 16:13:21 2013 -0700
Committer: Yusaku Sako <[email protected]>
Committed: Wed Sep 18 16:13:21 2013 -0700

----------------------------------------------------------------------
 ambari-web/app/models/service.js      | 16 ++++++++++------
 ambari-web/app/models/service/hdfs.js |  7 +++++++
 2 files changed, 17 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/074d8395/ambari-web/app/models/service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service.js b/ambari-web/app/models/service.js
index 5730fb1..b2eee69 100644
--- a/ambari-web/app/models/service.js
+++ b/ambari-web/app/models/service.js
@@ -71,8 +71,7 @@ App.Service = DS.Model.extend({
       serviceName = this.get('serviceName'),
       isRunning = true,
       runningHCs = [],
-      unknownHCs = [],
-      hdfsHealthStatus;
+      unknownHCs = [];
 
     //look through all components to find out common statuses
     this.get('hostComponents').forEach(function (_hostComponent) {
@@ -133,16 +132,21 @@ App.Service = DS.Model.extend({
       }
     }
 
+    /**
+     * Both App.HDFSService and its parent (App.Service) can hit this block.
+     * We need a property: App.HDFSService.hdfsHealthStatus to store the 
correct status.
+     * When App.HDFSService get in, we store the status in that property based 
on if activeNN existed.
+     * When App.Service get in, we get correct health status from that 
property.
+     */
     if (isGreen && serviceName === 'HDFS' && masterComponents.length == 5) { 
// enabled HA
       var activeNN = this.get('activeNameNode');
       var nameNode = this.get('nameNode');
-
       if (nameNode && !activeNN) { //hdfs model but no active NN
-        hdfsHealthStatus = 'red';
+        App.HDFSService.hdfsHealthStatus = 'red';
       } else if (nameNode && activeNN) {
-        hdfsHealthStatus = 'green';
+        App.HDFSService.hdfsHealthStatus = 'green';
       }
-      this.set('healthStatus', hdfsHealthStatus);
+      this.set('healthStatus', App.HDFSService.hdfsHealthStatus);
     }
 
     this.set('isStarted', everyStarted);

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/074d8395/ambari-web/app/models/service/hdfs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service/hdfs.js 
b/ambari-web/app/models/service/hdfs.js
index d04dc94..c774ea8 100644
--- a/ambari-web/app/models/service/hdfs.js
+++ b/ambari-web/app/models/service/hdfs.js
@@ -46,4 +46,11 @@ App.HDFSService = App.Service.extend({
   nameNodeRpc: DS.attr('number')
 });
 
+/**
+ * Use this property only in its parent class to store hdfs health status.
+ */
+App.HDFSService.reopenClass({
+  hdfsHealthStatus: ''
+});
+
 App.HDFSService.FIXTURES = [];

Reply via email to