import React from 'react'; import { useTranslation } from 'react-i18next'; import { Database, Server, Cpu, Activity, Plug, HardDrive, BrainCircuit, AlertCircle, CheckCircle, XCircle, AlertTriangle, RefreshCw, } from 'lucide-react'; import { useSystemDashboard, useSystemAlerts } from '@/api/systemDashboard'; import { useAuthStore } from '@/store/authStore'; // ─── Status Badge ──────────────────────────────────────────────────────────── function StatusBadge({ status }: { status: string }) { const { t } = useTranslation(); const isUp = status === 'up' || status === 'healthy'; const isDegraded = status === 'degraded'; const isDown = status === 'down'; const config = isUp ? { icon: CheckCircle, color: 'text-success-600', bg: 'bg-success-50', label: t('systemDashboard.statusUp', 'OK') } : isDegraded ? { icon: AlertTriangle, color: 'text-warning-600', bg: 'bg-warning-50', label: t('systemDashboard.statusDegraded', 'Degraded') } : isDown ? { icon: XCircle, color: 'text-danger-600', bg: 'bg-danger-50', label: t('systemDashboard.statusDown', 'Down') } : { icon: AlertCircle, color: 'text-secondary-600', bg: 'bg-secondary-50', label: t('systemDashboard.statusUnknown', 'Unknown') }; const Icon = config.icon; return ( {config.label} ); } // ─── Metric Card ───────────────────────────────────────────────────────────── interface MetricCardProps { title: string; icon: React.ReactNode; status?: string; children: React.ReactNode; } function MetricCard({ title, icon, status, children }: MetricCardProps) { return (
{alert.type.replace(/_/g, ' ').toUpperCase()}
{alert.message}
{t('systemDashboard.adminOnly', 'Administrator-Zugriff erforderlich')}
{t('systemDashboard.loadError', 'Fehler beim Laden der System-Metriken')}
{t('systemDashboard.subtitle', 'Echtzeit-Systemüberwachung')} — {new Date(dashboard.timestamp).toLocaleString()}
{dashboard.database.error}
) : ( <>{dashboard.redis.error}
) : ( <>{dashboard.worker.error}
) : ( <>{dashboard.api.error}
) : ( <>{dashboard.plugins.error}
) : ( <>{dashboard.storage.error}
) : ( <>