ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject [2/4] ambari git commit: AMBARI-18790. Implement lazy loading for Service configs Advanced tab. Additional patch. (akovalenko)
Date Mon, 23 Jan 2017 20:32:14 GMT
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/bb9859db
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bb9859db
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bb9859db

Branch: refs/heads/branch-2.5
Commit: bb9859db533be467e4845f743f3c8755f29dedb9
Parents: 4005200
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Mon Jan 23 22:26:40 2017 +0200
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Mon Jan 23 22:26:40 2017 +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/bb9859db/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 d52b3e1..d7c1f4d 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.
@@ -175,9 +184,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
@@ -320,7 +329,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');
+    var filter = this.get('mainView.filter');
     filter = filter? filter.toLowerCase() : filter; // filter can be undefined in some wizard
     var filteredResult = this.get('categoryConfigs');
     var isInitialRendering = !arguments.length || arguments[1] != 'categoryConfigs';
@@ -643,7 +652,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/bb9859db/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: []
     })
   });
 }


Mime
View raw message