mirror of https://github.com/portainer/portainer
fix(wizard): count swarm agent as local environment EE-6215 (#10684)
parent
450c167461
commit
92c18843b2
|
@ -103,6 +103,8 @@ function getTypeLabel(type?: EnvironmentType) {
|
|||
switch (type) {
|
||||
case EnvironmentType.Docker:
|
||||
return 'Docker';
|
||||
case EnvironmentType.AgentOnDocker:
|
||||
return 'Docker Agent';
|
||||
case EnvironmentType.KubernetesLocal:
|
||||
return 'Kubernetes';
|
||||
default:
|
||||
|
|
|
@ -74,7 +74,11 @@ function useFetchLocalEnvironment() {
|
|||
{
|
||||
page: 0,
|
||||
pageLimit: 1,
|
||||
types: [EnvironmentType.Docker, EnvironmentType.KubernetesLocal],
|
||||
types: [
|
||||
EnvironmentType.Docker,
|
||||
EnvironmentType.AgentOnDocker,
|
||||
EnvironmentType.KubernetesLocal,
|
||||
],
|
||||
},
|
||||
{
|
||||
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 {
|
||||
isLoading,
|
||||
environment: environments.length > 0 ? environments[0] : undefined,
|
||||
environment,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue