Skip to content

Commit

Permalink
fix: backrest can erroneously show 'forget snapshot' button for resto…
Browse files Browse the repository at this point in the history
…re entries
  • Loading branch information
garethgeorge committed Sep 7, 2024
1 parent 0d01c5c commit bfde425
Showing 1 changed file with 29 additions and 24 deletions.
53 changes: 29 additions & 24 deletions webui/src/components/OperationTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -463,34 +463,39 @@ const BackupView = ({ backup }: { backup?: FlowDisplayInfo }) => {
}
};

const deleteButton = backup.snapshotID ? (
<Tooltip title="This will remove the snapshot from the repository. This is irreversible.">
const snapshotInFlow = backup?.operations.find(
(op) => op.op.case === "operationIndexSnapshot",
);

const deleteButton =
snapshotInFlow && snapshotInFlow.snapshotId ? (
<Tooltip title="This will remove the snapshot from the repository. This is irreversible.">
<ConfirmButton
type="text"
confirmTitle="Confirm forget?"
confirmTimeout={2000}
onClickAsync={doDeleteSnapshot}
>
Forget (Destructive)
</ConfirmButton>
</Tooltip>
) : (
<ConfirmButton
type="text"
confirmTitle="Confirm forget?"
confirmTimeout={2000}
onClickAsync={doDeleteSnapshot}
confirmTitle="Confirm clear?"
onClickAsync={async () => {
backrestService.clearHistory(
new ClearHistoryRequest({
selector: new OpSelector({
ids: backup.operations.map((op) => op.id),
}),
}),
);
}}
>
Forget (Destructive)
Delete Event
</ConfirmButton>
</Tooltip>
) : (
<ConfirmButton
type="text"
confirmTitle="Confirm clear?"
onClickAsync={async () => {
backrestService.clearHistory(
new ClearHistoryRequest({
selector: new OpSelector({
ids: backup.operations.map((op) => op.id),
}),
}),
);
}}
>
Delete Event
</ConfirmButton>
);
);

return (
<div style={{ width: "100%" }}>
Expand Down

0 comments on commit bfde425

Please sign in to comment.