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/ee6c5d86
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ee6c5d86
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ee6c5d86

Branch: refs/heads/branch-dev-logsearch
Commit: ee6c5d8640c208f0fdec3f7ea59a777f35729e01
Parents: 07a30a1
Author: ababiichuk <[email protected]>
Authored: Tue Mar 7 19:30:52 2017 +0200
Committer: ababiichuk <[email protected]>
Committed: Wed Mar 8 00:14:59 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/ee6c5d86/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index a7f4edf..88e2cf4 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -1214,7 +1214,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/ee6c5d86/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 c7bd5c7..ffedc23 100644
--- a/ambari-web/test/utils/config_test.js
+++ b/ambari-web/test/utils/config_test.js
@@ -534,6 +534,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('#getIsSecure', function() {

Reply via email to