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

pull/10708/head
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) {
case EnvironmentType.Docker:
return 'Docker';
case EnvironmentType.AgentOnDocker:
return 'Docker Agent';
case EnvironmentType.KubernetesLocal:
return 'Kubernetes';
default:

View File

@ -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,
};
}