This commit is contained in:
Andras Bacsai 2023-06-22 21:17:53 +02:00
parent 37646bcfa0
commit 1304631aad
4 changed files with 47 additions and 35 deletions

View File

@ -44,7 +44,7 @@ class Form extends Component
public function validateServer() public function validateServer()
{ {
try { try {
$this->uptime = instant_remote_process(['uptime'], $this->server, false); $this->uptime = instant_remote_process(['uptime'], $this->server);
if ($this->uptime) { if ($this->uptime) {
$this->server->settings->is_reachable = true; $this->server->settings->is_reachable = true;
$this->server->settings->save(); $this->server->settings->save();
@ -61,7 +61,10 @@ class Form extends Component
$this->emit('serverValidated'); $this->emit('serverValidated');
} }
} catch (\Exception $e) { } catch (\Exception $e) {
return general_error_handler(err: $e, that: $this); $this->server->settings->is_reachable = false;
$this->server->settings->is_usable = false;
$this->server->settings->save();
return general_error_handler(customErrorMessage: "Server is not reachable. Reason: {$e->getMessage()}", that: $this);
} }
} }
public function delete() public function delete()

View File

@ -21,6 +21,9 @@ class PrivateKey extends Component
Toaster::success('Server is reachable with this private key.'); Toaster::success('Server is reachable with this private key.');
} }
} catch (\Exception $e) { } catch (\Exception $e) {
$this->server->settings->is_reachable = false;
$this->server->settings->is_usable = false;
$this->server->settings->save();
return general_error_handler(customErrorMessage: "Server is not reachable. Reason: {$e->getMessage()}", that: $this); return general_error_handler(customErrorMessage: "Server is not reachable. Reason: {$e->getMessage()}", that: $this);
} }
} }

View File

@ -66,6 +66,7 @@ class Proxy extends Component
$this->server->proxy->last_saved_settings = Str::of($docker_compose_yml_base64)->pipe('md5')->value; $this->server->proxy->last_saved_settings = Str::of($docker_compose_yml_base64)->pipe('md5')->value;
$this->server->proxy->redirect_url = $this->redirect_url; $this->server->proxy->redirect_url = $this->redirect_url;
$this->server->save(); $this->server->save();
instant_remote_process([ instant_remote_process([
"echo '$docker_compose_yml_base64' | base64 -d > $proxy_path/docker-compose.yml", "echo '$docker_compose_yml_base64' | base64 -d > $proxy_path/docker-compose.yml",
], $this->server); ], $this->server);

View File

@ -7,7 +7,8 @@
<div wire:loading wire:target="checkProxySettingsInSync"> <div wire:loading wire:target="checkProxySettingsInSync">
<x-loading /> <x-loading />
</div> </div>
@isset($proxy_settings) <div wire:loading.remove>
@if ($proxy_settings)
@if ($selectedProxy->value === 'TRAEFIK_V2') @if ($selectedProxy->value === 'TRAEFIK_V2')
<form wire:submit.prevent='saveConfiguration'> <form wire:submit.prevent='saveConfiguration'>
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
@ -22,7 +23,8 @@
@if ( @if (
$server->proxy->last_applied_settings && $server->proxy->last_applied_settings &&
$server->proxy->last_saved_settings !== $server->proxy->last_applied_settings) $server->proxy->last_saved_settings !== $server->proxy->last_applied_settings)
<div class="text-red-500 ">Configuration out of sync. Restart to get the new configs. <div class="text-red-500 ">Configuration out of sync. Restart to get the new
configs.
</div> </div>
@endif @endif
@if ($server->id !== 0) @if ($server->id !== 0)
@ -41,7 +43,10 @@
</div> </div>
</form> </form>
@endif @endif
@endisset @else
<div class="">Server is not validated. Validate first.</div>
@endif
</div>
</div> </div>
@else @else
<div> <div>