Better proxy loading ui

This commit is contained in:
Andras Bacsai 2023-06-23 14:35:13 +02:00
parent 3293979381
commit 019a1fd448
2 changed files with 57 additions and 54 deletions

View File

@ -1 +1,6 @@
<span {{ $attributes->class(['bg-warning loading', 'loading-spinner' => !$attributes->has('class')]) }}></span> @props(['text' => null])
<span class="flex items-center gap-4 text-white">
{{ $text }}<span
{{ $attributes->class(['bg-warning loading', 'loading-spinner' => !$attributes->has('class')]) }}>
</span>
</span>

View File

@ -4,66 +4,64 @@
@if ($server->settings->is_reachable) @if ($server->settings->is_reachable)
@if ($server->proxy->type) @if ($server->proxy->type)
<div x-init="$wire.checkProxySettingsInSync"> <div x-init="$wire.checkProxySettingsInSync">
<div wire:loading wire:target="checkProxySettingsInSync"> @if ($selectedProxy->value === 'TRAEFIK_V2')
<x-loading /> <form wire:submit.prevent='saveConfiguration'>
</div> <div class="flex items-center gap-2">
<div wire:loading.remove> <h2>Proxy</h2>
@if ($proxy_settings) <x-forms.button type="submit">Save</x-forms.button>
@if ($selectedProxy->value === 'TRAEFIK_V2') @if ($server->proxy->status === 'exited')
<form wire:submit.prevent='saveConfiguration'> <x-forms.button wire:click.prevent="switchProxy">Switch Proxy</x-forms.button>
<div class="flex items-center gap-2"> @endif
<h2>Proxy</h2> <livewire:server.proxy.status :server="$server" />
<x-forms.button type="submit">Save</x-forms.button> </div>
@if ($server->proxy->status === 'exited')
<x-forms.button wire:click.prevent="switchProxy">Switch Proxy</x-forms.button> <div class="pt-3 pb-4 ">Traefik v2</div>
@endif @if (
<livewire:server.proxy.status :server="$server" /> $server->proxy->last_applied_settings &&
</div> $server->proxy->last_saved_settings !== $server->proxy->last_applied_settings)
<div class="pt-3 pb-4 ">Traefik v2</div> <div class="text-red-500 ">Configuration out of sync. Restart to get the new
@if ( configs.
$server->proxy->last_applied_settings && </div>
$server->proxy->last_saved_settings !== $server->proxy->last_applied_settings) @endif
<div class="text-red-500 ">Configuration out of sync. Restart to get the new <x-forms.input placeholder="https://coolify.io" id="redirect_url" label="Default Redirect 404"
configs. helper="All urls that has no service available will be redirected to this domain.<span class='text-helper'>You can set to your main marketing page or your social media link.</span>" />
</div> <div class="container w-full mx-auto">
@endif <livewire:activity-monitor :header="true" />
<x-forms.input placeholder="https://coolify.io" id="redirect_url" </div>
label="Default Redirect 404" <div wire:loading wire:target="checkProxySettingsInSync" class="pt-4">
helper="All urls that has no service available will be redirected to this domain.<span class='text-helper'>You can set to your main marketing page or your social media link.</span>" /> <x-loading text="Loading proxy configuration..." />
<div class="container w-full mx-auto"> </div>
<livewire:activity-monitor :header="true" /> <div wire:loading.remove wire:target="checkProxySettingsInSync">
</div> @if ($proxy_settings)
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2 pt-2">
<x-forms.textarea label="Configuration file: traefik.conf" class="text-xs" noDirty <x-forms.textarea label="Configuration file: traefik.conf" class="text-xs" noDirty
name="proxy_settings" wire:model.defer="proxy_settings" rows="30" /> name="proxy_settings" wire:model.defer="proxy_settings" rows="30" />
<x-forms.button wire:click.prevent="resetProxy"> <x-forms.button wire:click.prevent="resetProxy">
Reset configuration to default Reset configuration to default
</x-forms.button> </x-forms.button>
</div> </div>
</form> @endif
@endif </div>
@else </form>
<div class="">Server is not validated. Validate first.</div> @endif
@endif @else
<div>
<h2>Proxy</h2>
<div class="pt-2 pb-10 ">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> </div>
</div>
@else
<div>
<h2>Proxy</h2>
<div class="pt-2 pb-10 ">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 @endif
@else @else
<div class="">Server is not validated. Validate first.</div> <div class="">Server is not validated. Validate first.</div>