Forráskód Böngészése

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

Oleg Nechiporenko 9 éve
szülő
commit
d057581b5b

+ 16 - 2
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() {

+ 12 - 0
ambari-web/app/views/main/dashboard/config_history_view.js

@@ -207,6 +207,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