Add real-time UI updates after Traefik version check

Dispatch ProxyStatusChangedUI event after version check completes so the UI updates in real-time without requiring page refresh.

Changes:
- Add ProxyStatusChangedUI::dispatch() at all exit points in CheckTraefikVersionForServerJob
- Ensures UI refreshes automatically via WebSocket when version check completes
- Works for all scenarios: version detected, using latest tag, outdated version, up-to-date

User experience:
- User restarts proxy
- Warning clears automatically in real-time (no refresh needed)
- Leverages existing WebSocket infrastructure

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Andras Bacsai 2025-12-03 09:56:04 +01:00
parent b1a4853e03
commit 13b7c3dbfc

View file

@ -2,6 +2,7 @@
namespace App\Jobs; namespace App\Jobs;
use App\Events\ProxyStatusChangedUI;
use App\Models\Server; use App\Models\Server;
use App\Notifications\Server\TraefikVersionOutdated; use App\Notifications\Server\TraefikVersionOutdated;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
@ -38,6 +39,8 @@ public function handle(): void
$this->server->update(['detected_traefik_version' => $currentVersion]); $this->server->update(['detected_traefik_version' => $currentVersion]);
if (! $currentVersion) { if (! $currentVersion) {
ProxyStatusChangedUI::dispatch($this->server->team_id);
return; return;
} }
@ -48,16 +51,22 @@ public function handle(): void
// Handle empty/null response from SSH command // Handle empty/null response from SSH command
if (empty(trim($imageTag))) { if (empty(trim($imageTag))) {
ProxyStatusChangedUI::dispatch($this->server->team_id);
return; return;
} }
if (str_contains(strtolower(trim($imageTag)), ':latest')) { if (str_contains(strtolower(trim($imageTag)), ':latest')) {
ProxyStatusChangedUI::dispatch($this->server->team_id);
return; return;
} }
// Parse current version to extract major.minor.patch // Parse current version to extract major.minor.patch
$current = ltrim($currentVersion, 'v'); $current = ltrim($currentVersion, 'v');
if (! preg_match('/^(\d+\.\d+)\.(\d+)$/', $current, $matches)) { if (! preg_match('/^(\d+\.\d+)\.(\d+)$/', $current, $matches)) {
ProxyStatusChangedUI::dispatch($this->server->team_id);
return; return;
} }
@ -77,6 +86,8 @@ public function handle(): void
$this->server->update(['traefik_outdated_info' => null]); $this->server->update(['traefik_outdated_info' => null]);
} }
ProxyStatusChangedUI::dispatch($this->server->team_id);
return; return;
} }
@ -96,6 +107,9 @@ public function handle(): void
// Fully up to date // Fully up to date
$this->server->update(['traefik_outdated_info' => null]); $this->server->update(['traefik_outdated_info' => null]);
} }
// Dispatch UI update event so warning state refreshes in real-time
ProxyStatusChangedUI::dispatch($this->server->team_id);
} }
/** /**