mirror of
https://github.com/garethgeorge/backrest.git
synced 2026-08-28 03:46:29 +00:00
fix: BackupInfoCollector handling of filtered events
This commit is contained in:
@@ -235,6 +235,7 @@ export class BackupInfoCollector {
|
||||
|
||||
public addOperation(event: OperationEventType, op: Operation): BackupInfo | null {
|
||||
if (!this.filter(op)) {
|
||||
this.removeOperation(op);
|
||||
return null;
|
||||
}
|
||||
const backupInfo = this.addHelper(op);
|
||||
@@ -245,7 +246,15 @@ export class BackupInfoCollector {
|
||||
// removeOperaiton is not quite correct from a formal standpoint; but will look correct in the UI.
|
||||
public removeOperation(op: Operation) {
|
||||
if (op.snapshotId) {
|
||||
this.backupBySnapshotId.delete(op.snapshotId);
|
||||
let existing = this.backupBySnapshotId.get(op.snapshotId);
|
||||
if (existing) {
|
||||
const operations = existing.operations.filter((o) => o.id !== op.id);
|
||||
if (operations.length === 0) {
|
||||
this.backupBySnapshotId.delete(op.snapshotId);
|
||||
} else {
|
||||
this.backupBySnapshotId.set(op.snapshotId, this.createBackup(operations));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.backupByOpId.delete(op.id);
|
||||
}
|
||||
@@ -293,7 +302,7 @@ export class BackupInfoCollector {
|
||||
...this.backupByOpId.values(),
|
||||
...this.backupBySnapshotId.values(),
|
||||
];
|
||||
return arr.filter((b) => !b.forgotten);
|
||||
return arr.filter((b) => !b.forgotten && !shouldHideStatus(b.status));
|
||||
}
|
||||
|
||||
public subscribe(
|
||||
|
||||
@@ -477,21 +477,17 @@ export const AddPlanModal = ({
|
||||
const RetentionPolicyView = () => {
|
||||
const form = Form.useFormInstance();
|
||||
const retention = Form.useWatch('retention', { form, preserve: true }) as RetentionPolicy | undefined;
|
||||
console.log("RETENTION: " + JSON.stringify(retention));
|
||||
|
||||
let [mode, setMode] = useState(0);
|
||||
useEffect(() => {
|
||||
if (!retention || (!retention.keepDaily && !retention.keepHourly && !retention.keepLastN && !retention.keepMonthly && !retention.keepWeekly && !retention.keepYearly)) {
|
||||
console.log("RETENTION NOT SET");
|
||||
setMode(0);
|
||||
} else if (!!retention.keepLastN) {
|
||||
console.log("KEEP LAST N: ", retention.keepLastN);
|
||||
setMode(1);
|
||||
} else {
|
||||
setMode(2);
|
||||
}
|
||||
}, [retention])
|
||||
console.log("MODE: ", mode);
|
||||
|
||||
let elem: React.ReactNode = null;
|
||||
if (mode === 0) {
|
||||
|
||||
Reference in New Issue
Block a user