From 9535c8df29037896c3a8a731528c17612a95ab64 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 11 Oct 2023 13:30:36 +0200 Subject: [PATCH] fix: check localhost connection --- app/Http/Livewire/Server/Form.php | 15 +++++++++++++-- resources/views/livewire/server/form.blade.php | 6 ++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/app/Http/Livewire/Server/Form.php b/app/Http/Livewire/Server/Form.php index 18fb1dbec..efe4f73eb 100644 --- a/app/Http/Livewire/Server/Form.php +++ b/app/Http/Livewire/Server/Form.php @@ -61,7 +61,18 @@ class Form extends Component $activity = InstallDocker::run($this->server); $this->emit('newMonitorActivity', $activity->id); } - + public function checkLocalhostConnection() { + $uptime = $this->server->validateConnection(); + if ($uptime) { + $this->emit('success', 'Server is reachable.'); + $this->server->settings->is_reachable = true; + $this->server->settings->is_usaable = true; + $this->server->settings->save(); + } else { + $this->emit('error', 'Server is not reachable. Please check your connection and configuration.'); + return; + } + } public function validateServer($install = true) { try { @@ -69,7 +80,7 @@ class Form extends Component if ($uptime) { $install && $this->emit('success', 'Server is reachable.'); } else { - $install &&$this->emit('error', 'Server is not reachable. Please check your connection and private key configuration.'); + $install &&$this->emit('error', 'Server is not reachable. Please check your connection and configuration.'); return; } $dockerInstalled = $this->server->validateDockerEngine(); diff --git a/resources/views/livewire/server/form.blade.php b/resources/views/livewire/server/form.blade.php index 515ec3eb4..d5382fd50 100644 --- a/resources/views/livewire/server/form.blade.php +++ b/resources/views/livewire/server/form.blade.php @@ -31,6 +31,12 @@ Validate Server & Install Docker Engine @endif + @if ($server->id === 0) + + Validate Server + + @endif