feat(frontend): sprint 3 — multi-technique MITRE selection + matrix modal
- types: replace mitre_technique_id/name scalars with techniques:MitreTechnique[] on Simulation; add MitreTactic/MitreMatrixTechnique/MitreMatrixSubtechnique; SimulationPatchInput now uses technique_ids:string[] - api/mitre.ts: add getMitreMatrix() → GET /api/mitre/matrix - hooks/useMitre: add useMitreMatrix(enabled) with staleTime:Infinity - MitreTechniquePicker: clean rewrite — onSelect(technique) one-shot, resets input after selection, no incoming value props - MitreTechniqueTag: chip component with id+name and × remove button - MitreMatrixModal: tactic columns (220px fixed), expand/collapse subtechniques, search filter (auto-expands parent on sub match), selection state, focus trap (Tab wrap, Escape, search autofocus), backdrop click cancel, Apply N techniques - MitreTechniquesField: orchestrates tags+picker+matrix with auto-save PATCH on every add/remove/Apply, dedup guard, disabled read-only mode for SOC - SimulationFormPage: swap MitreTechniquePicker for MitreTechniquesField; remove technique state from RT form (techniques have independent auto-save cycle) - SimulationList: MITRE column → T1059 +2 counter format, — when empty - Tests: 84 passing (13 test files); new suites for Tag, Field, Modal; MitreTechniquePicker + SimulationFormPage + SimulationList adapted to new API Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,12 +16,10 @@ import { LoadingState } from '@/components/LoadingState';
|
||||
import { ErrorState } from '@/components/ErrorState';
|
||||
import { SimulationStatusBadge } from '@/components/SimulationStatusBadge';
|
||||
import { ConfirmDialog } from '@/components/ConfirmDialog';
|
||||
import { MitreTechniquePicker } from '@/components/MitreTechniquePicker';
|
||||
import { MitreTechniquesField } from '@/components/MitreTechniquesField';
|
||||
|
||||
interface RedteamFormState {
|
||||
name: string;
|
||||
mitre_technique_id: string | null;
|
||||
mitre_technique_name: string | null;
|
||||
description: string;
|
||||
commands: string;
|
||||
prerequisites: string;
|
||||
@@ -38,8 +36,6 @@ interface SocFormState {
|
||||
|
||||
const EMPTY_RT: RedteamFormState = {
|
||||
name: '',
|
||||
mitre_technique_id: null,
|
||||
mitre_technique_name: null,
|
||||
description: '',
|
||||
commands: '',
|
||||
prerequisites: '',
|
||||
@@ -81,8 +77,6 @@ export function SimulationFormPage(): JSX.Element {
|
||||
const s = detail.data;
|
||||
setRt({
|
||||
name: s.name,
|
||||
mitre_technique_id: s.mitre_technique_id,
|
||||
mitre_technique_name: s.mitre_technique_name,
|
||||
description: s.description ?? '',
|
||||
commands: s.commands ?? '',
|
||||
prerequisites: s.prerequisites ?? '',
|
||||
@@ -154,8 +148,6 @@ export function SimulationFormPage(): JSX.Element {
|
||||
}
|
||||
const patch: SimulationPatchInput = {
|
||||
name: rt.name.trim(),
|
||||
mitre_technique_id: rt.mitre_technique_id ?? null,
|
||||
mitre_technique_name: rt.mitre_technique_name ?? null,
|
||||
description: rt.description.trim() || null,
|
||||
commands: rt.commands.trim() || null,
|
||||
prerequisites: rt.prerequisites.trim() || null,
|
||||
@@ -314,16 +306,15 @@ export function SimulationFormPage(): JSX.Element {
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<FormField label="MITRE Technique" htmlFor="sim-mitre">
|
||||
<MitreTechniquePicker
|
||||
techniqueId={rt.mitre_technique_id}
|
||||
techniqueName={rt.mitre_technique_name}
|
||||
onChange={(id, name) =>
|
||||
setRt({ ...rt, mitre_technique_id: id, mitre_technique_name: name })
|
||||
}
|
||||
<div className="flex flex-col gap-xs">
|
||||
<span className="text-[14px] font-medium text-ink">MITRE Techniques</span>
|
||||
<MitreTechniquesField
|
||||
value={simulation?.techniques ?? []}
|
||||
simulationId={simulationId as number}
|
||||
engagementId={engagementId as number}
|
||||
disabled={rtDisabled}
|
||||
/>
|
||||
</FormField>
|
||||
</div>
|
||||
|
||||
<FormField label="Description" htmlFor="sim-description">
|
||||
<TextArea
|
||||
|
||||
Reference in New Issue
Block a user