1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-19 13:29:41 +02:00
portainer/app/react/portainer/environments/wizard/EnvironmentsCreationView/useOnlyEdgeOptions.ts

17 lines
544 B
TypeScript

import { EnvironmentCreationTypes } from '@/react/portainer/environments/types';
import { Value, BoxSelectorOption } from '@@/BoxSelector/types';
import { useCreateEdgeDeviceParam } from '../hooks/useCreateEdgeDeviceParam';
export function useFilterEdgeOptionsIfNeeded<
T extends Value = EnvironmentCreationTypes
>(options: BoxSelectorOption<T>[], edgeValue: T) {
const createEdgeDevice = useCreateEdgeDeviceParam();
if (!createEdgeDevice) {
return options;
}
return options.filter((option) => option.value === edgeValue);
}