Browse Source

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

Oleg Nechiporenko 10 năm trước cách đây
mục cha
commit
27e6797f02

+ 1 - 1
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'),
 
   /**

+ 35 - 0
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);
+      });
+    });
+
+  });
+
 });