fix: Traefik start on new server validation

fix: Multiple server selection ui flow
This commit is contained in:
Andras Bacsai
2025-05-26 21:06:00 +02:00
parent 6ea6d2742b
commit be0453d9df
5 changed files with 14 additions and 57 deletions

View File

@@ -24,6 +24,7 @@ class Configuration extends Component
return [
"echo-private:team.{$teamId},ServiceChecked" => '$refresh',
'buildPackUpdated' => '$refresh',
'refresh' => '$refresh',
];
}

View File

@@ -26,6 +26,7 @@ class Destination extends Component
return [
"echo-private:team.{$teamId},ApplicationStatusChanged" => 'loadData',
'refresh' => 'mount',
];
}
@@ -114,6 +115,7 @@ class Destination extends Component
$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 @@ class Destination extends Component
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 @@ class Destination extends Component
}
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 @@ class Destination extends Component
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);

View File

@@ -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 @@ class ValidateAndInstall extends Component
$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 @@ class ValidateAndInstall extends Component
if ($this->server->isBuildServer()) {
return;
}
$this->dispatch('startProxy');
}
public function render()