Browse Source

AMBARI-7129 Save for non-default config group disabled. (atkach)

atkach 11 năm trước cách đây
mục cha
commit
ca2106fd9c

+ 4 - 3
ambari-web/app/controllers/main/service/info/configs.js

@@ -107,11 +107,11 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
   savedSiteNameToServerServiceConfigDataMap: {},
 
   isSubmitDisabled: function () {
-    return (!(this.stepConfigs.everyProperty('errorCount', 0)) || this.get('isApplyingChanges'));
+    return (!(this.get('stepConfigs').everyProperty('errorCount', 0)) || this.get('isApplyingChanges'));
   }.property('stepConfigs.@each.errorCount', 'isApplyingChanges'),
 
   isPropertiesChanged: function(){
-    return this.stepConfigs.someProperty('isPropertiesChanged', true)
+    return this.get('stepConfigs').someProperty('isPropertiesChanged', true);
   }.property('stepConfigs.@each.isPropertiesChanged'),
 
   slaveComponentGroups: null,
@@ -1033,7 +1033,8 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
         serviceConfigProperty.set('overrides', parentOverridesArray);
       }
       parentOverridesArray.pushObject(newSCP);
-      console.debug("createOverrideProperty(): Added:", newSCP, " to main-property:", serviceConfigProperty)
+      serviceConfigProperty.set('overrideValues', parentOverridesArray.mapProperty('value'));
+      console.debug("createOverrideProperty(): Added override to main-property:", serviceConfigProperty.get('name'));
     }, this);
   },
 

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

@@ -48,8 +48,8 @@ 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', true);
-  }.property('configs.@each.isNotDefaultValue')
+    return this.get('configs').someProperty('isNotDefaultValue') || this.get('configs').someProperty('isOverrideChanged');
+  }.property('configs.@each.isNotDefaultValue', 'configs.@each.isOverrideChanged')
 });
 
 App.ServiceConfigCategory = Ember.Object.extend({
@@ -172,6 +172,7 @@ App.ServiceConfigProperty = Ember.Object.extend({
   parentSCP: null, // This is the main SCP which is overridden by this. Set only when isOriginalSCP is false.
   selectedHostOptions : null, // contain array of hosts configured with overridden value
   overrides : null,
+  overrideValues: [],
   group: null, // Contain group related to this property. Set only when isOriginalSCP is false.
   isUserProperty: null, // This property was added by user. Hence they get removal actions etc.
   isOverridable: true,
@@ -216,6 +217,10 @@ App.ServiceConfigProperty = Ember.Object.extend({
     var overrides = this.get('overrides');
     return (overrides != null && overrides.get('length')>0) || !this.get('isOriginalSCP');
   }.property('overrides', 'overrides.length', 'isOriginalSCP'),
+  isOverrideChanged: function () {
+    if (Em.isNone(this.get('overrides')) && this.get('overrideValues.length') === 0) return false;
+    return JSON.stringify(this.get('overrides').mapProperty('value')) !== JSON.stringify(this.get('overrideValues'));
+  }.property('isOverridden', 'overrides.@each.isNotDefaultValue'),
   isRemovable: function() {
     var isOriginalSCP = this.get('isOriginalSCP');
     var isUserProperty = this.get('isUserProperty');