switch proxy

This commit is contained in:
Andras Bacsai 2023-06-08 08:39:00 +02:00
parent eb9c65d765
commit d029029043
6 changed files with 32 additions and 13 deletions

View File

@ -21,6 +21,11 @@ class Proxy extends Component
{
$this->server->refresh();
}
public function switchProxy()
{
$this->server->extra_attributes->proxy_type = null;
$this->server->save();
}
public function installProxy()
{
if (

View File

@ -12,7 +12,6 @@ class Status extends Component
protected $listeners = ['proxyStatusUpdated', 'serverValidated' => 'proxyStatusUpdated'];
public function proxyStatusUpdated()
{
ray('Status: ' . $this->server->extra_attributes->proxy_status);
$this->server->refresh();
}
public function proxyStatus()

View File

@ -35,7 +35,7 @@ label {
}
textarea {
@apply textarea placeholder:text-neutral-700 text-white rounded-none;
@apply textarea placeholder:text-neutral-700 text-white rounded-none scrollbar;
}
select {
@apply select select-sm text-sm disabled:bg-coolgray-200 border-none disabled:opacity-50 font-normal placeholder:text-neutral-700 text-white rounded-none;

View File

@ -55,8 +55,8 @@
</div>
@endif
@isset($uptime)
<h3>Server Info</h3>
<div class="pt-3 text-sm">
<h3 class="py-3">Server Info</h3>
<div class="text-sm">
<p>Uptime: {{ $uptime }}</p>
@isset($dockerVersion)
<p>Docker Engine {{ $dockerVersion }}</p>

View File

@ -13,9 +13,9 @@
<div class="flex items-center gap-2">
<h2>Proxy</h2>
<x-forms.button type="submit">Save</x-forms.button>
<x-forms.button wire:click.prevent="resetProxy">
Reset to default
</x-forms.button>
@if ($server->extra_attributes->proxy_status === 'exited')
<x-forms.button wire:click.prevent="switchProxy">Switch Proxy</x-forms.button>
@endif
<livewire:server.proxy.status :server="$server" />
</div>
<div class="pb-4 text-sm">Traefik v2</div>
@ -25,8 +25,13 @@
<div class="text-sm text-red-500">Configuration out of sync. Restart to get the new configs.
</div>
@endif
<x-forms.textarea label="Configuration file: traefik.conf" class="text-xs" noDirty
name="proxy_settings" wire:model.defer="proxy_settings" rows="30" />
<div class="flex flex-col gap-2">
<x-forms.textarea label="Configuration file: traefik.conf" class="text-xs" noDirty
name="proxy_settings" wire:model.defer="proxy_settings" rows="30" />
<x-forms.button wire:click.prevent="resetProxy">
Reset configuration to default
</x-forms.button>
</div>
</form>
@endif
@endisset
@ -34,9 +39,19 @@
@else
<div>
<h2>Proxy</h2>
<x-forms.button wire:click="setProxy('{{ \App\Enums\ProxyTypes::TRAEFIK_V2 }}')">Traefik v2
</x-forms.button>
<div class="pt-2 pb-10 text-sm">Select a proxy you would like to use on this server.</div>
<div class="flex gap-2">
<x-forms.button class="w-32 box" wire:click="setProxy('{{ \App\Enums\ProxyTypes::TRAEFIK_V2 }}')">
Traefik
v2
</x-forms.button>
<x-forms.button disabled class="w-32 box">
Nginx
</x-forms.button>
<x-forms.button disabled class="w-32 box">
Caddy
</x-forms.button>
</div>
</div>
@endif
<div class="container w-full pt-4 mx-auto">

View File

@ -1,6 +1,6 @@
<div>
@if ($server->settings->is_validated)
<div wire:poll.5000ms="proxyStatus">
<div wire:poll.10000ms="proxyStatus">
@if ($server->extra_attributes->proxy_status === 'running')
<x-loading wire:loading.delay.longer />
<div class="flex items-center gap-2" wire:loading.remove.delay.longer>