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-8633 Dashboard > Config History tab does a "double load". (atkach)
Date Wed, 10 Dec 2014 15:44:43 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk cd38a54d6 -> c1482f820


AMBARI-8633 Dashboard > Config History tab does a "double load". (atkach)


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

Branch: refs/heads/trunk
Commit: c1482f8202d9c02879e566b7885174cc331d4c47
Parents: cd38a54
Author: Andrii Tkach <atkach@hortonworks.com>
Authored: Wed Dec 10 16:11:57 2014 +0200
Committer: Andrii Tkach <atkach@hortonworks.com>
Committed: Wed Dec 10 17:44:22 2014 +0200

----------------------------------------------------------------------
 .../views/main/dashboard/config_history_view.js |  9 ++++++
 .../main/dashboard/config_history_view_test.js  | 29 ++++++++++++++++++++
 2 files changed, 38 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c1482f82/ambari-web/app/views/main/dashboard/config_history_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/config_history_view.js b/ambari-web/app/views/main/dashboard/config_history_view.js
index 36877e7..354cae0 100644
--- a/ambari-web/app/views/main/dashboard/config_history_view.js
+++ b/ambari-web/app/views/main/dashboard/config_history_view.js
@@ -25,6 +25,7 @@ App.MainConfigHistoryView = App.TableView.extend(App.TableServerViewMixin,
{
 
   controllerBinding: 'App.router.mainConfigHistoryController',
   filteringComplete: false,
+  isInitialRendering: true,
 
   /**
    * return filtered number of all content number information displayed on the page footer
bar
@@ -37,6 +38,7 @@ App.MainConfigHistoryView = App.TableView.extend(App.TableServerViewMixin,
{
   didInsertElement: function () {
     this.addObserver('startIndex', this, 'updatePagination');
     this.addObserver('displayLength', this, 'updatePagination');
+    this.set('isInitialRendering', true);
     this.refresh();
     this.set('controller.isPolling', true);
     this.get('controller').doPolling();
@@ -50,6 +52,12 @@ App.MainConfigHistoryView = App.TableView.extend(App.TableServerViewMixin,
{
     clearTimeout(this.get('controller.timeoutRef'));
   },
 
+  updateFilter: function (iColumn, value, type) {
+    if (!this.get('isInitialRendering')) {
+      this._super(iColumn, value, type);
+    }
+  },
+
   sortView: sort.serverWrapperView,
   versionSort: sort.fieldView.extend({
     column: 1,
@@ -178,6 +186,7 @@ App.MainConfigHistoryView = App.TableView.extend(App.TableServerViewMixin,
{
     var self = this;
     this.set('filteringComplete', false);
     this.get('controller').load().done(function () {
+      self.set('isInitialRendering', false);
       self.set('filteringComplete', true);
       self.propertyDidChange('pageContent');
       self.set('controller.resetStartIndex', false);

http://git-wip-us.apache.org/repos/asf/ambari/blob/c1482f82/ambari-web/test/views/main/dashboard/config_history_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/config_history_view_test.js b/ambari-web/test/views/main/dashboard/config_history_view_test.js
index f4cb6bc..379bba7 100644
--- a/ambari-web/test/views/main/dashboard/config_history_view_test.js
+++ b/ambari-web/test/views/main/dashboard/config_history_view_test.js
@@ -47,6 +47,7 @@ describe('App.MainConfigHistoryView', function() {
 
       view.didInsertElement();
       expect(view.addObserver.calledTwice).to.be.true;
+      expect(view.get('isInitialRendering')).to.be.true;
       expect(view.get('controller.isPolling')).to.be.true;
       expect(view.get('controller').doPolling.calledOnce).to.be.true;
 
@@ -55,6 +56,34 @@ describe('App.MainConfigHistoryView', function() {
     });
   });
 
+  describe('#updateFilter()', function () {
+    var cases = [
+      {
+        isInitialRendering: false,
+        updateFilterCalled: true,
+        title: 'updateFilter should be called'
+      },
+      {
+        isInitialRendering: true,
+        updateFilterCalled: false,
+        title: 'updateFilter should not be called'
+      }
+    ];
+    beforeEach(function () {
+      sinon.stub(view, 'saveFilterConditions', Em.K);
+    });
+    afterEach(function () {
+      view.saveFilterConditions.restore();
+    });
+    cases.forEach(function (item) {
+      it(item.title, function () {
+        view.set('isInitialRendering', item.isInitialRendering);
+        view.updateFilter(1, 'value', 'string');
+        expect(view.get('saveFilterConditions').calledWith(1, 'value', 'string')).to.equal(item.updateFilterCalled);
+      });
+    });
+  });
+
   describe('#willDestroyElement()', function() {
     it('', function() {
       view.willDestroyElement();


Mime
View raw message