浏览代码

AMBARI-1115. Host component live status is broken. (Srimanth Gunturi via yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1431804 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 年之前
父节点
当前提交
84fa1d22bd
共有 3 个文件被更改,包括 34 次插入9 次删除
  1. 3 0
      CHANGES.txt
  2. 6 0
      ambari-web/app/models/host_component.js
  3. 25 9
      ambari-web/app/views/main/host/summary.js

+ 3 - 0
CHANGES.txt

@@ -675,6 +675,9 @@ AMBARI-666 branch (unreleased changes)
 
   BUG FIXES
 
+  AMBARI-1115. Host component live status is broken. (Srimanth Gunturi via
+  yusaku)
+
   AMBARI-1113. Install Wizard: Confirm host stuck at Preparing stage.
   (Arun Kandregula via yusaku)
 

+ 6 - 0
ambari-web/app/models/host_component.js

@@ -90,6 +90,8 @@ App.HostComponent.Status = {
   starting: "STARTING",
   stopped: "INSTALLED",
   stopping: "STOPPING",
+  stop_failed: "STOP_FAILED",
+  start_failed: "START_FAILED",
 
   getKeyName:function(value){
     switch(value){
@@ -101,6 +103,10 @@ App.HostComponent.Status = {
         return 'installed';
       case this.stopping:
         return 'stopping';
+      case this.stop_failed:
+        return 'stop_failed';
+      case this.start_failed:
+        return 'start_failed';
     }
     return 'none';
   }

+ 25 - 9
ambari-web/app/views/main/host/summary.js

@@ -122,7 +122,23 @@ App.MainHostSummaryView = Em.View.extend({
 
   ComponentView: Em.View.extend({
     content: null,
-
+    hostComponent: function(){
+      var hostComponent = null;
+      var serviceComponent = this.get('content');
+      var host = App.router.get('mainHostDetailsController.content');
+      if(host){
+        var hostComponent = host.get('hostComponents').findProperty('componentName', serviceComponent.get('componentName'));
+      }
+      return hostComponent;
+    }.property('content', 'App.router.mainHostDetailsController.content'),
+    workStatus: function(){
+      var workStatus = this.get('content.workStatus');
+      var hostComponent = this.get('hostComponent');
+      if(hostComponent){
+        workStatus = hostComponent.get('workStatus');
+      }
+      return workStatus;
+    }.property('content.workStatus', 'hostComponent.workStatus'),
     statusClass: function(){
       var statusClass = null;
       if(this.get('isDataNode')){
@@ -131,24 +147,24 @@ App.MainHostSummaryView = Em.View.extend({
           return 'health-status-DEAD-ORANGE';
         }
       }
-      return 'health-status-' + App.Component.Status.getKeyName(this.get('content.workStatus'));
-    }.property('content.workStatus'),
+      return 'health-status-' + App.Component.Status.getKeyName(this.get('workStatus'));
+    }.property('workStatus'),
     /**
      * Disable element while component is starting/stopping
      */
     disabledClass:function(){
-      var workStatus = this.get('content.workStatus');
+      var workStatus = this.get('workStatus');
       if([App.Component.Status.starting, App.Component.Status.stopping].contains(workStatus) ){
         return 'disabled';
       } else {
         return '';
       }
-    }.property('content.workStatus'),
+    }.property('workStatus'),
     /**
      * Do blinking for 1 minute
      */
     doBlinking : function(){
-      var workStatus = this.get('content.workStatus');
+      var workStatus = this.get('workStatus');
       var self = this;
       var pulsate = [ App.Component.Status.starting, App.Component.Status.stopping ].contains(workStatus);
       if (!pulsate && this.get('isDataNode')) {
@@ -167,11 +183,11 @@ App.MainHostSummaryView = Em.View.extend({
      */
     startBlinking:function(){
       this.doBlinking();
-    }.observes('content.workStatus'),
+    }.observes('workStatus'),
 
     isStart : function() {
-      return (this.get('content.workStatus') === App.Component.Status.started || this.get('content.workStatus') === App.Component.Status.starting);
-    }.property('content.workStatus'),
+      return (this.get('workStatus') === App.Component.Status.started || this.get('workStatus') === App.Component.Status.starting);
+    }.property('workStatus'),
     /**
      * Shows whether we need to show Decommision/Recomission buttons
      */