fix: Restore all files lost during destructive rebase
A previous `git pull --rebase origin main` dropped 177 local commits,
losing 3400+ files across admin-v2, backend, studio-v2, website,
klausur-service, and many other services. The partial restore attempt
(660295e2) only recovered some files.
This commit restores all missing files from pre-rebase ref 98933f5e
while preserving post-rebase additions (night-scheduler, night-mode UI,
NightModeWidget dashboard integration).
Restored features include:
- AI Module Sidebar (FAB), OCR Labeling, OCR Compare
- GPU Dashboard, RAG Pipeline, Magic Help
- Klausur-Korrektur (8 files), Abitur-Archiv (5+ files)
- Companion, Zeugnisse-Crawler, Screen Flow
- Full backend, studio-v2, website, klausur-service
- All compliance SDKs, agent-core, voice-service
- CI/CD configs, documentation, scripts
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
407
website/app/admin/dsr/wizard/page.tsx
Normal file
407
website/app/admin/dsr/wizard/page.tsx
Normal file
@@ -0,0 +1,407 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import AdminLayout from '@/components/admin/AdminLayout'
|
||||
import {
|
||||
WizardStepper,
|
||||
WizardNavigation,
|
||||
EducationCard,
|
||||
ArchitectureContext,
|
||||
TestRunner,
|
||||
TestSummary,
|
||||
type WizardStep,
|
||||
type TestCategoryResult,
|
||||
type FullTestResults,
|
||||
type EducationContent,
|
||||
type ArchitectureContextType,
|
||||
} from '@/components/wizard'
|
||||
|
||||
// ==============================================
|
||||
// Constants
|
||||
// ==============================================
|
||||
|
||||
const BACKEND_URL = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'
|
||||
|
||||
const STEPS: WizardStep[] = [
|
||||
{ id: 'welcome', name: 'Willkommen', icon: '👋', status: 'pending' },
|
||||
{ id: 'api-health', name: 'API Status', icon: '💚', status: 'pending', category: 'api-health' },
|
||||
{ id: 'request-types', name: 'Anfragetypen', icon: '📝', status: 'pending', category: 'request-types' },
|
||||
{ id: 'workflow', name: 'Workflow', icon: '🔄', status: 'pending', category: 'workflow' },
|
||||
{ id: 'export', name: 'Datenexport', icon: '📦', status: 'pending', category: 'export' },
|
||||
{ id: 'audit', name: 'Audit Trail', icon: '📋', status: 'pending', category: 'audit' },
|
||||
{ id: 'summary', name: 'Zusammenfassung', icon: '📊', status: 'pending' },
|
||||
]
|
||||
|
||||
const EDUCATION_CONTENT: Record<string, EducationContent> = {
|
||||
'welcome': {
|
||||
title: 'Willkommen zum DSR-Wizard',
|
||||
content: [
|
||||
'DSR steht fuer "Data Subject Request" - Betroffenenanfragen nach DSGVO.',
|
||||
'',
|
||||
'Die DSGVO gibt Betroffenen umfangreiche Rechte:',
|
||||
'• Art. 15: Auskunftsrecht - Was wissen Sie ueber mich?',
|
||||
'• Art. 16: Berichtigung - Korrigieren Sie falsche Daten',
|
||||
'• Art. 17: Loeschung - Loeschen Sie alle meine Daten',
|
||||
'• Art. 18: Einschraenkung - Stoppen Sie die Verarbeitung',
|
||||
'• Art. 20: Portabilitaet - Geben Sie mir meine Daten',
|
||||
'• Art. 21: Widerspruch - Ich widerspreche der Verarbeitung',
|
||||
'',
|
||||
'Jede Anfrage muss innerhalb von 30 Tagen bearbeitet werden.',
|
||||
],
|
||||
},
|
||||
'api-health': {
|
||||
title: 'DSR API - Kritische Infrastruktur',
|
||||
content: [
|
||||
'Die DSR-API verarbeitet rechtlich bindende Anfragen.',
|
||||
'',
|
||||
'Verfuegbarkeit ist kritisch:',
|
||||
'• Fristversaeumnis = Bussgeld bis 20 Mio. EUR',
|
||||
'• Behoerden erwarten lueckenlose Dokumentation',
|
||||
'• Betroffene haben Anspruch auf zeitnahe Bearbeitung',
|
||||
'',
|
||||
'Wir pruefen:',
|
||||
'• DSR Admin Endpoints erreichbar',
|
||||
'• Statistik-Endpunkte funktional',
|
||||
'• Template-System verfuegbar',
|
||||
],
|
||||
},
|
||||
'request-types': {
|
||||
title: 'DSGVO Anfragetypen',
|
||||
content: [
|
||||
'Jeder Anfragetyp hat spezifische Anforderungen:',
|
||||
'',
|
||||
'ACCESS (Art. 15):',
|
||||
'• Vollstaendige Kopie aller personenbezogenen Daten',
|
||||
'• Verarbeitungszwecke, Kategorien, Empfaenger',
|
||||
'',
|
||||
'ERASURE (Art. 17) - "Recht auf Vergessenwerden":',
|
||||
'• Loeschung aller Daten, auch in Backups',
|
||||
'• Benachrichtigung Dritter ueber Loeschung',
|
||||
'',
|
||||
'PORTABILITY (Art. 20):',
|
||||
'• Daten in strukturiertem Format (JSON/CSV)',
|
||||
'• Uebertragung an anderen Anbieter moeglich',
|
||||
],
|
||||
},
|
||||
'workflow': {
|
||||
title: 'Bearbeitungs-Workflow',
|
||||
content: [
|
||||
'Jede Anfrage durchlaeuft definierte Status:',
|
||||
'',
|
||||
'pending → identity_verification → processing → completed',
|
||||
'',
|
||||
'• pending: Anfrage eingegangen',
|
||||
'• identity_verification: Identitaet wird geprueft',
|
||||
'• processing: Aktive Bearbeitung',
|
||||
'• on_hold: Warten auf Informationen',
|
||||
'• completed: Erfolgreich abgeschlossen',
|
||||
'• rejected: Mit Begruendung abgelehnt',
|
||||
'',
|
||||
'Fristen: 30 Tage Standard, max. 60 Tage mit Begruendung',
|
||||
],
|
||||
},
|
||||
'export': {
|
||||
title: 'GDPR-konformer Datenexport',
|
||||
content: [
|
||||
'Der Export muss alle Anforderungen erfuellen:',
|
||||
'',
|
||||
'Format-Optionen:',
|
||||
'• PDF: Menschenlesbar, fuer Endnutzer',
|
||||
'• JSON: Maschinenlesbar fuer Portabilitaet',
|
||||
'• CSV: Tabellarisch fuer einfache Analyse',
|
||||
'',
|
||||
'Inhalt:',
|
||||
'• Alle personenbezogenen Daten',
|
||||
'• Verarbeitungszwecke und Rechtsgrundlage',
|
||||
'• Empfaenger und Speicherdauer',
|
||||
'',
|
||||
'Sicherheit: Verschluesselt und zugriffskontrolliert',
|
||||
],
|
||||
},
|
||||
'audit': {
|
||||
title: 'Audit Trail - Rechtlicher Nachweis',
|
||||
content: [
|
||||
'Der Audit Trail ist rechtlich erforderlich:',
|
||||
'',
|
||||
'Dokumentiert wird:',
|
||||
'• Wer hat wann was getan',
|
||||
'• Jede Statusaenderung mit Zeitstempel',
|
||||
'• Alle Kommunikation mit dem Betroffenen',
|
||||
'• Identitaetspruefung und Methode',
|
||||
'• Fristverlaengerungen mit Begruendung',
|
||||
'',
|
||||
'Aufbewahrung: Mindestens 3 Jahre, unveraenderbar',
|
||||
'Bei Behoerdenanfragen ist dies der entscheidende Nachweis.',
|
||||
],
|
||||
},
|
||||
'summary': {
|
||||
title: 'Test-Zusammenfassung',
|
||||
content: [
|
||||
'Hier sehen Sie eine Uebersicht aller durchgefuehrten Tests:',
|
||||
'• Anzahl bestandener Tests',
|
||||
'• Fehlgeschlagene Tests mit Details',
|
||||
'• Empfehlungen zur Behebung',
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
const ARCHITECTURE_CONTEXTS: Record<string, ArchitectureContextType> = {
|
||||
'api-health': {
|
||||
layer: 'api',
|
||||
services: ['backend', 'consent-service'],
|
||||
dependencies: ['JWT Auth', 'PostgreSQL'],
|
||||
dataFlow: ['Browser', 'FastAPI', 'Go Consent Service', 'dsr_requests'],
|
||||
},
|
||||
'request-types': {
|
||||
layer: 'service',
|
||||
services: ['consent-service', 'postgres'],
|
||||
dependencies: ['Request Types Enum', 'Workflow Engine'],
|
||||
dataFlow: ['Request Type', 'Validation', 'Workflow Assignment'],
|
||||
},
|
||||
'workflow': {
|
||||
layer: 'service',
|
||||
services: ['consent-service'],
|
||||
dependencies: ['State Machine', 'Audit Log', 'Deadline Tracker'],
|
||||
dataFlow: ['Status Change', 'Validation', 'Audit Log', 'Notification'],
|
||||
},
|
||||
'export': {
|
||||
layer: 'service',
|
||||
services: ['backend', 'consent-service', 'postgres'],
|
||||
dependencies: ['Export Service', 'PDF Generator', 'Encryption'],
|
||||
dataFlow: ['Data Collection', 'Formatting', 'Encryption', 'Delivery'],
|
||||
},
|
||||
'audit': {
|
||||
layer: 'database',
|
||||
services: ['postgres'],
|
||||
dependencies: ['Immutable Logs', 'Timestamps', 'User Tracking'],
|
||||
dataFlow: ['Action', 'Log Entry', 'Persistent Storage'],
|
||||
},
|
||||
}
|
||||
|
||||
// ==============================================
|
||||
// Main Component
|
||||
// ==============================================
|
||||
|
||||
export default function DSRWizardPage() {
|
||||
const [currentStep, setCurrentStep] = useState(0)
|
||||
const [steps, setSteps] = useState<WizardStep[]>(STEPS)
|
||||
const [categoryResults, setCategoryResults] = useState<Record<string, TestCategoryResult>>({})
|
||||
const [fullResults, setFullResults] = useState<FullTestResults | null>(null)
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
|
||||
const currentStepData = steps[currentStep]
|
||||
const isTestStep = currentStepData?.category !== undefined
|
||||
const isWelcome = currentStepData?.id === 'welcome'
|
||||
const isSummary = currentStepData?.id === 'summary'
|
||||
|
||||
const runCategoryTest = async (category: string) => {
|
||||
setIsLoading(true)
|
||||
setError(null)
|
||||
|
||||
try {
|
||||
const response = await fetch(`${BACKEND_URL}/api/admin/dsr-tests/${category}`, {
|
||||
method: 'POST',
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP ${response.status}: ${response.statusText}`)
|
||||
}
|
||||
|
||||
const result: TestCategoryResult = await response.json()
|
||||
setCategoryResults((prev) => ({ ...prev, [category]: result }))
|
||||
|
||||
setSteps((prev) =>
|
||||
prev.map((step) =>
|
||||
step.category === category
|
||||
? { ...step, status: result.failed === 0 ? 'completed' : 'failed' }
|
||||
: step
|
||||
)
|
||||
)
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Unbekannter Fehler')
|
||||
} finally {
|
||||
setIsLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
const runAllTests = async () => {
|
||||
setIsLoading(true)
|
||||
setError(null)
|
||||
|
||||
try {
|
||||
const response = await fetch(`${BACKEND_URL}/api/admin/dsr-tests/run-all`, {
|
||||
method: 'POST',
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP ${response.status}: ${response.statusText}`)
|
||||
}
|
||||
|
||||
const results: FullTestResults = await response.json()
|
||||
setFullResults(results)
|
||||
|
||||
setSteps((prev) =>
|
||||
prev.map((step) => {
|
||||
if (step.category) {
|
||||
const catResult = results.categories.find((c) => c.category === step.category)
|
||||
if (catResult) {
|
||||
return { ...step, status: catResult.failed === 0 ? 'completed' : 'failed' }
|
||||
}
|
||||
}
|
||||
return step
|
||||
})
|
||||
)
|
||||
|
||||
const newCategoryResults: Record<string, TestCategoryResult> = {}
|
||||
results.categories.forEach((cat) => {
|
||||
newCategoryResults[cat.category] = cat
|
||||
})
|
||||
setCategoryResults(newCategoryResults)
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Unbekannter Fehler')
|
||||
} finally {
|
||||
setIsLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
const goToNext = () => {
|
||||
if (currentStep < steps.length - 1) {
|
||||
setSteps((prev) =>
|
||||
prev.map((step, idx) =>
|
||||
idx === currentStep && step.status === 'pending'
|
||||
? { ...step, status: 'completed' }
|
||||
: step
|
||||
)
|
||||
)
|
||||
setCurrentStep((prev) => prev + 1)
|
||||
}
|
||||
}
|
||||
|
||||
const goToPrev = () => {
|
||||
if (currentStep > 0) {
|
||||
setCurrentStep((prev) => prev - 1)
|
||||
}
|
||||
}
|
||||
|
||||
const handleStepClick = (index: number) => {
|
||||
if (index <= currentStep || steps[index - 1]?.status !== 'pending') {
|
||||
setCurrentStep(index)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<AdminLayout
|
||||
title="DSR Wizard"
|
||||
description="Interaktives Lernen und Testen der Betroffenenanfragen-Verwaltung"
|
||||
>
|
||||
{/* Header */}
|
||||
<div className="bg-white rounded-lg shadow p-4 mb-6 flex items-center justify-between">
|
||||
<div className="flex items-center">
|
||||
<span className="text-3xl mr-3">🔒</span>
|
||||
<div>
|
||||
<h2 className="text-lg font-bold text-gray-800">Datenschutzanfragen Test Wizard</h2>
|
||||
<p className="text-sm text-gray-600">DSGVO Art. 15-21 Betroffenenrechte</p>
|
||||
</div>
|
||||
</div>
|
||||
<a href="/admin/dsr" className="text-blue-600 hover:text-blue-800 text-sm">
|
||||
← Zurueck zu Datenschutzanfragen
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{/* Stepper */}
|
||||
<div className="bg-white rounded-lg shadow p-6 mb-6">
|
||||
<WizardStepper steps={steps} currentStep={currentStep} onStepClick={handleStepClick} />
|
||||
</div>
|
||||
|
||||
{/* Content */}
|
||||
<div className="bg-white rounded-lg shadow p-6">
|
||||
<div className="flex items-center mb-6">
|
||||
<span className="text-3xl mr-3">{currentStepData?.icon}</span>
|
||||
<div>
|
||||
<h2 className="text-xl font-bold text-gray-800">
|
||||
Schritt {currentStep + 1}: {currentStepData?.name}
|
||||
</h2>
|
||||
<p className="text-gray-500 text-sm">
|
||||
{currentStep + 1} von {steps.length}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<EducationCard content={EDUCATION_CONTENT[currentStepData?.id || '']} />
|
||||
|
||||
{isTestStep && currentStepData?.category && ARCHITECTURE_CONTEXTS[currentStepData.category] && (
|
||||
<ArchitectureContext
|
||||
context={ARCHITECTURE_CONTEXTS[currentStepData.category]}
|
||||
currentStep={currentStepData.name}
|
||||
/>
|
||||
)}
|
||||
|
||||
{error && (
|
||||
<div className="bg-red-50 border border-red-200 text-red-700 rounded-lg p-4 mb-6">
|
||||
<strong>Fehler:</strong> {error}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{isWelcome && (
|
||||
<div className="text-center py-8">
|
||||
<button
|
||||
onClick={goToNext}
|
||||
className="bg-blue-600 text-white px-8 py-3 rounded-lg font-medium hover:bg-blue-700 transition-colors"
|
||||
>
|
||||
Wizard starten
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{isTestStep && currentStepData?.category && (
|
||||
<TestRunner
|
||||
category={currentStepData.category}
|
||||
categoryResult={categoryResults[currentStepData.category]}
|
||||
isLoading={isLoading}
|
||||
onRunTests={() => runCategoryTest(currentStepData.category!)}
|
||||
/>
|
||||
)}
|
||||
|
||||
{isSummary && (
|
||||
<div>
|
||||
{!fullResults ? (
|
||||
<div className="text-center py-8">
|
||||
<p className="text-gray-600 mb-4">
|
||||
Fuehren Sie alle Tests aus um eine Zusammenfassung zu sehen.
|
||||
</p>
|
||||
<button
|
||||
onClick={runAllTests}
|
||||
disabled={isLoading}
|
||||
className={`px-6 py-3 rounded-lg font-medium transition-colors ${
|
||||
isLoading
|
||||
? 'bg-gray-400 cursor-not-allowed'
|
||||
: 'bg-blue-600 text-white hover:bg-blue-700'
|
||||
}`}
|
||||
>
|
||||
{isLoading ? 'Alle Tests laufen...' : 'Alle Tests ausfuehren'}
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<TestSummary results={fullResults} />
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<WizardNavigation
|
||||
currentStep={currentStep}
|
||||
totalSteps={steps.length}
|
||||
onPrev={goToPrev}
|
||||
onNext={goToNext}
|
||||
showNext={!isSummary}
|
||||
isLoading={isLoading}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="text-center text-gray-500 text-sm mt-6">
|
||||
Diese Tests pruefen die DSGVO-konforme Bearbeitung von Betroffenenanfragen.
|
||||
Bei Fragen wenden Sie sich an den Datenschutzbeauftragten.
|
||||
</div>
|
||||
</AdminLayout>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user