Repository: ambari
Updated Branches:
  refs/heads/trunk 8aeaf468e -> 4c1dfce22


AMBARI-17877. Some configs with empty value shown on "Customize Service" page 
are not saved in the configuration type (onechiporenko)


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

Branch: refs/heads/trunk
Commit: 4c1dfce223c71a1bdd3842df76595a17ad08345e
Parents: 8aeaf46
Author: Oleg Nechiporenko <onechipore...@apache.org>
Authored: Mon Jul 25 12:59:14 2016 +0300
Committer: Oleg Nechiporenko <onechipore...@apache.org>
Committed: Mon Jul 25 12:59:14 2016 +0300

----------------------------------------------------------------------
 .../app/mappers/configs/stack_config_properties_mapper.js      | 3 +++
 .../app/mixins/common/configs/config_recommendation_parser.js  | 6 ++++--
 .../mixins/common/configs/config_recommendation_parser_test.js | 6 ++++--
 3 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4c1dfce2/ambari-web/app/mappers/configs/stack_config_properties_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/configs/stack_config_properties_mapper.js 
b/ambari-web/app/mappers/configs/stack_config_properties_mapper.js
index 2c8959d..9eda557 100644
--- a/ambari-web/app/mappers/configs/stack_config_properties_mapper.js
+++ b/ambari-web/app/mappers/configs/stack_config_properties_mapper.js
@@ -141,6 +141,9 @@ App.stackConfigPropertiesMapper = 
App.QuickDataMapper.create({
           }
 
           var staticConfigInfo = this.parseIt(config, 
this.get('configToPlain'));
+          if (Em.isNone(staticConfigInfo.value)) {
+            staticConfigInfo.isVisible = false;
+          }
           var v = Em.isNone(staticConfigInfo.recommendedValue) ? 
staticConfigInfo.recommendedValue : staticConfigInfo.value;
           staticConfigInfo.value = staticConfigInfo.recommendedValue = 
App.config.formatPropertyValue(staticConfigInfo, v);
           staticConfigInfo.isSecureConfig = 
App.config.getIsSecure(staticConfigInfo.name);

http://git-wip-us.apache.org/repos/asf/ambari/blob/4c1dfce2/ambari-web/app/mixins/common/configs/config_recommendation_parser.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/app/mixins/common/configs/config_recommendation_parser.js 
b/ambari-web/app/mixins/common/configs/config_recommendation_parser.js
index ec5358b..582c083 100644
--- a/ambari-web/app/mixins/common/configs/config_recommendation_parser.js
+++ b/ambari-web/app/mixins/common/configs/config_recommendation_parser.js
@@ -17,7 +17,6 @@
  */
 
 var App = require('app');
-var validator = require('utils/validator');
 
 App.ConfigRecommendationParser = Em.Mixin.create(App.ConfigRecommendations, {
 
@@ -81,7 +80,7 @@ App.ConfigRecommendationParser = 
Em.Mixin.create(App.ConfigRecommendations, {
             for (var attr in propertyAttributes) {
               if (attr === 'delete' && 
this.allowUpdateProperty(parentProperties, name, fileName)) {
                 propertiesToDelete.push(config);
-              } else if ((attr === 'visible') || stackProperty) {
+              } else if (attr === 'visible' || stackProperty) {
                 /** update config boundaries **/
                 updateBoundariesCallback(stackProperty, attr, 
propertyAttributes[attr], name, fileName, configGroup);
               }
@@ -161,6 +160,9 @@ App.ConfigRecommendationParser = 
Em.Mixin.create(App.ConfigRecommendations, {
         errorMessage: '',
         warnMessage: ''
       });
+      if (!Em.isNone(recommendedValue)) {
+        Em.set(config, 'isVisible', true);
+      }
       this.applyRecommendation(Em.get(config, 'name'), Em.get(config, 
'filename'), Em.get(config, 'group.name'), recommendedValue, 
this._getInitialValue(config), parentProperties);
     }
     if (this.updateInitialOnRecommendations(Em.get(config, 'serviceName'))) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/4c1dfce2/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js 
b/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js
index c5ccdb9..f08bbad 100644
--- a/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js
+++ b/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js
@@ -196,7 +196,8 @@ describe('App.ConfigRecommendationParser', function() {
           'value': 'recommendedValue',
           'initialValue': 'recommendedValue',
           'errorMessage': '',
-          'warnMessage': ''
+          'warnMessage': '',
+          'isVisible': true
         }
       },
       {
@@ -208,7 +209,8 @@ describe('App.ConfigRecommendationParser', function() {
           'value': 'recommendedValue',
           'initialValue': null,
           'errorMessage': '',
-          'warnMessage': ''
+          'warnMessage': '',
+          'isVisible': true
         }
       },
       {

Reply via email to