feat: Phase 8 - Frontend main views (T-026 to T-031)
Implement all main frontend views for the MITRE ATT&CK coverage platform: - T-026: Dashboard with coverage summary cards and tactic breakdown table - T-027: Interactive ATT&CK matrix with filtering by status, tactic, platform - T-028: Technique detail page with tests, intel items, and review actions - T-029: Test creation form with technique selector and validation - T-030: Test detail page with drag and drop evidence upload and download - T-031: System admin panel with MITRE sync and intel scan controls New components: CoverageSummaryCard, TacticCoverageChart, AttackMatrix, TechniqueCell, TestForm, EvidenceUpload, EvidenceList New API modules: metrics.ts, techniques.ts, tests.ts, evidence.ts, system.ts All views use TanStack Query for data fetching with proper loading and error states. Role-based UI controls for admin/lead actions.
This commit is contained in:
67
frontend/src/api/tests.ts
Normal file
67
frontend/src/api/tests.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
import client from "./client";
|
||||
import type { Test, TestResult } from "../types/models";
|
||||
|
||||
export interface TestCreatePayload {
|
||||
technique_id: string;
|
||||
name: string;
|
||||
description?: string;
|
||||
platform?: string;
|
||||
procedure_text?: string;
|
||||
tool_used?: string;
|
||||
}
|
||||
|
||||
export interface TestUpdatePayload {
|
||||
name?: string;
|
||||
description?: string;
|
||||
platform?: string;
|
||||
procedure_text?: string;
|
||||
tool_used?: string;
|
||||
result?: TestResult;
|
||||
}
|
||||
|
||||
export interface TestValidatePayload {
|
||||
result: TestResult;
|
||||
comments?: string;
|
||||
}
|
||||
|
||||
export interface TestWithEvidences extends Test {
|
||||
evidences?: Array<{
|
||||
id: string;
|
||||
test_id: string;
|
||||
file_name: string;
|
||||
sha256_hash: string;
|
||||
uploaded_by: string | null;
|
||||
uploaded_at: string;
|
||||
download_url?: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
/** Create a new test. */
|
||||
export async function createTest(payload: TestCreatePayload): Promise<Test> {
|
||||
const { data } = await client.post<Test>("/tests", payload);
|
||||
return data;
|
||||
}
|
||||
|
||||
/** Get test by ID with evidences. */
|
||||
export async function getTestById(testId: string): Promise<TestWithEvidences> {
|
||||
const { data } = await client.get<TestWithEvidences>(`/tests/${testId}`);
|
||||
return data;
|
||||
}
|
||||
|
||||
/** Update a test (only draft/rejected). */
|
||||
export async function updateTest(testId: string, payload: TestUpdatePayload): Promise<Test> {
|
||||
const { data } = await client.patch<Test>(`/tests/${testId}`, payload);
|
||||
return data;
|
||||
}
|
||||
|
||||
/** Validate a test. */
|
||||
export async function validateTest(testId: string, payload: TestValidatePayload): Promise<Test> {
|
||||
const { data } = await client.post<Test>(`/tests/${testId}/validate`, payload);
|
||||
return data;
|
||||
}
|
||||
|
||||
/** Reject a test. */
|
||||
export async function rejectTest(testId: string): Promise<Test> {
|
||||
const { data } = await client.post<Test>(`/tests/${testId}/reject`);
|
||||
return data;
|
||||
}
|
||||
Reference in New Issue
Block a user