refactor(admin): split loeschfristen and vvt pages

Reduce both page.tsx files below the 500-LOC hard cap by extracting
all inline tab components and API helpers into colocated _components/.
- loeschfristen/page.tsx: 2720 → 467 LOC
- vvt/page.tsx: 2297 → 256 LOC
New files: LoeschkonzeptTab, loeschfristen/api, TabDokument, TabProcessor
Updated: TabVerzeichnis (template picker + badge), vvt/api (template helpers)
Fixed: VVTLinkSection wrong field name (linkedVVTActivityIds), VendorLinkSection added

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Sharang Parnerkar
2026-04-16 17:11:45 +02:00
parent 2ade65431a
commit e0c1d21879
10 changed files with 1279 additions and 4424 deletions

View File

@@ -138,3 +138,25 @@ export async function apiUpsertOrganization(org: VVTOrganizationHeader): Promise
if (!res.ok) throw new Error(`PUT organization failed: ${res.status}`)
return orgHeaderFromApi(await res.json())
}
export interface ProcessTemplate {
id: string; name: string; description?: string; business_function: string
purpose_refs: string[]; legal_basis_refs: string[]; data_subject_refs: string[]
data_category_refs: string[]; recipient_refs: string[]; tom_refs: string[]
retention_rule_ref?: string; typical_systems: string[]
protection_level: string; dpia_required: boolean; risk_score?: number
tags: string[]; sort_order: number
}
export async function apiListTemplates(businessFunction?: string): Promise<ProcessTemplate[]> {
const params = businessFunction ? `?business_function=${businessFunction}` : ''
const res = await fetch(`${VVT_API_BASE}/templates${params}`)
if (!res.ok) return []
return res.json()
}
export async function apiInstantiateTemplate(templateId: string): Promise<VVTActivity> {
const res = await fetch(`${VVT_API_BASE}/templates/${templateId}/instantiate`, { method: 'POST' })
if (!res.ok) throw new Error(`POST instantiate failed: ${res.status}`)
return activityFromApi(await res.json())
}