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-18200. Add Service button is not disabled if all services are installed (akovalenko)
Date Thu, 18 Aug 2016 16:21:48 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 2bc8690a3 -> d3bac1d45


AMBARI-18200. Add Service button is not disabled if all services are installed (akovalenko)


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

Branch: refs/heads/trunk
Commit: d3bac1d45e9bf57d562b447d1d4540ac867ad602
Parents: 2bc8690
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Thu Aug 18 19:02:31 2016 +0300
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Thu Aug 18 19:02:31 2016 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/main/service.js      |  8 +++++--
 ambari-web/app/styles/application.less          |  4 ----
 .../main/service/all_services_actions.hbs       |  2 +-
 .../test/controllers/main/service_test.js       | 24 ++++++++++++++++----
 4 files changed, 27 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d3bac1d4/ambari-web/app/controllers/main/service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service.js b/ambari-web/app/controllers/main/service.js
index 7fe5b68..d6fbfbb 100644
--- a/ambari-web/app/controllers/main/service.js
+++ b/ambari-web/app/controllers/main/service.js
@@ -51,8 +51,12 @@ App.MainServiceController = Em.ArrayController.extend({
    */
   isAllServicesInstalled: function () {
     if (!this.get('content')) return false;
-    var availableServices = App.StackService.find().mapProperty('serviceName');
-    return this.get('content').length == availableServices.length;
+    var notAvailableServices = App.ServiceSimple.find().filterProperty('doNotShowAndInstall').mapProperty('name');
+    var availableServices = App.ServiceSimple.find().filterProperty('doNotShowAndInstall',
false);
+    var installedServices = this.get('content').filter(function (service) {
+      return !notAvailableServices.contains(service.get('serviceName'));
+    });
+    return installedServices.length == availableServices.length;
   }.property('content.@each', 'content.length'),
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/d3bac1d4/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 2449443..3a41cd2 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -2459,10 +2459,6 @@ a:focus {
 
   }
 
-  .add-service-button {
-    margin: 20px 20px 10px;
-  }
-
   .start-stop-all-service-button {
     margin: 5px 5px 10px 10px;
     text-align: center;

http://git-wip-us.apache.org/repos/asf/ambari/blob/d3bac1d4/ambari-web/app/templates/main/service/all_services_actions.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/service/all_services_actions.hbs b/ambari-web/app/templates/main/service/all_services_actions.hbs
index edcd29c..081d3eb 100644
--- a/ambari-web/app/templates/main/service/all_services_actions.hbs
+++ b/ambari-web/app/templates/main/service/all_services_actions.hbs
@@ -24,7 +24,7 @@
             </a>
             <ul class="pull-left dropdown-menu">
                 {{#isAuthorized "SERVICE.ADD_DELETE_SERVICES"}}
-                    <li {{bindAttr class="view.serviceController.isAllServicesInstalled:disabled"}}>
+                    <li {{bindAttr class="view.serviceController.isAllServicesInstalled:disabled
:add-service-button"}}>
                         <a href="#"
                             {{bindAttr class="view.serviceController.isAllServicesInstalled:disabled"}}
                             {{action gotoAddService target="view.serviceController"}}>

http://git-wip-us.apache.org/repos/asf/ambari/blob/d3bac1d4/ambari-web/test/controllers/main/service_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service_test.js b/ambari-web/test/controllers/main/service_test.js
index 06961a1..440c26e 100644
--- a/ambari-web/test/controllers/main/service_test.js
+++ b/ambari-web/test/controllers/main/service_test.js
@@ -116,18 +116,17 @@ describe('App.MainServiceController', function () {
   describe("#isAllServicesInstalled", function() {
 
     beforeEach(function() {
-      sinon.stub(App.StackService, 'find').returns([
-        Em.Object.create({serviceName: 'S1'})
-      ]);
+      this.mock = sinon.stub(App.ServiceSimple, 'find');
     });
     afterEach(function() {
-      App.StackService.find.restore();
+      App.ServiceSimple.find.restore();
     });
 
     it("content is null", function() {
       mainServiceController.reopen({
         'content': null
       });
+      this.mock.returns([]);
       mainServiceController.propertyDidChange('isAllServicesInstalled');
       expect(mainServiceController.get('isAllServicesInstalled')).to.be.false;
     });
@@ -136,6 +135,9 @@ describe('App.MainServiceController', function () {
       mainServiceController.reopen({
         'content': []
       });
+      this.mock.returns([
+        {serviceName: 'S1', doNotShowAndInstall: false}
+      ]);
       mainServiceController.propertyDidChange('isAllServicesInstalled');
       expect(mainServiceController.get('isAllServicesInstalled')).to.be.false;
     });
@@ -144,9 +146,23 @@ describe('App.MainServiceController', function () {
       mainServiceController.reopen({
         'content': [Em.Object.create({serviceName: 'S1'})]
       });
+      this.mock.returns([
+        {serviceName: 'S1', doNotShowAndInstall: false}
+      ]);
       mainServiceController.propertyDidChange('isAllServicesInstalled');
       expect(mainServiceController.get('isAllServicesInstalled')).to.be.true;
     });
+    it("content doesn't match stack services", function() {
+      mainServiceController.reopen({
+        'content': [Em.Object.create({serviceName: 'S1'})]
+      });
+      this.mock.returns([
+        {serviceName: 'S1', doNotShowAndInstall: false},
+        {serviceName: 'S1', doNotShowAndInstall: false}
+      ]);
+      mainServiceController.propertyDidChange('isAllServicesInstalled');
+      expect(mainServiceController.get('isAllServicesInstalled')).to.be.false;
+    });
   });
 
   describe('#cluster', function() {


Mime
View raw message