diff --git a/app/Livewire/Ui/Security/ClamavManager.php b/app/Livewire/Ui/Security/ClamavManager.php index 0197880..9733148 100644 --- a/app/Livewire/Ui/Security/ClamavManager.php +++ b/app/Livewire/Ui/Security/ClamavManager.php @@ -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 diff --git a/resources/views/livewire/ui/security/clamav-manager.blade.php b/resources/views/livewire/ui/security/clamav-manager.blade.php index df465dd..9d06ec4 100644 --- a/resources/views/livewire/ui/security/clamav-manager.blade.php +++ b/resources/views/livewire/ui/security/clamav-manager.blade.php @@ -90,8 +90,14 @@ @endif -
- @if($running) +
+ @if($starting) +
+ + Wird gestartet… + {{ $startSecs }}s +
+ @elseif($running) @endif