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:
parent
bc0050a7b4
commit
d970f0e2bc
71 changed files with 2612 additions and 1399 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue