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 2017/01/10 14:50:12 UTC
[2/3] ambari git commit: AMBARI-19014. Add Service Wizard: error
thrown during transition on deploy step (akovalenko)
AMBARI-19014. Add Service Wizard: error thrown during transition on deploy step (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0722e544
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0722e544
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0722e544
Branch: refs/heads/branch-2.5
Commit: 0722e5445125b65070e15f465ff99bdacd4c2248
Parents: ea6c376
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Tue Nov 29 15:27:22 2016 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Tue Jan 10 16:46:41 2017 +0200
----------------------------------------------------------------------
.../controllers/main/service/add_controller.js | 11 +++++---
.../main/service/add_controller_test.js | 29 ++++++++++++++++----
2 files changed, 30 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/0722e544/ambari-web/app/controllers/main/service/add_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/add_controller.js b/ambari-web/app/controllers/main/service/add_controller.js
index 4310f8d..f312a5a 100644
--- a/ambari-web/app/controllers/main/service/add_controller.js
+++ b/ambari-web/app/controllers/main/service/add_controller.js
@@ -467,7 +467,7 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, {
installSelectedServices: function (callback) {
var name = 'common.services.update';
var selectedServices = this.get('content.services').filterProperty('isInstalled', false).filterProperty('isSelected', true).mapProperty('serviceName');
- var dependentServices = this.getDependentServices();
+ var dependentServices = this.getServicesBySelectedSlaves();
var data = this.generateDataForInstallServices(selectedServices.concat(dependentServices));
this.installServicesRequest(name, data, callback.bind(this));
},
@@ -484,14 +484,17 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, {
},
/**
- * return list of services by dependent slave components
+ * return list of services by selected and not installed slave components
* @returns {Array}
*/
- getDependentServices: function () {
+ getServicesBySelectedSlaves: function () {
var result = [];
this.get('content.slaveComponentHosts').forEach(function (slaveComponent) {
if (slaveComponent.hosts.someProperty('isInstalled', false)) {
- result.push(App.StackServiceComponent.find().findProperty('componentName', slaveComponent.componentName).get('serviceName'));
+ var stackComponent = App.StackServiceComponent.find().findProperty('componentName', slaveComponent.componentName);
+ if (stackComponent) {
+ result.push(stackComponent.get('serviceName'));
+ }
}
});
return result.uniq();
http://git-wip-us.apache.org/repos/asf/ambari/blob/0722e544/ambari-web/test/controllers/main/service/add_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/add_controller_test.js b/ambari-web/test/controllers/main/service/add_controller_test.js
index 7470f89..715f46a 100644
--- a/ambari-web/test/controllers/main/service/add_controller_test.js
+++ b/ambari-web/test/controllers/main/service/add_controller_test.js
@@ -566,14 +566,14 @@ describe('App.AddServiceController', function() {
});
- describe('#getDependentServices', function () {
+ describe('#getServicesBySelectedSlaves', function () {
beforeEach(function () {
sinon.stub(App.StackServiceComponent, 'find').returns([
- Em.Object.create({
- componentName: 'c1',
- serviceName: 's1'
- }),
+ Em.Object.create({
+ componentName: 'c1',
+ serviceName: 's1'
+ }),
Em.Object.create({
componentName: 'c2',
serviceName: 's2'
@@ -596,6 +596,23 @@ describe('App.AddServiceController', function() {
expect: []
},
{
+ title: 'should return empty array if component is absent in StackServiceComponent model',
+ sch: [
+ {
+ componentName: 'c5',
+ hosts: [
+ {
+ isInstalled: false
+ },
+ {
+ isInstalled: true
+ }
+ ]
+ },
+ ],
+ expect: []
+ },
+ {
title: 'should return services for not installed slaves',
sch: [
{
@@ -638,7 +655,7 @@ describe('App.AddServiceController', function() {
describe(test.title, function () {
it(function () {
addServiceController.set('content.slaveComponentHosts', test.sch);
- expect(addServiceController.getDependentServices()).to.eql(test.expect);
+ expect(addServiceController.getServicesBySelectedSlaves()).to.eql(test.expect);
});
})
});