import clsx from 'clsx'; import { RotateCw, List } from 'lucide-react'; import { FormikErrors } from 'formik'; import { InputGroup } from '@@/form-components/InputGroup'; import { Button } from '@@/buttons'; import { FormError } from '@@/form-components/FormError'; import { isArrayErrorType } from '@@/form-components/formikUtils'; import { ConfigurationOverrideKey } from './types'; type Props = { value: ConfigurationOverrideKey; onChange: (value: ConfigurationOverrideKey) => void; configurationIndex: number; keyIndex: number; overrideKeysErrors?: | string | string[] | FormikErrors[]; dataCyType: 'config' | 'secret'; }; export function ConfigurationData({ value, onChange, overrideKeysErrors, configurationIndex, keyIndex, dataCyType, }: Props) { // rule out the error (from formik) being of type string const overriddenKeyError = isArrayErrorType(overrideKeysErrors) ? overrideKeysErrors[keyIndex] : undefined; return (
Key {value.type === 'FILESYSTEM' && (
Path on disk onChange({ ...value, path: e.target.value })} data-cy={`k8sAppCreate-${dataCyType}PathOnDiskInput_${configurationIndex}_${keyIndex}`} /> {overriddenKeyError?.path && ( {overriddenKeyError.path} )}
)}
); }