From 68c976ab70564e4be5915f537448476cb39b220f Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 3 Oct 2023 08:48:07 +0200 Subject: [PATCH] fix: show all storages in one place for services --- .../Livewire/Project/Shared/Storages/All.php | 1 + .../Livewire/Project/Shared/Storages/Show.php | 1 + .../livewire/project/service/index.blade.php | 44 ++++++++++++++++++- .../livewire/project/service/show.blade.php | 4 +- .../project/shared/storages/all.blade.php | 37 +++++++++------- .../project/shared/storages/show.blade.php | 31 ++++++++----- 6 files changed, 88 insertions(+), 30 deletions(-) diff --git a/app/Http/Livewire/Project/Shared/Storages/All.php b/app/Http/Livewire/Project/Shared/Storages/All.php index 30fa9e9e9..8ac22d881 100644 --- a/app/Http/Livewire/Project/Shared/Storages/All.php +++ b/app/Http/Livewire/Project/Shared/Storages/All.php @@ -7,6 +7,7 @@ use Livewire\Component; class All extends Component { + public bool $isHeaderVisible = true; public $resource; protected $listeners = ['refreshStorages', 'submit']; diff --git a/app/Http/Livewire/Project/Shared/Storages/Show.php b/app/Http/Livewire/Project/Shared/Storages/Show.php index 84593aef3..15d16095c 100644 --- a/app/Http/Livewire/Project/Shared/Storages/Show.php +++ b/app/Http/Livewire/Project/Shared/Storages/Show.php @@ -11,6 +11,7 @@ class Show extends Component public LocalPersistentVolume $storage; public bool $isReadOnly = false; public ?string $modalId = null; + public bool $isFirst = true; protected $rules = [ 'storage.name' => 'required|string', diff --git a/resources/views/livewire/project/service/index.blade.php b/resources/views/livewire/project/service/index.blade.php index 75aa9166e..28a2deb63 100644 --- a/resources/views/livewire/project/service/index.blade.php +++ b/resources/views/livewire/project/service/index.blade.php @@ -7,6 +7,8 @@ Service Stack + Storages Environment @@ -34,7 +36,7 @@
- @foreach ($service->applications as $application) + @foreach ($applications as $application)
Str::of( $application->status)->contains(['exited']), @@ -98,6 +100,46 @@ @endforeach
+
+
+ @foreach ($applications as $application) + @if ($loop->first) + + @else + + @endif + @if ($application->fileStorages()->get()->count() > 0) +
Mounted Files/Dirs (binds)
+
+ @foreach ($application->fileStorages()->get()->sort() as $fileStorage) + + @endforeach +
+ @endif + @endforeach + @foreach ($databases as $database) + @if ($loop->first) +

{{ Str::headline($database->name) }}

+ @if ($applications->count() > 0) + + @else + + @endif + @if ($database->fileStorages()->get()->count() > 0) +
Mounted Files/Dirs (binds)
+
+ @foreach ($database->fileStorages()->get()->sort() as $fileStorage) + + @endforeach +
+ @endif + @else + + @endif + @endforeach +
diff --git a/resources/views/livewire/project/service/show.blade.php b/resources/views/livewire/project/service/show.blade.php index 8fcfc008a..b789e6550 100644 --- a/resources/views/livewire/project/service/show.blade.php +++ b/resources/views/livewire/project/service/show.blade.php @@ -26,7 +26,7 @@
@if ($serviceApplication->fileStorages()->get()->count() > 0) -

Mounted Files (binds)

+
Mounted Files/Dirs (binds)
@foreach ($serviceApplication->fileStorages()->get()->sort() as $fileStorage) @@ -42,7 +42,7 @@
@if ($serviceDatabase->fileStorages()->get()->count() > 0) -

Mounted Files (binds)

+
Mounted Files/Dirs (binds)
@foreach ($serviceDatabase->fileStorages()->get()->sort() as $fileStorage) diff --git a/resources/views/livewire/project/shared/storages/all.blade.php b/resources/views/livewire/project/shared/storages/all.blade.php index 21f7a89ae..fbf8cd593 100644 --- a/resources/views/livewire/project/shared/storages/all.blade.php +++ b/resources/views/livewire/project/shared/storages/all.blade.php @@ -1,28 +1,33 @@ -
- @forelse ($resource->persistentStorages as $storage) + @endif +
+ @foreach ($resource->persistentStorages as $storage) @if ($resource->type() === 'service') - @else @endif - @empty -
No volume storages found.
- @endforelse + @endforeach
diff --git a/resources/views/livewire/project/shared/storages/show.blade.php b/resources/views/livewire/project/shared/storages/show.blade.php index e84ff22ea..401b03069 100644 --- a/resources/views/livewire/project/shared/storages/show.blade.php +++ b/resources/views/livewire/project/shared/storages/show.blade.php @@ -6,19 +6,28 @@ reversible.
Please think again.

- @once ($isReadOnly) - Please modify storage layout in your
Docker Compose file. - @endonce -
+ + @if ($isReadOnly) - - - + @if ($isFirst) + + + + @else + + + + @endif @else - - - + @if ($isFirst) + + + + @else + + + + @endif
Update