feat: Variantenmanagement — Sub-Projekte mit GAP-Analyse
Backend: - parent_project_id auf iace_projects (DB + Go Struct) - POST/GET /variants + GET /variant-gap Endpoints - GAP-Analyse: Differenz Hazards/Massnahmen/Kategorien Frontend: - VariantPanel auf Projekt-Uebersicht - Variante erstellen Dialog - Sidebar-Anzeige (Variantenanzahl / Basis-Link) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import Link from 'next/link'
|
||||
import { useParams } from 'next/navigation'
|
||||
import { SuggestedNorms } from './_components/SuggestedNorms'
|
||||
import { ComplianceAlerts } from './_components/ComplianceAlerts'
|
||||
import { VariantPanel } from './_components/VariantPanel'
|
||||
|
||||
interface ProjectOverview {
|
||||
id: string
|
||||
@@ -15,6 +16,8 @@ interface ProjectOverview {
|
||||
completeness_pct: number
|
||||
created_at: string
|
||||
updated_at: string
|
||||
parent_project_id?: string | null
|
||||
parent_project_name?: string
|
||||
metadata?: { limits_form?: Record<string, unknown> }
|
||||
risk_summary?: {
|
||||
critical?: number
|
||||
@@ -125,12 +128,26 @@ export default function ProjectOverviewPage() {
|
||||
const stepsComplete = [hasLimits, hasComponents, hasHazards, hasMitigations].filter(Boolean).length
|
||||
const completeness = Math.round((stepsComplete / 6) * 100)
|
||||
|
||||
// If this is a variant, resolve parent project name
|
||||
let parentName: string | undefined
|
||||
if (json.parent_project_id) {
|
||||
try {
|
||||
const parentRes = await fetch(`/api/sdk/v1/iace/projects/${json.parent_project_id}`)
|
||||
if (parentRes.ok) {
|
||||
const parentJson = await parentRes.json()
|
||||
parentName = parentJson.machine_name
|
||||
}
|
||||
} catch { /* ignore */ }
|
||||
}
|
||||
|
||||
setProject({
|
||||
...json,
|
||||
completeness_pct: completeness,
|
||||
component_count: compCount,
|
||||
hazard_count: hazCount,
|
||||
mitigation_count: mitCount,
|
||||
parent_project_id: json.parent_project_id || null,
|
||||
parent_project_name: parentName,
|
||||
metadata: json.metadata,
|
||||
risk_summary: {
|
||||
critical: rs.critical || 0,
|
||||
@@ -334,6 +351,13 @@ export default function ProjectOverviewPage() {
|
||||
{/* Compliance Alerts */}
|
||||
<ComplianceAlerts projectId={projectId} />
|
||||
|
||||
{/* Variant Management */}
|
||||
<VariantPanel
|
||||
projectId={projectId}
|
||||
parentProjectId={project.parent_project_id}
|
||||
parentProjectName={project.parent_project_name}
|
||||
/>
|
||||
|
||||
{/* Suggested Norms */}
|
||||
<SuggestedNorms projectId={projectId} />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user