This commit is contained in:
Andras Bacsai
2023-06-02 15:15:12 +02:00
parent 77321172a2
commit 0f28acac00
28 changed files with 346 additions and 228 deletions

View File

@@ -37,17 +37,20 @@
@endif
</div>
</div>
<h3 class="pt-8 pb-4">Quick Actions</h3>
<div class="flex items-center gap-2">
<x-forms.button wire:click.prevent='validateServer'>
@if ($server->settings->is_validated)
Check Connection
@else
Validate Server
@endif
@if (!$server->settings->is_validated)
<x-forms.button class="mt-4" isHighlighted wire:click.prevent='validateServer'>
Validate Server
</x-forms.button>
{{-- <x-forms.button wire:click.prevent='installDocker'>Install Docker</x-forms.button> --}}
</div>
@endif
@if ($server->settings->is_validated)
<h3 class="pt-8 pb-4">Quick Actions</h3>
<div class="flex items-center gap-2">
<x-forms.button wire:click.prevent='validateServer'>
Check Connection
</x-forms.button>
{{-- <x-forms.button wire:click.prevent='installDocker'>Install Docker</x-forms.button> --}}
</div>
@endif
<div class="pt-3 text-sm">
@isset($uptime)
<p>Uptime: {{ $uptime }}</p>
@@ -76,10 +79,12 @@
</a>
</div>
<div>
@foreach ($server->standaloneDockers as $docker)
@forelse ($server->standaloneDockers as $docker)
<a href="{{ route('destination.show', ['destination_uuid' => data_get($docker, 'uuid')]) }}">
<button class="text-white btn-link">{{ data_get($docker, 'network') }}</button>
</a>
@endforeach
@empty
<div class="text-sm">No destinations added</div>
@endforelse
</div>
</div>

View File

@@ -2,38 +2,6 @@
<x-naked-modal show="stopProxy" action="stopProxy"
message='Are you sure you would like to stop the proxy? All resources will be unavailable.' />
@if ($server->settings->is_validated)
<div class="flex items-center gap-2 mb-2">
<h2>Proxy</h2>
@if ($server->extra_attributes->proxy_type)
<x-forms.button isHighlighted wire:click.prevent="installProxy">
Start/Reconfigure Proxy
</x-forms.button>
<x-forms.button x-on:click.prevent="stopProxy = true">Stop
</x-forms.button>
<div wire:poll.5000ms="proxyStatus">
@if (
$server->extra_attributes->last_applied_proxy_settings &&
$server->extra_attributes->last_saved_proxy_settings !== $server->extra_attributes->last_applied_proxy_settings)
<div class="text-red-500">Configuration out of sync.</div>
@endif
</div>
@endif
@if ($server->extra_attributes->proxy_status === 'running')
<span class="text-xs text-pink-600" wire:loading.delay.longer>Loading current status...</span>
<div class="flex items-center gap-2 text-sm" wire:loading.remove.delay.longer>
<span class="flex w-3 h-3 rounded-full bg-success"></span>
<span class="text-green-500">Running</span>
</div>
@else
<span class="text-xs text-pink-600" wire:loading.delay.longer>Loading current status...</span>
<div class="flex items-center gap-2 text-sm" wire:loading.remove.delay.longer>
<span class="flex w-3 h-3 rounded-full bg-error"></span>
<span class="text-error">Stopped</span>
</div>
@endif
</div>
<livewire:activity-monitor />
@if ($server->extra_attributes->proxy_type)
<div x-init="$wire.checkProxySettingsInSync">
<div wire:loading wire:target="checkProxySettingsInSync">
@@ -41,15 +9,23 @@
</div>
@isset($proxy_settings)
@if ($selectedProxy->value === 'TRAEFIK_V2')
<form wire:submit.prevent='saveConfiguration'>
<form wire:submit.prevent='saveConfiguration({{ $server }})'>
<div class="flex items-center gap-2">
<h3>Configuration</h3>
<x-forms.button type="submit">Save</x-forms.button>
<x-forms.button wire:click.prevent="resetProxy">
Reset Configuration
</x-forms.button>
<h2>Proxy</h2>
<livewire:server.proxy.status :server="$server" />
</div>
<h4>traefik.conf</h4>
<div class="pb-4 text-sm">Traefik v2</div>
@if (
$server->extra_attributes->proxy_last_applied_settings &&
$server->extra_attributes->proxy_last_saved_settings !== $server->extra_attributes->proxy_last_applied_settings)
<div class="text-sm text-red-500">Configuration out of sync. Restart to get the new configs.
</div>
@endif
<x-forms.button type="submit">Save</x-forms.button>
<x-forms.button wire:click.prevent="resetProxy">
Reset to default
</x-forms.button>
<div class="pt-4 pb-0 text-xs">traefik.conf</div>
<x-forms.textarea class="text-xs" noDirty name="proxy_settings"
wire:model.defer="proxy_settings" rows="30" />
</form>
@@ -57,14 +33,16 @@
@endisset
</div>
@else
<select wire:model="selectedProxy">
<option value="{{ \App\Enums\ProxyTypes::TRAEFIK_V2 }}">
{{ \App\Enums\ProxyTypes::TRAEFIK_V2 }}
</option>
</select>
<x-forms.button wire:click="setProxy">Set Proxy</x-forms.button>
<div>
<h2>Select a Proxy</h2>
<x-forms.button wire:click="setProxy('{{ \App\Enums\ProxyTypes::TRAEFIK_V2 }}')">Traefik v2
</x-forms.button>
</div>
@endif
<div class="container w-full pt-4 mx-auto">
<livewire:activity-monitor :header="true" />
</div>
@else
<p>Server is not validated. Validate first.</p>
<div class="text-sm">Server is not validated. Validate first.</div>
@endif
</div>

View File

@@ -0,0 +1,44 @@
<div>
@if ($server->settings->is_validated)
@if ($server->extra_attributes->proxy_status === 'running')
<div class="dropdown dropdown-bottom">
<x-forms.button isHighlighted tabindex="0">
Actions
<x-chevron-down />
</x-forms.button>
<ul tabindex="0"
class="mt-1 text-xs text-white normal-case rounded min-w-max dropdown-content menu bg-coolgray-200">
<li>
<div class="rounded-none hover:bg-coollabs" wire:click='deploy'><svg
xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M9 4.55a8 8 0 0 1 6 14.9m0 -4.45v5h5" />
<path d="M5.63 7.16l0 .01" />
<path d="M4.06 11l0 .01" />
<path d="M4.63 15.1l0 .01" />
<path d="M7.16 18.37l0 .01" />
<path d="M11 19.94l0 .01" />
</svg>Restart</div>
</li>
<li>
<div class="rounded-none hover:bg-red-500" wire:click='stop'> <svg
xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path
d="M5 5m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z" />
</svg>Stop</div>
</li>
</ul>
</div>
@else
<x-forms.button isHighlighted wire:click='deploy'> <svg xmlns="http://www.w3.org/2000/svg" class="icon"
width="44" height="44" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M7 4v16l13 -8z" />
</svg>Start</x-forms.button>
@endif
@endif
</div>

View File

@@ -0,0 +1,17 @@
<div>
@if ($server->settings->is_validated)
<div wire:poll.5000ms="proxyStatus">
@if ($server->extra_attributes->proxy_status === 'running')
<span class="text-xs text-pink-600" wire:loading.delay.longer>Loading current status...</span>
<div class="flex items-center gap-2 text-sm" wire:loading.remove.delay.longer>
<div class="text-xs font-medium tracking-wide text-white badge border-success">Running</div>
</div>
@else
<span class="text-xs text-pink-600" wire:loading.delay.longer>Loading current status...</span>
<div class="flex items-center gap-2 text-sm" wire:loading.remove.delay.longer>
<div class="text-xs font-medium tracking-wide text-white badge border-error">Stopped</div>
</div>
@endif
</div>
@endif
</div>