Repository: ambari
Updated Branches:
  refs/heads/trunk 7cf27fc4e -> 5d0d63119


AMBARI-12792 Component cannot be deleted after refreshing host details page. 
(atkach)


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

Branch: refs/heads/trunk
Commit: 5d0d63119f27e8de16fb174ba39d7598823151a4
Parents: 7cf27fc
Author: Andrii Tkach <atk...@hortonworks.com>
Authored: Mon Aug 17 20:08:12 2015 +0300
Committer: Andrii Tkach <atk...@hortonworks.com>
Committed: Mon Aug 17 20:08:12 2015 +0300

----------------------------------------------------------------------
 .../app/views/main/host/details/host_component_view.js | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5d0d6311/ambari-web/app/views/main/host/details/host_component_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/details/host_component_view.js 
b/ambari-web/app/views/main/host/details/host_component_view.js
index 73aacff..e6dcc19 100644
--- a/ambari-web/app/views/main/host/details/host_component_view.js
+++ b/ambari-web/app/views/main/host/details/host_component_view.js
@@ -210,26 +210,23 @@ App.HostComponentView = Em.View.extend({
     var installedCount = this.get('componentCounter');
     return (installedCount <= stackComponentCount)
       || ![App.HostComponentStatus.stopped, App.HostComponentStatus.unknown, 
App.HostComponentStatus.install_failed, App.HostComponentStatus.upgrade_failed, 
App.HostComponentStatus.init].contains(this.get('workStatus'));
-  }.property('workStatus'),
+  }.property('workStatus', 'componentCounter'),
 
   /**
    * gets number of current component that are applied to the cluster;
    * @returns {Number}
    */
   componentCounter: function() {
-    var componentCounter = 0;
+    var component;
     var stackServiceComponent =  
App.StackServiceComponent.find(this.get('hostComponent.componentName'));
     if (stackServiceComponent && 
App.get('router.clusterController.isHostContentLoaded')) {
       if (stackServiceComponent.get('isMaster')) {
-          componentCounter = 
App.HostComponent.find().filterProperty('componentName', 
this.get('content.componentName')).length
+        component = App.MasterComponent.find().findProperty('componentName', 
this.get('content.componentName'))
       } else {
-        var slaveComponent = 
App.SlaveComponent.find().findProperty('componentName', 
this.get('content.componentName'));
-        if (slaveComponent) {
-          componentCounter = slaveComponent.get('totalCount');
-        }
+        component = App.SlaveComponent.find().findProperty('componentName', 
this.get('content.componentName'));
       }
     }
-    return componentCounter;
+    return component ? component.get('totalCount') : 0;
   }.property('App.router.clusterController.isHostContentLoaded'),
 
   /**

Reply via email to