diff --git a/src/components/orphan-cleanup-task-modal.tsx b/src/components/orphan-cleanup-task-modal.tsx index 80b5609..9ee3cca 100644 --- a/src/components/orphan-cleanup-task-modal.tsx +++ b/src/components/orphan-cleanup-task-modal.tsx @@ -7,6 +7,7 @@ import { NumberInput, } from '@patternfly/react-core'; import React from 'react'; +import { FormFieldHelper } from 'src/components/form-field-helper'; interface IProps { cancelAction: () => void; @@ -48,14 +49,29 @@ export const OrphanCleanupTaskModal = (props: IProps) => { orphan_protection_time: taskValue.orphan_protection_time - 1, }); }} + onChange={(event) => { + // @ts-expect-error:Property 'value' does not exist on type 'EventTarget'. + const value = Number(event.target.value); + if (value < 0 || Number.isNaN(value)) { + updateTask({ + orphan_protection_time: 0, + }); + } else { + updateTask({ + orphan_protection_time: value, + }); + } + }} min={0} - max={100} onPlus={() => { updateTask({ orphan_protection_time: taskValue.orphan_protection_time + 1, }); }} /> + + {t`The value is in minutes. Usually the default is a day (1440). If set to zero it will clean all orphans.`} +
diff --git a/src/containers/task-management/task-list-view.tsx b/src/containers/task-management/task-list-view.tsx index 56ed0d8..8ffad14 100644 --- a/src/containers/task-management/task-list-view.tsx +++ b/src/containers/task-management/task-list-view.tsx @@ -68,6 +68,8 @@ interface IState { repairTask: { verify_checksums: boolean }; } +const ORPHAN_PROTECTION_TIME = 1440; + export class TaskListView extends Component { constructor(props) { super(props); @@ -102,7 +104,7 @@ export class TaskListView extends Component { finished_before: `${today.getFullYear()}-${today.getMonth() + 1}-${today.getDate()}`, states: ['completed'], }, - orphanCleanupTask: { orphan_protection_time: 0 }, + orphanCleanupTask: { orphan_protection_time: ORPHAN_PROTECTION_TIME }, repairTask: { verify_checksums: true }, }; }