wip: ui for services

This commit is contained in:
Andras Bacsai
2023-09-22 11:23:49 +02:00
parent 4ae7e46e81
commit 53d1fa0331
32 changed files with 575 additions and 250 deletions

View File

@@ -0,0 +1,14 @@
<form wire:submit.prevent='submit'>
<div class="flex gap-2 pb-4">
@if ($application->human_name)
<h2>{{ Str::headline($application->human_name) }}</h2>
@else
<h2>{{ Str::headline($application->name) }}</h2>
@endif
<x-forms.button type="submit">Save</x-forms.button>
</div>
<div class="flex gap-2">
<x-forms.input label="Name" id="application.human_name" placeholder="Name"></x-forms.input>
<x-forms.input label="FQDN" required id="application.fqdn"></x-forms.input>
</div>
</form>

View File

@@ -0,0 +1,13 @@
<form wire:submit.prevent='submit'>
<div class="flex gap-2 pb-4">
@if ($database->human_name)
<h2>{{ Str::headline($database->human_name) }}</h2>
@else
<h2>{{ Str::headline($database->name) }}</h2>
@endif
<x-forms.button type="submit">Save</x-forms.button>
</div>
<div class="flex gap-2">
<x-forms.input label="Name" id="database.human_name" placeholder="Name"></x-forms.input>
</div>
</form>

View File

@@ -1,25 +1,79 @@
<div x-init="$wire.check_status">
<livewire:project.service.modal />
<h1>Configuration</h1>
<x-resources.breadcrumbs :resource="$service" :parameters="$parameters" />
<x-services.navbar :service="$service" :parameters="$parameters" />
<h3>Applications</h3>
@foreach ($service->applications as $application)
<form class="box" wire:submit.prevent='submit'>
<p>{{ $application->name }}</p>
<x-forms.input id="services.{{ $application->name }}.fqdn"></x-forms.input>
<x-forms.button type="submit">Save</x-forms.button>
</form>
@endforeach
@if ($service->databases->count() > 0)
<h3>Databases</h3>
@endif
@foreach ($service->databases as $database)
<p>{{ $database->name }}</p>
<p>{{ $database->status }}</p>
@endforeach
<h3>Variables</h3>
@foreach ($service->environment_variables as $variable)
<p>{{ $variable->key }}={{ $variable->value }}</p>
@endforeach
</div>
<div x-data="{ raw: true, activeTab: window.location.hash ? window.location.hash.substring(1) : 'service-stack' }">
<livewire:project.service.navbar :service="$service" :parameters="$parameters" :query="$query" />
<div class="flex h-full pt-6">
<div class="flex flex-col gap-4 min-w-fit">
<a :class="activeTab === 'service-stack' && 'text-white'"
@click.prevent="activeTab = 'service-stack'; window.location.hash = 'service-stack'" href="#">Service Stack</a>
<a :class="activeTab === 'compose' && 'text-white'"
@click.prevent="activeTab = 'compose'; window.location.hash = 'compose'" href="#">Compose File</a>
<a :class="activeTab === 'environment-variables' && 'text-white'"
@click.prevent="activeTab = 'environment-variables'; window.location.hash = 'environment-variables'"
href="#">Environment
Variables</a>
<a :class="activeTab === 'danger' && 'text-white'"
@click.prevent="activeTab = 'danger'; window.location.hash = 'danger'" href="#">Danger Zone
</a>
</div>
<div class="w-full pl-8">
<div x-cloak x-show="activeTab === 'service-stack'">
<h2 class="pb-4"> Service Stack </h2>
<div class="grid grid-cols-1 gap-2">
@foreach ($service->applications as $application)
<a class="flex flex-col justify-center box"
href="{{ route('project.service.show', [...$parameters, 'service_name' => $application->name]) }}">
@if ($application->human_name)
{{ Str::headline($application->human_name) }}
@else
{{ Str::headline($application->name) }}
@endif
@if ($application->fqdn)
<span class="text-xs">{{ $application->fqdn }}</span>
@endif
</a>
@endforeach
@foreach ($service->databases as $database)
<a class="justify-center box"
href="{{ route('project.service.show', [...$parameters, 'service_name' => $database->name]) }}">
@if ($database->human_name)
{{ Str::headline($database->human_name) }}
@else
{{ Str::headline($database->name) }}
@endif
</a>
@endforeach
</div>
</div>
<div x-cloak x-show="activeTab === 'compose'">
<div x-cloak x-show="activeTab === 'compose'">
<div class="flex gap-2 pb-4">
<h2>Docker Compose</h2>
<div x-cloak x-show="raw">
<x-forms.button class="w-64" @click.prevent="raw = !raw">Show Deployable</x-forms.button>
<x-forms.button wire:click='save'>Save</x-forms.button>
</div>
<div x-cloak x-show="raw === false">
<x-forms.button class="w-64" @click.prevent="raw = !raw">Show Source</x-forms.button>
<x-forms.button disabled wire:click='save'>Save</x-forms.button>
</div>
</div>
<div x-cloak x-show="raw">
<x-forms.textarea rows="20" id="service.docker_compose_raw">
</x-forms.textarea>
</div>
<div x-cloak x-show="raw === false">
<x-forms.textarea readonly rows="20" id="service.docker_compose">
</x-forms.textarea>
</div>
</div>
</div>
<div x-cloak x-show="activeTab === 'environment-variables'">
<div x-cloak x-show="activeTab === 'environment-variables'">
<livewire:project.shared.environment-variable.all :resource="$service" />
</div>
</div>
<div x-cloak x-show="activeTab === 'danger'">
<livewire:project.shared.danger :resource="$service" />
</div>
</div>
</div>

View File

@@ -0,0 +1,6 @@
<div x-init="$wire.check_status">
<livewire:project.service.modal />
<h1>Configuration</h1>
<x-resources.breadcrumbs :resource="$service" :parameters="$parameters" />
<x-services.navbar :service="$service" :parameters="$parameters" />
</div>

View File

@@ -0,0 +1,30 @@
<div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : 'general' }">
<livewire:project.service.navbar :service="$service" :parameters="$parameters" :query="$query" />
<div class="flex h-full pt-6">
<div class="flex flex-col gap-4 min-w-fit">
<a :class="activeTab === 'general' && 'text-white'"
@click.prevent="activeTab = 'general'; window.location.hash = 'general'" href="#">General</a>
<a :class="activeTab === 'storages' && 'text-white'"
@click.prevent="activeTab = 'storages'; window.location.hash = 'storages'" href="#">Storages
</a>
</div>
<div class="w-full pl-8">
@isset($serviceApplication)
<div x-cloak x-show="activeTab === 'general'" class="h-full">
<livewire:project.service.application :application="$serviceApplication" />
</div>
<div x-cloak x-show="activeTab === 'storages'">
<livewire:project.shared.storages.all :resource="$serviceApplication" />
</div>
@endisset
@isset($serviceDatabase)
<div x-cloak x-show="activeTab === 'general'" class="h-full">
<livewire:project.service.database :database="$serviceDatabase" />
</div>
<div x-cloak x-show="activeTab === 'storages'">
<livewire:project.shared.storages.all :resource="$serviceDatabase" />
</div>
@endisset
</div>
</div>
</div>