Skip to content

Commit

Permalink
fix: proper display of retention policy
Browse files Browse the repository at this point in the history
  • Loading branch information
garethgeorge committed Mar 19, 2024
1 parent db4b76d commit 38ff5fe
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions webui/src/views/AddPlanModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ export const AddPlanModal = ({
{/* Disabled? toggles whether the plan will be scheduled. */}
<Form.Item label={<Tooltip title={"Toggles whether the plan's scheduling is enabled. If disabled no scheduled operations will be run."}>
Disable Scheduling
</Tooltip>} name="disabled" valuePropName="disabled">
</Tooltip>} name="disabled" valuePropName="checked">
<Checkbox />
</Form.Item>

Expand Down Expand Up @@ -488,22 +488,32 @@ const RetentionPolicyView = () => {
const retention = Form.useWatch('retention', { form, preserve: true }) as any;

const determineMode = () => {
console.log("DERIVE MODE BASED ON RETENTION: " + JSON.stringify(retention));
if (!retention || retention.policyTimeBucketed) {
if (!retention) {
return 2;
} else if (retention.policyKeepAll) {
return 0;
} else if (retention.policyKeepLastN) {
return 1;
} else if (retention.policyKeepAll) {
return 0;
} else if (retention.policyTimeBucketed) {
return 2;
}
}

const mode = determineMode();

let elem: React.ReactNode = null;
console.log("RENDERING WITH MODE: ", mode);
if (mode === 0) {
elem = <p>All backups are retained e.g. for append-only repos. Ensure that you manually forget / prune backups elsewhere. Backrest will register forgets performed externally on the next backup.</p>;
elem = <>
<p>All backups are retained e.g. for append-only repos. Ensure that you manually forget / prune backups elsewhere. Backrest will register forgets performed externally on the next backup.</p>
<Form.Item
name={["retention", "policyKeepAll"]}
valuePropName="checked"
initialValue={true}
hidden={true}
>
<Checkbox />
</Form.Item>
</>
} else if (mode === 1) {
elem = (
<Form.Item
Expand Down

0 comments on commit 38ff5fe

Please sign in to comment.