1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-20 13:59:40 +02:00

refactor(containers): migrate create view to react [EE-2307] (#9175)

This commit is contained in:
Chaim Lev-Ari 2023-10-19 13:45:50 +02:00 committed by GitHub
parent bc0050a7b4
commit d970f0e2bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
71 changed files with 2612 additions and 1399 deletions

View file

@ -1,4 +1,4 @@
import { FormikErrors, useFormikContext } from 'formik';
import { FormikErrors } from 'formik';
import { FormControl } from '@@/form-components/FormControl';
import { Input } from '@@/form-components/Input';
@ -9,14 +9,14 @@ import { Values } from './types';
export function AdvancedForm({
values,
errors,
fieldNamespace,
onChangeImage,
setFieldValue,
}: {
values: Values;
errors?: FormikErrors<Values>;
fieldNamespace?: string;
onChangeImage?: (name: string) => void;
setFieldValue: <T>(field: string, value: T) => void;
}) {
const { setFieldValue } = useFormikContext<Values>();
return (
<>
<TextTip color="blue">
@ -27,15 +27,15 @@ export function AdvancedForm({
<Input
id="image-field"
value={values.image}
onChange={(e) => setFieldValue(namespaced('image'), e.target.value)}
onChange={(e) => {
const { value } = e.target;
setFieldValue('image', value);
onChangeImage?.(value);
}}
placeholder="e.g. registry:port/my-image:my-tag"
required
/>
</FormControl>
</>
);
function namespaced(field: string) {
return fieldNamespace ? `${fieldNamespace}.${field}` : field;
}
}