Fix running progress label: avoid stale node name between iterations
Made-with: Cursor
This commit is contained in:
25
src/App.tsx
25
src/App.tsx
@@ -1219,19 +1219,28 @@ export default function App() {
|
||||
<Badge variant="secondary" className="bg-[#f8fafc] text-[#94a3b8] border border-[#e2e8f0] font-bold text-[9px] uppercase tracking-wider px-2 py-0.5 rounded-md">Pending</Badge>
|
||||
) : (() => {
|
||||
const lastResult = testCase.results[testCase.results.length - 1];
|
||||
const runningStep = testCase.status === 'running' && lastResult?.trace?.find(s => s.status === 'running');
|
||||
const lastFinished = testCase.status === 'running' && lastResult?.trace?.slice().reverse().find(s => s.status !== 'running');
|
||||
const currentNodeLabel = runningStep?.title || lastFinished?.title;
|
||||
// Only surface the node label while a step is actively running,
|
||||
// so it clears between iterations instead of showing a stale one.
|
||||
const runningStep =
|
||||
testCase.status === 'running'
|
||||
? lastResult?.trace?.find(s => s.status === 'running')
|
||||
: undefined;
|
||||
const done = testCase.results.length;
|
||||
const total = testCase.times;
|
||||
return (
|
||||
<div className="flex flex-col gap-1.5 min-w-24">
|
||||
<Progress value={testCase.progress} className="h-1.5 bg-[#f1f5f9] [&>div]:bg-[#0f172a] rounded-full" />
|
||||
<span className="text-[9px] font-bold text-[#64748b] uppercase tracking-tighter truncate max-w-[180px]">
|
||||
<span className="text-[9px] font-bold text-[#64748b] uppercase tracking-tighter">
|
||||
{testCase.status === 'running'
|
||||
? (currentNodeLabel
|
||||
? `Node · ${currentNodeLabel}`
|
||||
: `In Progress (${testCase.results.length}/${testCase.times})`)
|
||||
: `Complete (${testCase.times}/${testCase.times})`}
|
||||
? `In Progress (${done}/${total})`
|
||||
: `Complete (${total}/${total})`}
|
||||
</span>
|
||||
{runningStep?.title && (
|
||||
<span className="flex items-center gap-1 text-[9px] text-slate-400 max-w-[200px]">
|
||||
<Activity className="h-2.5 w-2.5 shrink-0" />
|
||||
<span className="truncate">{runningStep.title}</span>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})()}
|
||||
|
||||
Reference in New Issue
Block a user