Skip to content

Commit

Permalink
fix: incorrrect handling of oplog events in UI
Browse files Browse the repository at this point in the history
  • Loading branch information
garethgeorge committed Dec 20, 2023
1 parent f239b91 commit 95ca96a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
28 changes: 15 additions & 13 deletions webui/src/components/OperationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,19 +253,21 @@ export const OperationRow = ({
items={[
{
key: 1,
label:
"Removed " +
forgetOp.forget?.length +
" Snapshots (Policy Details)",
children: (
<div>
<ul>
{policyDesc.map((desc) => (
<li>{desc}</li>
))}
</ul>
</div>
),
label: "Removed " + forgetOp.forget?.length + " Snapshots",
children: <>
Removed snapshots:
<pre>{forgetOp.forget?.map((f) => (
<>
{"removed snapshot " + normalizeSnapshotId(f.id!) + " taken at " + formatTime(f.unixTimeMs!)} <br />
</>
))}</pre>
Policy:
<ul>
{policyDesc.map((desc) => (
<li>{desc}</li>
))}
</ul>
</>,
},
]}
/>
Expand Down
2 changes: 2 additions & 0 deletions webui/src/components/OperationTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const OperationTree = ({

// track backups for this operation tree view.
useEffect(() => {
console.log("using effect");
setSelectedBackupId(null);
const backupCollector = new BackupInfoCollector();
const lis = (opEvent: OperationEvent) => {
Expand Down Expand Up @@ -119,6 +120,7 @@ export const OperationTree = ({
setSelectedBackupId(null);
return;
}
console.log("SELECTED ID: " + backup.id);
setSelectedBackupId(backup.id!);
}}
titleRender={(node: OpTreeNode): React.ReactNode => {
Expand Down
3 changes: 3 additions & 0 deletions webui/src/state/oplog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ export class BackupInfoCollector {
private backupBySnapshotId: { [key: string]: BackupInfo } = {};

private mergeBackups(existing: BackupInfo, newInfo: BackupInfo) {
if (existing.id > newInfo.id) {
existing.id = newInfo.id;
}
existing.startTimeMs = Math.min(existing.startTimeMs, newInfo.startTimeMs);
existing.endTimeMs = Math.max(existing.endTimeMs, newInfo.endTimeMs);
existing.displayTime = new Date(existing.startTimeMs);
Expand Down

0 comments on commit 95ca96a

Please sign in to comment.