mirror of
https://github.com/portainer/portainer.git
synced 2025-07-20 22:09:41 +02:00
17 lines
563 B
TypeScript
17 lines
563 B
TypeScript
|
import _ from 'lodash';
|
||
|
|
||
|
import { EnvironmentType } from '@/react/portainer/environments/types';
|
||
|
|
||
|
import { EditorType } from './types';
|
||
|
|
||
|
export function getValidEditorTypes(endpointTypes: EnvironmentType[]) {
|
||
|
const right: Partial<Record<EnvironmentType, EditorType[]>> = {
|
||
|
[EnvironmentType.EdgeAgentOnDocker]: [EditorType.Compose],
|
||
|
[EnvironmentType.EdgeAgentOnKubernetes]: [EditorType.Kubernetes],
|
||
|
};
|
||
|
|
||
|
return endpointTypes.length
|
||
|
? _.intersection(...endpointTypes.map((type) => right[type]))
|
||
|
: [EditorType.Compose, EditorType.Kubernetes];
|
||
|
}
|