fix(templates): fix app templates stack deployment (#1747)

* fix(templates): fix app templates stack deployment

* fix(templates): stack deployment remove return statement and fix identation
pull/1755/head
Herwono W. Wijaya 2018-03-22 12:28:55 +07:00 committed by Anthony Lapenna
parent a72ffe4188
commit bca8936faa
1 changed files with 15 additions and 9 deletions

View File

@ -108,19 +108,25 @@ function ($scope, $q, $state, $transition$, $anchorScroll, $filter, ContainerSer
}
}
StackService.createStackFromGitRepository(stackName, template.Repository.url, template.Repository.stackfile, template.Env)
.then(function success() {
Notifications.success('Stack successfully created');
var repositoryOptions = {
RepositoryURL: template.Repository.url,
ComposeFilePathInRepository: template.Repository.stackfile
};
StackService.createStackFromGitRepository(stackName, repositoryOptions, template.Env)
.then(function success(data) {
Notifications.success('Stack successfully deployed');
ResourceControlService.applyResourceControl('stack', stackName, userId, accessControlData, [])
.then(function success() {
$state.go('docker.stacks');
})
.catch(function error(err) {
Notifications.error('Failure', err, 'Unable to apply resource control on the stack');
});
})
.catch(function error(err) {
Notifications.warning('Deployment error', err.err.data.err);
})
.then(function success(data) {
return ResourceControlService.applyResourceControl('stack', stackName, userId, accessControlData, []);
})
.then(function success() {
$state.go('docker.stacks', {}, {reload: true});
})
.finally(function final() {
$scope.state.actionInProgress = false;
});