This commit is contained in:
Andras Bacsai 2023-05-16 12:50:00 +02:00
parent ce265e1f91
commit dedcc80501
3 changed files with 33 additions and 34 deletions

View File

@ -22,7 +22,7 @@ public function __invoke(Server $server, bool $reset = false)
$docker_compose_yml_base64 = base64_encode($final_output);
$server->extra_attributes->last_saved_proxy_settings = Str::of($docker_compose_yml_base64)->pipe('md5')->value;
$server->save();
if (is_null($output)) {
if (is_null($output) || $reset) {
instantRemoteProcess([
"mkdir -p $proxy_path",
"echo '$docker_compose_yml_base64' | base64 -d > $proxy_path/docker-compose.yml",

View File

@ -3,13 +3,13 @@
'message' => 'Are you sure you want to delete this?',
'action' => 'delete',
])
<div x-cloak x-show="{{ $show }}" x-transition.opacity class="fixed inset-0 bg-slate-900/75"></div>
<div x-cloak x-show="{{ $show }}" x-transition class="fixed inset-0 z-50 flex items-center justify-center">
<div @click.away="{{ $show }} = false" class="w-screen h-20 max-w-xl mx-auto bg-black rounded-lg">
<div class="flex flex-col items-center justify-center h-full">
<div class="pb-5 text-white">{{ $message }}</div>
<div>
<x-inputs.button isWarning wire:click='{{ $action }}'>
<div x-cloak x-show="{{ $show }}" x-transition.opacity class="fixed inset-0 bg-coolgray-100/75"></div>
<div x-cloak x-show="{{ $show }}" x-transition class="fixed inset-0 z-50 top-20">
<div @click.away="{{ $show }} = false" class="w-screen max-w-xl mx-auto rounded-lg shadow-xl bg-coolgray-200">
<div class="flex flex-col items-center justify-center h-full p-4">
<div class="pb-5 text-xs text-white">{{ $message }}</div>
<div class="text-xs">
<x-inputs.button isWarning wire:click='{{ $action }}' x-on:click="{{ $show }} = false">
Yes
</x-inputs.button>
<x-inputs.button x-on:click="{{ $show }} = false">No</x-inputs.button>

View File

@ -13,6 +13,9 @@
$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>
<x-inputs.button isBold wire:click="installProxy">
Reconfigure
</x-inputs.button>
@endif
@if ($server->extra_attributes->proxy_status !== 'running')
<x-inputs.button isBold wire:click="installProxy">
@ -22,33 +25,29 @@
<x-inputs.button isWarning x-on:click.prevent="stopProxy = true">Stop
</x-inputs.button>
@endif
<span x-data="{ showConfiguration: false }">
<x-inputs.button isBold x-on:click.prevent="showConfiguration = !showConfiguration">Show
Configuration
</x-inputs.button>
<div class="pt-4">
<livewire:activity-monitor />
<div class="py-4">
<livewire:activity-monitor />
</div>
<div x-init="$wire.checkProxySettingsInSync">
<div wire:loading wire:target="checkProxySettingsInSync">
<x-proxy.loading />
</div>
<template x-if="showConfiguration">
<div x-init="$wire.checkProxySettingsInSync">
<h3>Configuration</h3>
<div wire:loading wire:target="checkProxySettingsInSync">
<x-proxy.loading />
</div>
@isset($proxy_settings)
<form wire:submit.prevent='saveConfiguration'>
<div class="pb-2">
<x-inputs.button isBold>Save</x-inputs.button>
<x-inputs.button wire:click.prevent="resetProxy">
Reset Configuration
</x-inputs.button>
</div>
<textarea wire:model.defer="proxy_settings" class="w-full" rows="30"></textarea>
</form>
@endisset
</div>
</template>
</span>
@isset($proxy_settings)
<h3>Configuration</h3>
@if ($selectedProxy->value === 'TRAEFIK_V2')
<h4>traefik.conf</h4>
<form wire:submit.prevent='saveConfiguration'>
<x-inputs.input noDirty type="textarea" wire:model.defer="proxy_settings" rows="30" />
<div class="pt-2">
<x-inputs.button isBold>Save</x-inputs.button>
<x-inputs.button wire:click.prevent="resetProxy">
Reset Configuration
</x-inputs.button>
</div>
</form>
@endif
@endisset
</div>
</div>
@else
<select wire:model="selectedProxy">