Repository: ambari
Updated Branches:
  refs/heads/trunk 995b5e053 -> 4b884e30b


AMBARI-20348 Discard/Save buttons for service configs are always enabled if 
custom property is overridden with empty value. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: 4b884e30bf40614a2721bbc5e6969a6767e2d02e
Parents: 995b5e0
Author: ababiichuk <ababiic...@hortonworks.com>
Authored: Tue Mar 7 19:30:52 2017 +0200
Committer: ababiichuk <ababiic...@hortonworks.com>
Committed: Wed Mar 8 00:13:32 2017 +0200

----------------------------------------------------------------------
 ambari-web/app/utils/config.js       |  4 +++-
 ambari-web/test/utils/config_test.js | 30 ++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4b884e30/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 28881bb..8e6e2fd 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -1197,7 +1197,9 @@ App.config = Em.Object.create({
 
     serviceConfigProperty.get('overrides').pushObject(newOverride);
 
-    var savedOverrides = 
serviceConfigProperty.get('overrides').filterProperty('savedValue');
+    var savedOverrides = 
serviceConfigProperty.get('overrides').filter(function (override) {
+      return !Em.isNone(Em.get(override, 'savedValue'));
+    });
     serviceConfigProperty.set('overrideValues', 
savedOverrides.mapProperty('savedValue'));
     serviceConfigProperty.set('overrideIsFinalValues', 
savedOverrides.mapProperty('savedIsFinal'));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/4b884e30/ambari-web/test/utils/config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/config_test.js 
b/ambari-web/test/utils/config_test.js
index f418614..7ad8828 100644
--- a/ambari-web/test/utils/config_test.js
+++ b/ambari-web/test/utils/config_test.js
@@ -750,6 +750,36 @@ describe('App.config', function() {
       });
 
     });
+
+    describe('overrides with empty string values', function () {
+
+      beforeEach(function () {
+        configProperty.set('overrides', [
+          {
+            savedValue: null,
+            savedIsFinal: true
+          },
+          {
+            savedValue: '',
+            savedIsFinal: false
+          },
+          {
+            savedValue: '1',
+            savedIsFinal: false
+          }
+        ]);
+        App.config.createOverride(configProperty, null, group);
+      });
+
+      it('values', function () {
+        expect(configProperty.get('overrideValues')).to.eql(['', '1']);
+      });
+
+      it('isFinal', function () {
+        expect(configProperty.get('overrideIsFinalValues')).to.eql([false, 
false]);
+      });
+
+    });
   });
 
   describe('#createCustomGroupConfig', function() {

Reply via email to