Repository: ambari Updated Branches: refs/heads/trunk e04dc67a6 -> 9a85b8b7c
AMBARI-6355 cause host page hang with range filter. (atkach) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9a85b8b7 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9a85b8b7 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9a85b8b7 Branch: refs/heads/trunk Commit: 9a85b8b7c9f98c303e20f7ebbd5bc778acd2b072 Parents: e04dc67 Author: atkach <[email protected]> Authored: Wed Jul 2 18:41:28 2014 +0300 Committer: atkach <[email protected]> Committed: Wed Jul 2 18:41:28 2014 +0300 ---------------------------------------------------------------------- .../app/controllers/global/update_controller.js | 17 +++++++++++++---- ambari-web/app/controllers/main/host.js | 4 ---- ambari-web/app/mappers/hosts_mapper.js | 7 +------ 3 files changed, 14 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/9a85b8b7/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 97012c5..f157fae 100644 --- a/ambari-web/app/controllers/global/update_controller.js +++ b/ambari-web/app/controllers/global/update_controller.js @@ -168,7 +168,11 @@ App.UpdateController = Em.Controller.extend({ this.get('queryParams').set('Hosts', App.router.get('mainHostController').getQueryParameters()); var clientCallback = function (skipCall, queryParams) { if (skipCall) { - App.hostsMapper.map({items: []}); + //no hosts match filter by component + App.hostsMapper.map({ + items: [], + itemTotal: '0' + }); callback(); } else { var hostsUrl = self.getComplexUrl(testUrl, realUrl, queryParams); @@ -226,14 +230,19 @@ App.UpdateController = Em.Controller.extend({ var preLoadKeys = this.get('hostsPreLoadKeys'); var queryParams = this.get('queryParams.Hosts'); var hostNames = data.items.mapProperty('Hosts.host_name'); + var skipCall = hostNames.length === 0; + + /** + * exclude pagination parameters as they were applied in previous call + * to obtain hostnames of filtered hosts + */ + preLoadKeys.pushObjects(['page_size', 'from']); var itemTotal = parseInt(data.itemTotal); - if (!isNaN(itemTotal) && itemTotal!==undefined && itemTotal!==null) { + if (!isNaN(itemTotal)) { App.router.set('mainHostController.filteredCount', itemTotal); - App.router.set('mainHostController.setFilteredCount', false); } - var skipCall = hostNames.length === 0; if (skipCall) { params.callback(skipCall); } else { http://git-wip-us.apache.org/repos/asf/ambari/blob/9a85b8b7/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 01e2fd1..793f715 100644 --- a/ambari-web/app/controllers/main/host.js +++ b/ambari-web/app/controllers/main/host.js @@ -27,10 +27,6 @@ App.MainHostController = Em.ArrayController.extend({ clearFilters: null, filteredCount: 0, - - // either set <code>filteredCount</code> property in hosts mapper, or it will be set in <code>getHostByHostComponentsSuccessCallback</code> - setFilteredCount: true, - resetStartIndex: false, /** * flag responsible for updating status counters of hosts http://git-wip-us.apache.org/repos/asf/ambari/blob/9a85b8b7/ambari-web/app/mappers/hosts_mapper.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mappers/hosts_mapper.js b/ambari-web/app/mappers/hosts_mapper.js index 90a8b5d..3b6ac5e 100644 --- a/ambari-web/app/mappers/hosts_mapper.js +++ b/ambari-web/app/mappers/hosts_mapper.js @@ -107,14 +107,9 @@ App.hostsMapper = App.QuickDataMapper.create({ App.store.commit(); App.store.loadMany(App.HostComponent, components); App.store.loadMany(App.Host, hostsWithFullInfo); - - // check if <code>mainHostController.filteredCount</code> is already set in <code>getHostByHostComponentsSuccessCallback</code> - var setFilteredCount = App.router.get('mainHostController.setFilteredCount'); var itemTotal = parseInt(json.itemTotal); - if (setFilteredCount && !isNaN(itemTotal) && itemTotal!==undefined && itemTotal!==null) { + if (!isNaN(itemTotal)) { App.router.set('mainHostController.filteredCount', itemTotal); - } else { - App.router.set('mainHostController.setFilteredCount', true); } } console.timeEnd('App.hostsMapper execution time');
