diff --git a/app/docker/views/templates/templatesController.js b/app/docker/views/templates/templatesController.js index d634b940c..68f7e2914 100644 --- a/app/docker/views/templates/templatesController.js +++ b/app/docker/views/templates/templatesController.js @@ -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; });