Repository: ambari
Updated Branches:
  refs/heads/trunk dae0dadca -> 8371a8a0e


AMBARI-9868. No feedback is shown for bulk start/stop operations if the target 
host components are already started/stopped (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 8371a8a0e6fbb28cdcc137863a2d6ec3cfd209fc
Parents: 568e49d
Author: Alex Antonenko <[email protected]>
Authored: Sun Mar 1 23:32:03 2015 +0200
Committer: Alex Antonenko <[email protected]>
Committed: Mon Mar 2 00:19:40 2015 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host.js | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8371a8a0/ambari-web/app/controllers/main/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host.js 
b/ambari-web/app/controllers/main/host.js
index 58ac9ba..522ab83 100644
--- a/ambari-web/app/controllers/main/host.js
+++ b/ambari-web/app/controllers/main/host.js
@@ -589,6 +589,8 @@ App.MainHostController = 
Em.ArrayController.extend(App.TableServerMixin, {
     var query = [];
     var hostNames = [];
     var hostsMap = {};
+    var context = this,
+        shouldRun = false;
 
     data.items.forEach(function (host) {
       host.host_components.forEach(function (hostComponent) {
@@ -600,19 +602,28 @@ App.MainHostController = 
Em.ArrayController.extend(App.TableServerMixin, {
           }
         }
       });
+      hostsMap[host.Hosts.host_name].healthStatus = 
context.dataSource.filterProperty('hostName', 
host.Hosts.host_name)[0].get('healthStatus');
     });
 
     for (var hostName in hostsMap) {
       var subQuery = '(HostRoles/component_name.in(%@)&HostRoles/host_name=' + 
hostName + ')';
       var components = hostsMap[hostName];
+      var action = operationData.get('action'),
+          healthStatus = hostsMap[hostName].healthStatus;
+
       if (components.length) {
         query.push(subQuery.fmt(components.join(',')));
       }
       hostNames.push(hostName);
-    }
 
+      if ((action === App.HostComponentStatus.started && healthStatus !== 
'HEALTHY') || // start all and already started
+          (action === App.HostComponentStatus.stopped && healthStatus !== 
'UNHEALTHY')) { // stop all and already stopped
+        shouldRun = true;
+      }
+    }
     hostNames = hostNames.join(",");
-    if (query.length) {
+
+    if (query.length && shouldRun) {
       query = query.join('|');
       App.ajax.send({
         name: 'common.host_components.update',

Reply via email to