ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject ambari git commit: AMBARI-18149. Config History: disable link to configs for deleted group (akovalenko)
Date Mon, 15 Aug 2016 17:25:57 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 2dd7510b5 -> d50518c1e


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

Branch: refs/heads/trunk
Commit: d50518c1e6dbbe0cc720123d541cc8ab4367fb13
Parents: 2dd7510
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Mon Aug 15 20:11:33 2016 +0300
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Mon Aug 15 20:11:33 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/d50518c1/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/d50518c1/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/d50518c1/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() {


Mime
View raw message