You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2016/12/27 16:00:34 UTC

ambari git commit: AMBARI-19299 Wrong number of filtered hosts.(atkach)

Repository: ambari
Updated Branches:
  refs/heads/trunk 85738c17a -> f36cf27b1


AMBARI-19299 Wrong number of filtered hosts.(atkach)


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

Branch: refs/heads/trunk
Commit: f36cf27b12c1c30b613fa99be04e0fcca9b461e0
Parents: 85738c1
Author: Andrii Tkach <at...@apache.org>
Authored: Tue Dec 27 13:00:02 2016 +0200
Committer: Andrii Tkach <at...@apache.org>
Committed: Tue Dec 27 18:00:06 2016 +0200

----------------------------------------------------------------------
 .../app/controllers/global/update_controller.js | 18 +++++++++---------
 ambari-web/app/controllers/main/host.js         | 20 +++++++++++++-------
 ambari-web/app/utils/http_client.js             |  6 +++++-
 3 files changed, 27 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f36cf27b/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 a3aee37..75b4a00 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -265,7 +265,7 @@ App.UpdateController = Em.Controller.extend({
       realUrl += loggingResource;
     }
 
-    var clientCallback = function (skipCall, queryParams) {
+    var clientCallback = function (skipCall, queryParams, itemTotal) {
       var completeCallback = function () {
         callback();
         if (loadMetricsSeparately) {
@@ -289,6 +289,11 @@ App.UpdateController = Em.Controller.extend({
 
         App.HttpClient.get(realUrl, App.hostsMapper, {
           complete: completeCallback,
+          beforeMap: function(response) {
+            if (itemTotal) {
+              response.itemTotal = itemTotal;
+            }
+          },
           doGetAsPost: true,
           params: self.computeParameters(queryParams),
           error: error
@@ -397,17 +402,12 @@ App.UpdateController = Em.Controller.extend({
     if (skipCall) {
       params.callback(skipCall);
     } else {
-      // get all non-hostcomponent related keys
-      queryParams = queryParams.filter(function (param) {
-        return !param.isComponentRelatedFilter;
-      });
-      // force specific hosts
-      queryParams.push({
+      queryParams = [{
         key: 'Hosts/host_name',
         value: hostNames,
         type: 'MULTIPLE'
-      });
-      params.callback(skipCall, queryParams);
+      }];
+      params.callback(skipCall, queryParams, itemTotal);
     }
   },
   getHostByHostComponentsErrorCallback: Em.K,

http://git-wip-us.apache.org/repos/asf/ambari/blob/f36cf27b/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 b85ed95..336bd25 100644
--- a/ambari-web/app/controllers/main/host.js
+++ b/ambari-web/app/controllers/main/host.js
@@ -105,17 +105,20 @@ App.MainHostController = Em.ArrayController.extend(App.TableServerMixin, {
     {
       name: 'hostComponents',
       key: 'host_components/HostRoles/component_name',
-      type: 'EQUAL'
+      type: 'EQUAL',
+      isComponentRelatedFilter: true
     },
     {
       name: 'services',
       key: 'host_components/HostRoles/service_name',
-      type: 'MATCH'
+      type: 'MATCH',
+      isComponentRelatedFilter: true
     },
     {
       name: 'state',
       key: 'host_components/HostRoles/state',
-      type: 'MATCH'
+      type: 'MATCH',
+      isComponentRelatedFilter: true
     },
     {
       name: 'healthClass',
@@ -130,12 +133,14 @@ App.MainHostController = Em.ArrayController.extend(App.TableServerMixin, {
     {
       name: 'componentsWithStaleConfigsCount',
       key: 'host_components/HostRoles/stale_configs',
-      type: 'EQUAL'
+      type: 'EQUAL',
+      isComponentRelatedFilter: true
     },
     {
       name: 'componentsInPassiveStateCount',
       key: 'host_components/HostRoles/maintenance_state',
-      type: 'MULTIPLE'
+      type: 'MULTIPLE',
+      isComponentRelatedFilter: true
     },
     {
       name: 'selected',
@@ -165,7 +170,8 @@ App.MainHostController = Em.ArrayController.extend(App.TableServerMixin, {
         '(host_components/HostRoles/component_name={0}&host_components/HostRoles/desired_admin_state={1})',
         '(host_components/HostRoles/component_name={0}&host_components/HostRoles/maintenance_state={1})'
       ],
-      type: 'COMBO'
+      type: 'COMBO',
+      isComponentRelatedFilter: true
     }
   ],
 
@@ -259,7 +265,7 @@ App.MainHostController = Em.ArrayController.extend(App.TableServerMixin, {
           value: filter.value,
           type: property.type,
           isFilter: true,
-          isComponentRelatedFilter: ([13,15].indexOf(filter.iColumn) != -1)
+          isComponentRelatedFilter: property.isComponentRelatedFilter
         };
         if (filter.type === 'string' && sortProperties.someProperty('name', colPropAssoc[filter.iColumn])) {
           if (Em.isArray(filter.value)) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/f36cf27b/ambari-web/app/utils/http_client.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/http_client.js b/ambari-web/app/utils/http_client.js
index dbfc640..9b8346c 100644
--- a/ambari-web/app/utils/http_client.js
+++ b/ambari-web/app/utils/http_client.js
@@ -90,7 +90,11 @@ App.HttpClient = Em.Object.create({
           } catch (err) {
             console.warn('App.store.commit error:', err);
           }
-          mapper.map($.parseJSON(xhr.responseText));
+          var response = $.parseJSON(xhr.responseText);
+          if (tmp_val.beforeMap) {
+            tmp_val.beforeMap.call(self, response);
+          }
+          mapper.map(response);
           tmp_val.complete.call(self);
           xhr.abort();
         } else {