diff --git a/frontend/src/components/test-detail/TeamTabs.tsx b/frontend/src/components/test-detail/TeamTabs.tsx index 477161b..772b758 100644 --- a/frontend/src/components/test-detail/TeamTabs.tsx +++ b/frontend/src/components/test-detail/TeamTabs.tsx @@ -148,6 +148,11 @@ export default function TeamTabs({ ((role === "blue_lead" || role === "admin") || (role === "blue_tech" && !!test.blue_work_started_at)); + // Containment fields only visible when attack was detected (draft or saved value) + const isDetected = canEditBlue + ? blueDraft.detection_result === "detected" || blueDraft.detection_result === "partially_detected" + : test.detection_result === "detected" || test.detection_result === "partially_detected"; + // Hint messages shown to operators when editing is locked const redLockedHint = test.state === "draft" && role === "red_tech" @@ -238,11 +243,12 @@ export default function TeamTabs({
{canEditRed ? ( onRedFieldChange("execution_start_time", e.target.value)} className="w-full rounded-lg border border-gray-700 bg-gray-800 px-3 py-2 text-sm text-gray-200 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500" @@ -255,11 +261,12 @@ export default function TeamTabs({
{canEditRed ? ( onRedFieldChange("execution_end_time", e.target.value)} className="w-full rounded-lg border border-gray-700 bg-gray-800 px-3 py-2 text-sm text-gray-200 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500" @@ -391,63 +398,61 @@ export default function TeamTabs({ )}
- {/* Containment Result */} -
- - {canEditBlue ? ( -
- {CONTAINMENT_RESULTS.map((opt) => ( - - ))} - {blueDraft.detection_result === "not_detected" && ( - N/A — attack not detected - )} -
- ) : ( -

- {test.containment_result ? ( - - {test.containment_result.replace(/_/g, " ")} - - ) : test.detection_result === "not_detected" ? ( - N/A - ) : ( - Not evaluated yet - )} -

- )} -
+ {/* Containment Result — only when detected/partially_detected */} + {isDetected && ( +
+ + {canEditBlue ? ( +
+ {CONTAINMENT_RESULTS.map((opt) => ( + + ))} +
+ ) : ( +

+ {test.containment_result ? ( + + {test.containment_result.replace(/_/g, " ")} + + ) : ( + Not evaluated yet + )} +

+ )} +
+ )} - {/* Detection & Containment times — only relevant when detected */} - {(canEditBlue || test.detection_result === "detected" || test.detection_result === "partially_detected") && ( + {/* Detection & Containment times — only when detected/partially_detected */} + {isDetected && (
{canEditBlue ? ( onBlueFieldChange("detection_time", e.target.value)} className="w-full rounded-lg border border-gray-700 bg-gray-800 px-3 py-2 text-sm text-gray-200 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500" @@ -460,11 +465,12 @@ export default function TeamTabs({
{canEditBlue ? ( onBlueFieldChange("containment_time", e.target.value)} className="w-full rounded-lg border border-gray-700 bg-gray-800 px-3 py-2 text-sm text-gray-200 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500" diff --git a/frontend/src/pages/TestDetailPage.tsx b/frontend/src/pages/TestDetailPage.tsx index 1d5638a..74baaeb 100644 --- a/frontend/src/pages/TestDetailPage.tsx +++ b/frontend/src/pages/TestDetailPage.tsx @@ -471,7 +471,11 @@ export default function TestDetailPage() {
{canSaveRed && (