Repository: ambari
Updated Branches:
  refs/heads/trunk 556b285e5 -> d39abe619


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


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

Branch: refs/heads/trunk
Commit: d39abe619e9cfcdeecc59b6c0b1905d1e2c306e1
Parents: 556b285
Author: Richard Zang <[email protected]>
Authored: Fri Nov 4 15:01:18 2016 -0700
Committer: Richard Zang <[email protected]>
Committed: Fri Nov 4 15:01:18 2016 -0700

----------------------------------------------------------------------
 .../app/controllers/global/update_controller.js  | 19 ++++++-------------
 ambari-web/app/controllers/main/host.js          |  3 ++-
 2 files changed, 8 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d39abe61/ambari-web/app/controllers/global/update_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/update_controller.js 
b/ambari-web/app/controllers/global/update_controller.js
index fda1704..4631f09 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/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);
     }
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/d39abe61/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 cea40cb..b85ed95 100644
--- a/ambari-web/app/controllers/main/host.js
+++ b/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)) {

Reply via email to