1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-19 05:19:39 +02:00
portainer/app/react/edge/edge-stacks/utils.ts
Ali 4e8b371fb7
fix(gitops): clean trailing slash [EE-6346] (#10777)
Co-authored-by: testa113 <testa113>
2023-12-07 13:43:01 +13:00

21 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];
}