feat(iace): Betriebszustand-Traceability auf Hazards + Mitigations
Hazards zeigen jetzt farbige Badges mit den Betriebszustaenden die sie ausgeloest haben (z.B. "Wartung", "Not-Halt"). Mitigations erben die States ihrer verknuepften Hazards. Backend: OperationalStates im Function-Feld encodiert (kein DB-Schema), beim Lesen als operational_states[] JSON-Feld zurueckgegeben. Frontend: Indigo-Badges in HazardTable + MitigationCard. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+16
-1
@@ -3,6 +3,12 @@
|
||||
import { Mitigation } from './types'
|
||||
import { StatusBadge } from './StatusBadge'
|
||||
|
||||
const OP_STATE_LABELS: Record<string, string> = {
|
||||
startup: 'Hochfahren', homing: 'Referenzfahrt', automatic_operation: 'Automatik',
|
||||
manual_operation: 'Handbetrieb', teach_mode: 'Einrichten', maintenance: 'Wartung',
|
||||
cleaning: 'Reinigung', emergency_stop: 'Not-Halt', recovery_mode: 'Wiederanlauf',
|
||||
}
|
||||
|
||||
export function MitigationCard({
|
||||
mitigation,
|
||||
onVerify,
|
||||
@@ -26,7 +32,16 @@ export function MitigationCard({
|
||||
<StatusBadge status={mitigation.status} />
|
||||
</div>
|
||||
{mitigation.description && (
|
||||
<p className="text-xs text-gray-500 mb-3">{mitigation.description}</p>
|
||||
<p className="text-xs text-gray-500 mb-2">{mitigation.description}</p>
|
||||
)}
|
||||
{mitigation.operational_states && mitigation.operational_states.length > 0 && (
|
||||
<div className="flex flex-wrap gap-1 mb-2">
|
||||
{mitigation.operational_states.map((s) => (
|
||||
<span key={s} className="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-indigo-50 text-indigo-700 dark:bg-indigo-900/30 dark:text-indigo-300 border border-indigo-200 dark:border-indigo-800">
|
||||
{OP_STATE_LABELS[s] || s}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{(mitigation.linked_hazard_names || []).length > 0 && (
|
||||
<div className="mb-3">
|
||||
|
||||
@@ -12,6 +12,7 @@ export interface Mitigation {
|
||||
verified_at: string | null
|
||||
verified_by: string | null
|
||||
source?: string
|
||||
operational_states?: string[]
|
||||
}
|
||||
|
||||
export interface Hazard {
|
||||
@@ -19,6 +20,7 @@ export interface Hazard {
|
||||
name: string
|
||||
risk_level: string
|
||||
category?: string
|
||||
operational_states?: string[]
|
||||
}
|
||||
|
||||
export interface ProtectiveMeasure {
|
||||
|
||||
Reference in New Issue
Block a user