1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-19 21:39:40 +02:00
portainer/app/react/components/ImageConfigFieldset/AdvancedForm.tsx
cmeng d089dfbca0
fix(container): fix various creating container issues EE-6287 (#10595)
* fix(container): show placeholder for image field EE-6287

* fix(container): correct query params for search button field EE-6287

* fix(container): use btoa to encode registry credential EE-6287

* fix(container): allow creating non-existing option EE-6287

* fix(ui/forms): typeahead component

* fix(container): select the default registry EE-6287

* fix(container): always enable deploy button when always pull is off EE-6287

* fix(container): reset command fields outside current event to avoid validation on broken values EE-6287

* fix(container): query registry with endpoint ID param EE-6287

---------

Co-authored-by: Chaim Lev-Ari <chaim.levi-ari@portainer.io>
2023-11-16 08:50:23 +13:00

41 lines
1.1 KiB
TypeScript

import { FormikErrors } from 'formik';
import { FormControl } from '@@/form-components/FormControl';
import { Input } from '@@/form-components/Input';
import { TextTip } from '@@/Tip/TextTip';
import { Values } from './types';
export function AdvancedForm({
values,
errors,
onChangeImage,
setFieldValue,
}: {
values: Values;
errors?: FormikErrors<Values>;
onChangeImage?: (name: string) => void;
setFieldValue: <T>(field: string, value: T) => void;
}) {
return (
<>
<TextTip color="blue">
When using advanced mode, image and repository <b>must be</b> publicly
available.
</TextTip>
<FormControl label="Image" inputId="image-field" errors={errors?.image}>
<Input
id="image-field"
value={values.image}
onChange={(e) => {
const { value } = e.target;
setFieldValue('image', value);
setTimeout(() => onChangeImage?.(value), 0);
}}
placeholder="e.g. registry:port/my-image:my-tag"
required
/>
</FormControl>
</>
);
}