diff --git a/app/Livewire/Ui/Nx/Dashboard.php b/app/Livewire/Ui/Nx/Dashboard.php index aab2e1f..9ebe834 100644 --- a/app/Livewire/Ui/Nx/Dashboard.php +++ b/app/Livewire/Ui/Nx/Dashboard.php @@ -75,25 +75,40 @@ class Dashboard extends Component private function loadServices(): array { - // 1) Monit-Cache (populated by RunHealthChecks job) - $cached = Cache::get(CacheVer::k('health:services'), []); - $rows = $cached['rows'] ?? []; + $allCards = config('woltguard.cards', []); + $dashKeys = config('woltguard.dashboard', array_keys($allCards)); - // 2) Fallback: nur die Dashboard-Teilmenge aus woltguard.php (aktive Probes) - if (empty($rows)) { - $allCards = config('woltguard.cards', []); - $dashKeys = config('woltguard.dashboard', array_keys($allCards)); - foreach ($dashKeys as $key) { - $card = $allCards[$key] ?? null; - if (!$card) continue; - $isOk = false; - foreach ($card['sources'] as $src) { - if ($this->probeSource($src)) { $isOk = true; break; } - } - // Optionale Dienste (z.B. ClamAV) nur anzeigen wenn aktiv - if (!$isOk && ($card['optional'] ?? false)) continue; - $rows[] = ['label' => $card['label'], 'hint' => $card['hint'], 'ok' => $isOk]; + // 1) Monit-Cache für nicht-optionale Dienste + $cached = Cache::get(CacheVer::k('health:services'), []); + $monitRows = $cached['rows'] ?? []; + $monitIndex = []; + foreach ($monitRows as $r) { + $monitIndex[strtolower($r['name'] ?? '')] = $r; + } + + $rows = []; + foreach ($dashKeys as $key) { + $card = $allCards[$key] ?? null; + if (!$card) continue; + $optional = $card['optional'] ?? false; + + // Optionale Dienste (z.B. ClamAV) immer live prüfen – Monit-Cache kann veraltet sein + if (!$optional && isset($monitIndex[strtolower($card['label'] ?? '')])) { + $rows[] = $monitIndex[strtolower($card['label'])]; + continue; } + + $isOk = false; + foreach ($card['sources'] as $src) { + if ($this->probeSource($src)) { $isOk = true; break; } + } + if (!$isOk && $optional) continue; + $rows[] = ['label' => $card['label'], 'hint' => $card['hint'], 'ok' => $isOk]; + } + + // Fallback: wenn gar keine Daten, alle live proben + if (empty($rows) && !empty($monitRows)) { + $rows = $monitRows; } return array_map(fn($r) => [