parent
0d41b6b658
commit
fcbc935c28
|
|
@ -47,7 +47,8 @@ class UpdateCard extends Component
|
||||||
{
|
{
|
||||||
$this->reloadVersionsAndStatus();
|
$this->reloadVersionsAndStatus();
|
||||||
$this->recompute();
|
$this->recompute();
|
||||||
$this->progressLine = $this->tailUpdateLog();
|
$this->progressLine = '';
|
||||||
|
// $this->progressLine = $this->tailUpdateLog();
|
||||||
|
|
||||||
if ($this->running) {
|
if ($this->running) {
|
||||||
$this->state = 'running';
|
$this->state = 'running';
|
||||||
|
|
|
||||||
|
|
@ -2,27 +2,29 @@
|
||||||
|
|
||||||
namespace App\Livewire\Ui\System;
|
namespace App\Livewire\Ui\System;
|
||||||
|
|
||||||
|
use App\Support\CacheVer;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class WoltguardCard extends Component
|
class WoltguardCard extends Component
|
||||||
{
|
{
|
||||||
/** Gesamter Roh-Input aus dem Health-Cache (optional für später) */
|
/** Gesamter Roh-Input aus dem Health-Cache */
|
||||||
public array $services = [];
|
public array $services = [];
|
||||||
|
|
||||||
/** UI: zusammengefasster Status */
|
/** UI: Status */
|
||||||
public bool $guardOk = false; // alle Dienste OK?
|
public bool $guardOk = false;
|
||||||
public int $okCount = 0; // wie viele OK
|
public int $okCount = 0;
|
||||||
public int $totalCount = 0; // wie viele gesamt
|
public int $totalCount = 0;
|
||||||
public int $downCount = 0; // wie viele down
|
public int $downCount = 0;
|
||||||
|
|
||||||
public string $badgeText = 'unbekannt';
|
public string $badgeText = 'unbekannt';
|
||||||
public string $badgeIcon = 'ph ph-question';
|
public string $badgeIcon = 'ph ph-question';
|
||||||
public string $badgeClass = 'text-white/70 border-white/20 bg-white/10';
|
public string $badgeClass = 'text-white/70 border-white/20 bg-white/10';
|
||||||
|
|
||||||
/** Optional: Liste der ausgefallenen Dienste (für Tooltip/weitere Anzeige) */
|
/** Liste der ausgefallenen Dienste (für Tooltip/Anzeige) */
|
||||||
public array $downServices = [];
|
public array $downServices = [];
|
||||||
|
|
||||||
/** Pollintervall steuern (z. B. 30s) */
|
/** Pollintervall (Sek.) */
|
||||||
public int $pollSeconds = 30;
|
public int $pollSeconds = 30;
|
||||||
|
|
||||||
public function mount(): void
|
public function mount(): void
|
||||||
|
|
@ -45,8 +47,13 @@ class WoltguardCard extends Component
|
||||||
|
|
||||||
protected function load(): void
|
protected function load(): void
|
||||||
{
|
{
|
||||||
// Erwartet: Cache::put('health:services', [['name'=>'postfix','ok'=>true], ...])
|
// 1) Primär: versionierter Key
|
||||||
|
$list = Cache::get(CacheVer::k('health:services'), []);
|
||||||
|
// 2) Fallback: Legacy-Key (nur falls 1) leer)
|
||||||
|
if (empty($list)) {
|
||||||
$list = Cache::get('health:services', []);
|
$list = Cache::get('health:services', []);
|
||||||
|
}
|
||||||
|
|
||||||
$this->services = is_array($list) ? $list : [];
|
$this->services = is_array($list) ? $list : [];
|
||||||
|
|
||||||
$this->totalCount = count($this->services);
|
$this->totalCount = count($this->services);
|
||||||
|
|
@ -54,14 +61,13 @@ class WoltguardCard extends Component
|
||||||
$this->downCount = $this->totalCount - $this->okCount;
|
$this->downCount = $this->totalCount - $this->okCount;
|
||||||
$this->guardOk = ($this->totalCount > 0) && ($this->downCount === 0);
|
$this->guardOk = ($this->totalCount > 0) && ($this->downCount === 0);
|
||||||
|
|
||||||
// Down-Services Namen extrahieren
|
|
||||||
$this->downServices = collect($this->services)
|
$this->downServices = collect($this->services)
|
||||||
->filter(fn($s) => !($s['ok'] ?? false))
|
->filter(fn($s) => !($s['ok'] ?? false))
|
||||||
->map(fn($s) => (string)($s['name'] ?? 'unbekannt'))
|
->map(fn($s) => (string)($s['name'] ?? 'unbekannt'))
|
||||||
->values()
|
->values()
|
||||||
->all();
|
->all();
|
||||||
|
|
||||||
// Badge aufbereiten (Text/Style/Icon)
|
// Badge
|
||||||
if ($this->totalCount === 0) {
|
if ($this->totalCount === 0) {
|
||||||
$this->badgeText = 'keine Daten';
|
$this->badgeText = 'keine Daten';
|
||||||
$this->badgeIcon = 'ph ph-warning-circle';
|
$this->badgeIcon = 'ph ph-warning-circle';
|
||||||
|
|
@ -74,7 +80,6 @@ class WoltguardCard extends Component
|
||||||
$this->badgeIcon = 'ph ph-check-circle';
|
$this->badgeIcon = 'ph ph-check-circle';
|
||||||
$this->badgeClass = 'text-emerald-300 border-emerald-400/30 bg-emerald-500/10';
|
$this->badgeClass = 'text-emerald-300 border-emerald-400/30 bg-emerald-500/10';
|
||||||
} else {
|
} else {
|
||||||
// kleine Abstufung je nach Anzahl der Störungen
|
|
||||||
if ($this->downCount >= 3) {
|
if ($this->downCount >= 3) {
|
||||||
$this->badgeText = "{$this->downCount} Dienste down";
|
$this->badgeText = "{$this->downCount} Dienste down";
|
||||||
$this->badgeIcon = 'ph ph-x-circle';
|
$this->badgeIcon = 'ph ph-x-circle';
|
||||||
|
|
@ -87,3 +92,92 @@ class WoltguardCard extends Component
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//namespace App\Livewire\Ui\System;
|
||||||
|
//
|
||||||
|
//use Illuminate\Support\Facades\Cache;
|
||||||
|
//use Livewire\Component;
|
||||||
|
//
|
||||||
|
//class WoltguardCard extends Component
|
||||||
|
//{
|
||||||
|
// /** Gesamter Roh-Input aus dem Health-Cache (optional für später) */
|
||||||
|
// public array $services = [];
|
||||||
|
//
|
||||||
|
// /** UI: zusammengefasster Status */
|
||||||
|
// public bool $guardOk = false; // alle Dienste OK?
|
||||||
|
// public int $okCount = 0; // wie viele OK
|
||||||
|
// public int $totalCount = 0; // wie viele gesamt
|
||||||
|
// public int $downCount = 0; // wie viele down
|
||||||
|
// public string $badgeText = 'unbekannt';
|
||||||
|
// public string $badgeIcon = 'ph ph-question';
|
||||||
|
// public string $badgeClass = 'text-white/70 border-white/20 bg-white/10';
|
||||||
|
//
|
||||||
|
// /** Optional: Liste der ausgefallenen Dienste (für Tooltip/weitere Anzeige) */
|
||||||
|
// public array $downServices = [];
|
||||||
|
//
|
||||||
|
// /** Pollintervall steuern (z. B. 30s) */
|
||||||
|
// public int $pollSeconds = 30;
|
||||||
|
//
|
||||||
|
// public function mount(): void
|
||||||
|
// {
|
||||||
|
// $this->load();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public function render()
|
||||||
|
// {
|
||||||
|
// return view('livewire.ui.system.woltguard-card');
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /** Manuelles Refresh aus dem UI */
|
||||||
|
// public function refresh(): void
|
||||||
|
// {
|
||||||
|
// $this->load();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /* ---------------- intern ---------------- */
|
||||||
|
//
|
||||||
|
// protected function load(): void
|
||||||
|
// {
|
||||||
|
// // Erwartet: Cache::put('health:services', [['name'=>'postfix','ok'=>true], ...])
|
||||||
|
// $list = Cache::get('health:services', []);
|
||||||
|
// $this->services = is_array($list) ? $list : [];
|
||||||
|
//
|
||||||
|
// $this->totalCount = count($this->services);
|
||||||
|
// $this->okCount = collect($this->services)->filter(fn ($s) => (bool)($s['ok'] ?? false))->count();
|
||||||
|
// $this->downCount = $this->totalCount - $this->okCount;
|
||||||
|
// $this->guardOk = ($this->totalCount > 0) && ($this->downCount === 0);
|
||||||
|
//
|
||||||
|
// // Down-Services Namen extrahieren
|
||||||
|
// $this->downServices = collect($this->services)
|
||||||
|
// ->filter(fn ($s) => !($s['ok'] ?? false))
|
||||||
|
// ->map(fn ($s) => (string)($s['name'] ?? 'unbekannt'))
|
||||||
|
// ->values()
|
||||||
|
// ->all();
|
||||||
|
//
|
||||||
|
// // Badge aufbereiten (Text/Style/Icon)
|
||||||
|
// if ($this->totalCount === 0) {
|
||||||
|
// $this->badgeText = 'keine Daten';
|
||||||
|
// $this->badgeIcon = 'ph ph-warning-circle';
|
||||||
|
// $this->badgeClass = 'text-amber-300 border-amber-400/30 bg-amber-500/10';
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if ($this->guardOk) {
|
||||||
|
// $this->badgeText = 'alle Dienste OK';
|
||||||
|
// $this->badgeIcon = 'ph ph-check-circle';
|
||||||
|
// $this->badgeClass = 'text-emerald-300 border-emerald-400/30 bg-emerald-500/10';
|
||||||
|
// } else {
|
||||||
|
// // kleine Abstufung je nach Anzahl der Störungen
|
||||||
|
// if ($this->downCount >= 3) {
|
||||||
|
// $this->badgeText = "{$this->downCount} Dienste down";
|
||||||
|
// $this->badgeIcon = 'ph ph-x-circle';
|
||||||
|
// $this->badgeClass = 'text-rose-300 border-rose-400/30 bg-rose-500/10';
|
||||||
|
// } else {
|
||||||
|
// $this->badgeText = 'Störung erkannt';
|
||||||
|
// $this->badgeIcon = 'ph ph-warning-circle';
|
||||||
|
// $this->badgeClass = 'text-amber-300 border-amber-400/30 bg-amber-500/10';
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ Artisan::command('inspire', function () {
|
||||||
})->purpose('Display an inspiring quote');
|
})->purpose('Display an inspiring quote');
|
||||||
|
|
||||||
Schedule::job(RunHealthChecks::class)->everyMinute()->withoutOverlapping();
|
Schedule::job(RunHealthChecks::class)->everyMinute()->withoutOverlapping();
|
||||||
Schedule::command('woltguard:collect-services')->everyMinute();
|
//Schedule::command('woltguard:collect-services')->everyMinute();
|
||||||
//Schedule::command('mailwolt:check-updates')->dailyAt('04:10');
|
//Schedule::command('mailwolt:check-updates')->dailyAt('04:10');
|
||||||
Schedule::command('mailwolt:check-updates')->everytwoMinutes();
|
Schedule::command('mailwolt:check-updates')->everytwoMinutes();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue