Repository: ambari
Updated Branches:
  refs/heads/trunk 54435dbb2 -> c2c0bc0f9


AMBARI-21885 Config group filter in Dashboard page shows 'All' even if you 
choose a config group. (atkach)


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

Branch: refs/heads/trunk
Commit: c2c0bc0f9f7c738d12fa863502d4771c1705f057
Parents: 54435db
Author: Andrii Tkach <atk...@apache.org>
Authored: Fri Sep 15 13:05:26 2017 +0300
Committer: Andrii Tkach <atk...@apache.org>
Committed: Fri Sep 15 13:05:26 2017 +0300

----------------------------------------------------------------------
 .../views/main/dashboard/config_history_view.js | 25 ++++++++++++++------
 .../main/dashboard/config_history_view_test.js  |  1 +
 2 files changed, 19 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c2c0bc0f/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 4afd73b..2808de3 100644
--- a/ambari-web/app/views/main/dashboard/config_history_view.js
+++ b/ambari-web/app/views/main/dashboard/config_history_view.js
@@ -130,13 +130,24 @@ App.MainConfigHistoryView = 
App.TableView.extend(App.TableServerViewMixin, {
   configGroupFilterView: filters.createSelectView({
     column: 2,
     fieldType: 'filter-input-width',
-    content: function () {
-      return [
-        {value: '', label: Em.I18n.t('common.all') }
-      
].concat(App.ServiceConfigVersion.find().mapProperty('groupName').uniq().compact().map(item
 => {
-        return { value: item, label: item }
-      }));
-    }.property('parentView.isInitialRendering', 'controller.content.[]'),
+    content: [],
+    observeContent: function() {
+      var groupName = 
App.ServiceConfigVersion.find().mapProperty('groupName').uniq().compact();
+      // list of group names can only grow since config versions not removable
+      if (groupName.length >= this.get('content.length')) {
+        this.set('content', [
+          {
+            value: '',
+            label: Em.I18n.t('common.all')
+          }
+        ].concat(groupName.map(function (item) {
+            return {
+              value: item,
+              label: item
+            }
+          })));
+      }
+    }.observes('parentView.isInitialRendering', 'parentView.pageContent'),
     onChangeValue: function () {
       this.get('parentView').updateFilter(this.get('column'), 
this.get('value'), 'select');
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c2c0bc0f/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 979aefc..da9ce31 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
@@ -112,6 +112,7 @@ describe('App.MainConfigHistoryView', function() {
       App.ServiceConfigVersion.find.restore();
     });
     it("content", function () {
+      subView.observeContent();
       expect(subView.get('content')).to.eql([
         {
           value: '',

Reply via email to