Skip to content
Permalink
Browse files
Merge pull request #2724 from atkach/AMBARI-25045-trunk
AMBARI-25045 UI logic for component dependencies needs to be modified to use the type field
  • Loading branch information
atkach committed Dec 18, 2018
2 parents f3aa02f + 0bf2c54 commit 067024fd5f04f211489f93e8553394699a1af635
Showing 5 changed files with 25 additions and 7 deletions.
@@ -3003,7 +3003,10 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
break;
}
var component = App.StackServiceComponent.find(componentName);
return component.missingDependencies(installedComponents, opt).map(function(componentDependency) {
const excludeExclusiveDependencies = (d) => d.type !== 'exclusive';
return component.missingDependencies(installedComponents, opt)
.filter(excludeExclusiveDependencies) //If type is "exclusive" the dependent component should never be co-hosted.
.map(function(componentDependency) {
return componentDependency.chooseCompatible();
});
},
@@ -101,7 +101,7 @@ App.stackServiceMapper = App.QuickDataMapper.create({
var serviceComponents = [];
item.components.forEach(function (serviceComponent) {
var dependencies = serviceComponent.dependencies.map(function (dependecy) {
return { Dependencies: App.keysUnderscoreToCamelCase(App.permit(dependecy.Dependencies, ['component_name', 'scope', 'service_name'])) };
return { Dependencies: App.keysUnderscoreToCamelCase(App.permit(dependecy.Dependencies, ['component_name', 'scope', 'service_name', 'type'])) };
});
serviceComponent.StackServiceComponents.id = serviceComponent.StackServiceComponents.component_name;
serviceComponent.StackServiceComponents.dependencies = dependencies;
@@ -107,12 +107,13 @@ App.StackServiceComponent = DS.Model.extend({
return !installedComponents.some(function(each) {
return each.compatibleWith(App.StackServiceComponent.find(dependency.componentName));
});
}).mapProperty('componentName');
return missingComponents.map(function (missingComponentName) {
});
return missingComponents.map(function (missingComponent) {
return ComponentDependency.create({
'componentName': missingComponentName,
'componentName': missingComponent.componentName,
'type': missingComponent.type,
'compatibleComponents': App.StackServiceComponent.find().filter(function (each) {
return each.compatibleWith(App.StackServiceComponent.find(missingComponentName));
return each.compatibleWith(App.StackServiceComponent.find(missingComponent.componentName));
})
});
});
@@ -2053,7 +2053,7 @@ var urls = {
'type': 'DELETE'
},
'wizard.service_components': {
'real': '{stackUrl}/services?fields=StackServices/*,components/*,components/dependencies/Dependencies/scope,components/dependencies/Dependencies/service_name,artifacts/Artifacts/artifact_name',
'real': '{stackUrl}/services?fields=StackServices/*,components/*,components/dependencies/Dependencies/scope,components/dependencies/Dependencies/service_name,components/dependencies/Dependencies/type,artifacts/Artifacts/artifact_name',
'mock': '/data/stacks/HDP-2.1/service_components.json'
},
'wizard.step9.installer.get_host_status': {
@@ -3723,6 +3723,20 @@ describe('App.MainHostDetailsController', function () {
this.mock.withArgs('C3').returns(App.StackServiceComponent.createRecord({ componentName: 'C3' }));
expect(controller.checkComponentDependencies('C1', opt)).to.eql(['C3']);
});
it("dependecies should be excluded when exclusive type", function () {
var opt = {scope: '*', installedComponents: ['C2']};
this.mock.returns([
App.StackServiceComponent.createRecord({componentName: 'C1'}),
App.StackServiceComponent.createRecord({componentName: 'C2'}),
App.StackServiceComponent.createRecord({componentName: 'C3'})
]);
this.mock.withArgs('C1').returns(App.StackServiceComponent.createRecord({
dependencies: [{componentName: 'C3', type: 'exclusive'}]
}));
this.mock.withArgs('C2').returns(App.StackServiceComponent.createRecord({ componentName: 'C2' }));
this.mock.withArgs('C3').returns(App.StackServiceComponent.createRecord({ componentName: 'C3' }));
expect(controller.checkComponentDependencies('C1', opt)).to.be.empty;
});
it("dependecies already installed by component type", function () {
var opt = {scope: '*', installedComponents: ['C3']};
this.mock.withArgs('C1').returns(App.StackServiceComponent.createRecord({

0 comments on commit 067024f

Please sign in to comment.