ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject ambari git commit: AMBARI-8249. Usability: Configs Tab UI responsiveness issues (alexantonenko)
Date Tue, 11 Nov 2014 15:28:12 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk ba5bc737a -> 6c94df6b2


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/6c94df6b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6c94df6b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6c94df6b

Branch: refs/heads/trunk
Commit: 6c94df6b24251e8eb111096d81ab61ce3fd4f83e
Parents: ba5bc73
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Tue Nov 11 02:06:06 2014 +0200
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Tue Nov 11 17:16:10 2014 +0200

----------------------------------------------------------------------
 ambari-web/app/models/service_config.js         |  1 +
 .../common/configs/service_config_category.hbs  |  4 +-
 .../app/views/common/configs/services_config.js | 19 ++---
 .../common/configs/services_config_test.js      | 80 --------------------
 4 files changed, 13 insertions(+), 91 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6c94df6b/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/6c94df6b/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/6c94df6b/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..a822aa2 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,6 +363,7 @@ App.ServiceConfigsByCategoryView = Ember.View.extend(App.UserPref, {
         });
 
         if (!passesFilters) {
+          config.set('isHiddenByFilter', true);
           return false;
         }
 
@@ -376,13 +377,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 +402,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 +441,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 +851,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
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/6c94df6b/ambari-web/test/views/common/configs/services_config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/services_config_test.js b/ambari-web/test/views/common/configs/services_config_test.js
index c4b245d..f508ec9 100644
--- a/ambari-web/test/views/common/configs/services_config_test.js
+++ b/ambari-web/test/views/common/configs/services_config_test.js
@@ -161,86 +161,6 @@ describe('App.ServiceConfigsByCategoryView', function () {
     })
   });
 
-  describe('#updateReadOnlyFlags', function () {
-    it('if canEdit is true then isEditable flag of configs shouldn\'t be changed', function
() {
-      view.set('canEdit', true);
-      view.set('serviceConfigs', [
-        Em.Object.create({
-          name: 'config1',
-          isEditable: true
-        }),
-        Em.Object.create({
-          name: 'config2',
-          isEditable: false
-        })
-      ]);
-      view.updateReadOnlyFlags();
-      expect(view.get('serviceConfigs').findProperty('name', 'config1').get('isEditable')).to.equal(true);
-      expect(view.get('serviceConfigs').findProperty('name', 'config2').get('isEditable')).to.equal(false);
-    });
-    it('if canEdit is false then configs shouldn\'t be editable', function () {
-      view.set('canEdit', false);
-      view.set('serviceConfigs', [
-        Em.Object.create({
-          name: 'config1',
-          isEditable: true
-        }),
-        Em.Object.create({
-          name: 'config2',
-          isEditable: false
-        })
-      ]);
-      view.updateReadOnlyFlags();
-      expect(view.get('serviceConfigs').findProperty('name', 'config1').get('isEditable')).to.equal(false);
-      expect(view.get('serviceConfigs').findProperty('name', 'config2').get('isEditable')).to.equal(false);
-    });
-    it('if canEdit is false then config overrides shouldn\'t be editable', function () {
-      view.set('canEdit', false);
-      view.set('serviceConfigs', [
-        Em.Object.create({
-          name: 'config',
-          isEditable: true,
-          overrides: [
-            Em.Object.create({
-              name: 'override1',
-              isEditable: true
-            }),
-            Em.Object.create({
-              name: 'override2',
-              isEditable: false
-            })
-          ]
-        })
-      ]);
-      view.updateReadOnlyFlags();
-      var overrides = view.get('serviceConfigs').findProperty('name', 'config').get('overrides');
-      expect(overrides.findProperty('name', 'override1').get('isEditable')).to.equal(false);
-      expect(overrides.findProperty('name', 'override2').get('isEditable')).to.equal(false);
-    });
-    it('if canEdit is true then isEditable flag of overrides shouldn\'t be changed', function
() {
-      view.set('canEdit', true);
-      view.set('serviceConfigs', [
-        Em.Object.create({
-          name: 'config',
-          isEditable: true,
-          overrides: [
-            Em.Object.create({
-              name: 'override1',
-              isEditable: true
-            }),
-            Em.Object.create({
-              name: 'override2',
-              isEditable: false
-            })
-          ]
-        })
-      ]);
-      view.updateReadOnlyFlags();
-      var overrides = view.get('serviceConfigs').findProperty('name', 'config').get('overrides');
-      expect(overrides.findProperty('name', 'override1').get('isEditable')).to.equal(true);
-      expect(overrides.findProperty('name', 'override2').get('isEditable')).to.equal(false);
-    })
-  })
 });
 
 describe('App.ServiceConfigContainerView', function () {


Mime
View raw message