Bläddra i källkod

AMBARI-7147 Save button after adding new config property is disabled. (atkach)

atkach 10 år sedan
förälder
incheckning
7343cb2a8c

+ 1 - 0
ambari-web/app/controllers/main/service/info/configs.js

@@ -891,6 +891,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
       componentConfig.configs.pushObject(serviceConfigProperty);
       serviceConfigProperty.validate();
     }, this);
+    componentConfig.set('initConfigsLength', componentConfig.get('configs.length'));
   },
 
   /**

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

@@ -27,6 +27,7 @@ App.ServiceConfig = Ember.Object.extend({
   restartRequiredMessage: '',
   restartRequiredHostsAndComponents: {},
   configGroups: [],
+  initConfigsLength: 0, // configs length after initialization in order to watch changes
   errorCount: function () {
     var overrideErrors = 0;
     this.get('configs').filterProperty("overrides").forEach(function (e) {
@@ -48,8 +49,11 @@ App.ServiceConfig = Ember.Object.extend({
   }.property('configs.@each.isValid', 'configs.@each.isVisible', 'configCategories.@each.slaveErrorCount', 'configs.@each.overrideErrorTrigger'),
 
   isPropertiesChanged: function() {
-    return this.get('configs').someProperty('isNotDefaultValue') || this.get('configs').someProperty('isOverrideChanged');
-  }.property('configs.@each.isNotDefaultValue', 'configs.@each.isOverrideChanged')
+    return this.get('configs').someProperty('isNotDefaultValue') ||
+           this.get('configs').someProperty('isOverrideChanged') ||
+           this.get('configs.length') !== this.get('initConfigsLength') ||
+           (this.get('configs.length') === this.get('initConfigsLength') && this.get('configs').someProperty('defaultValue', null));
+  }.property('configs.@each.isNotDefaultValue', 'configs.@each.isOverrideChanged', 'configs.length')
 });
 
 App.ServiceConfigCategory = Ember.Object.extend({