You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2014/11/10 17:10:13 UTC

ambari git commit: AMBARI-8249. Usability: Configs Tab UI responsiveness issues (alexantonenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk f088f55e4 -> ae0d82574


AMBARI-8249. Usability: Configs Tab UI responsiveness issues (alexantonenko)


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

Branch: refs/heads/trunk
Commit: ae0d8257440f7399f457ebbf71e03f1198296727
Parents: f088f55
Author: Alex Antonenko <hi...@gmail.com>
Authored: Mon Nov 10 16:33:10 2014 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Mon Nov 10 18:09:39 2014 +0200

----------------------------------------------------------------------
 ambari-web/app/models/service_config.js         |  1 +
 .../common/configs/service_config_category.hbs  |  4 ++--
 .../app/views/common/configs/services_config.js | 20 ++++++++++----------
 3 files changed, 13 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ae0d8257/ambari-web/app/models/service_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service_config.js b/ambari-web/app/models/service_config.js
index a3ffc3e..300c2c6 100644
--- a/ambari-web/app/models/service_config.js
+++ b/ambari-web/app/models/service_config.js
@@ -194,6 +194,7 @@ App.ServiceConfigProperty = Ember.Object.extend({
   serviceValidator: null,
   isNotSaved: false, // user property was added but not saved
   hasInitialValue: false, //if true then property value is defined and saved to server
+  isHiddenByFilter: false, //if true then hide this property (filtered out)
   /**
    * Usage example see on <code>App.ServiceConfigRadioButtons.handleDBConnectionProperty()</code>
    *

http://git-wip-us.apache.org/repos/asf/ambari/blob/ae0d8257/ambari-web/app/templates/common/configs/service_config_category.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/service_config_category.hbs b/ambari-web/app/templates/common/configs/service_config_category.hbs
index a03c9af..1ad4384 100644
--- a/ambari-web/app/templates/common/configs/service_config_category.hbs
+++ b/ambari-web/app/templates/common/configs/service_config_category.hbs
@@ -25,8 +25,8 @@
   <div class="accordion-inner service-config-section">
     <form class="form-horizontal" autocomplete="off">
 
-      {{#each view.filteredCategoryConfigs}}
-        <div {{bindAttr class=":entry-row isOverridden:overridden-property hasCompareDiffs:overridden-property"}}>
+      {{#each view.categoryConfigs}}
+        <div {{bindAttr class=":entry-row isHiddenByFilter:hide isOverridden:overridden-property hasCompareDiffs:overridden-property"}}>
           {{#if showLabel}}
             <span {{bindAttr class="errorMessage:error: :control-group :control-label-span"}}>
               <label class="control-label">

http://git-wip-us.apache.org/repos/asf/ambari/blob/ae0d8257/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 23bb6e8..dd16117 100644
--- a/ambari-web/app/views/common/configs/services_config.js
+++ b/ambari-web/app/views/common/configs/services_config.js
@@ -350,10 +350,10 @@ App.ServiceConfigsByCategoryView = Ember.View.extend(App.UserPref, {
     $('.popover').remove();
     var filter = this.get('parentView.filter').toLowerCase();
     var selectedFilters = this.get('parentView.columns').filterProperty('selected');
-    var filteredResult = this.get('categoryConfigs')
+    var filteredResult = this.get('categoryConfigs');
 
     if (selectedFilters.length > 0 || filter.length > 0 || this.get('state') === 'inDOM') {
-      filteredResult = filteredResult.filter(function (config) {
+      filteredResult.forEach(function (config) {
         var passesFilters = true;
 
         selectedFilters.forEach(function (filter) {
@@ -363,7 +363,7 @@ App.ServiceConfigsByCategoryView = Ember.View.extend(App.UserPref, {
         });
 
         if (!passesFilters) {
-          return false;
+          config.set('isHiddenByFilter', true);
         }
 
         var searchString = config.get('defaultValue') + config.get('description') +
@@ -376,13 +376,14 @@ App.ServiceConfigsByCategoryView = Ember.View.extend(App.UserPref, {
         }
 
         if (filter != null && typeof searchString === "string") {
-          return searchString.toLowerCase().indexOf(filter) > -1;
+          config.set('isHiddenByFilter', !(searchString.toLowerCase().indexOf(filter) > -1));
         } else {
-          return true;
+          config.set('isHiddenByFilter', false);
         }
       });
     }
     filteredResult = this.sortByIndex(filteredResult);
+    filteredResult = filteredResult.filterProperty('isHiddenByFilter', false);
 
     if (filter && filteredResult.length ) {
       if (typeof this.get('category.collapsedByDefault') === 'undefined') {
@@ -400,8 +401,7 @@ App.ServiceConfigsByCategoryView = Ember.View.extend(App.UserPref, {
 
     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').cacheable(),
+  }.observes('categoryConfigs', 'parentView.filter', 'parentView.columns.@each.selected'),
 
   /**
    * sort configs in current category by index
@@ -440,8 +440,8 @@ App.ServiceConfigsByCategoryView = Ember.View.extend(App.UserPref, {
    * Should we show config group or not
    */
   isShowBlock: function () {
-    return this.get('category.customCanAddProperty') || this.get('filteredCategoryConfigs').length > 0;
-  }.property('category.customCanAddProperty', 'filteredCategoryConfigs.length'),
+    return this.get('category.customCanAddProperty') || this.get('categoryConfigs').filterProperty('isHiddenByFilter', false).length > 0;
+  }.property('category.customCanAddProperty', 'categoryConfigs.@each.isHiddenByFilter'),
 
   didInsertElement: function () {
     var isCollapsed = this.get('category.isCollapsed') == undefined ? (this.get('category.name').indexOf('Advanced') != -1 || this.get('category.name').indexOf('CapacityScheduler') != -1) : this.get('category.isCollapsed');
@@ -850,4 +850,4 @@ App.ServiceConfigTab = Ember.View.extend({
     var serviceName = this.get('controller.selectedService.serviceName');
     this.$('a[href="#' + serviceName + '"]').tab('show');
   }
-});
\ No newline at end of file
+});