diff --git a/app/Livewire/Project/Service/Storage.php b/app/Livewire/Project/Service/Storage.php index 26cd54425..fb7da1184 100644 --- a/app/Livewire/Project/Service/Storage.php +++ b/app/Livewire/Project/Service/Storage.php @@ -39,7 +39,32 @@ public function refreshStoragesFromEvent() public function refreshStorages() { $this->fileStorage = $this->resource->fileStorages()->get(); - $this->dispatch('$refresh'); + $this->resource->refresh(); + } + + public function getFilesProperty() + { + return $this->fileStorage->where('is_directory', false); + } + + public function getDirectoriesProperty() + { + return $this->fileStorage->where('is_directory', true); + } + + public function getVolumeCountProperty() + { + return $this->resource->persistentStorages()->count(); + } + + public function getFileCountProperty() + { + return $this->files->count(); + } + + public function getDirectoryCountProperty() + { + return $this->directories->count(); } public function addNewVolume($data) diff --git a/resources/views/livewire/project/service/file-storage.blade.php b/resources/views/livewire/project/service/file-storage.blade.php index aa0ce66a3..3aa24b087 100644 --- a/resources/views/livewire/project/service/file-storage.blade.php +++ b/resources/views/livewire/project/service/file-storage.blade.php @@ -1,73 +1,75 @@ -
-
-
- - +
+
+
+
+ + +
-
-
- @can('update', $resource) -
- @if ($fileStorage->is_directory) - - - @else - @if (!$fileStorage->is_binary) - + @can('update', $resource) +
+ @if ($fileStorage->is_directory) + + shortConfirmationLabel="Filepath" :confirmWithPassword="false" step2ButtonText="Convert to file" /> + + @else + @if (!$fileStorage->is_binary) + + @endif + Load from server + @endif - Load from server - - @endif -
- @endcan - @if (!$fileStorage->is_directory) - @can('update', $resource) - @if (data_get($resource, 'settings.is_preserve_repository_enabled')) -
- -
- @endif - - @if (!$fileStorage->is_based_on_git && !$fileStorage->is_binary) - Save - @endif - @else - @if (data_get($resource, 'settings.is_preserve_repository_enabled')) -
- -
- @endif - +
@endcan - @endif -
+ @if (!$fileStorage->is_directory) + @can('update', $resource) + @if (data_get($resource, 'settings.is_preserve_repository_enabled')) +
+ +
+ @endif + + @if (!$fileStorage->is_based_on_git && !$fileStorage->is_binary) + Save + @endif + @else + @if (data_get($resource, 'settings.is_preserve_repository_enabled')) +
+ +
+ @endif + + @endcan + @endif + +
diff --git a/resources/views/livewire/project/service/storage.blade.php b/resources/views/livewire/project/service/storage.blade.php index 41d48f386..56a52a566 100644 --- a/resources/views/livewire/project/service/storage.blade.php +++ b/resources/views/livewire/project/service/storage.blade.php @@ -1,4 +1,4 @@ -
+
@if ( $resource->getMorphClass() == 'App\Models\Application' || $resource->getMorphClass() == 'App\Models\StandalonePostgresql' || @@ -9,50 +9,117 @@ $resource->getMorphClass() == 'App\Models\StandaloneClickhouse' || $resource->getMorphClass() == 'App\Models\StandaloneMongodb' || $resource->getMorphClass() == 'App\Models\StandaloneMysql') -
-

Storages

- - @if ($resource?->build_pack !== 'dockercompose') - @can('update', $resource) - - - - @endcan - @endif +
+
+

Storages

+ + @if ($resource?->build_pack !== 'dockercompose') + @can('update', $resource) + + + + @endcan + @endif +
+
Persistent storage to preserve data between deployments.
-
Persistent storage to preserve data between deployments.
@if ($resource?->build_pack === 'dockercompose') - Please modify storage layout in your Docker Compose - file or reload the compose file to reread the storage layout. +
Please modify storage layout in your Docker Compose + file or reload the compose file to reread the storage layout.
@else @if ($resource->persistentStorages()->get()->count() === 0 && $fileStorage->count() == 0) -
No storage found.
+
No storage found.
@endif @endif - @if ($resource->persistentStorages()->get()->count() > 0) -

Volumes

- - @endif - @if ($fileStorage->count() > 0) -
- @foreach ($fileStorage as $fs) - - @endforeach + @php + $hasVolumes = $this->volumeCount > 0; + $hasFiles = $this->fileCount > 0; + $hasDirectories = $this->directoryCount > 0; + $defaultTab = $hasVolumes ? 'volumes' : ($hasFiles ? 'files' : 'directories'); + @endphp + + @if ($hasVolumes || $hasFiles || $hasDirectories) +
+ {{-- Tabs Navigation --}} +
+ + + +
+ + {{-- Tab Content --}} +
+ {{-- Volumes Tab --}} +
+ @if ($hasVolumes) + + @else +
+ No volumes configured. +
+ @endif +
+ + {{-- Files Tab --}} +
+ @if ($hasFiles) + @foreach ($this->files as $fs) + + @endforeach + @else +
+ No file mounts configured. +
+ @endif +
+ + {{-- Directories Tab --}} +
+ @if ($hasDirectories) + @foreach ($this->directories as $fs) + + @endforeach + @else +
+ No directory mounts configured. +
+ @endif +
+
@endif @else @if ($resource->persistentStorages()->get()->count() > 0) -

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

+

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

@endif @if ($resource->persistentStorages()->get()->count() > 0) @endif @if ($fileStorage->count() > 0) -
+
@foreach ($fileStorage->sort() as $fileStorage) diff --git a/resources/views/livewire/project/shared/storages/show.blade.php b/resources/views/livewire/project/shared/storages/show.blade.php index 569df0c4b..8c0ba0c06 100644 --- a/resources/views/livewire/project/shared/storages/show.blade.php +++ b/resources/views/livewire/project/shared/storages/show.blade.php @@ -1,5 +1,5 @@
-
+ @if ($isReadOnly) @if ($isFirst)