From f134171855a5af9430be5da949f296f2b5e8e053 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 23 Jul 2024 11:11:54 +0200 Subject: [PATCH] fix: restart proxy does not work + status indicator on the UI --- app/Livewire/Server/Proxy/Deploy.php | 8 ++++---- app/Livewire/Server/Proxy/Status.php | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/Livewire/Server/Proxy/Deploy.php b/app/Livewire/Server/Proxy/Deploy.php index 965c51e2d..2279951ee 100644 --- a/app/Livewire/Server/Proxy/Deploy.php +++ b/app/Livewire/Server/Proxy/Deploy.php @@ -50,7 +50,7 @@ public function traefikDashboardAvailable(bool $data) public function proxyStarted() { CheckProxy::run($this->server, true); - $this->dispatch('success', 'Proxy started.'); + $this->dispatch('proxyStatusUpdated'); } public function proxyStatusUpdated() @@ -61,7 +61,7 @@ public function proxyStatusUpdated() public function restart() { try { - $this->stop(); + $this->stop(forceStop: false); $this->dispatch('checkProxy'); } catch (\Throwable $e) { return handleError($e, $this); @@ -91,7 +91,7 @@ public function startProxy() } } - public function stop() + public function stop(bool $forceStop = true) { try { if ($this->server->isSwarm()) { @@ -104,7 +104,7 @@ public function stop() ], $this->server); } $this->server->proxy->status = 'exited'; - $this->server->proxy->force_stop = true; + $this->server->proxy->force_stop = $forceStop; $this->server->save(); $this->dispatch('proxyStatusUpdated'); } catch (\Throwable $e) { diff --git a/app/Livewire/Server/Proxy/Status.php b/app/Livewire/Server/Proxy/Status.php index 8dd4dd8e6..d23d7fc20 100644 --- a/app/Livewire/Server/Proxy/Status.php +++ b/app/Livewire/Server/Proxy/Status.php @@ -16,7 +16,10 @@ class Status extends Component public int $numberOfPolls = 0; - protected $listeners = ['proxyStatusUpdated' => '$refresh', 'startProxyPolling']; + protected $listeners = [ + 'proxyStatusUpdated', + 'startProxyPolling', + ]; public function startProxyPolling() {