- TestCase 新增 startedAt / completedAt 字段 - 流转到"执行中"时记录 startedAt - 流转到"通过/失败/阻塞"时记录 completedAt - 回退到执行中时清除 completedAt - 测试耗时 = startedAt → completedAt 工作日 × 8h - 列表行显示耗时,详情抽屉显示开始/完成/耗时 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
37 lines
1.5 KiB
TypeScript
37 lines
1.5 KiB
TypeScript
'use client';
|
|
|
|
import { TestCaseStatusBadge } from './TestCaseStatusBadge';
|
|
import { calcActualHoursByDates } from '@/lib/dev-task';
|
|
import type { TestCase } from '@/lib/test-case';
|
|
|
|
interface Props {
|
|
testCase: TestCase;
|
|
bugCount: number;
|
|
onClick?: () => void;
|
|
}
|
|
|
|
const PRIORITY_DOT: Record<string, string> = {
|
|
P0: 'bg-red-500',
|
|
P1: 'bg-orange-400',
|
|
P2: 'bg-blue-400',
|
|
P3: 'bg-zinc-300',
|
|
};
|
|
|
|
export function TestCaseRow({ testCase, bugCount, onClick }: Props) {
|
|
return (
|
|
<div onClick={onClick} className="flex items-center gap-3 px-4 py-2.5 border-b border-[var(--line)] hover:bg-[var(--bg-subtle)] cursor-pointer transition-colors last:border-b-0">
|
|
<span className={`h-2 w-2 rounded-full shrink-0 ${PRIORITY_DOT[testCase.priority] || 'bg-zinc-300'}`} />
|
|
<span className="text-[11px] font-mono text-[var(--ink-muted)] w-14 shrink-0">{testCase.caseNo}</span>
|
|
<span className="text-[13px] text-[var(--ink)] flex-1 truncate">{testCase.title}</span>
|
|
<TestCaseStatusBadge status={testCase.status} />
|
|
{testCase.startedAt && (
|
|
<span className="text-[11px] text-[var(--ink-muted)] tabular-nums w-10 text-right">{calcActualHoursByDates(testCase.startedAt, testCase.completedAt)}h</span>
|
|
)}
|
|
{bugCount > 0 && (
|
|
<span className="text-[10px] text-red-500 bg-red-50 px-1.5 py-0.5 rounded">{bugCount} Bug</span>
|
|
)}
|
|
<span className="text-[11px] text-[var(--ink-soft)] w-14 text-right truncate">{testCase.assigneeId || '-'}</span>
|
|
</div>
|
|
);
|
|
}
|