ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject git commit: AMBARI-6337. Hosts page. Incorrect total number of hosts after filtering by installed component. (akovalenko)
Date Tue, 01 Jul 2014 17:34:04 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 7110b855b -> bb883731c


AMBARI-6337. Hosts page. Incorrect total number of hosts after filtering by installed component.
(akovalenko)


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

Branch: refs/heads/trunk
Commit: bb883731cc9d271b7b642dcbde42a1fa9983dd44
Parents: 7110b85
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Tue Jul 1 20:32:23 2014 +0300
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Tue Jul 1 20:32:23 2014 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/global/update_controller.js | 8 +++++++-
 ambari-web/app/controllers/main/host.js                | 4 ++++
 ambari-web/app/mappers/hosts_mapper.js                 | 7 ++++++-
 3 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bb883731/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 44e86cb..97012c5 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -226,8 +226,14 @@ 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;
 
+    var itemTotal = parseInt(data.itemTotal);
+    if (!isNaN(itemTotal) && itemTotal!==undefined && itemTotal!==null) {
+      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/bb883731/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 8753a36..a0d30b8 100644
--- a/ambari-web/app/controllers/main/host.js
+++ b/ambari-web/app/controllers/main/host.js
@@ -27,6 +27,10 @@ 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/bb883731/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 e65d406..90a8b5d 100644
--- a/ambari-web/app/mappers/hosts_mapper.js
+++ b/ambari-web/app/mappers/hosts_mapper.js
@@ -107,9 +107,14 @@ 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 (!isNaN(itemTotal) && itemTotal!==undefined && itemTotal!==null)
{
+      if (setFilteredCount && !isNaN(itemTotal) && itemTotal!==undefined
&& itemTotal!==null) {
         App.router.set('mainHostController.filteredCount', itemTotal);
+      } else {
+        App.router.set('mainHostController.setFilteredCount', true);
       }
     }
     console.timeEnd('App.hostsMapper execution time');


Mime
View raw message