Files
Chaim Lev-Ari dd68560ad0 chore(deps): upgrade prettier (#2592)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13 16:39:58 +03:00

24 lines
700 B
TypeScript

import _ from 'lodash';
import { useEdgeGroups } from '@/react/edge/edge-groups/queries/useEdgeGroups';
import { EnvironmentType } from '@/react/portainer/environments/types';
import { DeploymentType, EdgeStack } from '../../types';
export function useAllowKubeToSelectCompose(edgeStack: EdgeStack) {
const edgeGroupsQuery = useEdgeGroups();
const initiallyContainsKubeEnv = _.compact(
edgeStack.EdgeGroups.map((id) =>
edgeGroupsQuery.data?.find((e) => e.Id === id)
)
)
.flatMap((group) => group.EndpointTypes)
.includes(EnvironmentType.EdgeAgentOnKubernetes);
return (
initiallyContainsKubeEnv &&
edgeStack.DeploymentType === DeploymentType.Compose
);
}