Pārlūkot izejas kodu

AMBARI-2085. UI allows user to set empty value for configs in Advanced category. (jaimin)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1479998 13f79535-47bb-0310-9956-ffa450edef68
Jaimin Jetly 12 gadi atpakaļ
vecāks
revīzija
01630d5e82

+ 3 - 0
CHANGES.txt

@@ -830,6 +830,9 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-2085. UI allows user to set empty value for configs in
+ Advanced category. (jaimin)
+
  AMBARI-2087. Tasks are not filtered by parent request id. (smohanty)
 
  AMBARI-2086. Agent on host with clients and DATANODE only seems to schedule 

+ 1 - 2
ambari-web/app/models/service_config.js

@@ -439,14 +439,13 @@ App.ServiceConfigProperty = Ember.Object.extend({
   }.property('displayType'),
 
   validate: function () {
-
     var value = this.get('value');
     var valueRange = this.get('valueRange');
     var values = [];//value split by "," to check UNIX users, groups list
 
     var isError = false;
 
-    if (typeof value === 'string' && value.trim().length === 0) {
+    if (typeof value === 'string' && value.length === 0) {
       if (this.get('isRequired')) {
         this.set('errorMessage', 'This is required');
         isError = true;

+ 3 - 3
ambari-web/app/utils/config.js

@@ -103,7 +103,7 @@ App.config = Em.Object.create({
     } else {
       config.category = 'Advanced';
       config.filename = isAdvanced && advancedConfigs.findProperty('name', config.name).filename;
-      config.isRequired = false;
+      config.isRequired = true;
     }
   },
   /**
@@ -227,7 +227,7 @@ App.config = Em.Object.create({
           isUserProperty: stored.isUserProperty === true,
           isOverridable: true,
           overrides: stored.overrides,
-          isRequired: !isAdvanced
+          isRequired: true
         };
         this.calculateConfigProperties(configData, isAdvanced, advancedConfigs);
       } else if (preDefined && !stored) {
@@ -272,7 +272,7 @@ App.config = Em.Object.create({
            * false; _config.value = ''; } else if
            * (/^\s+$/.test(_config.value)) { _config.isRequired = false; }
            */
-          _config.isRequired = false;
+          _config.isRequired = true;
           _config.isVisible = true;
           _config.displayType = 'advanced';
           serviceConfigs.push(_config);