ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject ambari git commit: AMBARI-19299 Wrong number of filtered hosts.(atkach)
Date Thu, 20 Apr 2017 14:41:42 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 3f4323ac0 -> 54c09d44e


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/54c09d44
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/54c09d44
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/54c09d44

Branch: refs/heads/branch-2.4
Commit: 54c09d44ebb655a62ba2ba1c25e75b8c46c9cd9c
Parents: 3f4323a
Author: Andrii Tkach <atkach@apache.org>
Authored: Thu Apr 20 17:41:06 2017 +0300
Committer: Andrii Tkach <atkach@apache.org>
Committed: Thu Apr 20 17:41:06 2017 +0300

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


http://git-wip-us.apache.org/repos/asf/ambari/blob/54c09d44/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 4631f09..c54e669 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -266,7 +266,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) {
@@ -290,6 +290,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
@@ -398,17 +403,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: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/54c09d44/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/54c09d44/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 6b94d81..7a9f51a 100644
--- a/ambari-web/app/utils/http_client.js
+++ b/ambari-web/app/utils/http_client.js
@@ -109,7 +109,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 {

http://git-wip-us.apache.org/repos/asf/ambari/blob/54c09d44/ambari-web/test/controllers/global/errors_handler_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/global/errors_handler_controller_test.js b/ambari-web/test/controllers/global/errors_handler_controller_test.js
index b255dcc..c9159df 100644
--- a/ambari-web/test/controllers/global/errors_handler_controller_test.js
+++ b/ambari-web/test/controllers/global/errors_handler_controller_test.js
@@ -48,6 +48,7 @@ describe('App.ErrorsHandlerController', function () {
 
     beforeEach(function() {
       sinon.stub(controller, 'postUserPref');
+      localStorage.removeItem('errors');
     });
 
     afterEach(function() {


Mime
View raw message