ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject ambari git commit: AMBARI-12212 When visiting Hosts page, UI makes two duplicated calls (performance issue). (atkach)
Date Tue, 30 Jun 2015 14:24:37 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 6d3633c44 -> 83f1b62a1


AMBARI-12212 When visiting Hosts page, UI makes two duplicated calls (performance issue).
(atkach)


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

Branch: refs/heads/trunk
Commit: 83f1b62a120a42fd86aff61a0dabea4aa9b6f9d3
Parents: 6d3633c
Author: Andrii Tkach <atkach@hortonworks.com>
Authored: Tue Jun 30 17:23:49 2015 +0300
Committer: Andrii Tkach <atkach@hortonworks.com>
Committed: Tue Jun 30 17:23:49 2015 +0300

----------------------------------------------------------------------
 .../app/mixins/common/table_server_mixin.js     |  5 -----
 ambari-web/app/views/common/table_view.js       |  2 +-
 ambari-web/app/views/main/host.js               | 12 ++---------
 ambari-web/test/views/main/host_test.js         | 22 --------------------
 4 files changed, 3 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/83f1b62a/ambari-web/app/mixins/common/table_server_mixin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/table_server_mixin.js b/ambari-web/app/mixins/common/table_server_mixin.js
index 5162a02..84e9ce3 100644
--- a/ambari-web/app/mixins/common/table_server_mixin.js
+++ b/ambari-web/app/mixins/common/table_server_mixin.js
@@ -59,11 +59,6 @@ App.TableServerMixin = Em.Mixin.create({
    * @return {array}
    */
   getPaginationProps: function () {
-    var displayLength = App.db.getDisplayLength(this.get('name'));
-    if (displayLength) {
-      this.get('paginationProps').findProperty('name', 'displayLength').value = displayLength;
-    }
-
     var startIndex = App.db.getStartIndex(this.get('name'));
     if (!Em.isNone(startIndex)) {
       startIndex = (startIndex > 0) ? startIndex - 1 : startIndex;

http://git-wip-us.apache.org/repos/asf/ambari/blob/83f1b62a/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 5c51daf..8a64c5c 100644
--- a/ambari-web/app/views/common/table_view.js
+++ b/ambari-web/app/views/common/table_view.js
@@ -81,8 +81,8 @@ App.TableView = Em.View.extend(App.UserPref, {
     var name = this.get('controller.name');
     if (!this.get('displayLength')) {
       if (App.db.getDisplayLength(name)) {
+        self.set('displayLength', App.db.getDisplayLength(name));
         Em.run.next(function () {
-          self.set('displayLength', App.db.getDisplayLength(name));
           self.initFilters();
         });
       } else {

http://git-wip-us.apache.org/repos/asf/ambari/blob/83f1b62a/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 bfd668d..df2f65f 100644
--- a/ambari-web/app/views/main/host.js
+++ b/ambari-web/app/views/main/host.js
@@ -155,11 +155,7 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, {
     change: function () {
       this.get('parentView').saveDisplayLength();
       var self = this;
-      if (this.get('parentView.startIndex') === 1 || this.get('parentView.startIndex') ===
0) {
-        Ember.run.next(function () {
-          self.get('parentView').updatePagination();
-        });
-      } else {
+      if (this.get('parentView.startIndex') !== 1 && this.get('parentView.startIndex')
!== 0) {
         Ember.run.next(function () {
           self.set('parentView.startIndex', 1);
         });
@@ -203,16 +199,12 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, {
     this.clearFiltersObs();
     this.addObserver('selectAllHosts', this, this.toggleAllHosts);
     this.addObserver('filteringComplete', this, this.overlayObserver);
-    this.addObserver('startIndex', this, 'updateHostsPagination');
+    this.addObserver('startIndex', this, 'updatePagination');
     this.addObserver('displayLength', this, 'updatePagination');
     this.addObserver('filteredCount', this, this.updatePaging);
     this.overlayObserver();
   },
 
-  updateHostsPagination: function () {
-    this.updatePagination();
-  },
-
   willDestroyElement: function () {
     $('.tooltip').remove();
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/83f1b62a/ambari-web/test/views/main/host_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/host_test.js b/ambari-web/test/views/main/host_test.js
index 4f9766a..a63caca 100644
--- a/ambari-web/test/views/main/host_test.js
+++ b/ambari-web/test/views/main/host_test.js
@@ -49,11 +49,6 @@ describe('App.MainHostView', function () {
           callCount: 2
         },
         {
-          methodName: 'updateHostsPagination',
-          propertyToChange: 'startIndex',
-          callCount: 1
-        },
-        {
           methodName: 'updatePagination',
           propertyToChange: 'displayLength',
           callCount: 1
@@ -88,23 +83,6 @@ describe('App.MainHostView', function () {
 
   });
 
-  describe('#updateHostsPagination', function () {
-
-    beforeEach(function () {
-      sinon.stub(view, 'updatePagination', Em.K);
-    });
-
-    afterEach(function () {
-      view.updatePagination.restore();
-    });
-
-    it('should execute updatePagination', function () {
-      view.updateHostsPagination();
-      expect(view.updatePagination.calledOnce).to.be.true;
-    });
-
-  });
-
   describe('#HostView', function () {
 
     var hostView;


Mime
View raw message