mirror of https://github.com/portainer/portainer
fix(stacks): show missing status stacks (#5047)
Co-authored-by: dbuduev <dbuduev@gmail.com>pull/5143/head
parent
a5e8cf62d2
commit
d7bc4f9b96
|
@ -50,7 +50,7 @@ angular.module('portainer.app').controller('StacksDatatableController', [
|
|||
if (stack.Orphaned) {
|
||||
return stack.OrphanedRunning || this.settings.allOrphanedStacks;
|
||||
} else {
|
||||
return (stack.Status === 1 && showActiveStacks) || (stack.Status === 2 && showUnactiveStacks) || stack.External;
|
||||
return (stack.Status === 1 && showActiveStacks) || (stack.Status === 2 && showUnactiveStacks) || stack.External || !stack.Status;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -302,7 +302,7 @@ angular.module('portainer.app').controller('StackController', [
|
|||
$scope.formValues.Env = $scope.stack.Env;
|
||||
|
||||
let resourcesPromise = Promise.resolve({});
|
||||
if (stack.Status === 1) {
|
||||
if (!stack.Status || stack.Status === 1) {
|
||||
resourcesPromise = stack.Type === 1 ? retrieveSwarmStackResources(stack.Name, agentProxy) : retrieveComposeStackResources(stack.Name);
|
||||
}
|
||||
|
||||
|
@ -312,9 +312,15 @@ angular.module('portainer.app').controller('StackController', [
|
|||
});
|
||||
})
|
||||
.then(function success(data) {
|
||||
const isSwarm = $scope.stack.Type === 1;
|
||||
$scope.stackFileContent = data.stackFile;
|
||||
// workaround for missing status, if stack has resources, set the status to 1 (active), otherwise to 2 (inactive) (https://github.com/portainer/portainer/issues/4422)
|
||||
if (!$scope.stack.Status) {
|
||||
$scope.stack.Status = data.resources && ((isSwarm && data.resources.services.length) || data.resources.containers.length) ? 1 : 2;
|
||||
}
|
||||
|
||||
if ($scope.stack.Status === 1) {
|
||||
if ($scope.stack.Type === 1) {
|
||||
if (isSwarm) {
|
||||
assignSwarmStackResources(data.resources, agentProxy);
|
||||
} else {
|
||||
assignComposeStackResources(data.resources);
|
||||
|
|
Loading…
Reference in New Issue