You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2016/02/01 16:41:48 UTC

[11/39] ambari git commit: AMBARI-14828. Config History table does not update data after clear filters (onechiporenko)

AMBARI-14828. Config History table does not update data after clear filters (onechiporenko)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: d057581b5b6930c988fe805b799258a9fb5a9744
Parents: 7371c1b
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Thu Jan 28 15:05:11 2016 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Thu Jan 28 15:05:11 2016 +0200

----------------------------------------------------------------------
 ambari-web/app/views/common/table_view.js         | 18 ++++++++++++++++--
 .../views/main/dashboard/config_history_view.js   | 12 ++++++++++++
 2 files changed, 28 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d057581b/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 2ac9649..386a2aa 100644
--- a/ambari-web/app/views/common/table_view.js
+++ b/ambari-web/app/views/common/table_view.js
@@ -359,9 +359,23 @@ App.TableView = Em.View.extend(App.UserPref, {
       };
       this.get('filterConditions').push(filterCondition);
     }
+
+    this.saveAllFilterConditions();
+  },
+
+  /**
+   * Save not empty <code>filterConditions</code> to the localStorage
+   *
+   * @method saveAllFilterConditions
+   */
+  saveAllFilterConditions: function () {
+    var filterConditions = this.get('filterConditions');
     // remove empty entries
-    this.set('filterConditions', this.get('filterConditions').filter(function(item){ return !Em.isEmpty(item.value); }));
-    App.db.setFilterConditions(this.get('controller.name'), this.get('filterConditions'));
+    filterConditions = filterConditions.filter(function(item) {
+      return !Em.isEmpty(item.value);
+    });
+    this.set('filterConditions', filterConditions);
+    App.db.setFilterConditions(this.get('controller.name'), filterConditions);
   },
 
   saveDisplayLength: function() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/d057581b/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 88f9025..3bfb22b 100644
--- a/ambari-web/app/views/main/dashboard/config_history_view.js
+++ b/ambari-web/app/views/main/dashboard/config_history_view.js
@@ -208,6 +208,18 @@ App.MainConfigHistoryView = App.TableView.extend(App.TableServerViewMixin, {
   },
 
   /**
+   * Clear all filter values, update filter conditions in the localStorage and update table data with API-request
+   *
+   * @method clearFilters
+   * @override
+   */
+  clearFilters: function () {
+    this._super();
+    this.saveAllFilterConditions();
+    this.refresh();
+  },
+
+  /**
    * callback executed after refresh call done
    * @method refreshDone
    */