You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2016/11/04 15:42:05 UTC

ambari git commit: AMBARI-18790. Implement lazy loading for Service configs Advanced tab. Additional patch. (akovalenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk 1cba2f95c -> e6444733d


AMBARI-18790. Implement lazy loading for Service configs Advanced tab. Additional patch. (akovalenko)


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

Branch: refs/heads/trunk
Commit: e6444733d11d18761f30003110dec8886654d279
Parents: 1cba2f9
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Fri Nov 4 17:32:21 2016 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Fri Nov 4 17:32:21 2016 +0200

----------------------------------------------------------------------
 .../configs/service_configs_by_category_view.js    | 17 +++++++++++++----
 .../notification_configs_view_test.js              |  8 +++-----
 2 files changed, 16 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e6444733/ambari-web/app/views/common/configs/service_configs_by_category_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/service_configs_by_category_view.js b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
index baf7852..8ebe68c 100644
--- a/ambari-web/app/views/common/configs/service_configs_by_category_view.js
+++ b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
@@ -64,6 +64,15 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
    */
   categoryConfigs: [],
 
+  /**
+   * Link to main configs view
+   * @type {Ember.View}
+   */
+  mainView: function () {
+    //todo: Get rid of this logic. Get data from controller instead.
+    return this.get('controller.name') === 'mainServiceInfoConfigsController' ? this.get('parentView.parentView') : this.get('parentView');
+  }.property('controller.name'),
+
   didInsertElement: function () {
     var self = this;
     // If `this.categoryConfigsAll` is a computed property then don't set it.
@@ -171,9 +180,9 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
     var hasFilteredAdvancedConfigs = this.get('categoryConfigs').filter(function (config) {
         return config.get('isHiddenByFilter') === false && Em.isNone(config.get('widget'));
       }, this).length > 0;
-    return (isCustomPropertiesCategory && this.get('controller.filter') === '' && !this.get('parentView.parentView.columns').someProperty('selected')) ||
+    return (isCustomPropertiesCategory && this.get('controller.filter') === '' && !this.get('mainView.columns').someProperty('selected')) ||
       hasFilteredAdvancedConfigs;
-  }.property('category.customCanAddProperty', 'categoryConfigs.@each.isHiddenByFilter', 'categoryConfigs.@each.widget', 'controller.filter', 'parentView.parentView.columns.@each.selected'),
+  }.property('category.customCanAddProperty', 'categoryConfigs.@each.isHiddenByFilter', 'categoryConfigs.@each.widget', 'controller.filter', 'mainView.columns.@each.selected'),
 
   /**
    * Re-order the configs to list content displayType properties at last in the category
@@ -317,7 +326,7 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
   collapseCategory: function () {
     if (this.get('state') === 'destroyed') return;
     $('.popover').remove();
-    var filter = this.get('parentView.parentView.filter').toLowerCase();
+    var filter = this.get('mainView.filter').toLowerCase();
     var filteredResult = this.get('categoryConfigs');
     var isInitialRendering = !arguments.length || arguments[1] != 'categoryConfigs';
 
@@ -640,7 +649,7 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
           var controller = (App.router.get('currentState.name') == 'configs')
               ? App.router.get('mainServiceInfoConfigsController')
               : App.router.get('wizardStep7Controller');
-          this.get('parentView.parentView').onClose();
+          this.get('mainView').onClose();
           controller.set('filter', event.view.get('serviceConfigObj.name'));
         }
       })

http://git-wip-us.apache.org/repos/asf/ambari/blob/e6444733/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js b/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
index 681d346..46be186 100644
--- a/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
+++ b/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
@@ -31,11 +31,9 @@ function getView() {
     serviceConfigs: [],
     categoryConfigs: [],
     categoryConfigsAll: [],
-    parentView: Em.View.create({
-      parentView: Em.View.create({
-        filter: '',
-        columns: []
-      })
+    mainView: Em.View.create({
+      filter: '',
+      columns: []
     })
   });
 }