Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

chore: Update listeners and proxy settings in server form and new server components

Andras Bacsai664a990c60b9
diff --git a/app/Livewire/Server/Form.php b/app/Livewire/Server/Form.php
index 8a4efb21df..3b3747a81e 100644
--- a/app/Livewire/Server/Form.php
+++ b/app/Livewire/Server/Form.php
@@ -24,7 +24,11 @@ class Form extends Component
public $timezones;
- protected $listeners = ['serverInstalled', 'revalidate' => '$refresh'];
+ protected $listeners = [
+ 'serverInstalled',
+ 'refreshServerShow' => 'serverInstalled',
+ 'revalidate' => '$refresh',
+ ];
protected $rules = [
'server.name' => 'required',
diff --git a/app/Livewire/Server/New/ByIp.php b/app/Livewire/Server/New/ByIp.php
index 5f69835d7a..f801524358 100644
--- a/app/Livewire/Server/New/ByIp.php
+++ b/app/Livewire/Server/New/ByIp.php
@@ -2,10 +2,10 @@
namespace App\Livewire\Server\New;
-use App\Enums\ProxyStatus;
use App\Enums\ProxyTypes;
use App\Models\Server;
use App\Models\Team;
+use Illuminate\Support\Collection;
use Livewire\Component;
class ByIp extends Component
@@ -40,7 +40,7 @@ class ByIp extends Component
public bool $is_build_server = false;
- public $swarm_managers = [];
+ public Collection $swarm_managers;
protected $rules = [
'name' => 'required|string',
@@ -102,11 +102,6 @@ class ByIp extends Component
'port' => $this->port,
'team_id' => currentTeam()->id,
'private_key_id' => $this->private_key_id,
- 'proxy' => [
- // set default proxy type to traefik v2
- 'type' => ProxyTypes::TRAEFIK->value,
- 'status' => ProxyStatus::EXITED->value,
- ],
];
if ($this->is_swarm_worker) {
$payload['swarm_cluster'] = $this->selected_swarm_cluster;
@@ -115,6 +110,9 @@ class ByIp extends Component
data_forget($payload, 'proxy');
}
$server = Server::create($payload);
+ $server->proxy->set('status', 'exited');
+ $server->proxy->set('type', ProxyTypes::TRAEFIK->value);
+ $server->save();
if ($this->is_build_server) {
$this->is_swarm_manager = false;
$this->is_swarm_worker = false;
diff --git a/app/Livewire/Server/Show.php b/app/Livewire/Server/Show.php
index 0751b186e9..a5e94a19a1 100644
--- a/app/Livewire/Server/Show.php
+++ b/app/Livewire/Server/Show.php
@@ -14,7 +14,7 @@ class Show extends Component
public $parameters = [];
- protected $listeners = ['refreshServerShow' => '$refresh'];
+ protected $listeners = ['refreshServerShow'];
public function mount()
{
@@ -29,6 +29,12 @@ class Show extends Component
}
}
+ public function refreshServerShow()
+ {
+ $this->server->refresh();
+ $this->dispatch('$refresh');
+ }
+
public function submit()
{
$this->dispatch('serverRefresh', false);