Browse Source

AMBARI-5836 Bulk Ops need to keep working with Ambari Web scalability fixes. (atkach)

atkach 11 years ago
parent
commit
e3da23b4c0

+ 170 - 94
ambari-web/app/controllers/main/host.js

@@ -176,25 +176,51 @@ App.MainHostController = Em.ArrayController.extend({
    * @param {Object} operationData - data about bulk operation (action, hostComponents etc)
    * @param {Array} hosts - list of affected hosts
    */
-  bulkOperationForHosts: function(operationData, hosts) {
+  bulkOperationForHosts: function (operationData, hosts) {
+    var self = this;
+
+    batchUtils.getComponentsFromServer({
+      hosts: hosts.mapProperty('hostName'),
+      workStatus: operationData.actionToCheck,
+      passiveState: 'OFF',
+      displayParams: ['host_components/HostRoles/component_name']
+    }, function (data) {
+      self.bulkOperationForHostsCallback(operationData, data);
+    });
+  },
+  /**
+   * run Bulk operation (start/stop all) for selected hosts
+   * after host and components are loaded
+   * @param operationData
+   * @param data
+   */
+  bulkOperationForHostsCallback: function (operationData, data) {
     var query = [];
-    hosts.forEach(function(host) {
-      var subQuery = '(HostRoles/component_name.in(%@)&HostRoles/host_name=' + host.get('hostName') + ')';
-      var components = [];
-      host.get('hostComponents').forEach(function(hostComponent) {
-        if (hostComponent.get('passiveState') == 'OFF') {
-          if (hostComponent.get('isMaster') || hostComponent.get('isSlave')) {
-            if (hostComponent.get('workStatus') === operationData.actionToCheck) {
-              components.push(hostComponent.get('componentName'));
-            }
+    var hostNames = [];
+    var hostsMap = {};
+
+    data.items.forEach(function (host) {
+      host.host_components.forEach(function(hostComponent){
+        if (!App.components.get('clients').contains((hostComponent.HostRoles.component_name))) {
+          if (hostsMap[host.Hosts.host_name]) {
+            hostsMap[host.Hosts.host_name].push(hostComponent.HostRoles.component_name);
+          } else {
+            hostsMap[host.Hosts.host_name] = [hostComponent.HostRoles.component_name];
           }
         }
       });
+    });
+
+    for (var hostName in hostsMap) {
+      var subQuery = '(HostRoles/component_name.in(%@)&HostRoles/host_name=' + hostName + ')';
+      var components = hostsMap[hostName];
       if (components.length) {
         query.push(subQuery.fmt(components.join(',')));
       }
-    });
-    var hostNames = hosts.mapProperty('hostName').join(",");
+      hostNames.push(hostName);
+    }
+
+    hostNames = hostNames.join(",");
     if (query.length) {
       query = query.join('|');
       App.ajax.send({
@@ -224,11 +250,22 @@ App.MainHostController = Em.ArrayController.extend({
    * @param {Ember.Enumerable} hosts - list of affected hosts
    */
   bulkOperationForHostsRestart: function(operationData, hosts) {
-    var hostComponents = [];
-    hosts.forEach(function(host) {
-      hostComponents.pushObjects(host.get('hostComponents').filterProperty('passiveState','OFF').toArray());
+    batchUtils.getComponentsFromServer({
+      passiveState: 'OFF',
+      hosts: hosts.mapProperty('hostName'),
+      displayParams: ['host_components/HostRoles/component_name']
+    }, function (data) {
+      var hostComponents = [];
+      data.items.forEach(function (host) {
+        host.host_components.forEach(function (hostComponent) {
+          hostComponents.push(Em.Object.create({
+            componentName: hostComponent.HostRoles.component_name,
+            hostName: host.Hosts.host_name
+          }));
+        })
+      });
+      batchUtils.restartHostComponents(hostComponents, Em.I18n.t('rollingrestart.context.allOnSelectedHosts'), "HOST");
     });
-    batchUtils.restartHostComponents(hostComponents, Em.I18n.t('rollingrestart.context.allOnSelectedHosts'), "HOST");
   },
 
   /**
@@ -236,37 +273,41 @@ App.MainHostController = Em.ArrayController.extend({
    * @param {Object} operationData - data about bulk operation (action, hostComponents etc)
    * @param {Array} hosts - list of affected hosts
    */
-  bulkOperationForHostsPassiveState: function(operationData, hosts) {
-    var affectedHosts = [];
-    hosts.forEach(function(host) {
-      if (host.get('passiveState') !== operationData.state) {
-        affectedHosts.push(host);
+  bulkOperationForHostsPassiveState: function (operationData, hosts) {
+    var self = this;
+
+    batchUtils.getComponentsFromServer({
+      displayParams: ['Hosts/maintenance_state']
+    }, function (data) {
+      var hostNames = [];
+
+      data.items.forEach(function (host) {
+        if (host.Hosts.maintenance_state !== operationData.state) {
+          hostNames.push(host.Hosts.host_name);
+        }
+      });
+      if (hostNames.length) {
+        App.ajax.send({
+          name: 'bulk_request.hosts.passive_state',
+          sender: self,
+          data: {
+            hostNames: hostNames.join(','),
+            passive_state: operationData.state,
+            requestInfo: operationData.message
+          },
+          success: 'updateHostPassiveState'
+        });
+      } else {
+        App.ModalPopup.show({
+          header: Em.I18n.t('rolling.nothingToDo.header'),
+          body: Em.I18n.t('hosts.bulkOperation.passiveState.nothingToDo.body'),
+          secondary: false
+        });
       }
     });
-    if (affectedHosts.length) {
-      App.ajax.send({
-        name: 'bulk_request.hosts.passive_state',
-        sender: this,
-        data: {
-          hosts: affectedHosts,
-          hostNames: affectedHosts.mapProperty('hostName').join(','),
-          passive_state: operationData.state,
-          requestInfo: operationData.message
-        },
-        success: 'updateHostPassiveState'
-      });
-    }
-    else {
-      App.ModalPopup.show({
-        header: Em.I18n.t('rolling.nothingToDo.header'),
-        body: Em.I18n.t('hosts.bulkOperation.passiveState.nothingToDo.body'),
-        secondary: false
-      });
-    }
   },
 
   updateHostPassiveState: function(data, opt, params) {
-    params.hosts.setEach('passiveState', params.passive_state);
     App.router.get('clusterController').loadUpdatedStatus(function(){
       batchUtils.infoPassiveState(params.passive_state);
     });
@@ -277,38 +318,35 @@ App.MainHostController = Em.ArrayController.extend({
    * @param {Array} hosts - list of affected hosts
    */
   bulkOperationForHostComponents: function(operationData, hosts) {
-    var service = App.Service.find(operationData.serviceName);
-    var components = service.get('hostComponents').filter(function(hc) {
-      if (hc.get('componentName') != operationData.componentName || hc.get('passiveState') != 'OFF' ) {
-        return false;
+    var self = this;
+
+    batchUtils.getComponentsFromServer({
+      components: [operationData.componentName],
+      hosts: hosts.mapProperty('hostName'),
+      passiveState: 'OFF'
+    }, function (data) {
+      if (data.items.length) {
+        var hostsWithComponentInProperState = data.items.mapProperty('Hosts.host_name');
+        App.ajax.send({
+          name: 'bulk_request.host_components',
+          sender: self,
+          data: {
+            hostNames: hostsWithComponentInProperState.join(','),
+            state: operationData.action,
+            requestInfo: operationData.message + ' ' + operationData.componentNameFormatted,
+            componentName: operationData.componentName
+          },
+          success: 'bulkOperationForHostComponentsSuccessCallback'
+        });
       }
-      if(hc.get('workStatus') == operationData.action) {
-        return false;
+      else {
+        App.ModalPopup.show({
+          header: Em.I18n.t('rolling.nothingToDo.header'),
+          body: Em.I18n.t('rolling.nothingToDo.body').format(operationData.componentNameFormatted),
+          secondary: false
+        });
       }
-      return hosts.contains(hc.get('host'));
     });
-
-    if (components.length) {
-      var hostsWithComponentInProperState = components.mapProperty('host.hostName');
-      App.ajax.send({
-        name: 'bulk_request.host_components',
-        sender: this,
-        data: {
-          hostNames: hostsWithComponentInProperState.join(','),
-          state: operationData.action,
-          requestInfo: operationData.message + ' ' + operationData.componentNameFormatted,
-          componentName: operationData.componentName
-        },
-        success: 'bulkOperationForHostComponentsSuccessCallback'
-      });
-    }
-    else {
-      App.ModalPopup.show({
-        header: Em.I18n.t('rolling.nothingToDo.header'),
-        body: Em.I18n.t('rolling.nothingToDo.body').format(operationData.componentNameFormatted),
-        secondary: false
-      });
-    }
   },
 
   /**
@@ -316,17 +354,41 @@ App.MainHostController = Em.ArrayController.extend({
    * @param {Object} operationData
    * @param {Array} hosts
    */
-  bulkOperationForHostComponentsDecommission: function(operationData, hosts) {
+  bulkOperationForHostComponentsDecommission: function (operationData, hosts) {
+    var self = this;
+
+    batchUtils.getComponentsFromServer({
+      components: [operationData.realComponentName],
+      hosts: hosts.mapProperty('hostName'),
+      passiveState: 'OFF',
+      displayParams: ['host_components/HostRoles/state']
+    }, function (data) {
+      self.bulkOperationForHostComponentsDecommissionCallBack(operationData, data)
+    });
+  },
+
+  /**
+   * run Bulk decommission/recommission for selected hostComponents
+   * after host and components are loaded
+   * @param operationData
+   * @param data
+   */
+  bulkOperationForHostComponentsDecommissionCallBack: function(operationData, data){
     var service = App.Service.find(operationData.serviceName);
-    var components = service.get('hostComponents').filter(function(hc) {
-      if (hc.get('componentName') != operationData.realComponentName || hc.get('passiveState') != 'OFF' ) {
-        return false;
-      }
-      return hosts.contains(hc.get('host'));
+    var components = [];
+
+    data.items.forEach(function (host) {
+      host.host_components.forEach(function (hostComponent) {
+        components.push(Em.Object.create({
+          componentName: hostComponent.HostRoles.component_name,
+          hostName: host.Hosts.host_name,
+          workStatus: hostComponent.HostRoles.state
+        }))
+      });
     });
 
     if (components.length) {
-      var hostsWithComponentInProperState = components.mapProperty('host.hostName');
+      var hostsWithComponentInProperState = components.mapProperty('hostName');
       var turn_off = operationData.action.indexOf('OFF') !== -1;
       var svcName = operationData.serviceName;
       var masterName = operationData.componentName;
@@ -341,7 +403,7 @@ App.MainHostController = Em.ArrayController.extend({
           App.router.get('mainHostDetailsController').doRecommissionAndRestart(hostNames, svcName, masterName, slaveName);
         }
       } else {
-        hostsWithComponentInProperState = components.filterProperty('workStatus','STARTED').mapProperty('host.hostName');
+        hostsWithComponentInProperState = components.filterProperty('workStatus', 'STARTED').mapProperty('hostName');
         //For decommession
         if (svcName == "HBASE") {
           // HBASE service, decommission RegionServer in batch requests
@@ -388,23 +450,37 @@ App.MainHostController = Em.ArrayController.extend({
    */
   bulkOperationForHostComponentsRestart: function(operationData, hosts) {
     var service = App.Service.find(operationData.serviceName);
-    var components = service.get('hostComponents').filter(function(hc) {
-      if (hc.get('componentName') != operationData.componentName || hc.get('passiveState') != 'OFF') {
-        return false;
-      }
-      return hosts.contains(hc.get('host'));
-    });
 
-    if (components.length) {
-      batchUtils.showRollingRestartPopup(components.objectAt(0).get('componentName'), service.get('displayName'), service.get('passiveState') === "ON", false, components);
-    }
-    else {
-      App.ModalPopup.show({
-        header: Em.I18n.t('rolling.nothingToDo.header'),
-        body: Em.I18n.t('rolling.nothingToDo.body').format(operationData.componentNameFormatted),
-        secondary: false
+    batchUtils.getComponentsFromServer({
+      components: [operationData.componentName],
+      hosts: hosts.mapProperty('hostName'),
+      passiveState: 'OFF',
+      displayParams: ['Hosts/maintenance_state', 'host_components/HostRoles/stale_configs', 'host_components/HostRoles/maintenance_state']
+    }, function (data) {
+      var wrappedHostComponents = [];
+
+      data.items.forEach(function (host) {
+        host.host_components.forEach(function (hostComponent) {
+          wrappedHostComponents.push(Em.Object.create({
+            componentName: hostComponent.HostRoles.component_name,
+            hostName: host.Hosts.host_name,
+            hostPassiveState: host.Hosts.maintenance_state,
+            staleConfigs: hostComponent.HostRoles.stale_configs,
+            passiveState: hostComponent.HostRoles.maintenance_state
+          }))
+        });
       });
-    }
+
+      if (wrappedHostComponents.length) {
+        batchUtils.showRollingRestartPopup(wrappedHostComponents.objectAt(0).get('componentName'), service.get('displayName'), service.get('passiveState') === "ON", false, wrappedHostComponents);
+      } else {
+        App.ModalPopup.show({
+          header: Em.I18n.t('rolling.nothingToDo.header'),
+          body: Em.I18n.t('rolling.nothingToDo.body').format(operationData.componentNameFormatted),
+          secondary: false
+        });
+      }
+    });
   },
 
   updateHostComponentsPassiveState: function(data, opt, params) {

+ 18 - 3
ambari-web/app/controllers/main/service/item.js

@@ -309,11 +309,26 @@ App.MainServiceItemController = Em.Controller.extend({
   /**
    * Restart clients host components to apply config changes
    */
-  refreshConfigs: function() {
+  refreshConfigs: function () {
     var self = this;
+
     if (this.get('content.isClientsOnly')) {
-      return App.showConfirmationFeedBackPopup(function(query) {
-        batchUtils.restartHostComponents(self.get('content.hostComponents'), Em.I18n.t('rollingrestart.context.allForSelectedService').format(self.get('content.serviceName')),"SERVICE",  query);
+      return App.showConfirmationFeedBackPopup(function (query) {
+        batchUtils.getComponentsFromServer({
+          services: [self.get('content.serviceName')]
+        }, function (data) {
+          var hostComponents = [];
+
+          data.items.forEach(function (host) {
+            host.host_components.forEach(function (hostComponent) {
+              hostComponents.push(Em.Object.create({
+                componentName: hostComponent.HostRoles.component_name,
+                hostName: host.Hosts.host_name
+              }))
+            });
+          });
+          batchUtils.restartHostComponents(hostComponents, Em.I18n.t('rollingrestart.context.allForSelectedService').format(self.get('content.serviceName')), "SERVICE", query);
+        })
       });
     }
   },

+ 9 - 0
ambari-web/app/utils/ajax/ajax.js

@@ -2076,6 +2076,15 @@ var urls = {
   'host.host_component.flume.metrics.timeseries': {
     'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/FLUME_HANDLER?fields=metrics/flume/flume/{flumeComponent}/*/{flumeComponentMetric}[{fromSeconds},{toSeconds},{stepSeconds}]',
     'mock': ''
+  },
+  'host.host_components.filtered': {
+    'real': '/clusters/{clusterName}/hosts',
+    'mock': '',
+    format: function(data, opt) {
+      return {
+        url: opt.url + data.urlParams
+      }
+    }
   }
 };
 /**

+ 134 - 25
ambari-web/app/utils/batch_scheduled_requests.js

@@ -70,27 +70,110 @@ module.exports = {
    * @param {bool} staleConfigsOnly restart only hostComponents with <code>staleConfig</code> true
    */
   restartAllServiceHostComponents: function(serviceName, staleConfigsOnly, query) {
-    var service = App.Service.find(serviceName);
+    var self = this;
     var context = staleConfigsOnly ? Em.I18n.t('rollingrestart.context.allWithStaleConfigsForSelectedService').format(serviceName) : Em.I18n.t('rollingrestart.context.allForSelectedService').format(serviceName);
-    if (service) {
-      var hostComponents = service.get('hostComponents').filterProperty('host.passiveState','OFF');
+    var services = (serviceName === 'HIVE' && App.Service.find('HCATALOG').get('isLoaded')) ? ['HIVE', 'HCATALOG'] : [serviceName];
 
-      // HCatalog components are technically owned by Hive.
-      if (serviceName == 'HIVE') {
-        var hcatService = App.Service.find('HCATALOG');
-        if (hcatService != null && hcatService.get('isLoaded')) {
-          var hcatHcs = hcatService.get('hostComponents').filterProperty('host.passiveState', 'OFF');
-          if (hcatHcs != null) {
-            hostComponents.pushObjects(hcatHcs);
-          }
+    this.getComponentsFromServer({
+      services: services,
+      staleConfigs: staleConfigsOnly,
+      passiveState: 'OFF',
+      displayParams: ['host_components/HostRoles/component_name']
+    }, function (data) {
+      var hostComponents = [];
+      data.items.forEach(function (host) {
+        host.host_components.forEach(function (hostComponent) {
+          hostComponents.push(Em.Object.create({
+            componentName: hostComponent.HostRoles.component_name,
+            hostName: host.Hosts.host_name
+          }))
+        });
+      });
+      self.restartHostComponents(hostComponents, context, "SERVICE", query);
+    });
+  },
+
+  /**
+   * construct URL from parameters for request in <code>getComponentsFromServer()</code>
+   * @param options
+   * @return {String}
+   */
+  constructComponentsCallUrl: function (options) {
+    var multipleValueParams = {
+      'services': 'host_components/HostRoles/service_name.in(<entity-names>)',
+      'hosts': 'Hosts/host_name.in(<entity-names>)',
+      'components': 'host_components/HostRoles/component_name.in(<entity-names>)'
+    };
+    var singleValueParams = {
+      staleConfigs: 'host_components/HostRoles/stale_configs=',
+      passiveState: 'Hosts/maintenance_state=',
+      workStatus: 'host_components/HostRoles/state='
+    };
+    var displayParams = options.displayParams || [];
+    var urlParams = '?';
+    var addAmpersand = false;
+
+    for (var i in multipleValueParams) {
+      var arrayParams = options[i];
+      if (Array.isArray(arrayParams) && arrayParams.length > 0) {
+        if (addAmpersand) {
+          urlParams += '&';
+          addAmpersand = false;
         }
+        urlParams += multipleValueParams[i].replace('<entity-names>', arrayParams.join(','));
+        addAmpersand = true;
       }
+    }
 
-      if (staleConfigsOnly) {
-        hostComponents = hostComponents.filterProperty('staleConfigs', true);
+    for (var j in singleValueParams) {
+      var param = options[j];
+      if (!Em.isNone(param)) {
+        urlParams += (addAmpersand) ? '&' : '';
+        urlParams += singleValueParams[j] + param.toString();
+        addAmpersand = true;
       }
-      this.restartHostComponents(hostComponents, context, "SERVICE", query);
     }
+
+    displayParams.forEach(function (displayParam, index, array) {
+      if (index === 0) {
+        urlParams += (addAmpersand) ? '&' : '';
+        urlParams += 'fields=';
+      }
+      urlParams += displayParam;
+      urlParams += (array.length === (index + 1)) ? '' : ",";
+    });
+
+    return urlParams + '&minimal_response=true';
+  },
+
+  /**
+   * make GET call to server in order to obtain host-components
+   * which correspond to filter params from <code>options</code>
+   * @param options
+   * @param callback
+   */
+  getComponentsFromServer: function (options, callback) {
+    var urlParams = this.constructComponentsCallUrl(options);
+
+    App.ajax.send({
+      name: 'host.host_components.filtered',
+      sender: this,
+      data: {
+        urlParams: urlParams,
+        callback: callback
+      },
+      success: 'getComponentsFromServerSuccessCallback'
+    });
+  },
+
+  /**
+   * pass request outcome to <code>callback()<code>
+   * @param data
+   * @param opt
+   * @param params
+   */
+  getComponentsFromServerSuccessCallback: function (data, opt, params) {
+    params.callback(data);
   },
 
   /**
@@ -100,7 +183,7 @@ module.exports = {
    * @param {String} level - operation level, can be ("CLUSTER", "SERVICE", "HOST", "HOSTCOMPONENT")
    * @param {String} query
    */
-  restartHostComponents: function(hostComponentsList, context, level, query) {
+  restartHostComponents: function (hostComponentsList, context, level, query) {
     context = context || Em.I18n.t('rollingrestart.context.default');
     /**
      * Format: {
@@ -113,26 +196,27 @@ module.exports = {
     var hosts = [];
     var componentServiceMap = App.QuickDataMapper.componentServiceMap();
     hostComponentsList.forEach(function(hc) {
+      var hostName = hc.get('hostName') || hc.get('host.hostName');
       var componentName = hc.get('componentName');
       if (!componentToHostsMap[componentName]) {
         componentToHostsMap[componentName] = [];
       }
-      componentToHostsMap[componentName].push(hc.get('host.hostName'));
-      hosts.push(hc.get('host.hostName'));
+      componentToHostsMap[componentName].push(hostName);
+      hosts.push(hostName);
     });
     var resource_filters = [];
     for (var componentName in componentToHostsMap) {
       if (componentToHostsMap.hasOwnProperty(componentName)) {
         resource_filters.push({
-          service_name:  componentServiceMap[componentName],
+          service_name: componentServiceMap[componentName],
           component_name: componentName,
           hosts: componentToHostsMap[componentName].join(",")
         });
       }
     }
-      if(hostComponentsList.length > 0) {
+    if (hostComponentsList.length > 0) {
       var operation_level = this.getOperationLevelobject(level, hosts.uniq().join(","),
-          hostComponentsList[0].get("service.serviceName"), hostComponentsList[0].get("componentName"));
+        componentServiceMap[hostComponentsList[0].get("componentName")], hostComponentsList[0].get("componentName"));
     }
 
 
@@ -224,12 +308,12 @@ module.exports = {
         batchCount = Math.ceil(restartHostComponents.length / batchSize),
         sampleHostComponent = restartHostComponents.objectAt(0),
         componentName = sampleHostComponent.get('componentName'),
-        serviceName = sampleHostComponent.get('service.serviceName');
+        serviceName = sampleHostComponent.get('serviceName');
 
     for ( var count = 0; count < batchCount; count++) {
       var hostNames = [];
       for ( var hc = 0; hc < batchSize && hostIndex < restartHostComponents.length; hc++) {
-        hostNames.push(restartHostComponents.objectAt(hostIndex++).get('host.hostName'));
+        hostNames.push(restartHostComponents.objectAt(hostIndex++).get('hostName'));
       }
       if (hostNames.length > 0) {
         batches.push({
@@ -284,6 +368,7 @@ module.exports = {
   showRollingRestartPopup: function(hostComponentName, serviceName, isMaintenanceModeOn, staleConfigsOnly, hostComponents, skipMaintenance) {
     hostComponents = hostComponents || [];
     var componentDisplayName = App.format.role(hostComponentName);
+    var self = this;
     if (!componentDisplayName) {
       componentDisplayName = hostComponentName;
     }
@@ -294,16 +379,40 @@ module.exports = {
       skipMaintenance: skipMaintenance,
       serviceName: serviceName,
       isServiceInMM: isMaintenanceModeOn,
-      didInsertElement : function() {
+      didInsertElement: function () {
+        var view = this;
+
         this.set('parentView.innerView', this);
-        this.initialize();
+        if (hostComponents.length) {
+          view.initialize();
+        } else {
+          self.getComponentsFromServer({
+            components: [hostComponentName],
+            displayParams: ['host_components/HostRoles/stale_configs', 'Hosts/maintenance_state', 'host_components/HostRoles/maintenance_state'],
+            staleConfigs: staleConfigsOnly
+          }, function (data) {
+            var wrappedHostComponents = [];
+            data.items.forEach(function (host) {
+              host.host_components.forEach(function(hostComponent){
+                wrappedHostComponents.push(Em.Object.create({
+                  componentName: hostComponent.HostRoles.component_name,
+                  hostName: host.Hosts.host_name,
+                  staleConfigs: hostComponent.HostRoles.stale_configs,
+                  hostPassiveState: host.Hosts.maintenance_state,
+                  passiveState: hostComponent.HostRoles.maintenance_state
+                }));
+              });
+            });
+            view.set('allHostComponents', wrappedHostComponents);
+            view.initialize();
+          });
+        }
       }
     };
     if (hostComponents.length) {
       viewExtend.allHostComponents = hostComponents;
     }
 
-    var self = this;
     App.ModalPopup.show({
       header : title,
       hostComponentName : hostComponentName,

+ 9 - 18
ambari-web/app/views/common/rolling_restart_view.js

@@ -139,18 +139,14 @@ App.RollingRestartView = Em.View.extend({
    * List of all host components
    * @type {Array}
    */
-  allHostComponents : function() {
-    return App.HostComponent.find().filterProperty('componentName', this.get('hostComponentName'));
-  }.property('hostComponentName'),
+  allHostComponents : [],
 
   /**
    * List of host components without components in out-of-service state
    * @type {Array}
    */
   nonMaintainanceHostComponents : function() {
-    return this.get('allHostComponents').filter(function(item) {
-      return item.get('passiveState') == 'OFF';
-    });
+    return this.get('allHostComponents').filterProperty('passiveState', 'OFF')
   }.property('allHostComponents', 'allHostComponents.@each.passiveState'),
 
   /**
@@ -158,26 +154,21 @@ App.RollingRestartView = Em.View.extend({
    * @type {Array}
    */
   componentsWithMaintenanceHost: function() {
-    return this.get('allHostComponents').filterProperty('host.passiveState','ON');
-  }.property('allHostComponents', 'allHostComponents.@each.passiveState'),
+    return this.get('allHostComponents').filterProperty('hostPassiveState', 'ON');
+  }.property('allHostComponents', 'allHostComponents.@each.hostPassiveState'),
   /**
    * List of host components without components in out-of-service state
    * If <code>staleConfigsOnly</code> is true, components with <code>staleConfigs</code> = false are also filtered
    * @type {Array}
    */
-  restartHostComponents : function() {
-    var hostComponents = null;
-    if (this.get('skipMaintenance')) {
-      hostComponents = this.get('allHostComponents').filterProperty('host.passiveState','OFF');
-    } else {
-      hostComponents = this.get('nonMaintainanceHostComponents');
-    }
+  restartHostComponents: function () {
+    var hostComponents = (this.get('skipMaintenance')) ? this.get('allHostComponents') : this.get('nonMaintainanceHostComponents');
+
     if (this.get('staleConfigsOnly')) {
-      hostComponents = hostComponents.filterProperty('staleConfigs', true);
+      hostComponents = hostComponents.filterProperty('staleConfigs');
     }
     return hostComponents;
-  }.property('nonMaintainanceHostComponents', 'staleConfigsOnly'),
-
+  }.property('nonMaintainanceHostComponents'),
   /**
    * @type {String}
    */

+ 3 - 1
ambari-web/test/controllers/main/host/details_test.js

@@ -906,9 +906,11 @@ describe('App.MainHostDetailsController', function () {
     beforeEach(function () {
       sinon.stub(controller, "doDecommission", Em.K);
       sinon.stub(controller, "showBackgroundOperationsPopup", Em.K);
+      sinon.stub(controller, "doDecommissionRegionServer", Em.K);
     });
 
     afterEach(function () {
+      controller.doDecommissionRegionServer.restore();
       controller.doDecommission.restore();
       controller.showBackgroundOperationsPopup.restore();
     });
@@ -930,7 +932,7 @@ describe('App.MainHostDetailsController', function () {
     });
     it('HBASE service', function () {
       controller.runDecommission('host1', 'HBASE');
-      expect(controller.doDecommission.calledWith('host1', 'HBASE', "HBASE_MASTER", "HBASE_REGIONSERVER")).to.be.true;
+      expect(controller.doDecommissionRegionServer.calledWith('host1', 'HBASE', "HBASE_MASTER", "HBASE_REGIONSERVER")).to.be.true;
       expect(controller.showBackgroundOperationsPopup.calledOnce).to.be.true;
     });
   });