Skip to content

Commit edca6bb

Browse files
authored
Merge pull request #395 from demml/traceid-cross-page-pagination
Traceid cross page pagination
2 parents 40db314 + 5593de0 commit edca6bb

1 file changed

Lines changed: 22 additions & 12 deletions

File tree

crates/opsml_server/opsml_ui/src/lib/components/card/agent/evaluation/AgentEvalDashboard.svelte

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
// Working mutable state (refreshed on time range changes)
4949
let evalData = $state<AgentPromptEvalData[]>(agentPromptEvals);
5050
let isRefreshing = $state(false);
51+
let recordTraceMap = $state(new Map<string, string>());
5152
// Snapshot on mount so stale singleton state from prior navigation never triggers an immediate refresh.
5253
let lastSeenRange = $state(timeRangeState.selectedTimeRange);
5354
let lastSeenSignal = $state(timeRangeState.refreshSignal);
@@ -93,6 +94,7 @@
9394
console.error('[AgentEvalDashboard] Refresh failed:', err);
9495
} finally {
9596
isRefreshing = false;
97+
resetRecordTraceMap();
9698
timeRangeState.endRefresh();
9799
}
98100
}
@@ -118,6 +120,7 @@
118120
console.error('[AgentEvalDashboard] Record page change failed:', err);
119121
} finally {
120122
isRefreshing = false;
123+
appendToRecordTraceMap();
121124
timeRangeState.endRefresh();
122125
}
123126
}
@@ -147,6 +150,20 @@
147150
}
148151
}
149152
153+
function appendToRecordTraceMap() {
154+
evalData.forEach(e => {
155+
if (e.monitoringData.status !== 'success') return;
156+
e.monitoringData.selectedData.records?.items?.forEach(r => {
157+
if (r.trace_id) recordTraceMap.set(r.uid, r.trace_id);
158+
});
159+
});
160+
}
161+
162+
function resetRecordTraceMap() {
163+
recordTraceMap = new Map<string, string>();
164+
appendToRecordTraceMap();
165+
}
166+
150167
// ── Chart ─────────────────────────────────────────────────────────────────────
151168
Chart.register(zoomPlugin, annotationPlugin, Filler);
152169
@@ -290,14 +307,6 @@
290307
/** Merged workflow page: items from all evals sorted by created_at desc. */
291308
const workflowPage = $derived(
292309
(() => {
293-
const recordTraceMap = new Map<string, string>();
294-
evalData.forEach(e => {
295-
if (e.monitoringData.status !== 'success') return;
296-
e.monitoringData.selectedData.records?.items?.forEach(r => {
297-
if (r.trace_id) recordTraceMap.set(r.uid, r.trace_id);
298-
});
299-
});
300-
301310
const items: WorkflowWithAgent[] = [];
302311
let hasNext = false;
303312
let hasPrevious = false;
@@ -327,6 +336,7 @@
327336
328337
onMount(() => {
329338
currentMaxPoints = getMaxDataPoints();
339+
appendToRecordTraceMap();
330340
let timeoutId: ReturnType<typeof setTimeout>;
331341
const handleResize = () => {
332342
clearTimeout(timeoutId);
@@ -448,7 +458,7 @@
448458
<!-- ── Evaluation Records Table ──────────────────────────────────────────── -->
449459
<div class="grid grid-cols-1 gap-6">
450460
{#if recordPage.items.length > 0 || recordPage.hasPrevious}
451-
<div class="bg-white border-2 border-black shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] rounded-xl overflow-hidden flex flex-col h-full">
461+
<div class="bg-white border-2 border-black shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] rounded-base overflow-hidden flex flex-col h-full">
452462
<div class="bg-primary-100 border-b-2 border-black px-5 py-3 flex items-center justify-between flex-shrink-0">
453463
<div class="flex items-center gap-2">
454464
<TableProperties class="w-4 h-4 text-primary-700" />
@@ -458,7 +468,7 @@
458468
{recordPage.items.length}
459469
</span>
460470
</div>
461-
<div class="p-2 w-full flex-grow bg-slate-50 min-h-0">
471+
<div class="p-2 w-full flex-grow bg-surface-50 min-h-0">
462472
<AgentEvalRecordTable
463473
records={recordPage.items}
464474
hasNext={recordPage.hasNext}
@@ -471,7 +481,7 @@
471481
{/if}
472482

473483
{#if workflowPage.items.length > 0 || workflowPage.hasPrevious}
474-
<div class="bg-white border-2 border-black shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] rounded-xl overflow-hidden flex flex-col h-full">
484+
<div class="bg-white border-2 border-black shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] rounded-base overflow-hidden flex flex-col h-full">
475485
<div class="bg-primary-100 border-b-2 border-black px-5 py-3 flex items-center justify-between flex-shrink-0">
476486
<div class="flex items-center gap-2">
477487
<ArrowRightLeft class="w-4 h-4 text-primary-700"/>
@@ -481,7 +491,7 @@
481491
{workflowPage.items.length}
482492
</span>
483493
</div>
484-
<div class="p-2 w-full flex-grow bg-slate-50 min-h-0">
494+
<div class="p-2 w-full flex-grow bg-surface-50 min-h-0">
485495
<AgentEvalWorkflowTable
486496
workflows={workflowPage.items}
487497
hasNext={workflowPage.hasNext}

0 commit comments

Comments
 (0)