Selaa lähdekoodia

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

Alex Antonenko 10 vuotta sitten
vanhempi
commit
8371a8a0e6
1 muutettua tiedostoa jossa 13 lisäystä ja 2 poistoa
  1. 13 2
      ambari-web/app/controllers/main/host.js

+ 13 - 2
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',