From 5be1c171cbcf0a25d413e113d36ac4d721cef1df Mon Sep 17 00:00:00 2001 From: Benjamin Admin Date: Thu, 7 May 2026 17:26:28 +0200 Subject: [PATCH] fix: Performance + Hazard-Tabelle Layout - Uebersicht: Nur noch 2 leichte API-Calls statt 4 (risk-summary statt alle Hazards/Mitigations laden) - RiskAssessmentTable: Gefaehrdungs-Spalte min-w-[250px] statt max-w-[200px], kein truncate mehr Co-Authored-By: Claude Opus 4.6 (1M context) --- .../_components/RiskAssessmentTable.tsx | 6 ++--- .../app/sdk/iace/[projectId]/page.tsx | 24 ++++++------------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/admin-compliance/app/sdk/iace/[projectId]/hazards/_components/RiskAssessmentTable.tsx b/admin-compliance/app/sdk/iace/[projectId]/hazards/_components/RiskAssessmentTable.tsx index ea8e4c6..66b6958 100644 --- a/admin-compliance/app/sdk/iace/[projectId]/hazards/_components/RiskAssessmentTable.tsx +++ b/admin-compliance/app/sdk/iace/[projectId]/hazards/_components/RiskAssessmentTable.tsx @@ -198,9 +198,9 @@ export function RiskAssessmentTable({ projectId, hazards, onReassess, decisions, return ( {/* Hazard info */} - -
{h.name}
- {h.component_name &&
{h.component_name}
} + +
{h.name}
+ {h.component_name &&
{h.component_name}
} diff --git a/admin-compliance/app/sdk/iace/[projectId]/page.tsx b/admin-compliance/app/sdk/iace/[projectId]/page.tsx index d289147..b70aa6c 100644 --- a/admin-compliance/app/sdk/iace/[projectId]/page.tsx +++ b/admin-compliance/app/sdk/iace/[projectId]/page.tsx @@ -122,19 +122,19 @@ export default function ProjectOverviewPage() { async function fetchProject() { try { - // Fetch project detail + live risk summary + mitigations count in parallel - const [projRes, riskRes, mitRes, hazRes] = await Promise.all([ + // Only fetch project detail + lightweight risk summary (NO heavy lists) + const [projRes, riskRes] = await Promise.all([ fetch(`/api/sdk/v1/iace/projects/${projectId}`), fetch(`/api/sdk/v1/iace/projects/${projectId}/risk-summary`), - fetch(`/api/sdk/v1/iace/projects/${projectId}/mitigations`), - fetch(`/api/sdk/v1/iace/projects/${projectId}/hazards`), ]) if (!projRes.ok) return const json = await projRes.json() - // Live risk summary from dedicated endpoint + // Live risk summary from dedicated endpoint (lightweight — just counts) let rs = json.risk_summary || {} + let hazCount = 0 + let mitCount = 0 if (riskRes.ok) { const riskJson = await riskRes.json() const live = riskJson.risk_summary || riskJson || {} @@ -146,18 +146,8 @@ export default function ProjectOverviewPage() { negligible: live.negligible || 0, total: live.total_hazards || live.total || 0, } - } - - // Live counts - let mitCount = 0 - if (mitRes.ok) { - const mitJson = await mitRes.json() - mitCount = mitJson.total || (mitJson.mitigations || []).length || 0 - } - let hazCount = 0 - if (hazRes.ok) { - const hazJson = await hazRes.json() - hazCount = hazJson.total || (hazJson.hazards || []).length || 0 + hazCount = live.total_hazards || live.total || 0 + mitCount = live.total_mitigations || 0 } // Calculate dynamic completeness percentage