From 3aa289541f0cdfabd5ca0d9031cafa105763ad31 Mon Sep 17 00:00:00 2001 From: Gareth George Date: Thu, 21 Dec 2023 01:01:17 +0000 Subject: [PATCH] fix: hide no-op prune operations --- internal/orchestrator/taskprune.go | 2 +- webui/src/components/OperationList.tsx | 12 ++++++------ webui/src/components/OperationTree.tsx | 3 --- webui/src/state/oplog.ts | 13 ++----------- 4 files changed, 9 insertions(+), 21 deletions(-) diff --git a/internal/orchestrator/taskprune.go b/internal/orchestrator/taskprune.go index bb9d8894..6c4c9f23 100644 --- a/internal/orchestrator/taskprune.go +++ b/internal/orchestrator/taskprune.go @@ -92,7 +92,7 @@ func (t *PruneTask) Run(ctx context.Context) error { return fmt.Errorf("get next prune time: %w", err) } if nextPruneTime.After(time.Now()) { - opPrune.OperationPrune.Output = "Skipping prune operation.\nPrune will next run at (or after): " + nextPruneTime.String() + "\nAdjust prune policy's MaxFrequencyDays to increase or decrease the interval." + op.Status = v1.OperationStatus_STATUS_SYSTEM_CANCELLED return nil } } diff --git a/webui/src/components/OperationList.tsx b/webui/src/components/OperationList.tsx index e3977a4f..6933127d 100644 --- a/webui/src/components/OperationList.tsx +++ b/webui/src/components/OperationList.tsx @@ -88,9 +88,6 @@ export const OperationList = ({ backupCollector.subscribe(() => { let backups = backupCollector.getAll(); - backups = backups.filter((b) => { - return !shouldHideStatus(b.status); - }); backups.sort((a, b) => { return b.startTimeMs - a.startTimeMs; }); @@ -134,9 +131,12 @@ export const OperationList = ({ return ( - {ops.map((op) => ( - - ))} + {ops.map((op) => { + if (shouldHideStatus(op.status!)) { + return null; + } + return + })} ); }} diff --git a/webui/src/components/OperationTree.tsx b/webui/src/components/OperationTree.tsx index 9761df2e..7b1ac97e 100644 --- a/webui/src/components/OperationTree.tsx +++ b/webui/src/components/OperationTree.tsx @@ -60,9 +60,6 @@ export const OperationTree = ({ backupCollector.subscribe(() => { let backups = backupCollector.getAll(); - backups = backups.filter((b) => { - return !shouldHideStatus(b.status); - }); backups.sort((a, b) => { return b.startTimeMs - a.startTimeMs; }); diff --git a/webui/src/state/oplog.ts b/webui/src/state/oplog.ts index b1863bbb..83519008 100644 --- a/webui/src/state/oplog.ts +++ b/webui/src/state/oplog.ts @@ -120,7 +120,7 @@ export class BackupInfoCollector { existing.endTimeMs = Math.max(existing.endTimeMs, newInfo.endTimeMs); existing.displayTime = new Date(existing.startTimeMs); existing.displayType = DisplayType.SNAPSHOT; - if (newInfo.startTimeMs >= existing.startTimeMs) { + if (newInfo.startTimeMs >= existing.startTimeMs && newInfo.status !== OperationStatus.STATUS_SYSTEM_CANCELLED) { // don't overwrite with cancelled status since that operation will be hidden. existing.status = newInfo.status; // use the latest status } existing.operations = _.uniqBy( @@ -219,16 +219,7 @@ export class BackupInfoCollector { public getAll(): BackupInfo[] { const arr = []; arr.push(...Object.values(this.backupByOpId)); - arr.push( - ...Object.values(this.backupBySnapshotId).filter((b) => { - for (const op of b.operations) { - if (op.operationIndexSnapshot && op.operationIndexSnapshot.forgot) { - return false; - } - } - return true; - }) - ); + arr.push(...Object.values(this.backupBySnapshotId)); return arr; }