import * as React from 'react'; import { Alert, Box, Flex, FormControl, FormErrorMessage, FormHelperText, FormLabel, IconButton, Link, Select, Text, Textarea, Tooltip, } from '@chakra-ui/react'; import { Trash } from 'phosphor-react'; import { useTranslation } from 'react-i18next'; import { v4 as uuid } from 'uuid'; import { areRrmParamsValid } from './helper'; import { InfoPopover } from 'components/InfoPopover'; import { RrmAlgorithm } from 'hooks/Network/Rrm'; type Props = { algorithms?: RrmAlgorithm[]; value: { name: string; parameters: string }; onChange: (v: { name: string; parameters: string }) => void; onRemove: () => void; isDisabled?: boolean; options: { label: string; value: string; }[]; }; const AlgorithmPicker = ({ algorithms, value, onChange, onRemove, isDisabled, options }: Props) => { const { t } = useTranslation(); const details = algorithms?.find((a) => a.shortName === value.name); const onSelectChange = (e: React.ChangeEvent) => { onChange({ name: e.target.value, parameters: value.parameters }); }; const onAreaChange = (e: React.ChangeEvent) => { onChange({ name: value.name, parameters: e.target.value }); }; if (!algorithms || algorithms.length === 0 || !details) { return ( {t('rrm.algorithm')} {t('rrm.no_algos')} ); } return ( <> {details && ( {details.description} {t('common.details')}: {details.helper} )} } mt={1} /> {t('rrm.parameters')} Examples: {details?.parameterSamples}