import { FormikErrors } from 'formik'; import { useState } from 'react'; import { FormControl } from '@@/form-components/FormControl'; import { Input } from '@@/form-components/Input'; import { ConsoleSettings } from './ConsoleSettings'; import { LoggerConfig } from './LoggerConfig'; import { OverridableInput } from './OverridableInput'; import { Values } from './types'; export function CommandsTab({ apiVersion, values, onChange, errors, }: { apiVersion: number; values: Values; onChange: (values: Values) => void; errors?: FormikErrors; }) { const [controlledValues, setControlledValues] = useState(values); return (
handleChange({ cmd })} id="command-input" placeholder="e.g. '-logtostderr' '--housekeeping_interval=5s' or /usr/bin/nginx -t -c /mynginx.conf" /> handleChange({ entrypoint })} id="entrypoint-input" placeholder="e.g. /bin/sh -c" />
handleChange({ workingDir: e.target.value })} placeholder="e.g. /myapp" /> handleChange({ user: e.target.value })} placeholder="e.g. nginx" />
handleChange({ console })} /> handleChange({ logConfig, }) } errors={errors?.logConfig} />
); function handleChange(newValues: Partial) { onChange({ ...values, ...newValues }); setControlledValues((values) => ({ ...values, ...newValues })); } }