fix(stacks): fix stop and start [EE-5572] (#9050)

pull/9115/head
Chaim Lev-Ari 2023-06-22 21:08:24 +07:00 committed by GitHub
parent 2cd5d55b00
commit 2363d23de0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View File

@ -16,8 +16,8 @@ function StackFactory($resource, API_ENDPOINT_STACKS) {
remove: { method: 'DELETE', params: { id: '@id', external: '@external', endpointId: '@endpointId' } }, remove: { method: 'DELETE', params: { id: '@id', external: '@external', endpointId: '@endpointId' } },
getStackFile: { method: 'GET', params: { id: '@id', action: 'file' } }, getStackFile: { method: 'GET', params: { id: '@id', action: 'file' } },
migrate: { method: 'POST', params: { id: '@id', action: 'migrate', endpointId: '@endpointId' }, ignoreLoadingBar: true }, migrate: { method: 'POST', params: { id: '@id', action: 'migrate', endpointId: '@endpointId' }, ignoreLoadingBar: true },
start: { method: 'POST', params: { id: '@id', action: 'start' } }, start: { method: 'POST', params: { id: '@id', action: 'start', endpointId: '@endpointId' } },
stop: { method: 'POST', params: { id: '@id', action: 'stop' } }, stop: { method: 'POST', params: { id: '@id', action: 'stop', endpointId: '@endpointId' } },
updateGit: { method: 'PUT', params: { id: '@id', action: 'git', subaction: 'redeploy' } }, updateGit: { method: 'PUT', params: { id: '@id', action: 'git', subaction: 'redeploy' } },
updateGitStackSettings: { method: 'POST', params: { id: '@id', action: 'git' }, ignoreLoadingBar: true }, updateGitStackSettings: { method: 'POST', params: { id: '@id', action: 'git' }, ignoreLoadingBar: true },
} }

View File

@ -421,13 +421,13 @@ angular.module('portainer.app').factory('StackService', [
}; };
service.start = start; service.start = start;
function start(id) { function start(endpointId, id) {
return Stack.start({ id }).$promise; return Stack.start({ id, endpointId }).$promise;
} }
service.stop = stop; service.stop = stop;
function stop(id) { function stop(endpointId, id) {
return Stack.stop({ id }).$promise; return Stack.stop({ endpointId, id }).$promise;
} }
function updateGit(id, endpointId, env, prune, gitConfig, pullImage) { function updateGit(id, endpointId, env, prune, gitConfig, pullImage) {

View File

@ -293,7 +293,7 @@ angular.module('portainer.app').controller('StackController', [
$scope.state.actionInProgress = true; $scope.state.actionInProgress = true;
try { try {
await StackService.stop($scope.stack.Id); await StackService.stop(endpoint.Id, $scope.stack.Id);
$state.reload(); $state.reload();
} catch (err) { } catch (err) {
Notifications.error('Failure', err, 'Unable to stop stack'); Notifications.error('Failure', err, 'Unable to stop stack');
@ -309,7 +309,7 @@ angular.module('portainer.app').controller('StackController', [
$scope.state.actionInProgress = true; $scope.state.actionInProgress = true;
const id = $scope.stack.Id; const id = $scope.stack.Id;
try { try {
await StackService.start(id); await StackService.start(endpoint.Id, id);
$state.reload(); $state.reload();
} catch (err) { } catch (err) {
Notifications.error('Failure', err, 'Unable to start stack'); Notifications.error('Failure', err, 'Unable to start stack');