AMBARI-19084. Custom property added to the Notification settings appears twice (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b2d2ef16 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b2d2ef16 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b2d2ef16 Branch: refs/heads/branch-dev-patch-upgrade Commit: b2d2ef1689d5434c20d6a791ace598f58742605a Parents: f5051dc Author: Oleg Nechiporenko <[email protected]> Authored: Mon Dec 5 17:08:41 2016 +0200 Committer: Oleg Nechiporenko <[email protected]> Committed: Mon Dec 5 18:05:42 2016 +0200 ---------------------------------------------------------------------- .../common/configs/notifications_configs.hbs | 2 +- .../notification_configs_view.js | 18 ++++++++++++++---- .../configs/service_configs_by_category_view.js | 9 ++++++++- 3 files changed, 23 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/b2d2ef16/ambari-web/app/templates/common/configs/notifications_configs.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/common/configs/notifications_configs.hbs b/ambari-web/app/templates/common/configs/notifications_configs.hbs index ca2c208..2dd71aa 100644 --- a/ambari-web/app/templates/common/configs/notifications_configs.hbs +++ b/ambari-web/app/templates/common/configs/notifications_configs.hbs @@ -20,7 +20,7 @@ <div class="panel-heading" {{action "onToggleBlock" category target="view"}}> <h3 class="panel-title"> <i {{bindAttr class=":pull-left :panel-toggle view.category.isCollapsed:icon-caret-right:icon-caret-down"}}></i> - <a class="panel-toggle">{{view.category.displayName}}</a> + <a class="panel-toggle category-header"><span class="category-name">{{view.category.displayName}}</span></a> </h3> </div> http://git-wip-us.apache.org/repos/asf/ambari/blob/b2d2ef16/ambari-web/app/views/common/configs/custom_category_views/notification_configs_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/configs/custom_category_views/notification_configs_view.js b/ambari-web/app/views/common/configs/custom_category_views/notification_configs_view.js index 9ad8762..d299b5f 100644 --- a/ambari-web/app/views/common/configs/custom_category_views/notification_configs_view.js +++ b/ambari-web/app/views/common/configs/custom_category_views/notification_configs_view.js @@ -62,8 +62,8 @@ App.NotificationsConfigsView = App.ServiceConfigsByCategoryView.extend({ if (!this.get('categoryConfigsAll.length')) return; this.set('createNotification', this.get('categoryConfigsAll').findProperty('name', 'create_notification').get('value')); this.set('tlsOrSsl', this.get('categoryConfigsAll').findProperty('name', 'mail.smtp.starttls.enable').get('value') ? 'tls' : 'ssl'); - var smtp_use_auth = this.get('categoryConfigsAll').findProperty('name', 'smtp_use_auth'); - smtp_use_auth.set('value', Boolean(smtp_use_auth.get('value') === 'true')); + var smtpUseAuth = this.get('categoryConfigsAll').findProperty('name', 'smtp_use_auth'); + smtpUseAuth.set('value', Boolean(smtpUseAuth.get('value') === 'true')); this.updateCategoryConfigs(); }, @@ -74,8 +74,8 @@ App.NotificationsConfigsView = App.ServiceConfigsByCategoryView.extend({ */ onTlsOrSslChanged: function () { var tlsOrSsl = this.get('tlsOrSsl'); - this.get('categoryConfigsAll').findProperty('name', 'mail.smtp.starttls.enable').set('value', tlsOrSsl == 'tls'); - this.get('categoryConfigsAll').findProperty('name', 'mail.smtp.startssl.enable').set('value', tlsOrSsl == 'ssl'); + this.get('categoryConfigsAll').findProperty('name', 'mail.smtp.starttls.enable').set('value', tlsOrSsl === 'tls'); + this.get('categoryConfigsAll').findProperty('name', 'mail.smtp.startssl.enable').set('value', tlsOrSsl === 'ssl'); }.observes('tlsOrSsl'), /** @@ -122,6 +122,16 @@ App.NotificationsConfigsView = App.ServiceConfigsByCategoryView.extend({ updateConfig: function (config, flag) { config.set('isRequired', flag); config.set('isEditable', flag); + }, + + /** + * No sense to store config to <code>serviceConfigs</code> and <code>categoryConfigsAll</code> because + * <code>categoryConfigsAll</code> is a subset of <code>serviceConfigs</code> + * + * @override + */ + _appendConfigToCollection: function (serviceConfigProperty) { + this.get('serviceConfigs').pushObject(serviceConfigProperty); } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/b2d2ef16/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 dfcd5df..16258cf 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 @@ -439,7 +439,14 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri isNotSaved: true }, selectedConfigGroup); } - var serviceConfigProperty = App.ServiceConfigProperty.create(config); + this._appendConfigToCollection(App.ServiceConfigProperty.create(config)); + }, + + /** + * @param {App.ServiceConfigProperty} serviceConfigProperty + * @private + */ + _appendConfigToCollection: function (serviceConfigProperty) { this.get('serviceConfigs').pushObject(serviceConfigProperty); this.get('categoryConfigsAll').pushObject(serviceConfigProperty); },
