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:50:16 UTC
ambari git commit: AMBARI-18200. Add Service button is not disabled
if all services are installed (akovalenko)
Repository: ambari
Updated Branches:
refs/heads/branch-2.5 7861fcb06 -> 8b1ec08a3
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/8b1ec08a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8b1ec08a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8b1ec08a
Branch: refs/heads/branch-2.5
Commit: 8b1ec08a36e953ee9bb4eaac1eca6965613f0107
Parents: 7861fcb
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Thu Aug 18 19:02:31 2016 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Tue Sep 13 15:49:57 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/8b1ec08a/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/8b1ec08a/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 7d3981c..691580d 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/8b1ec08a/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/8b1ec08a/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() {