From bfde425c2d03b0e4dc7c19381cb604dcba9d36e3 Mon Sep 17 00:00:00 2001 From: garethgeorge Date: Sat, 7 Sep 2024 13:59:55 -0700 Subject: [PATCH] fix: backrest can erroneously show 'forget snapshot' button for restore entries --- webui/src/components/OperationTree.tsx | 53 ++++++++++++++------------ 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/webui/src/components/OperationTree.tsx b/webui/src/components/OperationTree.tsx index b037ccc3..16e05747 100644 --- a/webui/src/components/OperationTree.tsx +++ b/webui/src/components/OperationTree.tsx @@ -463,34 +463,39 @@ const BackupView = ({ backup }: { backup?: FlowDisplayInfo }) => { } }; - const deleteButton = backup.snapshotID ? ( - + const snapshotInFlow = backup?.operations.find( + (op) => op.op.case === "operationIndexSnapshot", + ); + + const deleteButton = + snapshotInFlow && snapshotInFlow.snapshotId ? ( + + + Forget (Destructive) + + + ) : ( { + backrestService.clearHistory( + new ClearHistoryRequest({ + selector: new OpSelector({ + ids: backup.operations.map((op) => op.id), + }), + }), + ); + }} > - Forget (Destructive) + Delete Event - - ) : ( - { - backrestService.clearHistory( - new ClearHistoryRequest({ - selector: new OpSelector({ - ids: backup.operations.map((op) => op.id), - }), - }), - ); - }} - > - Delete Event - - ); + ); return (