fix: show all storages in one place for services

This commit is contained in:
Andras Bacsai
2023-10-03 08:48:07 +02:00
parent 1560ab2a50
commit 68c976ab70
6 changed files with 88 additions and 30 deletions

View File

@@ -1,28 +1,33 @@
<div>
<div>
<div class="flex items-center gap-2">
<h2>Storages</h2>
@if ($resource->type() !== 'service')
<x-helper
helper="For Preview Deployments, storage has a <span class='text-helper'>-pr-#PRNumber</span> in their
@if ($isHeaderVisible)
<div>
<div class="flex items-center gap-2">
<h2>Storages</h2>
@if ($resource->type() !== 'service')
<x-helper
helper="For Preview Deployments, storage has a <span class='text-helper'>-pr-#PRNumber</span> in their
volume
name, example: <span class='text-helper'>-pr-1</span>" />
<x-forms.button class="btn" onclick="newStorage.showModal()">+ Add</x-forms.button>
<livewire:project.shared.storages.add :uuid="$resource->uuid" />
<x-forms.button class="btn" onclick="newStorage.showModal()">+ Add</x-forms.button>
<livewire:project.shared.storages.add :uuid="$resource->uuid" />
@endif
</div>
<div class="pb-4">Persistent storage to preserve data between deployments.</div>
@if ($resource->type() === 'service')
<span class="text-warning">Please modify storage layout in your <a class="underline"
href="{{ Str::of(url()->current())->beforeLast('/') }}">Docker Compose</a> file.</span>
<h2 class="pt-4">{{ Str::headline($resource->name) }} </h2>
@endif
</div>
<div>Persistent storage to preserve data between deployments.</div>
</div>
<div class="flex flex-col gap-2 py-4">
@forelse ($resource->persistentStorages as $storage)
@endif
<div class="flex flex-col gap-4">
@foreach ($resource->persistentStorages as $storage)
@if ($resource->type() === 'service')
<livewire:project.shared.storages.show wire:key="storage-{{ $storage->id }}" :storage="$storage"
<livewire:project.shared.storages.show wire:key="storage-{{ $storage->id }}" :storage="$storage" :isFirst="$loop->first"
isReadOnly='true' />
@else
<livewire:project.shared.storages.show wire:key="storage-{{ $storage->id }}" :storage="$storage" />
@endif
@empty
<div class="text-neutral-500">No volume storages found.</div>
@endforelse
@endforeach
</div>
</div>

View File

@@ -6,19 +6,28 @@
reversible. <br>Please think again.</p>
</x-slot:modalBody>
</x-modal>
@once ($isReadOnly)
<span class="text-warning">Please modify storage layout in your <a
class="underline" href="{{ Str::of(url()->current())->beforeLast('/') }}">Docker Compose</a> file.</span>
@endonce
<form wire:submit.prevent='submit' class="flex flex-col gap-2 pt-4 xl:items-end xl:flex-row">
<form wire:submit.prevent='submit' class="flex flex-col gap-2 xl:items-end xl:flex-row">
@if ($isReadOnly)
<x-forms.input id="storage.name" label="Volume Name" required readonly />
<x-forms.input id="storage.host_path" label="Source Path" readonly />
<x-forms.input id="storage.mount_path" label="Destination Path" required readonly />
@if ($isFirst)
<x-forms.input id="storage.name" label="Volume Name" required readonly />
<x-forms.input id="storage.host_path" label="Source Path (on host)" readonly />
<x-forms.input id="storage.mount_path" label="Destination Path (in container)" required readonly />
@else
<x-forms.input id="storage.name" required readonly />
<x-forms.input id="storage.host_path" readonly />
<x-forms.input id="storage.mount_path" required readonly />
@endif
@else
<x-forms.input id="storage.name" label="Name" required />
<x-forms.input id="storage.host_path" label="Source Path" />
<x-forms.input id="storage.mount_path" label="Destination Path" required />
@if ($isFirst)
<x-forms.input id="storage.name" label="Volume Name" required />
<x-forms.input id="storage.host_path" label="Source Path (on host)" />
<x-forms.input id="storage.mount_path" label="Destination Path (in container)" required />
@else
<x-forms.input id="storage.name" required />
<x-forms.input id="storage.host_path" />
<x-forms.input id="storage.mount_path" required />
@endif
<div class="flex gap-2">
<x-forms.button type="submit">
Update