feat: Betrieb-Module auf 100% — Buttons verdrahtet, Delete-Flows, tote Links gefixt
All checks were successful
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Successful in 36s
CI / test-python-backend-compliance (push) Successful in 32s
CI / test-python-document-crawler (push) Successful in 22s
CI / test-python-dsms-gateway (push) Successful in 17s
All checks were successful
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Successful in 36s
CI / test-python-backend-compliance (push) Successful in 32s
CI / test-python-document-crawler (push) Successful in 22s
CI / test-python-dsms-gateway (push) Successful in 17s
- consent-management: ConsentTemplateCreateModal + useRouter für DSR-Navigation - vendor-compliance: QuickActionCard unterstützt onClick; /vendors/new → Modal, /processing-activities/new → Liste - incidents: handleDeleteIncident + Löschen-Button im IncidentDetailDrawer - whistleblower: handleDeleteReport + Löschen-Button im CaseDetailPanel - escalations: handleDeleteEscalation + Löschen-Button im EscalationDetailDrawer - notfallplan: ExerciseCreateModal (API-backed) + handleDeleteExercise + Neue-Übung-Button Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -369,6 +369,7 @@ export default function NotfallplanPage() {
|
||||
const [exercises, setExercises] = useState<Exercise[]>([])
|
||||
const [showAddIncident, setShowAddIncident] = useState(false)
|
||||
const [showAddExercise, setShowAddExercise] = useState(false)
|
||||
const [showExerciseModal, setShowExerciseModal] = useState(false)
|
||||
const [saved, setSaved] = useState(false)
|
||||
|
||||
// API-backed state
|
||||
@@ -380,8 +381,10 @@ export default function NotfallplanPage() {
|
||||
const [showScenarioModal, setShowScenarioModal] = useState(false)
|
||||
const [newContact, setNewContact] = useState({ name: '', role: '', email: '', phone: '', is_primary: false, available_24h: false })
|
||||
const [newScenario, setNewScenario] = useState({ title: '', category: 'data_breach', severity: 'medium', description: '' })
|
||||
const [newExercise, setNewExercise] = useState({ title: '', exercise_type: 'tabletop', exercise_date: '', notes: '' })
|
||||
const [savingContact, setSavingContact] = useState(false)
|
||||
const [savingScenario, setSavingScenario] = useState(false)
|
||||
const [savingExercise, setSavingExercise] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
const data = loadFromStorage()
|
||||
@@ -477,6 +480,43 @@ export default function NotfallplanPage() {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCreateExercise() {
|
||||
if (!newExercise.title.trim()) return
|
||||
setSavingExercise(true)
|
||||
try {
|
||||
const res = await fetch(`${NOTFALLPLAN_API}/exercises`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
title: newExercise.title.trim(),
|
||||
exercise_type: newExercise.exercise_type,
|
||||
exercise_date: newExercise.exercise_date || null,
|
||||
notes: newExercise.notes.trim() || null,
|
||||
}),
|
||||
})
|
||||
if (res.ok) {
|
||||
setShowExerciseModal(false)
|
||||
setNewExercise({ title: '', exercise_type: 'tabletop', exercise_date: '', notes: '' })
|
||||
loadApiData()
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Uebung erstellen fehlgeschlagen:', e)
|
||||
} finally {
|
||||
setSavingExercise(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDeleteExercise(id: string) {
|
||||
try {
|
||||
const res = await fetch(`${NOTFALLPLAN_API}/exercises/${id}`, { method: 'DELETE' })
|
||||
if (res.ok) {
|
||||
setApiExercises(prev => prev.filter(e => e.id !== id))
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Löschen fehlgeschlagen:', e)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDeleteScenario(id: string) {
|
||||
try {
|
||||
const res = await fetch(`${NOTFALLPLAN_API}/scenarios/${id}`, { method: 'DELETE' })
|
||||
@@ -669,7 +709,15 @@ export default function NotfallplanPage() {
|
||||
<div className="bg-white rounded-lg border p-5">
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<h3 className="text-base font-semibold">Uebungen (Datenbank)</h3>
|
||||
<span className="text-sm text-gray-500">{apiExercises.length} Eintraege</span>
|
||||
<div className="flex items-center gap-3">
|
||||
<span className="text-sm text-gray-500">{apiExercises.length} Eintraege</span>
|
||||
<button
|
||||
onClick={() => setShowExerciseModal(true)}
|
||||
className="px-3 py-1.5 bg-blue-600 text-white text-sm rounded-lg hover:bg-blue-700 transition-colors"
|
||||
>
|
||||
+ Neue Uebung
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{apiExercises.length === 0 ? (
|
||||
<div className="text-sm text-gray-400 py-2 text-center">Noch keine Uebungen in der Datenbank</div>
|
||||
@@ -685,6 +733,19 @@ export default function NotfallplanPage() {
|
||||
{ex.outcome && <span className={`text-xs px-2 py-0.5 rounded ${ex.outcome === 'passed' ? 'bg-green-100 text-green-700' : 'bg-red-100 text-red-700'}`}>{ex.outcome}</span>}
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
onClick={() => {
|
||||
if (window.confirm(`Uebung "${ex.title}" loeschen?`)) {
|
||||
handleDeleteExercise(ex.id)
|
||||
}
|
||||
}}
|
||||
className="p-1.5 text-red-400 hover:text-red-600 hover:bg-red-50 rounded transition-colors"
|
||||
title="Loeschen"
|
||||
>
|
||||
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
@@ -792,6 +853,79 @@ export default function NotfallplanPage() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Exercise Create Modal */}
|
||||
{showExerciseModal && (
|
||||
<div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50">
|
||||
<div className="bg-white rounded-xl shadow-xl max-w-md w-full mx-4">
|
||||
<div className="px-6 py-4 border-b border-gray-200 flex items-center justify-between">
|
||||
<h3 className="font-semibold text-gray-900">Neue Uebung planen</h3>
|
||||
<button onClick={() => setShowExerciseModal(false)} className="text-gray-400 hover:text-gray-600">
|
||||
<svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div className="p-6 space-y-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">Titel *</label>
|
||||
<input
|
||||
type="text"
|
||||
value={newExercise.title}
|
||||
onChange={e => setNewExercise(p => ({ ...p, title: e.target.value }))}
|
||||
placeholder="z.B. Tabletop-Uebung Ransomware"
|
||||
className="w-full border rounded px-3 py-2 text-sm"
|
||||
/>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">Uebungstyp</label>
|
||||
<select
|
||||
value={newExercise.exercise_type}
|
||||
onChange={e => setNewExercise(p => ({ ...p, exercise_type: e.target.value }))}
|
||||
className="w-full border rounded px-3 py-2 text-sm"
|
||||
>
|
||||
<option value="tabletop">Tabletop</option>
|
||||
<option value="simulation">Simulation</option>
|
||||
<option value="walkthrough">Walkthrough</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">Datum</label>
|
||||
<input
|
||||
type="date"
|
||||
value={newExercise.exercise_date}
|
||||
onChange={e => setNewExercise(p => ({ ...p, exercise_date: e.target.value }))}
|
||||
className="w-full border rounded px-3 py-2 text-sm"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">Notizen</label>
|
||||
<textarea
|
||||
value={newExercise.notes}
|
||||
onChange={e => setNewExercise(p => ({ ...p, notes: e.target.value }))}
|
||||
placeholder="Ziele, Teilnehmer, Ablauf..."
|
||||
rows={3}
|
||||
className="w-full border rounded px-3 py-2 text-sm"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="px-6 py-4 border-t border-gray-200 flex justify-end gap-3">
|
||||
<button onClick={() => setShowExerciseModal(false)} className="px-4 py-2 text-sm text-gray-600 hover:bg-gray-100 rounded-lg">
|
||||
Abbrechen
|
||||
</button>
|
||||
<button
|
||||
onClick={handleCreateExercise}
|
||||
disabled={!newExercise.title || savingExercise}
|
||||
className="px-4 py-2 text-sm text-white bg-blue-600 hover:bg-blue-700 rounded-lg font-medium disabled:opacity-50"
|
||||
>
|
||||
{savingExercise ? 'Speichern...' : 'Uebung erstellen'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Scenario Create Modal */}
|
||||
{showScenarioModal && (
|
||||
<div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50">
|
||||
|
||||
Reference in New Issue
Block a user