fix: use hidden prop to always include form items
allow for a simpler change detection logic
by ensuring the fields are always present.
@@ -184,16 +184,22 @@ const ManageJob: React.FC<Props> = ({ onFinish, selectedRPStats, job, jobs, sche
labelCol={{ span: 6 }}
name="form basic"
ref={formRef}>
- {schedulerType === api.V1SchedulerType.PRIORITY && (
- <>
<Form.Item
extra="Priority is a whole number from 1 to 99 with 1 being the highest priority."
+ hidden={schedulerType !== api.V1SchedulerType.PRIORITY}
label="Priority"
name="priority">
<Input addonAfter="out of 99" max={99} min={1} type="number" />
</Form.Item>
- {process.env.IS_DEV && (
<Form.Item
+ extra="Priority is a whole number from 1 to 99 with 1 being the lowest priority."
+ hidden={schedulerType !== api.V1SchedulerType.KUBERNETES}
+ label="Priority"
+ name="priority">
+ <Input max={99} min={1} type="number" />
+ </Form.Item>
+ <Form.Item
+ hidden={!process.env.IS_DEV || schedulerType === api.V1SchedulerType.FAIRSHARE}
label="Position in Queue"
name="position">
<Input
@@ -203,24 +209,12 @@ const ManageJob: React.FC<Props> = ({ onFinish, selectedRPStats, job, jobs, sche
type="number"
/>
</Form.Item>
- )}
- </>
- )}
- {schedulerType === api.V1SchedulerType.KUBERNETES && (
- <Form.Item
- extra="Priority is a whole number from 1 to 99 with 1 being the lowest priority."
- label="Priority"
- name="priority">
- <Input max={99} min={1} type="number" />
- </Form.Item>
- )}
- {schedulerType === api.V1SchedulerType.FAIRSHARE && (
<Form.Item
+ hidden={schedulerType !== api.V1SchedulerType.FAIRSHARE}
label="Weight"
name="weight">
<Input min={0} type="number" />
</Form.Item>
- )}
<Form.Item
extra={poolDetails}
label="Resource Pool"
