You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2016/09/13 12:47:04 UTC

ambari git commit: AMBARI-18149. Config History: disable link to configs for deleted group (akovalenko)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 3b6fc2bf4 -> 7861fcb06


AMBARI-18149. Config History: disable link to configs for deleted group  (akovalenko)


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

Branch: refs/heads/branch-2.5
Commit: 7861fcb06c773246f585f2b3c2f62f03715ce762
Parents: 3b6fc2b
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Mon Aug 15 20:11:33 2016 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Tue Sep 13 15:46:37 2016 +0300

----------------------------------------------------------------------
 .../models/configs/service_config_version.js    |  7 ++++
 .../views/main/dashboard/config_history_view.js |  4 +--
 .../main/dashboard/config_history_view_test.js  | 36 +++++++++++++++++---
 3 files changed, 41 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7861fcb0/ambari-web/app/models/configs/service_config_version.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/service_config_version.js b/ambari-web/app/models/configs/service_config_version.js
index 8722bb3..2859030 100644
--- a/ambari-web/app/models/configs/service_config_version.js
+++ b/ambari-web/app/models/configs/service_config_version.js
@@ -51,6 +51,13 @@ App.ServiceConfigVersion = DS.Model.extend({
   }.property('groupName','isDefault'),
 
   /**
+   * @type {Boolean}
+   */
+  isConfigGroupDeleted: function () {
+    return this.get('groupName') === 'Deleted';
+  }.property('groupName'),
+
+  /**
    * @type {string}
    */
   authorFormatted: Em.computed.truncate('author', 15, 15),

http://git-wip-us.apache.org/repos/asf/ambari/blob/7861fcb0/ambari-web/app/views/main/dashboard/config_history_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/config_history_view.js b/ambari-web/app/views/main/dashboard/config_history_view.js
index 3bfb22b..7bd9e4a 100644
--- a/ambari-web/app/views/main/dashboard/config_history_view.js
+++ b/ambari-web/app/views/main/dashboard/config_history_view.js
@@ -192,8 +192,8 @@ App.MainConfigHistoryView = App.TableView.extend(App.TableServerViewMixin, {
 
     // Define if show plain text label or link
     isServiceLinkDisabled: function () {
-      return this.get('content.serviceName') === 'KERBEROS' && !App.Service.find().someProperty('serviceName', 'KERBEROS');
-    }.property('content.serviceName')
+      return this.get('content.serviceName') === 'KERBEROS' && !App.Service.find().someProperty('serviceName', 'KERBEROS') || this.get('content.isConfigGroupDeleted');
+    }.property('content.serviceName', 'content.isConfigGroupDeleted')
   }),
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/7861fcb0/ambari-web/test/views/main/dashboard/config_history_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/config_history_view_test.js b/ambari-web/test/views/main/dashboard/config_history_view_test.js
index af1733d..d799c44 100644
--- a/ambari-web/test/views/main/dashboard/config_history_view_test.js
+++ b/ambari-web/test/views/main/dashboard/config_history_view_test.js
@@ -204,11 +204,12 @@ describe('App.MainConfigHistoryView', function() {
   });
 
   describe("#ConfigVersionView", function () {
-    var subView = view.get('ConfigVersionView').create({
-      parentView: view
-    });
-
+    var subView;
     before(function () {
+      subView = view.get('ConfigVersionView').create({
+        parentView: view
+      });
+
       sinon.stub(App, 'tooltip', Em.K);
     });
     after(function () {
@@ -223,6 +224,33 @@ describe('App.MainConfigHistoryView', function() {
       subView.toggleShowLessStatus();
       expect(subView.get('showLessNotes')).to.be.false;
     });
+
+    describe("#isServiceLinkDisable", function () {
+      beforeEach(function () {
+        subView.set('content', Em.Object.create());
+        this.hasKerberos = sinon.stub(App.Service, 'find');
+      });
+      afterEach(function () {
+        App.Service.find.restore();
+      });
+      it("should be true for deleted kerberos groups", function () {
+        subView.set('content.serviceName', 'KERBEROS');
+        this.hasKerberos.returns([]);
+        expect(subView.get('isServiceLinkDisabled')).to.be.true;
+      });
+      it("should be false for deleted kerberos groups", function () {
+        subView.set('content.serviceName', 'KERBEROS');
+        subView.set('content.isConfigGroupDeleted', false);
+        this.hasKerberos.returns([{serviceName: 'KERBEROS'}]);
+        expect(subView.get('isServiceLinkDisabled')).to.be.false;
+      });
+      it("should be true if group is deleted", function () {
+        subView.set('content.serviceName', 'KERBEROS');
+        subView.set('content.isConfigGroupDeleted', true);
+        this.hasKerberos.returns([{serviceName: 'KERBEROS'}]);
+        expect(subView.get('isServiceLinkDisabled')).to.be.true;
+      });
+    });
   });
 
   describe('#didInsertElement()', function() {