ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject git commit: AMBARI-6355 cause host page hang with range filter. (atkach)
Date Wed, 02 Jul 2014 15:45:12 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-1.6.1 543470f84 -> 14ad9558e


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

Branch: refs/heads/branch-1.6.1
Commit: 14ad9558ea5b4d213dc5c5fff3f328b5a74f79ef
Parents: 543470f
Author: atkach <atkach@hortonworks.com>
Authored: Wed Jul 2 18:31:37 2014 +0300
Committer: atkach <atkach@hortonworks.com>
Committed: Wed Jul 2 18:31:37 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/14ad9558/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/14ad9558/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 dcafcae..1c270e2 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/14ad9558/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');


Mime
View raw message