ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject git commit: AMBARI-6290. Hosts page paging: visiting Host Detail page and back causes unpredictable behavior. (akovalenko)
Date Thu, 26 Jun 2014 18:49:36 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-1.6.1 3d81a6a45 -> 4bc10a43e


AMBARI-6290. Hosts page paging: visiting Host Detail page and back causes unpredictable behavior.
(akovalenko)


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

Branch: refs/heads/branch-1.6.1
Commit: 4bc10a43e9331b32935018dd676b966902f61a89
Parents: 3d81a6a
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Thu Jun 26 21:49:25 2014 +0300
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Thu Jun 26 21:49:25 2014 +0300

----------------------------------------------------------------------
 ambari-web/app/mappers/hosts_mapper.js    |  5 +++-
 ambari-web/app/views/common/sort_view.js  |  3 +-
 ambari-web/app/views/common/table_view.js | 38 ++++++--------------------
 ambari-web/app/views/main/host.js         |  5 ++++
 4 files changed, 18 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4bc10a43/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 cadf519..bb9474f 100644
--- a/ambari-web/app/mappers/hosts_mapper.js
+++ b/ambari-web/app/mappers/hosts_mapper.js
@@ -103,7 +103,10 @@ App.hostsMapper = App.QuickDataMapper.create({
       });
       App.store.loadMany(App.HostComponent, components);
       App.store.loadMany(App.Host, hostsWithFullInfo);
-      App.router.set('mainHostController.filteredCount', parseInt(json.itemTotal));
+      var itemTotal = parseInt(json.itemTotal);
+      if (itemTotal) {
+        App.router.set('mainHostController.filteredCount', itemTotal);
+      }
     }
     console.timeEnd('App.hostsMapper execution time');
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4bc10a43/ambari-web/app/views/common/sort_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/sort_view.js b/ambari-web/app/views/common/sort_view.js
index 53b529a..9fb63b2 100644
--- a/ambari-web/app/views/common/sort_view.js
+++ b/ambari-web/app/views/common/sort_view.js
@@ -62,7 +62,6 @@ var wrapperView = Em.View.extend({
         }
       });
     }
-    this.get('parentView').showProperPage();
   }.observes('parentView.filteringComplete'),
 
   /**
@@ -282,4 +281,4 @@ module.exports = {
   serverWrapperView: serverWrapperView,
   wrapperView: wrapperView,
   fieldView: fieldView
-};
\ No newline at end of file
+};

http://git-wip-us.apache.org/repos/asf/ambari/blob/4bc10a43/ambari-web/app/views/common/table_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/table_view.js b/ambari-web/app/views/common/table_view.js
index 82943be..8f7f6ad 100644
--- a/ambari-web/app/views/common/table_view.js
+++ b/ambari-web/app/views/common/table_view.js
@@ -41,12 +41,6 @@ App.TableView = Em.View.extend(App.UserPref, {
   tableFilteringComplete: false,
 
   /**
-   * Loaded from local storage startIndex value
-   * @type {Number}
-   */
-  startIndexOnLoad: null,
-
-  /**
    * The number of rows to show on every page
    * The value should be a number converted into string type in order to support select element
API
    * Example: "10", "25"
@@ -74,8 +68,9 @@ App.TableView = Em.View.extend(App.UserPref, {
   willInsertElement:function () {
     var self = this;
     var name = this.get('controller.name');
-
-    this.set('startIndexOnLoad', App.db.getStartIndex(name));
+    if (App.db.getStartIndex(name)) {
+      this.set('startIndex', App.db.getStartIndex(name));
+    }
     if (!this.get('displayLength')) {
       if (App.db.getDisplayLength(name)) {
         this.set('displayLength', App.db.getDisplayLength(name));
@@ -148,21 +143,6 @@ App.TableView = Em.View.extend(App.UserPref, {
   },
 
   /**
-   * Do pagination after filtering and sorting
-   * Don't call this method! It's already used where it's need
-   */
-  showProperPage: function() {
-    var self = this;
-    Em.run.next(function() {
-      Em.run.next(function() {
-        if(self.get('startIndexOnLoad')) {
-          self.set('startIndex', self.get('startIndexOnLoad'));
-        }
-      });
-    });
-  },
-
-  /**
    * Return pagination information displayed on the page
    * @type {String}
    */
@@ -179,7 +159,7 @@ App.TableView = Em.View.extend(App.UserPref, {
         return "paginate_previous";
       }
       return "paginate_disabled_previous";
-    }.property("parentView.startIndex", 'filteredCount'),
+    }.property("parentView.startIndex", 'parentView.filteredCount'),
 
     click: function () {
       if (this.get('class') === "paginate_previous") {
@@ -197,7 +177,7 @@ App.TableView = Em.View.extend(App.UserPref, {
         return "paginate_next";
       }
       return "paginate_disabled_next";
-    }.property("parentView.endIndex", 'filteredCount'),
+    }.property("parentView.endIndex", 'parentView.filteredCount'),
 
     click: function () {
       if (this.get('class') === "paginate_next") {
@@ -215,7 +195,7 @@ App.TableView = Em.View.extend(App.UserPref, {
         return "paginate_previous";
       }
       return "paginate_disabled_previous";
-    }.property("parentView.endIndex", 'filteredCount'),
+    }.property("parentView.endIndex", 'parentView.filteredCount'),
 
     click: function () {
       if (this.get('class') === "paginate_previous") {
@@ -233,7 +213,7 @@ App.TableView = Em.View.extend(App.UserPref, {
         return "paginate_next";
       }
       return "paginate_disabled_next";
-    }.property("parentView.endIndex", 'filteredCount'),
+    }.property("parentView.endIndex", 'parentView.filteredCount'),
 
     click: function () {
       if (this.get('class') === "paginate_next") {
@@ -362,9 +342,7 @@ App.TableView = Em.View.extend(App.UserPref, {
   },
 
   saveStartIndex: function() {
-    if (this.get('filteringComplete')) {
-      App.db.setStartIndex(this.get('controller.name'), this.get('startIndex'));
-    }
+    App.db.setStartIndex(this.get('controller.name'), this.get('startIndex'));
   }.observes('startIndex'),
 
   clearFilterCondition: function() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/4bc10a43/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 0076087..78ed0cf 100644
--- a/ambari-web/app/views/main/host.js
+++ b/ambari-web/app/views/main/host.js
@@ -84,6 +84,11 @@ App.MainHostView = App.TableView.extend(App.TableServerProvider, {
   }.property('filteredCount', 'startIndex', 'endIndex'),
 
   /**
+   * Stub function
+   */
+  updatePaging: function () {},
+
+  /**
    * flag to toggle displaying selected hosts counter
    */
   showSelectedFilter: function () {


Mime
View raw message