Ver Fonte

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

Oleg Nechiporenko há 9 anos atrás
pai
commit
1c653d7abd

+ 3 - 0
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);

+ 4 - 2
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'))) {

+ 4 - 2
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
         }
       },
       {