Repository: ambari
Updated Branches:
  refs/heads/trunk a4008c18b -> 27e6797f0


AMBARI-11415. Undo action not available for advanced configs (onechiporenko)


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

Branch: refs/heads/trunk
Commit: 27e6797f02c970d00cb51bf3b3d5ca692f4f396e
Parents: a4008c1
Author: Oleg Nechiporenko <[email protected]>
Authored: Wed May 27 13:02:05 2015 +0300
Committer: Oleg Nechiporenko <[email protected]>
Committed: Wed May 27 13:23:06 2015 +0300

----------------------------------------------------------------------
 .../configs/objects/service_config_property.js  |  2 +-
 .../objects/service_config_property_test.js     | 35 ++++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/27e6797f/ambari-web/app/models/configs/objects/service_config_property.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/objects/service_config_property.js 
b/ambari-web/app/models/configs/objects/service_config_property.js
index a4dffa4..ad4de55 100644
--- a/ambari-web/app/models/configs/objects/service_config_property.js
+++ b/ambari-web/app/models/configs/objects/service_config_property.js
@@ -239,7 +239,7 @@ App.ServiceConfigProperty = Em.Object.extend({
    * @type {boolean}
    */
   undoAvailable: function () {
-    return this.get('cantBeUndone') && this.get('isNotDefaultValue');
+    return !this.get('cantBeUndone') && this.get('isNotDefaultValue');
   }.property('cantBeUndone', 'isNotDefaultValue'),
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/27e6797f/ambari-web/test/models/configs/objects/service_config_property_test.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/test/models/configs/objects/service_config_property_test.js 
b/ambari-web/test/models/configs/objects/service_config_property_test.js
index 004153a..5eb8c3e 100644
--- a/ambari-web/test/models/configs/objects/service_config_property_test.js
+++ b/ambari-web/test/models/configs/objects/service_config_property_test.js
@@ -574,4 +574,39 @@ describe('App.ServiceConfigProperty', function () {
 
   });
 
+  describe('#undoAvailable', function () {
+
+    Em.A([
+      {
+        cantBeUndone: true,
+        isNotDefaultValue: true,
+        e: false
+      },
+      {
+        cantBeUndone: false,
+        isNotDefaultValue: true,
+        e: true
+      },
+      {
+        cantBeUndone: true,
+        isNotDefaultValue: false,
+        e: false
+      },
+      {
+        cantBeUndone: false,
+        isNotDefaultValue: false,
+        e: false
+      }
+    ]).forEach(function (test) {
+      it('', function () {
+        serviceConfigProperty.reopen({
+          cantBeUndone: test.cantBeUndone,
+          isNotDefaultValue: test.isNotDefaultValue
+        });
+        expect(serviceConfigProperty.get('undoAvailable')).to.equal(test.e);
+      });
+    });
+
+  });
+
 });

Reply via email to