import { FormikErrors } from 'formik'; import { array, SchemaOf, string } from 'yup'; import { FormError } from '@@/form-components/FormError'; import { InputList, ItemProps } from '@@/form-components/InputList'; import { InputLabeled } from '@@/form-components/Input/InputLabeled'; export type Values = Array; export function SecurityOptField({ values, onChange, errors, }: { values: Values; onChange: (value: Values) => void; errors?: FormikErrors[]; }) { return ( ''} data-cy="docker-container-securityopts" /> ); } function Item({ item, onChange, error, index }: ItemProps) { return (
onChange(e.target.value)} label="Security Option" placeholder="e.g. seccomp=unconfined" className="w-full" size="small" data-cy={`docker-container-securityopt-name_${index}`} />
{error && ( {typeof error === 'string' ? error : Object.values(error)[0]} )}
); } export function securityOptValidation(): SchemaOf { return array(string().required('Security option is required')); }