You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2014/07/01 20:26:51 UTC

git commit: AMBARI-6340. Hosts page. Incorrect total number of hosts after filtering by installed component. (akovalenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk 6b52b54b1 -> c477ba061


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

Branch: refs/heads/trunk
Commit: c477ba061d6ce9599c70ebb1b399cbef3d6f430a
Parents: 6b52b54
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Tue Jul 1 21:21:46 2014 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Tue Jul 1 21:25:45 2014 +0300

----------------------------------------------------------------------
 ambari-web/app/utils/db.js        | 22 +++++++++++++++++++++-
 ambari-web/app/views/main/host.js |  6 ++++--
 2 files changed, 25 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c477ba06/ambari-web/app/utils/db.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/db.js b/ambari-web/app/utils/db.js
index ffa149c..d994393 100644
--- a/ambari-web/app/utils/db.js
+++ b/ambari-web/app/utils/db.js
@@ -26,7 +26,8 @@ var InitialData =  {
       'filterConditions': {},
       'displayLength': {},
       'startIndex': {},
-      'sortingConditions': {}
+      'sortingConditions': {},
+      'selectedItems': {}
     }
   },
 
@@ -208,6 +209,16 @@ App.db.setSortingStatuses = function(name, sortingConditions) {
   localStorage.setObject('ambari', App.db.data);
 };
 
+App.db.setSelectedHosts = function(name, selectedHosts) {
+  console.log('TRACE: Entering db:setSelectedHosts function');
+  App.db.data = localStorage.getObject('ambari');
+  if (!App.db.data.app.tables.selectedItems) {
+    App.db.data.app.tables.selectedItems = {};
+  }
+  App.db.data.app.tables.selectedItems[name] = selectedHosts;
+  localStorage.setObject('ambari', App.db.data);
+};
+
 App.db.setAllHostNames = function (hostNames) {
   console.log('TRACE: Entering db:setAllHostNames function');
   App.db.data = localStorage.getObject('ambari');
@@ -584,6 +595,15 @@ App.db.getSortingStatuses = function(name) {
   return null;
 };
 
+App.db.getSelectedHosts = function(name) {
+  console.log('TRACE: Entering db:getSelectedHosts function');
+  App.db.data = localStorage.getObject('ambari');
+  if (App.db.data.app.tables.selectedItems[name]) {
+    return App.db.data.app.tables.selectedItems[name];
+  }
+  return [];
+};
+
 /**
  * Return current step for specified Wizard Type
  * @param wizardType

http://git-wip-us.apache.org/repos/asf/ambari/blob/c477ba06/ambari-web/app/views/main/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host.js b/ambari-web/app/views/main/host.js
index 8de4434..987ddb1 100644
--- a/ambari-web/app/views/main/host.js
+++ b/ambari-web/app/views/main/host.js
@@ -52,7 +52,8 @@ App.MainHostView = App.TableView.extend(App.TableServerProvider, {
    * @type {Array}
    */
   content: function () {
-    var selectedHosts = this.getSelectedFilter();
+    var controllerName = this.get('controller.name');
+    var selectedHosts = App.db.getSelectedHosts(controllerName);
     if (this.get('controller')) {
       return this.get('controller.content').filter(function (host) {
         host.set('selected', selectedHosts.contains(host.get('hostName')));
@@ -276,7 +277,8 @@ App.MainHostView = App.TableView.extend(App.TableServerProvider, {
     }
     this.combineSelectedFilter();
     //10 is an index of selected column
-    this.saveFilterConditions(10, this.get('selectedHosts'), 'multiple', true);
+    var controllerName = this.get('controller.name');
+    App.db.setSelectedHosts(controllerName, this.get('selectedHosts'));
 
     this.addObserver('selectAllHosts', this, this.toggleAllHosts);
   },