Skip to content

Commit daa4c71

Browse files
authored
feat(ui): link compare table values to run detail test modal (#176)
## Summary - Clicking a per-test value in the compare page's test comparison table now opens the run detail page in a new tab with the test modal pre-opened - Uses the existing `testModal` URL param on the run detail page ## Test plan - [x] On the compare page, click a value cell in the per-test comparison table - [x] Verify it opens the run detail page in a new tab with the correct test modal shown - [x] Verify cells with no value ("-") are not clickable
1 parent 5d71be4 commit daa4c71

1 file changed

Lines changed: 21 additions & 8 deletions

File tree

ui/src/components/compare/TestComparisonTable.tsx

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useMemo, useState } from 'react'
2+
import { Link } from '@tanstack/react-router'
23
import clsx from 'clsx'
34
import { Table } from 'lucide-react'
45
import type { SuiteTest, AggregatedStats, BlockLogs, BlockLogEntry } from '@/api/types'
@@ -387,14 +388,26 @@ export function TestComparisonTable({ runs, suiteTests, stepFilter, blockLogsPer
387388
: undefined
388389
return (
389390
<td key={RUN_SLOTS[i].label} className="whitespace-nowrap px-4 py-2 text-right text-sm/6">
390-
<div className={isRef ? 'font-semibold text-gray-900 dark:text-gray-100' : 'text-gray-500 dark:text-gray-400'}>
391-
{val !== undefined ? activeMetric.format(val) : '-'}
392-
</div>
393-
{diff !== undefined && !isRef && refValue! > 0 && (
394-
<div className="text-xs/4" style={{ color: getDiffColor(diff, refValue!) }}>
395-
{diff >= 0 ? '+' : '-'}{activeMetric.format(Math.abs(diff))}
396-
{' '}({diff >= 0 ? '+' : '-'}{((Math.abs(diff) / refValue!) * 100).toFixed(1)}%)
397-
</div>
391+
{val !== undefined ? (
392+
<Link
393+
to="/runs/$runId"
394+
params={{ runId: runs[i].runId }}
395+
search={{ testModal: test.name }}
396+
target="_blank"
397+
className="block hover:underline"
398+
>
399+
<div className={isRef ? 'font-semibold text-gray-900 dark:text-gray-100' : 'text-gray-500 dark:text-gray-400'}>
400+
{activeMetric.format(val)}
401+
</div>
402+
{diff !== undefined && !isRef && refValue! > 0 && (
403+
<div className="text-xs/4" style={{ color: getDiffColor(diff, refValue!) }}>
404+
{diff >= 0 ? '+' : '-'}{activeMetric.format(Math.abs(diff))}
405+
{' '}({diff >= 0 ? '+' : '-'}{((Math.abs(diff) / refValue!) * 100).toFixed(1)}%)
406+
</div>
407+
)}
408+
</Link>
409+
) : (
410+
<div className="text-gray-500 dark:text-gray-400">-</div>
398411
)}
399412
</td>
400413
)

0 commit comments

Comments
 (0)