Browse Source

AMBARI-22929. Add service not prompting user to enter a mandatory field(database password)

Alex Antonenko 7 years ago
parent
commit
5430d488df

+ 1 - 3
ambari-web/app/models/configs/objects/service_config_property.js

@@ -364,9 +364,7 @@ App.ServiceConfigProperty = Em.Object.extend({
   cantBeUndone: Em.computed.existsIn('displayType', ["componentHost", "componentHosts", "radio button"]),
 
   validate: function () {
-    if (!this.get('isEditable')) {
-      this.set('errorMessage', ''); // do not perform validation for not editable configs
-    } else if ((typeof this.get('value') != 'object') && ((this.get('value') + '').length === 0)) {
+    if ((typeof this.get('value') != 'object') && ((this.get('value') + '').length === 0)) {
       var widgetType = this.get('widgetType');
       this.set('errorMessage', (this.get('isRequired') && (!['test-db-connection','label'].contains(widgetType))) ? Em.I18n.t('errorMessage.config.required') : '');
     } else {

+ 2 - 1
ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js

@@ -27,7 +27,6 @@ describe('App.ListConfigWidgetView', function () {
       initPopover: Em.K,
       movePopover: Em.K,
       config: Em.Object.create({
-        validate: App.ServiceConfigProperty.prototype.validate,
         name: 'a.b.c',
         savedValue: '2,1',
         value: '2,1',
@@ -70,6 +69,8 @@ describe('App.ListConfigWidgetView', function () {
       }),
       controller: App.MainServiceInfoConfigsController.create({})
     });
+    view.config.set('validate', App.ServiceConfigProperty.prototype.validate.bind(view.config));
+    view.config.set('validateErrors', App.ServiceConfigProperty.prototype.validateErrors.bind(view.config));
     view.willInsertElement();
     view.didInsertElement();