Ver Fonte

AMBARI-17703 - Hosts page: after component filter hosts have wrong list of components<fix1> (rzang)

Richard Zang há 8 anos atrás
pai
commit
aeada8a6d2

+ 6 - 13
ambari-web/app/controllers/global/update_controller.js

@@ -27,11 +27,6 @@ App.UpdateController = Em.Controller.extend({
   timeIntervalId: null,
   clusterName: Em.computed.alias('App.router.clusterController.clusterName'),
 
-  /**
-   * keys which should be preloaded in order to filter hosts by host-components
-   */
-  hostsPreLoadKeys: ['host_components/HostRoles/component_name', 'host_components/HostRoles/stale_configs', 'host_components/HostRoles/maintenance_state'],
-
   paginationKeys: ['page_size', 'from'],
 
   /**
@@ -363,10 +358,8 @@ App.UpdateController = Em.Controller.extend({
    * @return {Boolean}
    */
   preLoadHosts: function (callback) {
-    var preLoadKeys = this.get('hostsPreLoadKeys');
-
     if (this.get('queryParams.Hosts').length > 0 && this.get('queryParams.Hosts').filter(function (param) {
-      return preLoadKeys.contains(param.key);
+      return param.isComponentRelatedFilter;
     }, this).length > 0) {
       this.getHostByHostComponents(callback);
       return true;
@@ -393,7 +386,6 @@ App.UpdateController = Em.Controller.extend({
     })
   },
   getHostByHostComponentsSuccessCallback: function (data, opt, params) {
-    var preLoadKeys = this.get('hostsPreLoadKeys');
     var queryParams = this.get('queryParams.Hosts');
     var hostNames = data.items.mapProperty('Hosts.host_name');
     var skipCall = hostNames.length === 0;
@@ -406,15 +398,16 @@ App.UpdateController = Em.Controller.extend({
     if (skipCall) {
       params.callback(skipCall);
     } else {
+      // get all non-hostcomponent related keys
       queryParams = queryParams.filter(function (param) {
-        return !preLoadKeys.contains(param.key);
+        return !param.isComponentRelatedFilter;
       });
-
-      queryParams = [{
+      // force specific hosts
+      queryParams.push({
         key: 'Hosts/host_name',
         value: hostNames,
         type: 'MULTIPLE'
-      }];
+      });
       params.callback(skipCall, queryParams);
     }
   },

+ 2 - 1
ambari-web/app/controllers/main/host.js

@@ -258,7 +258,8 @@ App.MainHostController = Em.ArrayController.extend(App.TableServerMixin, {
           key: property.key,
           value: filter.value,
           type: property.type,
-          isFilter: true
+          isFilter: true,
+          isComponentRelatedFilter: ([13,15].indexOf(filter.iColumn) != -1)
         };
         if (filter.type === 'string' && sortProperties.someProperty('name', colPropAssoc[filter.iColumn])) {
           if (Em.isArray(filter.value)) {