Repository: ambari Updated Branches: refs/heads/trunk 72a94ec7b -> ca2106fd9
AMBARI-7129 Save for non-default config group disabled. (atkach) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ca2106fd Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ca2106fd Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ca2106fd Branch: refs/heads/trunk Commit: ca2106fd9ce077f2c77ade507fc4cad64f8921dc Parents: 72a94ec Author: atkach <atk...@hortonworks.com> Authored: Wed Sep 3 12:39:14 2014 +0300 Committer: atkach <atk...@hortonworks.com> Committed: Wed Sep 3 12:39:14 2014 +0300 ---------------------------------------------------------------------- ambari-web/app/controllers/main/service/info/configs.js | 7 ++++--- ambari-web/app/models/service_config.js | 9 +++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/ca2106fd/ambari-web/app/controllers/main/service/info/configs.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js index e8cc813..2c1774e 100644 --- a/ambari-web/app/controllers/main/service/info/configs.js +++ b/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); }, http://git-wip-us.apache.org/repos/asf/ambari/blob/ca2106fd/ambari-web/app/models/service_config.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/models/service_config.js b/ambari-web/app/models/service_config.js index 45e4f50..a1231d4 100644 --- a/ambari-web/app/models/service_config.js +++ b/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');