diff --git a/app/Livewire/Project/Application/Configuration.php b/app/Livewire/Project/Application/Configuration.php index f0b95a9c8..021731c20 100644 --- a/app/Livewire/Project/Application/Configuration.php +++ b/app/Livewire/Project/Application/Configuration.php @@ -24,6 +24,7 @@ public function getListeners() return [ "echo-private:team.{$teamId},ServiceChecked" => '$refresh', 'buildPackUpdated' => '$refresh', + 'refresh' => '$refresh', ]; } diff --git a/app/Livewire/Project/Shared/Destination.php b/app/Livewire/Project/Shared/Destination.php index 9d5331ff6..a4343bff9 100644 --- a/app/Livewire/Project/Shared/Destination.php +++ b/app/Livewire/Project/Shared/Destination.php @@ -26,6 +26,7 @@ public function getListeners() return [ "echo-private:team.{$teamId},ApplicationStatusChanged" => 'loadData', + 'refresh' => 'mount', ]; } @@ -114,6 +115,7 @@ public function promote(int $network_id, int $server_id) $this->resource->additional_networks()->detach($network_id, ['server_id' => $server_id]); $this->resource->additional_networks()->attach($main_destination->id, ['server_id' => $main_destination->server->id]); $this->refreshServers(); + $this->resource->refresh(); } public function refreshServers() @@ -126,7 +128,7 @@ public function refreshServers() public function addServer(int $network_id, int $server_id) { $this->resource->additional_networks()->attach($network_id, ['server_id' => $server_id]); - $this->loadData(); + $this->dispatch('refresh'); } public function removeServer(int $network_id, int $server_id, $password) @@ -141,7 +143,7 @@ public function removeServer(int $network_id, int $server_id, $password) } if ($this->resource->destination->server->id == $server_id && $this->resource->destination->id == $network_id) { - $this->dispatch('error', 'You cannot remove this destination server.', 'You are trying to remove the main server.'); + $this->dispatch('error', 'You are trying to remove the main server.'); return; } @@ -149,6 +151,7 @@ public function removeServer(int $network_id, int $server_id, $password) StopApplicationOneServer::run($this->resource, $server); $this->resource->additional_networks()->detach($network_id, ['server_id' => $server_id]); $this->loadData(); + $this->dispatch('refresh'); ApplicationStatusChanged::dispatch(data_get($this->resource, 'environment.project.team.id')); } catch (\Exception $e) { return handleError($e, $this); diff --git a/app/Livewire/Server/ValidateAndInstall.php b/app/Livewire/Server/ValidateAndInstall.php index 791ef9350..ba8fd9d4f 100644 --- a/app/Livewire/Server/ValidateAndInstall.php +++ b/app/Livewire/Server/ValidateAndInstall.php @@ -2,8 +2,6 @@ namespace App\Livewire\Server; -use App\Actions\Proxy\CheckProxy; -use App\Actions\Proxy\StartProxy; use App\Models\Server; use Livewire\Component; @@ -39,7 +37,6 @@ class ValidateAndInstall extends Component 'validateOS', 'validateDockerEngine', 'validateDockerVersion', - 'startProxy', 'refresh' => '$refresh', ]; @@ -64,25 +61,6 @@ public function startValidatingAfterAsking() $this->init(); } - public function startProxy() - { - try { - $shouldStart = CheckProxy::run($this->server); - if ($shouldStart) { - $proxy = StartProxy::run($this->server, false); - if ($proxy === 'OK') { - $this->proxy_started = true; - } else { - throw new \Exception('Proxy could not be started.'); - } - } else { - $this->proxy_started = true; - } - } catch (\Throwable $e) { - return handleError($e, $this); - } - } - public function validateConnection() { ['uptime' => $this->uptime, 'error' => $error] = $this->server->validateConnection(); @@ -172,7 +150,6 @@ public function validateDockerVersion() if ($this->server->isBuildServer()) { return; } - $this->dispatch('startProxy'); } public function render() diff --git a/resources/views/livewire/project/shared/destination.blade.php b/resources/views/livewire/project/shared/destination.blade.php index f0ae90830..c6a3e2370 100644 --- a/resources/views/livewire/project/shared/destination.blade.php +++ b/resources/views/livewire/project/shared/destination.blade.php @@ -34,7 +34,7 @@ class="relative flex flex-col bg-white border cursor-default dark:text-white box @if ($resource?->additional_networks?->count() > 0 && data_get($resource, 'build_pack') !== 'dockercompose')

Additional Server(s)

@foreach ($resource->additional_networks as $destination) -
+
@if (str(data_get($destination, 'pivot.status'))->startsWith('running'))
@isset($docker_version) - @if($docker_version) -
Minimum Docker version: Minimum Docker version:
@else -
Minimum Docker version: - -
+
Minimum Docker version: + +
@endif @else
@endisset - @if (!$server->isBuildServer()) - @if ($proxy_started) -
Proxy started: - - - - -
- @else - @if ($error) -
Proxy started: - -
- @else -
- @endif - @endif - @endif @else @if ($error)
Docker Compose is installed: