ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rz...@apache.org
Subject ambari git commit: AMBARI-12968. Hosts page 'clear filters' link does not work (rzang)
Date Wed, 02 Sep 2015 23:09:27 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 0fde6a747 -> b838dcfb0


AMBARI-12968. Hosts page 'clear filters' link does not work (rzang)


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

Branch: refs/heads/trunk
Commit: b838dcfb0d43360e1a7116820bd12d7370922bd0
Parents: 0fde6a7
Author: Richard Zang <rzang@apache.org>
Authored: Wed Sep 2 11:38:12 2015 -0700
Committer: Richard Zang <rzang@apache.org>
Committed: Wed Sep 2 16:06:44 2015 -0700

----------------------------------------------------------------------
 ambari-web/app/views/common/table_view.js       |  2 +-
 .../app/views/main/alert_definitions_view.js    |  2 +-
 ambari-web/app/views/main/host.js               | 21 ++++++++++++++++++--
 .../views/main/alert_definitions_view_test.js   |  8 ++++----
 4 files changed, 25 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b838dcfb/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 12bf9f3..7c0a2b4 100644
--- a/ambari-web/app/views/common/table_view.js
+++ b/ambari-web/app/views/common/table_view.js
@@ -384,7 +384,7 @@ App.TableView = Em.View.extend(App.UserPref, {
     });
   },
 
-  clearFilterCondition: function() {
+  clearFilterConditionsFromLocalStorage: function() {
     var result = false;
     var currentFCs = App.db.getFilterConditions(this.get('controller.name'));
     if (currentFCs != null) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/b838dcfb/ambari-web/app/views/main/alert_definitions_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/alert_definitions_view.js b/ambari-web/app/views/main/alert_definitions_view.js
index 189f71d..803fa63 100644
--- a/ambari-web/app/views/main/alert_definitions_view.js
+++ b/ambari-web/app/views/main/alert_definitions_view.js
@@ -38,7 +38,7 @@ App.MainAlertDefinitionsView = App.TableView.extend({
 
   willInsertElement: function () {
     if (!this.get('controller.showFilterConditionsFirstLoad')) {
-      this.clearFilterCondition();
+      this.clearFilterConditionsFromLocalStorage();
     }
     this._super();
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/b838dcfb/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 f63870f..7ff4c69 100644
--- a/ambari-web/app/views/main/host.js
+++ b/ambari-web/app/views/main/host.js
@@ -181,7 +181,7 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, {
    */
   willInsertElement: function () {
     if (!this.get('controller.showFilterConditionsFirstLoad')) {
-      var didClearedSomething = this.clearFilterCondition();
+      var didClearedSomething = this.clearFilterConditionsFromLocalStorage();
       this.set('controller.filterChangeHappened', didClearedSomething);
     }
     this._super();
@@ -1174,5 +1174,22 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, {
    */
   colPropAssoc: function () {
     return this.get('controller.colPropAssoc');
-  }.property('controller.colPropAssoc')
+  }.property('controller.colPropAssoc'),
+
+  /**
+   * Run <code>clearFilter</code> in the each child filterView
+   */
+  clearFilters: function() {
+    // clean filters stored in-memory and local storage
+    this.set('filterConditions', []);
+    this.clearFilterConditionsFromLocalStorage();
+    // clean UI
+    this.get('_childViews').forEach(function(childView) {
+      if (childView['clearFilter']) {
+        childView.clearFilter();
+      }
+    });
+    // force refresh
+    this.refresh();
+  }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/b838dcfb/ambari-web/test/views/main/alert_definitions_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/alert_definitions_view_test.js b/ambari-web/test/views/main/alert_definitions_view_test.js
index 0e8773c..c817e88 100644
--- a/ambari-web/test/views/main/alert_definitions_view_test.js
+++ b/ambari-web/test/views/main/alert_definitions_view_test.js
@@ -40,23 +40,23 @@ describe('App.MainAlertDefinitionsView', function () {
   describe('#willInsertElement', function () {
 
     beforeEach(function(){
-      sinon.stub(view, 'clearFilterCondition', Em.K);
+      sinon.stub(view, 'clearFilterConditionsFromLocalStorage', Em.K);
     });
 
     afterEach(function(){
-      view.clearFilterCondition.restore();
+      view.clearFilterConditionsFromLocalStorage.restore();
     });
 
     it('should call clearFilterCondition if controller.showFilterConditionsFirstLoad is false',
function () {
       view.set('controller', {showFilterConditionsFirstLoad: false, content: []});
       view.willInsertElement();
-      expect(view.clearFilterCondition.calledOnce).to.be.true;
+      expect(view.clearFilterConditionsFromLocalStorage.calledOnce).to.be.true;
     });
 
     it('should not call clearFilterCondition if controller.showFilterConditionsFirstLoad
is true', function () {
       view.set('controller', {showFilterConditionsFirstLoad: true, content: []});
       view.willInsertElement();
-      expect(view.clearFilterCondition.calledOnce).to.be.false;
+      expect(view.clearFilterConditionsFromLocalStorage.calledOnce).to.be.false;
     });
   });
 


Mime
View raw message