1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 15:59:41 +02:00

refactor(docker/containers): migrate env vars to react [EE-5211] (#10345)

This commit is contained in:
Chaim Lev-Ari 2023-09-21 04:11:18 +03:00 committed by GitHub
parent 54112b56f2
commit 16ccf5871e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 103 additions and 24 deletions

View file

@ -0,0 +1,32 @@
import { useState } from 'react';
import { EnvironmentVariablesPanel } from '@@/form-components/EnvironmentVariablesFieldset';
import { ArrayError } from '@@/form-components/InputList/InputList';
import { Values } from './types';
export function EnvVarsTab({
values: initialValues,
onChange,
errors,
}: {
values: Values;
onChange(value: Values): void;
errors?: ArrayError<Values>;
}) {
const [values, setControlledValues] = useState(initialValues);
return (
<EnvironmentVariablesPanel
values={values}
explanation="These values will be applied to the container when deployed"
onChange={handleChange}
errors={errors}
/>
);
function handleChange(values: Values) {
setControlledValues(values);
onChange(values);
}
}