fix: hide no-op prune operations

This commit is contained in:
Gareth George
2023-12-21 01:01:17 +00:00
parent 7f7f98bc6c
commit 3aa289541f
4 changed files with 9 additions and 21 deletions
+1 -1
View File
@@ -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
}
}
+6 -6
View File
@@ -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 (
<Card size="small" style={{ margin: "5px" }}>
{ops.map((op) => (
<OperationRow alertApi={alertApi!} key={op.id!} operation={toEop(op)} />
))}
{ops.map((op) => {
if (shouldHideStatus(op.status!)) {
return null;
}
return <OperationRow alertApi={alertApi!} key={op.id!} operation={toEop(op)} />
})}
</Card>
);
}}
-3
View File
@@ -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;
});
+2 -11
View File
@@ -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;
}