diff --git a/src/routes/recurringJob/CreateRecurringJob.js b/src/routes/recurringJob/CreateRecurringJob.js index 0ffeac53..7716da6b 100644 --- a/src/routes/recurringJob/CreateRecurringJob.js +++ b/src/routes/recurringJob/CreateRecurringJob.js @@ -107,7 +107,6 @@ const modal = ({ data.parameters = {} data.parameters[data.parametersKey] = data.parametersValue.toString() } - delete data.parametersKey delete data.parametersValue onOk(data) @@ -154,6 +153,16 @@ const modal = ({ }) } } + + const handleParameterChange = (value) => { + // clear parametersValue if parametersKey is cleared + if (value === undefined) { + setFieldsValue({ + parametersValue: '', + }) + } + } + const onCronOk = () => { // CronProps.cron changed by the parent component and passed on to the current component. setFieldsValue({ @@ -349,20 +358,14 @@ const modal = ({
{getFieldDecorator('parametersKey', { - initialValue: isEdit ? Object.keys(item?.parameters)[0] : '', - })( )} {getFieldDecorator('parametersValue', { - initialValue: isEdit ? Object.values(item?.parameters)[0] : '', - rules: [ - { - required: getFieldValue('parametersKey') !== '', - message: 'interval number is required', - }, - ], + initialValue: isEdit && item?.parameters && Object.keys(item.parameters)[0] ? Object.values(item.parameters)[0] : '', })()}