You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by xi...@apache.org on 2014/07/18 01:21:25 UTC

git commit: AMBARI-6494. When filtering on a prop, if the prop is in adv, custom, etc, we should expand section.(Levgen Gorbachev via xiwang)

Repository: ambari
Updated Branches:
  refs/heads/trunk d90c8eed8 -> a09565cff


AMBARI-6494. When filtering on a prop, if the prop is in adv, custom, etc, we should expand section.(Levgen Gorbachev via xiwang)


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

Branch: refs/heads/trunk
Commit: a09565cffaa552540f801e1e5af49dd4e630369a
Parents: d90c8ee
Author: Xi Wang <xi...@apache.org>
Authored: Thu Jul 17 16:18:22 2014 -0700
Committer: Xi Wang <xi...@apache.org>
Committed: Thu Jul 17 16:20:09 2014 -0700

----------------------------------------------------------------------
 .../app/views/common/configs/services_config.js    | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a09565cf/ambari-web/app/views/common/configs/services_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/services_config.js b/ambari-web/app/views/common/configs/services_config.js
index ca07473..61b6e85 100644
--- a/ambari-web/app/views/common/configs/services_config.js
+++ b/ambari-web/app/views/common/configs/services_config.js
@@ -360,7 +360,22 @@ App.ServiceConfigsByCategoryView = Ember.View.extend({
      }
     });
     filteredResult = this.sortByIndex(filteredResult);
-    var categoryBlock = $('.' + this.get('category.name') + '>.accordion-body');
+
+    if (filter && filteredResult.length ) {
+      if (typeof this.get('category.collapsedByDefault') === 'undefined') {
+        // Save state
+        this.set('category.collapsedByDefault', this.get('category.isCollapsed'));
+      }
+      this.set('category.isCollapsed', false);
+    } else if (filter && !filteredResult.length) {
+      this.set('category.isCollapsed', true);
+    } else if (!filter && typeof this.get('category.collapsedByDefault') !== 'undefined') {
+      // If user clear filter -- restore defaults
+      this.set('category.isCollapsed', this.get('category.collapsedByDefault'));
+      this.set('category.collapsedByDefault', undefined);
+    }
+
+    var categoryBlock = $('.' + this.get('category.name').split(' ').join('.') + '>.accordion-body');
     filteredResult.length && !this.get('category.isCollapsed') ? categoryBlock.show() : categoryBlock.hide();
     return filteredResult;
   }.property('categoryConfigs', 'parentView.filter', 'parentView.columns.@each.selected'),