You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2016/10/21 19:48:16 UTC

ambari git commit: AMBARI-18617. Adding custom property to hive-site adds it to other 'Custom' panels on hive. (jaimin)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 a36a78f41 -> e570a39fb


AMBARI-18617. Adding custom property to hive-site adds it to other 'Custom' panels on hive. (jaimin)


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

Branch: refs/heads/branch-2.4
Commit: e570a39fb31d09967a525bbdea59daf85d328f87
Parents: a36a78f
Author: Jaimin Jetly <ja...@hortonworks.com>
Authored: Fri Oct 21 12:47:50 2016 -0700
Committer: Jaimin Jetly <ja...@hortonworks.com>
Committed: Fri Oct 21 12:47:50 2016 -0700

----------------------------------------------------------------------
 .../configs/service_configs_by_category_view.js | 24 ++++++++++++--------
 .../notification_configs_view_test.js           | 14 ++++++++----
 .../service_configs_by_category_view_test.js    |  2 +-
 3 files changed, 26 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e570a39f/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 0874872..bdcc382 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
@@ -48,13 +48,6 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
   serviceConfigs: null,
 
   /**
-   * Configs for current category filtered by <code>isVisible</code>
-   * and sorted by <code>displayType</code> and <code>index</code>
-   * @type {App.ServiceConfigProperty[]}
-   */
-  categoryConfigs: [],
-
-  /**
    * This is array of all the properties which apply
    * to this category, irrespective of visibility. This
    * is helpful in Oozie/Hive database configuration, where
@@ -64,9 +57,20 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
    */
   categoryConfigsAll: [],
 
+  /**
+   * Configs for current category filtered by <code>isVisible</code>
+   * and sorted by <code>displayType</code> and <code>index</code>
+   * @type {App.ServiceConfigProperty[]}
+   */
+  categoryConfigs: [],
+
   didInsertElement: function () {
     var self = this;
-    this.setCategoryConfigs();
+    // If `this.categoryConfigsAll` is a computed property then don't set it.
+    // some extended class like `App.NotificationsConfigsView` overrides `categoryConfigsAll` as computed property
+    if ($.isArray(this.categoryConfigsAll)) {
+      this.setCategoryConfigsAll();
+    }
     this.setVisibleCategoryConfigs();
     var isCollapsed = this.calcIsCollapsed();
     this.set('category.isCollapsed', isCollapsed);
@@ -94,7 +98,9 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
     Em.run.once(this, 'addConfigToCategoryConfigs');
   }.observes('categoryConfigsAll.@each.isVisible'),
 
-  setCategoryConfigs: function () {
+  setCategoryConfigsAll: function () {
+    // reset `categoryConfigsAll` to empty array
+    this.set('categoryConfigsAll', []);
     var categoryConfigsAll = this.get('serviceConfigs').filterProperty('category', this.get('category.name'));
     if (categoryConfigsAll && categoryConfigsAll.length) {
       this.set('categoryConfigsAll',categoryConfigsAll);

http://git-wip-us.apache.org/repos/asf/ambari/blob/e570a39f/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 8f03434..b970c89 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
@@ -70,20 +70,26 @@ describe('App.NotificationsConfigsView', function () {
       var configs = [
         Em.Object.create({
           name: "create_notification",
-          value: 'yes'
+          value: 'yes',
+          filename: "alert_notification"
         }),
         Em.Object.create({
           name: 'mail.smtp.starttls.enable',
-          value: false
+          value: false,
+          filename: "alert_notification"
         }),
         Em.Object.create({
           name: 'smtp_use_auth',
-          value: 'true'
+          value: 'true',
+          filename: "alert_notification"
         })
       ];
 
       beforeEach(function () {
-        view.set('categoryConfigsAll', configs);
+        view.set('serviceConfigs', configs);
+        view.reopen({
+          categoryConfigsAll: Em.computed.filterBy('serviceConfigs', 'filename', 'alert_notification')
+        });
         view.didInsertElement();
       });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/e570a39f/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js b/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js
index 9b49653..5c91220 100644
--- a/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js
+++ b/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js
@@ -312,7 +312,7 @@ describe('App.ServiceConfigsByCategoryView', function () {
           filteredCategoryConfigs: Em.K,
           collapseCategory: Em.K
         });
-        view.setCategoryConfigs();
+        view.setCategoryConfigsAll();
         view.setVisibleCategoryConfigs();
         expect(view.get('categoryConfigs').mapProperty('resultId')).to.deep.equal(result);
         view.destroy();