feat(ai): 优化拆解重跑与结果展示
This commit is contained in:
@@ -121,7 +121,7 @@ export function TestCaseCreateModal({ versionId, requirementIds, onClose }: Prop
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-[12px] text-[var(--ink-soft)] mb-1">预估耗时 *</label>
|
||||
<label className="block text-[12px] text-[var(--ink-soft)] mb-1">执行预估耗时 *</label>
|
||||
<input
|
||||
type="number"
|
||||
min="0.25"
|
||||
|
||||
@@ -10,7 +10,7 @@ import { useRequirementStore } from '@/stores/useRequirementStore';
|
||||
import { useMemberStore } from '@/stores/useMemberStore';
|
||||
import { useTaskCategoryStore } from '@/stores/useTaskCategoryStore';
|
||||
import { CategoryChip } from '@/components/dev-task/CategoryChip';
|
||||
import { TC_ALLOWED_TRANSITIONS, TEST_CASE_STATUS_LABEL, getTestCaseActualHours, getTestCaseEstimateHours } from '@/lib/test-case';
|
||||
import { TC_ALLOWED_TRANSITIONS, TEST_CASE_STATUS_LABEL, getTestCaseActualHours } from '@/lib/test-case';
|
||||
import { formatWorkHours } from '@/lib/work-hours';
|
||||
import { formatDateTime } from '@/lib/format';
|
||||
import { BUG_SEVERITY_LABEL, BUG_SEVERITY_COLOR } from '@/lib/bug';
|
||||
@@ -39,7 +39,8 @@ export function TestCaseDetailDrawer({ testCaseId, onClose, onCreateBug, context
|
||||
const category = categories.find((c) => c.id === tc.categoryId);
|
||||
const relatedBugs = bugs.filter((b) => b.testCaseId === tc.id);
|
||||
const nextStatuses = TC_ALLOWED_TRANSITIONS[tc.status];
|
||||
const estimateHours = getTestCaseEstimateHours(tc);
|
||||
const executorEstimateHours = typeof tc.estimateHours === 'number' && tc.estimateHours > 0 ? tc.estimateHours : undefined;
|
||||
const aiEstimateHours = typeof tc.aiEstimateHours === 'number' && tc.aiEstimateHours > 0 ? tc.aiEstimateHours : undefined;
|
||||
const actualHours = getTestCaseActualHours(tc);
|
||||
|
||||
const [failReason, setFailReason] = useState('');
|
||||
@@ -159,7 +160,8 @@ export function TestCaseDetailDrawer({ testCaseId, onClose, onCreateBug, context
|
||||
<div><span className="text-[var(--ink-muted)]">优先级:</span><span className="text-[var(--ink)] font-medium">{tc.priority}</span></div>
|
||||
<div className="flex items-center gap-1.5"><span className="text-[var(--ink-muted)]">任务类型:</span><CategoryChip category={category} /></div>
|
||||
<div><span className="text-[var(--ink-muted)]">负责人:</span><span className="text-[var(--ink)] font-medium">{tc.assigneeId || '-'}</span></div>
|
||||
<div><span className="text-[var(--ink-muted)]">预估耗时:</span><span className="text-[var(--ink)] font-medium">{formatWorkHours(estimateHours)}</span></div>
|
||||
<div><span className="text-[var(--ink-muted)]">AI 预估:</span><span className="text-[var(--ink)] font-medium">{aiEstimateHours ? formatWorkHours(aiEstimateHours) : '—'}</span></div>
|
||||
<div><span className="text-[var(--ink-muted)]">执行预估:</span><span className="text-[var(--ink)] font-medium">{executorEstimateHours ? formatWorkHours(executorEstimateHours) : '待负责人填写'}</span></div>
|
||||
<div><span className="text-[var(--ink-muted)]">创建人:</span><span className="text-[var(--ink)]">{tc.createdBy}</span></div>
|
||||
<div><span className="text-[var(--ink-muted)]">创建日期:</span><span className="text-[var(--ink)]">{tc.createdAt.slice(0, 10)}</span></div>
|
||||
{tc.startedAt && <div><span className="text-[var(--ink-muted)]">开始执行:</span><span className="text-[var(--ink)]">{formatDateTime(tc.startedAt)}</span></div>}
|
||||
|
||||
@@ -25,6 +25,9 @@ const PRIORITY_DOT: Record<string, string> = {
|
||||
function TestCaseRowImpl({ testCase, category, bugCount, onClick }: Props) {
|
||||
const estimateHours = getTestCaseEstimateHours(testCase);
|
||||
const actualHours = getTestCaseActualHours(testCase);
|
||||
const hasExecutorEstimate = typeof testCase.estimateHours === 'number' && testCase.estimateHours > 0;
|
||||
const hasAiEstimate = typeof testCase.aiEstimateHours === 'number' && testCase.aiEstimateHours > 0;
|
||||
const estimatePrefix = hasExecutorEstimate ? '执行预' : hasAiEstimate ? 'AI预' : '预';
|
||||
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 ${testCase.aiDraft ? 'border-l-2 border-l-purple-400 bg-purple-50/30' : ''}`}>
|
||||
<span className={`h-2 w-2 rounded-full shrink-0 ${PRIORITY_DOT[testCase.priority] || 'bg-zinc-300'}`} />
|
||||
@@ -40,7 +43,7 @@ function TestCaseRowImpl({ testCase, category, bugCount, onClick }: Props) {
|
||||
</div>
|
||||
<TestCaseStatusBadge status={testCase.status} />
|
||||
<span className="text-[11px] text-[var(--ink-muted)] tabular-nums w-32 text-right shrink-0 whitespace-nowrap">
|
||||
{actualHours > 0 ? `${formatWorkHours(actualHours)} / ${formatWorkHours(estimateHours)}` : `预 ${formatWorkHours(estimateHours)}`}
|
||||
{actualHours > 0 ? `${formatWorkHours(actualHours)} / ${formatWorkHours(estimateHours)}` : `${estimatePrefix} ${formatWorkHours(estimateHours)}`}
|
||||
</span>
|
||||
{bugCount > 0 && (
|
||||
<span className="text-[10px] text-red-500 bg-red-50 px-1.5 py-0.5 rounded shrink-0">{bugCount} Bug</span>
|
||||
|
||||
Reference in New Issue
Block a user