Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 67 additions & 36 deletions ambari-web/app/controllers/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,7 @@ App.InstallerController = App.WizardController.extend(App.Persist, {
stackName: stackName,
stackVersion: stackVersion,
serviceName: serviceName
},
success: 'loadMpackServiceInfoSuccess',
error: 'loadMpackServiceInfoError'
}
});
},

Expand Down Expand Up @@ -1431,11 +1429,32 @@ App.InstallerController = App.WizardController.extend(App.Persist, {
sCallback();
},

clearStackServices: function () {
const stackServices = App.StackService.find();
stackServices.forEach(service => {
Em.run.once(this, () => App.MpackServiceMapper.deleteRecord(service));
});
clearStackServices: function (deleteAll) {
var dfd = $.Deferred();

if (deleteAll) {
const stackServices = App.StackService.find();
let stackServicesCount = stackServices.content.length;

if (stackServicesCount > 0) {
stackServices.forEach(service => {
Em.run.once(this, () => {
App.MpackServiceMapper.deleteRecord(service);
stackServicesCount--;

if (stackServicesCount === 0) {
dfd.resolve();
}
});
});
} else {
dfd.resolve();
}
} else {
dfd.resolve();
}

return dfd.promise();
},

getStepSavedState: function (stepName) {
Expand Down Expand Up @@ -1494,40 +1513,52 @@ App.InstallerController = App.WizardController.extend(App.Persist, {
* @return {object} a promise
*/
finishRegisteringMpacks: function (keepStackServices) {
return this.getMpackStackVersions().fail(this.addErrors).always(data => {
data.items.forEach(versionDefinition => App.stackMapper.map(versionDefinition))

if (!keepStackServices) {
this.clearStackServices();
}
var dfd = $.Deferred();

this.getMpackStackVersions()
.fail(errors => {
this.addErrors(errors);
dfd.reject();
})
.always(data => {
data.items.forEach(versionDefinition => App.stackMapper.map(versionDefinition));
return this.clearStackServices(!keepStackServices);
})
.then(() => {
//get info about services from specific stack versions and save to StackService model
const selectedServices = this.get('content.selectedServices');
const servicePromises = selectedServices.map(service => this.loadMpackServiceInfo(service.stackName, service.stackVersion, service.name));

return $.when(...servicePromises).then(() => {
const services = App.StackService.find();
this.set('content.services', services);

const clients = [];
services.forEach(service => {
const client = service.get('serviceComponents').filterProperty('isClient', true);
client.forEach(clientComponent => {
clients.pushObject({
component_name: clientComponent.get('componentName'),
display_name: clientComponent.get('displayName'),
isInstalled: false
});
const servicePromises = selectedServices.map(service =>
this.loadMpackServiceInfo(service.stackName, service.stackVersion, service.name)
.then(this.loadMpackServiceInfoSuccess, this.loadMpackServiceInfoError)
);

return $.when(...servicePromises);
})
.then(() => {
const services = App.StackService.find();
this.set('content.services', services);

const clients = [];
services.forEach(service => {
const client = service.get('serviceComponents').filterProperty('isClient', true);
client.forEach(clientComponent => {
clients.pushObject({
component_name: clientComponent.get('componentName'),
display_name: clientComponent.get('displayName'),
isInstalled: false
});
});
this.set('content.clients', clients);
this.save('clients');

//TODO: mpacks - hard coding this for now. We need to get rid of the concept of "selected stack".
this.set('content.selectedStack', { name: "HDP", version: "3.0.0" });
this.save('selectedStack');
});
this.set('content.clients', clients);
this.save('clients');

//TODO: mpacks - hard coding this for now. We need to get rid of the concept of "selected stack".
this.set('content.selectedStack', { name: "HDP", version: "3.0.0" });
this.save('selectedStack');

dfd.resolve();
});

return dfd;
}

});
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ App.WizardVerifyProductsController = App.WizardStepController.extend({
this.verifyRepo(repo).then(this.verifyRepoSucceeded.bind(this), this.verifyRepoFailed.bind(this));
},

isStepDisabled: function (stepIndex, currentIndex) {
const normallyDisabled = this._super(stepIndex, currentIndex);
const useCustomRepo = this.get('wizardController.content.downloadConfig.useCustomRepo');

return normallyDisabled || !useCustomRepo;
},

isSubmitDisabled: function () {
const repos = this.get('repos');
return App.get('router.btnClickInProgress')
Expand Down
2 changes: 2 additions & 0 deletions ambari-web/app/mixins/wizard/assign_master_components.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ App.AssignMasterComponents = Em.Mixin.create(App.HostComponentValidationMixin, A
clearRecommendations: function() {
if (this.get('content.recommendations')) {
this.set('content.recommendations', null);
}
if (this.get('recommendations')) {
this.set('recommendations', null);
}
},
Expand Down
12 changes: 9 additions & 3 deletions ambari-web/app/routes/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
if (downloadConfig && downloadConfig.useCustomRepo) {
router.transitionTo('customProductRepos');
} else {
router.transitionTo('verifyProducts');
router.transitionTo('step5');
}
console.timeEnd('downloadMpacks next');
}
Expand Down Expand Up @@ -587,7 +587,12 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
backTransition: function (router) {
var controller = router.get('installerController');
controller.clearErrors();
router.transitionTo('verifyProducts');
const downloadConfig = controller.get('content.downloadConfig');
if (downloadConfig && downloadConfig.useCustomRepo) {
router.transitionTo('verifyProducts');
} else {
router.transitionTo('downloadMpacks');
}
},

next: function (router) {
Expand All @@ -597,7 +602,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
var controller = router.get('installerController');
var wizardStep5Controller = router.get('wizardStep5Controller');
controller.saveMasterComponentHosts(wizardStep5Controller);
controller.setDBProperty('recommendations', wizardStep5Controller.get('content.recommendations'));
controller.setDBProperty('recommendations', wizardStep5Controller.get('content.recommendations') || wizardStep5Controller.get('recommendations'));
// Clear subsequent steps if user made changes
if (!wizardStep5Controller.get('isSaved')) {
controller.setDBProperty('slaveComponentHosts', undefined);
Expand Down Expand Up @@ -631,6 +636,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
console.timeEnd('step6 connectOutlets');
});
},

backTransition: function(router) {
var controller = router.get('installerController');
controller.clearErrors();
Expand Down
9 changes: 9 additions & 0 deletions ambari-web/app/views/wizard/selectMpacks_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ App.WizardSelectMpacksView = Em.View.extend({

didInsertElement: function () {
this.get('controller').loadStep();

//enable initial tooltips
$('[data-toggle="tooltip"]').tooltip();
//enables tooltips added later
const target = document.querySelector('#select-mpacks');
const observer = new MutationObserver(() => {
$('[data-toggle="tooltip"]').tooltip();
});
observer.observe(target, { childList: true, subtree: true });
},

toggleMode: function () {
Expand Down