mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 07:49:41 +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,7 +1,5 @@
|
|||
import { useState } from 'react';
|
||||
import { FormikErrors } from 'formik';
|
||||
|
||||
import { InputList } from '@@/form-components/InputList';
|
||||
import { ArrayError } from '@@/form-components/InputList/InputList';
|
||||
|
||||
import { Values, Volume } from './types';
|
||||
import { InputContext } from './context';
|
||||
|
@ -16,17 +14,15 @@ export function VolumesTab({
|
|||
onChange: (values: Values) => void;
|
||||
values: Values;
|
||||
allowBindMounts: boolean;
|
||||
errors?: FormikErrors<Values>;
|
||||
errors?: ArrayError<Values>;
|
||||
}) {
|
||||
const [controlledValues, setControlledValues] = useState(values);
|
||||
|
||||
return (
|
||||
<InputContext.Provider value={allowBindMounts}>
|
||||
<InputList<Volume>
|
||||
errors={Array.isArray(errors) ? errors : []}
|
||||
label="Volume mapping"
|
||||
onChange={(volumes) => handleChange(volumes)}
|
||||
value={controlledValues}
|
||||
value={values}
|
||||
addLabel="map additional volume"
|
||||
item={Item}
|
||||
itemBuilder={() => ({
|
||||
|
@ -41,6 +37,5 @@ export function VolumesTab({
|
|||
|
||||
function handleChange(newValues: Values) {
|
||||
onChange(newValues);
|
||||
setControlledValues(() => newValues);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue