feat(phase-13): update frontend types and API clients for Red/Blue workflow (T-113, T-114)
T-113: Rewrite models.ts with v2 types - TestState now includes red_executing/blue_evaluating, add TeamSide, ValidationStatus, TestTemplate, TestTemplateSummary, TestTimelineEntry types, RED_EDITABLE_STATES/BLUE_EDITABLE_STATES constants, and dual validation fields on Test interface. Remove old validated_by/validated_at references from TestDetailPage and techniques API. T-114: Rewrite tests.ts API client with 16 functions covering full Red/Blue workflow (createTestFromTemplate, updateTestRed/Blue, startExecution, submitRed/Blue, validateAsRedLead/BlueLead, reopenTest, getTestTimeline). Rewrite evidence.ts with team parameter on upload/list and new deleteEvidence. Create test-templates.ts with getTemplates, getTemplateById, getTemplatesByTechnique, createTemplate, importAtomicTests.
This commit is contained in:
@@ -20,6 +20,8 @@ import { useState } from "react";
|
||||
|
||||
const testStateBadgeColors: Record<TestState, string> = {
|
||||
draft: "bg-gray-800/50 text-gray-400 border-gray-600/30",
|
||||
red_executing: "bg-orange-900/50 text-orange-400 border-orange-500/30",
|
||||
blue_evaluating: "bg-indigo-900/50 text-indigo-400 border-indigo-500/30",
|
||||
in_review: "bg-blue-900/50 text-blue-400 border-blue-500/30",
|
||||
validated: "bg-green-900/50 text-green-400 border-green-500/30",
|
||||
rejected: "bg-red-900/50 text-red-400 border-red-500/30",
|
||||
@@ -60,7 +62,7 @@ export default function TestDetailPage() {
|
||||
});
|
||||
|
||||
const uploadMutation = useMutation({
|
||||
mutationFn: (file: File) => uploadEvidence(testId!, file),
|
||||
mutationFn: (file: File) => uploadEvidence(testId!, file, "red"),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ["test", testId] });
|
||||
},
|
||||
@@ -248,7 +250,7 @@ export default function TestDetailPage() {
|
||||
{/* Evidence List */}
|
||||
<div className="mt-6">
|
||||
<EvidenceList
|
||||
evidences={test.evidences || []}
|
||||
evidences={[...(test.red_evidences || []), ...(test.blue_evidences || [])]}
|
||||
onDownload={handleDownload}
|
||||
/>
|
||||
</div>
|
||||
@@ -277,11 +279,19 @@ export default function TestDetailPage() {
|
||||
{formatDate(test.execution_date)}
|
||||
</dd>
|
||||
</div>
|
||||
{test.validated_at && (
|
||||
{test.red_validated_at && (
|
||||
<div>
|
||||
<dt className="text-xs font-medium uppercase text-gray-500">Validated</dt>
|
||||
<dt className="text-xs font-medium uppercase text-gray-500">Red Validated</dt>
|
||||
<dd className="mt-1 text-sm text-gray-300">
|
||||
{formatDate(test.validated_at)}
|
||||
{formatDate(test.red_validated_at)}
|
||||
</dd>
|
||||
</div>
|
||||
)}
|
||||
{test.blue_validated_at && (
|
||||
<div>
|
||||
<dt className="text-xs font-medium uppercase text-gray-500">Blue Validated</dt>
|
||||
<dd className="mt-1 text-sm text-gray-300">
|
||||
{formatDate(test.blue_validated_at)}
|
||||
</dd>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user