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


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7343cb2a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7343cb2a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7343cb2a

Branch: refs/heads/branch-alerts-dev
Commit: 7343cb2a8c9b4783f55072e2cf529e8ef0f0f4f8
Parents: 7490cfd
Author: atkach <atk...@hortonworks.com>
Authored: Thu Sep 4 14:37:07 2014 +0300
Committer: atkach <atk...@hortonworks.com>
Committed: Thu Sep 4 14:37:07 2014 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/main/service/info/configs.js | 1 +
 ambari-web/app/models/service_config.js                 | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7343cb2a/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 d104083..80e92ea 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/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'));
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/7343cb2a/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 a1231d4..7d99660 100644
--- a/ambari-web/app/models/service_config.js
+++ b/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({

Reply via email to