Fix start server tasking; closes #1928
This commit is contained in:
parent
a1c3730861
commit
7a3263f57b
1 changed files with 11 additions and 10 deletions
|
@ -10,6 +10,7 @@ import FlashMessageRender from '@/components/FlashMessageRender';
|
||||||
import { number, object, string } from 'yup';
|
import { number, object, string } from 'yup';
|
||||||
import useFlash from '@/plugins/useFlash';
|
import useFlash from '@/plugins/useFlash';
|
||||||
import useServer from '@/plugins/useServer';
|
import useServer from '@/plugins/useServer';
|
||||||
|
import FormikFieldWrapper from '@/components/elements/FormikFieldWrapper';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
schedule: Schedule;
|
schedule: Schedule;
|
||||||
|
@ -29,10 +30,8 @@ const TaskDetailsForm = ({ isEditingTask }: { isEditingTask: boolean }) => {
|
||||||
const { values: { action }, setFieldValue, setFieldTouched } = useFormikContext<Values>();
|
const { values: { action }, setFieldValue, setFieldTouched } = useFormikContext<Values>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return () => {
|
setFieldValue('payload', action === 'power' ? 'start' : '');
|
||||||
setFieldValue('payload', '');
|
|
||||||
setFieldTouched('payload', false);
|
setFieldTouched('payload', false);
|
||||||
};
|
|
||||||
}, [ action ]);
|
}, [ action ]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -56,12 +55,14 @@ const TaskDetailsForm = ({ isEditingTask }: { isEditingTask: boolean }) => {
|
||||||
:
|
:
|
||||||
<div>
|
<div>
|
||||||
<label className={'input-dark-label'}>Payload</label>
|
<label className={'input-dark-label'}>Payload</label>
|
||||||
|
<FormikFieldWrapper name={'payload'}>
|
||||||
<FormikField as={'select'} name={'payload'} className={'input-dark'}>
|
<FormikField as={'select'} name={'payload'} className={'input-dark'}>
|
||||||
<option value={'start'}>Start the server</option>
|
<option value={'start'}>Start the server</option>
|
||||||
<option value={'restart'}>Restart the server</option>
|
<option value={'restart'}>Restart the server</option>
|
||||||
<option value={'stop'}>Stop the server</option>
|
<option value={'stop'}>Stop the server</option>
|
||||||
<option value={'kill'}>Terminate the server</option>
|
<option value={'kill'}>Terminate the server</option>
|
||||||
</FormikField>
|
</FormikField>
|
||||||
|
</FormikFieldWrapper>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue