1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-06 06:15:22 +02:00

fix(wizard): count swarm agent as local environment EE-6215 (#10684)

This commit is contained in:
cmeng 2023-11-30 08:53:56 +13:00 committed by GitHub
parent 450c167461
commit 92c18843b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 2 deletions

View file

@ -103,6 +103,8 @@ function getTypeLabel(type?: EnvironmentType) {
switch (type) { switch (type) {
case EnvironmentType.Docker: case EnvironmentType.Docker:
return 'Docker'; return 'Docker';
case EnvironmentType.AgentOnDocker:
return 'Docker Agent';
case EnvironmentType.KubernetesLocal: case EnvironmentType.KubernetesLocal:
return 'Kubernetes'; return 'Kubernetes';
default: default:

View file

@ -74,7 +74,11 @@ function useFetchLocalEnvironment() {
{ {
page: 0, page: 0,
pageLimit: 1, pageLimit: 1,
types: [EnvironmentType.Docker, EnvironmentType.KubernetesLocal], types: [
EnvironmentType.Docker,
EnvironmentType.AgentOnDocker,
EnvironmentType.KubernetesLocal,
],
}, },
{ {
refetchInterval: false, refetchInterval: false,
@ -82,8 +86,21 @@ function useFetchLocalEnvironment() {
} }
); );
let environment: Environment | undefined;
environments.forEach((value) => {
if (!environment) {
if (value.Type === EnvironmentType.AgentOnDocker) {
if (value.Name === 'primary' && value.Id === 1) {
environment = value;
}
} else {
environment = value;
}
}
});
return { return {
isLoading, isLoading,
environment: environments.length > 0 ? environments[0] : undefined, environment,
}; };
} }