Feat: ClamAV Aktivieren mit Spinner + Sekundentimer bis ClamAV läuft
wire:poll.3s prüft serviceActive() nach Klick. Zeigt laufenden Spinner mit Sekundenanzeige (0s, 3s, 6s…) bis ClamAV aktiv ist, dann Erfolgsmeldung. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>main v1.1.336
parent
029d959d51
commit
2331ef74f6
|
|
@ -20,6 +20,8 @@ class ClamavManager extends Component
|
|||
public string $lastError = '';
|
||||
public string $lastSuccess = '';
|
||||
public bool $installing = false;
|
||||
public bool $starting = false;
|
||||
public int $startSecs = 0;
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
|
|
@ -54,11 +56,26 @@ class ClamavManager extends Component
|
|||
|
||||
public function enable(): void
|
||||
{
|
||||
$this->lastError = '';
|
||||
$this->lastError = '';
|
||||
$this->lastSuccess = '';
|
||||
ClamavEnable::dispatch();
|
||||
$this->enabled = true;
|
||||
$this->lastSuccess = 'ClamAV wird gestartet… Dies kann bis zu 60 Sekunden dauern. Klicken Sie danach auf „Aktualisieren".';
|
||||
$this->enabled = true;
|
||||
$this->starting = true;
|
||||
$this->startSecs = 0;
|
||||
}
|
||||
|
||||
public function pollStatus(): void
|
||||
{
|
||||
if (!$this->starting) return;
|
||||
$this->startSecs += 3;
|
||||
$this->running = $this->serviceActive();
|
||||
if ($this->running) {
|
||||
$this->starting = false;
|
||||
$this->startSecs = 0;
|
||||
$this->enabled = $this->serviceEnabled();
|
||||
$this->ramMb = $this->readRamMb();
|
||||
$this->lastSuccess = 'ClamAV ist aktiv und läuft.';
|
||||
}
|
||||
}
|
||||
|
||||
public function disable(): void
|
||||
|
|
|
|||
|
|
@ -90,8 +90,14 @@
|
|||
@endif
|
||||
</div>
|
||||
|
||||
<div style="display:flex;gap:8px">
|
||||
@if($running)
|
||||
<div style="display:flex;gap:8px;align-items:center">
|
||||
@if($starting)
|
||||
<div wire:poll.3s="pollStatus" style="display:flex;align-items:center;gap:8px;padding:6px 12px;background:rgba(167,139,250,.08);border:1px solid rgba(167,139,250,.25);border-radius:8px">
|
||||
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" style="color:#a78bfa;animation:spin 1s linear infinite;flex-shrink:0"><path d="M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>
|
||||
<span style="font-size:12px;color:#c4b5fd;font-weight:500">Wird gestartet…</span>
|
||||
<span style="font-size:11px;color:rgba(196,181,253,.5)">{{ $startSecs }}s</span>
|
||||
</div>
|
||||
@elseif($running)
|
||||
<button wire:click="disable" wire:loading.attr="disabled" wire:target="disable"
|
||||
class="mbx-btn-danger"
|
||||
onclick="return confirm('ClamAV wirklich stoppen und deaktivieren?')">
|
||||
|
|
@ -104,7 +110,7 @@
|
|||
class="mbx-btn-primary">
|
||||
<svg width="12" height="12" viewBox="0 0 14 14" fill="none"><path d="M7 2v10M2 7h10" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/></svg>
|
||||
<span wire:loading.remove wire:target="enable">Aktivieren & starten</span>
|
||||
<span wire:loading wire:target="enable">Wird gestartet…</span>
|
||||
<span wire:loading wire:target="enable">Startet…</span>
|
||||
</button>
|
||||
@endif
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue