Files
portainer/app/react/edge/edge-stacks/utils.ts
T
Ali 90a160e83f
Test / test-client (push) Has been cancelled
Test / test-server (push) Has been cancelled
Revert "fix(gitops): correct commit hash link [EE-6346] (#10722)" (#10788)
This reverts commit 83cd5d9b2f.
2023-12-07 17:05:17 +13:00

22 lines
690 B
TypeScript

import _ from 'lodash';
import { EnvironmentType } from '@/react/portainer/environments/types';
import { EditorType } from './types';
export function getValidEditorTypes(
endpointTypes: EnvironmentType[],
allowKubeToSelectCompose?: boolean
) {
const right: Partial<Record<EnvironmentType, EditorType[]>> = {
[EnvironmentType.EdgeAgentOnDocker]: [EditorType.Compose],
[EnvironmentType.EdgeAgentOnKubernetes]: allowKubeToSelectCompose
? [EditorType.Kubernetes, EditorType.Compose]
: [EditorType.Kubernetes],
};
return endpointTypes.length
? _.intersection(...endpointTypes.map((type) => right[type]))
: [EditorType.Compose, EditorType.Kubernetes];
}