fix: server validation

This commit is contained in:
Andras Bacsai
2024-02-22 14:46:11 +01:00
parent 836458ad85
commit 592221b4bf
3 changed files with 14 additions and 12 deletions

View File

@@ -11,7 +11,7 @@ class ValidateAndInstall extends Component
{ {
public Server $server; public Server $server;
public int $number_of_tries = 0; public int $number_of_tries = 0;
public int $max_tries = 2; public int $max_tries = 1;
public bool $install = true; public bool $install = true;
public $uptime = null; public $uptime = null;
public $supported_os_type = null; public $supported_os_type = null;
@@ -99,7 +99,7 @@ class ValidateAndInstall extends Component
$this->error = 'Docker Engine could not be installed. Please install Docker manually before continuing: <a target="_blank" class="underline" href="https://docs.docker.com/engine/install/#server">documentation</a>.'; $this->error = 'Docker Engine could not be installed. Please install Docker manually before continuing: <a target="_blank" class="underline" href="https://docs.docker.com/engine/install/#server">documentation</a>.';
return; return;
} else { } else {
if ($this->number_of_tries == 0 ) { if ($this->number_of_tries == 0) {
$activity = $this->server->installDocker(); $activity = $this->server->installDocker();
$this->number_of_tries++; $this->number_of_tries++;
$this->dispatch('newActivityMonitor', $activity->id, 'init'); $this->dispatch('newActivityMonitor', $activity->id, 'init');

View File

@@ -469,7 +469,7 @@ class Server extends BaseModel
return false; return false;
} }
try { try {
$dockerRunning = instant_remote_process(["docker version"], $this); instant_remote_process(["docker version"], $this);
} catch (\Throwable $e) { } catch (\Throwable $e) {
$this->settings->is_usable = false; $this->settings->is_usable = false;
$this->settings->save(); $this->settings->save();

View File

@@ -10,15 +10,17 @@
</x-new-modal> </x-new-modal>
@else @else
<x-forms.button type="submit">Save</x-forms.button> <x-forms.button type="submit">Save</x-forms.button>
<x-slide-over closeWithX fullScreen> @if ($server->isFunctional())
<x-slot:title>Validate & configure</x-slot:title> <x-slide-over closeWithX fullScreen>
<x-slot:content> <x-slot:title>Validate & configure</x-slot:title>
<livewire:server.validate-and-install :server="$server" ask /> <x-slot:content>
</x-slot:content> <livewire:server.validate-and-install :server="$server" ask />
<x-forms.button @click="slideOverOpen=true" wire:click.prevent='validateServer' isHighlighted> </x-slot:content>
Revalidate server <x-forms.button @click="slideOverOpen=true" wire:click.prevent='validateServer' isHighlighted>
</x-forms.button> Revalidate server
</x-slide-over> </x-forms.button>
</x-slide-over>
@endif
@endif @endif
</div> </div>
@if ($server->isFunctional()) @if ($server->isFunctional())