Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

feat(storage): add read-only volume handling and UI notifications

Andras Bacsaib4cfb78f86be
diff --git a/app/Livewire/Project/Service/FileStorage.php b/app/Livewire/Project/Service/FileStorage.php
index 2933a8cca5..7f0caaba3f 100644
--- a/app/Livewire/Project/Service/FileStorage.php
+++ b/app/Livewire/Project/Service/FileStorage.php
@@ -34,6 +34,8 @@ class FileStorage extends Component
public bool $permanently_delete = true;
+ public bool $isReadOnly = false;
+
protected $rules = [
'fileStorage.is_directory' => 'required',
'fileStorage.fs_path' => 'required',
@@ -52,6 +54,8 @@ class FileStorage extends Component
$this->workdir = null;
$this->fs_path = $this->fileStorage->fs_path;
}
+
+ $this->isReadOnly = $this->fileStorage->isReadOnlyVolume();
}
public function convertToDirectory()
diff --git a/app/Livewire/Project/Shared/Storages/Show.php b/app/Livewire/Project/Shared/Storages/Show.php
index 3928ee1d4a..4f57cbfa6f 100644
--- a/app/Livewire/Project/Shared/Storages/Show.php
+++ b/app/Livewire/Project/Shared/Storages/Show.php
@@ -37,6 +37,11 @@ class Show extends Component
'host_path' => 'host',
];
+ public function mount()
+ {
+ $this->isReadOnly = $this->storage->isReadOnlyVolume();
+ }
+
public function submit()
{
$this->authorize('update', $this->resource);
diff --git a/app/Models/LocalFileVolume.php b/app/Models/LocalFileVolume.php
index b3e71d75de..376ea9c5ea 100644
--- a/app/Models/LocalFileVolume.php
+++ b/app/Models/LocalFileVolume.php
@@ -5,6 +5,7 @@ namespace App\Models;
use App\Events\FileStorageChanged;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
+use Symfony\Component\Yaml\Yaml;
class LocalFileVolume extends BaseModel
{
@@ -192,4 +193,61 @@ class LocalFileVolume extends BaseModel
{
return $query->get()->where('plain_mount_path', $path);
}
+
+ // Check if this volume is read-only by parsing the docker-compose content
+ public function isReadOnlyVolume(): bool
+ {
+ try {
+ // Only check for services
+ $service = $this->service;
+ if (! $service || ! method_exists($service, 'service')) {
+ return false;
+ }
+
+ $actualService = $service->service;
+ if (! $actualService || ! $actualService->docker_compose_raw) {
+ return false;
+ }
+
+ // Parse the docker-compose content
+ $compose = Yaml::parse($actualService->docker_compose_raw);
+ if (! isset($compose['services'])) {
+ return false;
+ }
+
+ // Find the service that this volume belongs to
+ $serviceName = $service->name;
+ if (! isset($compose['services'][$serviceName]['volumes'])) {
+ return false;
+ }
+
+ $volumes = $compose['services'][$serviceName]['volumes'];
+
+ // Check each volume to find a match
+ foreach ($volumes as $volume) {
+ // Volume can be string like "host:container:ro" or "host:container"
+ if (is_string($volume)) {
+ $parts = explode(':', $volume);
+
+ // Check if this volume matches our fs_path and mount_path
+ if (count($parts) >= 2) {
+ $hostPath = $parts[0];
+ $containerPath = $parts[1];
+ $options = $parts[2] ?? null;
+
+ // Match based on fs_path and mount_path
+ if ($hostPath === $this->fs_path && $containerPath === $this->mount_path) {
+ return $options === 'ro';
+ }
+ }
+ }
+ }
+
+ return false;
+ } catch (\Throwable $e) {
+ ray($e->getMessage(), 'Error checking read-only volume');
+
+ return false;
+ }
+ }
}
diff --git a/app/Models/LocalPersistentVolume.php b/app/Models/LocalPersistentVolume.php
index 00dc15fea2..e7862478b9 100644
--- a/app/Models/LocalPersistentVolume.php
+++ b/app/Models/LocalPersistentVolume.php
@@ -4,6 +4,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
+use Symfony\Component\Yaml\Yaml;
class LocalPersistentVolume extends Model
{
@@ -48,4 +49,69 @@ class LocalPersistentVolume extends Model
}
);
}
+
+ // Check if this volume is read-only by parsing the docker-compose content
+ public function isReadOnlyVolume(): bool
+ {
+ try {
+ // Get the resource (can be application, service, or database)
+ $resource = $this->resource;
+ if (! $resource) {
+ return false;
+ }
+
+ // Only check for services
+ if (! method_exists($resource, 'service')) {
+ return false;
+ }
+
+ $actualService = $resource->service;
+ if (! $actualService || ! $actualService->docker_compose_raw) {
+ return false;
+ }
+
+ // Parse the docker-compose content
+ $compose = Yaml::parse($actualService->docker_compose_raw);
+ if (! isset($compose['services'])) {
+ return false;
+ }
+
+ // Find the service that this volume belongs to
+ $serviceName = $resource->name;
+ if (! isset($compose['services'][$serviceName]['volumes'])) {
+ return false;
+ }
+
+ $volumes = $compose['services'][$serviceName]['volumes'];
+
+ // Check each volume to find a match
+ foreach ($volumes as $volume) {
+ // Volume can be string like "host:container:ro" or "host:container"
+ if (is_string($volume)) {
+ $parts = explode(':', $volume);
+
+ // Check if this volume matches our mount_path
+ if (count($parts) >= 2) {
+ $containerPath = $parts[1];
+ $options = $parts[2] ?? null;
+
+ // Match based on mount_path
+ // Remove leading slash from mount_path if present for comparison
+ $mountPath = str($this->mount_path)->ltrim('/')->toString();
+ $containerPathClean = str($containerPath)->ltrim('/')->toString();
+
+ if ($mountPath === $containerPathClean || $this->mount_path === $containerPath) {
+ return $options === 'ro';
+ }
+ }
+ }
+ }
+
+ return false;
+ } catch (\Throwable $e) {
+ ray($e->getMessage(), 'Error checking read-only persistent volume');
+
+ return false;
+ }
+ }
}
diff --git a/resources/views/livewire/project/service/file-storage.blade.php b/resources/views/livewire/project/service/file-storage.blade.php
index 3aa24b0875..dc8f949fa0 100644
--- a/resources/views/livewire/project/service/file-storage.blade.php
+++ b/resources/views/livewire/project/service/file-storage.blade.php
@@ -1,5 +1,14 @@
<div>
<div class="flex flex-col gap-4 p-4 bg-white border dark:bg-base dark:border-coolgray-300 border-neutral-200">
+ @if ($isReadOnly)
+ <div class="w-full p-2 text-sm rounded bg-warning/10 text-warning">
+ @if ($fileStorage->is_directory)
+ This directory is mounted as read-only and cannot be modified from the UI.
+ @else
+ This file is mounted as read-only and cannot be modified from the UI.
+ @endif
+ </div>
+ @endif
<div class="flex flex-col justify-center text-sm select-text">
<div class="flex gap-2 md:flex-row flex-col">
<x-forms.input label="Source Path" :value="$fileStorage->fs_path" readonly />
@@ -7,58 +16,75 @@
</div>
</div>
<form wire:submit='submit' class="flex flex-col gap-2">
- @can('update', $resource)
- <div class="flex gap-2">
- @if ($fileStorage->is_directory)
- <x-modal-confirmation :ignoreWire="false" title="Confirm Directory Conversion to File?"
- buttonTitle="Convert to file" submitAction="convertToFile" :actions="[
- 'All files in this directory will be permanently deleted and an empty file will be created in its place.',
- ]"
- confirmationText="{{ $fs_path }}"
- confirmationLabel="Please confirm the execution of the actions by entering the Filepath below"
- shortConfirmationLabel="Filepath" :confirmWithPassword="false" step2ButtonText="Convert to file" />
- <x-modal-confirmation :ignoreWire="false" title="Confirm Directory Deletion?" buttonTitle="Delete"
- isErrorButton submitAction="delete" :checkboxes="$directoryDeletionCheckboxes" :actions="[
- 'The selected directory and all its contents will be permanently deleted from the container.',
- ]"
- confirmationText="{{ $fs_path }}"
- confirmationLabel="Please confirm the execution of the actions by entering the Filepath below"
- shortConfirmationLabel="Filepath" />
- @else
- @if (!$fileStorage->is_binary)
- <x-modal-confirmation :ignoreWire="false" title="Confirm File Conversion to Directory?"
- buttonTitle="Convert to directory" submitAction="convertToDirectory" :actions="[
- 'The selected file will be permanently deleted and an empty directory will be created in its place.',
+ @if (!$isReadOnly)
+ @can('update', $resource)
+ <div class="flex gap-2">
+ @if ($fileStorage->is_directory)
+ <x-modal-confirmation :ignoreWire="false" title="Confirm Directory Conversion to File?"
+ buttonTitle="Convert to file" submitAction="convertToFile" :actions="[
+ 'All files in this directory will be permanently deleted and an empty file will be created in its place.',
+ ]"
+ confirmationText="{{ $fs_path }}"
+ confirmationLabel="Please confirm the execution of the actions by entering the Filepath below"
+ shortConfirmationLabel="Filepath" :confirmWithPassword="false" step2ButtonText="Convert to file" />
+ <x-modal-confirmation :ignoreWire="false" title="Confirm Directory Deletion?" buttonTitle="Delete"
+ isErrorButton submitAction="delete" :checkboxes="$directoryDeletionCheckboxes" :actions="[
+ 'The selected directory and all its contents will be permanently deleted from the container.',
]"
confirmationText="{{ $fs_path }}"
confirmationLabel="Please confirm the execution of the actions by entering the Filepath below"
- shortConfirmationLabel="Filepath" :confirmWithPassword="false" step2ButtonText="Convert to directory" />
+ shortConfirmationLabel="Filepath" />
+ @else
+ @if (!$fileStorage->is_binary)
+ <x-modal-confirmation :ignoreWire="false" title="Confirm File Conversion to Directory?"
+ buttonTitle="Convert to directory" submitAction="convertToDirectory" :actions="[
+ 'The selected file will be permanently deleted and an empty directory will be created in its place.',
+ ]"
+ confirmationText="{{ $fs_path }}"
+ confirmationLabel="Please confirm the execution of the actions by entering the Filepath below"
+ shortConfirmationLabel="Filepath" :confirmWithPassword="false"
+ step2ButtonText="Convert to directory" />
+ @endif
+ <x-forms.button type="button" wire:click="loadStorageOnServer">Load from
+ server</x-forms.button>
+ <x-modal-confirmation :ignoreWire="false" title="Confirm File Deletion?" buttonTitle="Delete"
+ isErrorButton submitAction="delete" :checkboxes="$fileDeletionCheckboxes" :actions="['The selected file will be permanently deleted from the container.']"
+ confirmationText="{{ $fs_path }}"
+ confirmationLabel="Please confirm the execution of the actions by entering the Filepath below"
+ shortConfirmationLabel="Filepath" />
@endif
- <x-forms.button type="button" wire:click="loadStorageOnServer">Load from server</x-forms.button>
- <x-modal-confirmation :ignoreWire="false" title="Confirm File Deletion?" buttonTitle="Delete"
- isErrorButton submitAction="delete" :checkboxes="$fileDeletionCheckboxes" :actions="['The selected file will be permanently deleted from the container.']"
- confirmationText="{{ $fs_path }}"
- confirmationLabel="Please confirm the execution of the actions by entering the Filepath below"
- shortConfirmationLabel="Filepath" />
- @endif
- </div>
- @endcan
- @if (!$fileStorage->is_directory)
- @can('update', $resource)
- @if (data_get($resource, 'settings.is_preserve_repository_enabled'))
- <div class="w-96">
- <x-forms.checkbox instantSave label="Is this based on the Git repository?"
- id="fileStorage.is_based_on_git"></x-forms.checkbox>
- </div>
- @endif
- <x-forms.textarea
- label="{{ $fileStorage->is_based_on_git ? 'Content (refreshed after a successful deployment)' : 'Content' }}"
- rows="20" id="fileStorage.content"
- readonly="{{ $fileStorage->is_based_on_git || $fileStorage->is_binary }}"></x-forms.textarea>
- @if (!$fileStorage->is_based_on_git && !$fileStorage->is_binary)
- <x-forms.button class="w-full" type="submit">Save</x-forms.button>
- @endif
- @else
+ </div>
+ @endcan
+ @if (!$fileStorage->is_directory)
+ @can('update', $resource)
+ @if (data_get($resource, 'settings.is_preserve_repository_enabled'))
+ <div class="w-96">
+ <x-forms.checkbox instantSave label="Is this based on the Git repository?"
+ id="fileStorage.is_based_on_git"></x-forms.checkbox>
+ </div>
+ @endif
+ <x-forms.textarea
+ label="{{ $fileStorage->is_based_on_git ? 'Content (refreshed after a successful deployment)' : 'Content' }}"
+ rows="20" id="fileStorage.content"
+ readonly="{{ $fileStorage->is_based_on_git || $fileStorage->is_binary }}"></x-forms.textarea>
+ @if (!$fileStorage->is_based_on_git && !$fileStorage->is_binary)
+ <x-forms.button class="w-full" type="submit">Save</x-forms.button>
+ @endif
+ @else
+ @if (data_get($resource, 'settings.is_preserve_repository_enabled'))
+ <div class="w-96">
+ <x-forms.checkbox disabled label="Is this based on the Git repository?"
+ id="fileStorage.is_based_on_git"></x-forms.checkbox>
+ </div>
+ @endif
+ <x-forms.textarea
+ label="{{ $fileStorage->is_based_on_git ? 'Content (refreshed after a successful deployment)' : 'Content' }}"
+ rows="20" id="fileStorage.content" disabled></x-forms.textarea>
+ @endcan
+ @endif
+ @else
+ {{-- Read-only view --}}
+ @if (!$fileStorage->is_directory)
@if (data_get($resource, 'settings.is_preserve_repository_enabled'))
<div class="w-96">
<x-forms.checkbox disabled label="Is this based on the Git repository?"
@@ -68,7 +94,7 @@
<x-forms.textarea
label="{{ $fileStorage->is_based_on_git ? 'Content (refreshed after a successful deployment)' : 'Content' }}"
rows="20" id="fileStorage.content" disabled></x-forms.textarea>
- @endcan
+ @endif
@endif
</form>
</div>
diff --git a/resources/views/livewire/project/service/storage.blade.php b/resources/views/livewire/project/service/storage.blade.php
index 47ee991141..d55bd801a1 100644
--- a/resources/views/livewire/project/service/storage.blade.php
+++ b/resources/views/livewire/project/service/storage.blade.php
@@ -23,7 +23,8 @@
volumeModalOpen: false,
fileModalOpen: false,
directoryModalOpen: false
- }" @close-storage-modal.window="
+ }"
+ @close-storage-modal.window="
if ($event.detail === 'volume') volumeModalOpen = false;
if ($event.detail === 'file') fileModalOpen = false;
if ($event.detail === 'directory') directoryModalOpen = false;
@@ -45,8 +46,7 @@
<div
class="p-1 mt-1 bg-white border rounded-sm shadow-sm dark:bg-coolgray-200 dark:border-coolgray-300 border-neutral-300">
<div class="flex flex-col gap-1">
- <a class="dropdown-item"
- @click="volumeModalOpen = true; dropdownOpen = false">
+ <a class="dropdown-item" @click="volumeModalOpen = true; dropdownOpen = false">
<svg class="size-4" fill="none" stroke="currentColor"
viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
@@ -105,31 +105,41 @@
</button>
</div>
<div class="relative flex items-center justify-center w-auto"
- x-init="$watch('volumeModalOpen', value => { if(value) { $nextTick(() => { const input = $el.querySelector('input'); input?.focus(); }) } })">
- <form class="flex flex-col w-full gap-2 rounded-sm" wire:submit='submitPersistentVolume'>
+ x-init="$watch('volumeModalOpen', value => {
+ if (value) {
+ $nextTick(() => {
+ const input = $el.querySelector('input');
+ input?.focus();
+ })
+ }
+ })">
+ <form class="flex flex-col w-full gap-2 rounded-sm"
+ wire:submit='submitPersistentVolume'>
<div class="flex flex-col">
<div>Docker Volumes mounted to the container.</div>
</div>
@if ($isSwarm)
- <div class="text-warning">Swarm Mode detected: You need to set a shared volume
- (EFS/NFS/etc) on all the worker nodes if you would like to use a persistent
+ <div class="text-warning">Swarm Mode detected: You need to set a shared
+ volume
+ (EFS/NFS/etc) on all the worker nodes if you would like to use a
+ persistent
volumes.</div>
@endif
<div class="flex flex-col gap-2">
<x-forms.input canGate="update" :canResource="$resource" placeholder="pv-name"
id="name" label="Name" required helper="Volume name." />
@if ($isSwarm)
- <x-forms.input canGate="update" :canResource="$resource" placeholder="/root"
- id="host_path" label="Source Path" required
+ <x-forms.input canGate="update" :canResource="$resource"
+ placeholder="/root" id="host_path" label="Source Path" required
helper="Directory on the host system." />
@else
- <x-forms.input canGate="update" :canResource="$resource" placeholder="/root"
- id="host_path" label="Source Path"
+ <x-forms.input canGate="update" :canResource="$resource"
+ placeholder="/root" id="host_path" label="Source Path"
helper="Directory on the host system." />
@endif
- <x-forms.input canGate="update" :canResource="$resource" placeholder="/tmp/root"
- id="mount_path" label="Destination Path" required
- helper="Directory inside the container." />
+ <x-forms.input canGate="update" :canResource="$resource"
+ placeholder="/tmp/root" id="mount_path" label="Destination Path"
+ required helper="Directory inside the container." />
<x-forms.button canGate="update" :canResource="$resource" type="submit">
Add
</x-forms.button>
@@ -169,15 +179,24 @@
</button>
</div>
<div class="relative flex items-center justify-center w-auto"
- x-init="$watch('fileModalOpen', value => { if(value) { $nextTick(() => { const input = $el.querySelector('input'); input?.focus(); }) } })">
- <form class="flex flex-col w-full gap-2 rounded-sm" wire:submit='submitFileStorage'>
+ x-init="$watch('fileModalOpen', value => {
+ if (value) {
+ $nextTick(() => {
+ const input = $el.querySelector('input');
+ input?.focus();
+ })
+ }
+ })">
+ <form class="flex flex-col w-full gap-2 rounded-sm"
+ wire:submit='submitFileStorage'>
<div class="flex flex-col">
<div>Actual file mounted from the host system to the container.</div>
</div>
<div class="flex flex-col gap-2">
<x-forms.input canGate="update" :canResource="$resource"
placeholder="/etc/nginx/nginx.conf" id="file_storage_path"
- label="Destination Path" required helper="File location inside the container" />
+ label="Destination Path" required
+ helper="File location inside the container" />
<x-forms.textarea canGate="update" :canResource="$resource" label="Content"
id="file_storage_content"></x-forms.textarea>
<x-forms.button canGate="update" :canResource="$resource" type="submit">
@@ -219,18 +238,27 @@
</button>
</div>
<div class="relative flex items-center justify-center w-auto"
- x-init="$watch('directoryModalOpen', value => { if(value) { $nextTick(() => { const input = $el.querySelector('input'); input?.focus(); }) } })">
- <form class="flex flex-col w-full gap-2 rounded-sm" wire:submit='submitFileStorageDirectory'>
+ x-init="$watch('directoryModalOpen', value => {
+ if (value) {
+ $nextTick(() => {
+ const input = $el.querySelector('input');
+ input?.focus();
+ })
+ }
+ })">
+ <form class="flex flex-col w-full gap-2 rounded-sm"
+ wire:submit='submitFileStorageDirectory'>
<div class="flex flex-col">
<div>Directory mounted from the host system to the container.</div>
</div>
<div class="flex flex-col gap-2">
<x-forms.input canGate="update" :canResource="$resource"
placeholder="{{ application_configuration_dir() }}/{{ $resource->uuid }}/etc/nginx"
- id="file_storage_directory_source" label="Source Directory" required
- helper="Directory on the host system." />
- <x-forms.input canGate="update" :canResource="$resource" placeholder="/etc/nginx"
- id="file_storage_directory_destination" label="Destination Directory" required
+ id="file_storage_directory_source" label="Source Directory"
+ required helper="Directory on the host system." />
+ <x-forms.input canGate="update" :canResource="$resource"
+ placeholder="/etc/nginx" id="file_storage_directory_destination"
+ label="Destination Directory" required
helper="Directory inside the container." />
<x-forms.button canGate="update" :canResource="$resource" type="submit">
Add
@@ -270,19 +298,22 @@
{{-- Tabs Navigation --}}
<div class="flex gap-2 border-b dark:border-coolgray-300 border-neutral-200">
<button @click="activeTab = 'volumes'"
- :class="activeTab === 'volumes' ? 'border-b-2 dark:border-white border-black' : 'border-b-2 border-transparent'"
+ :class="activeTab === 'volumes' ? 'border-b-2 dark:border-white border-black' :
+ 'border-b-2 border-transparent'"
@if (!$hasVolumes) disabled @endif
class="px-4 py-2 -mb-px font-medium transition-colors {{ $hasVolumes ? 'dark:text-neutral-400 dark:hover:text-white text-neutral-600 hover:text-black cursor-pointer' : 'opacity-50 cursor-not-allowed' }} focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-coollabs dark:focus-visible:ring-warning focus-visible:ring-offset-2 dark:focus-visible:ring-offset-coolgray-100">
Volumes ({{ $this->volumeCount }})
</button>
<button @click="activeTab = 'files'"
- :class="activeTab === 'files' ? 'border-b-2 dark:border-white border-black' : 'border-b-2 border-transparent'"
+ :class="activeTab === 'files' ? 'border-b-2 dark:border-white border-black' :
+ 'border-b-2 border-transparent'"
@if (!$hasFiles) disabled @endif
class="px-4 py-2 -mb-px font-medium transition-colors {{ $hasFiles ? 'dark:text-neutral-400 dark:hover:text-white text-neutral-600 hover:text-black cursor-pointer' : 'opacity-50 cursor-not-allowed' }} focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-coollabs dark:focus-visible:ring-warning focus-visible:ring-offset-2 dark:focus-visible:ring-offset-coolgray-100">
Files ({{ $this->fileCount }})
</button>
<button @click="activeTab = 'directories'"
- :class="activeTab === 'directories' ? 'border-b-2 dark:border-white border-black' : 'border-b-2 border-transparent'"
+ :class="activeTab === 'directories' ? 'border-b-2 dark:border-white border-black' :
+ 'border-b-2 border-transparent'"
@if (!$hasDirectories) disabled @endif
class="px-4 py-2 -mb-px font-medium transition-colors {{ $hasDirectories ? 'dark:text-neutral-400 dark:hover:text-white text-neutral-600 hover:text-black cursor-pointer' : 'opacity-50 cursor-not-allowed' }} focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-coollabs dark:focus-visible:ring-warning focus-visible:ring-offset-2 dark:focus-visible:ring-offset-coolgray-100">
Directories ({{ $this->directoryCount }})
@@ -333,19 +364,96 @@
</div>
@endif
@else
- @if ($resource->persistentStorages()->get()->count() > 0)
- <h3>{{ Str::headline($resource->name) }} </h3>
- @endif
- @if ($resource->persistentStorages()->get()->count() > 0)
- <livewire:project.shared.storages.all :resource="$resource" />
- @endif
- @if ($fileStorage->count() > 0)
- <div class="flex flex-col gap-4">
- @foreach ($fileStorage->sort() as $fileStorage)
- <livewire:project.service.file-storage :fileStorage="$fileStorage"
- wire:key="resource-{{ $fileStorage->uuid }}" />
- @endforeach
+ <div class="flex flex-col gap-4 py-2">
+ <div>
+ <div class="flex items-center gap-2">
+ <h2>{{ Str::headline($resource->name) }}</h2>
+ </div>
</div>
- @endif
+
+ @if ($resource->persistentStorages()->get()->count() === 0 && $fileStorage->count() == 0)
+ <div>No storage found.</div>
+ @endif
+
+ @php
+ $hasVolumes = $this->volumeCount > 0;
+ $hasFiles = $this->fileCount > 0;
+ $hasDirectories = $this->directoryCount > 0;
+ $defaultTab = $hasVolumes ? 'volumes' : ($hasFiles ? 'files' : 'directories');
+ @endphp
+
+ @if ($hasVolumes || $hasFiles || $hasDirectories)
+ <div x-data="{
+ activeTab: '{{ $defaultTab }}'
+ }">
+ {{-- Tabs Navigation --}}
+ <div class="flex gap-2 border-b dark:border-coolgray-300 border-neutral-200">
+ <button @click="activeTab = 'volumes'"
+ :class="activeTab === 'volumes' ? 'border-b-2 dark:border-white border-black' :
+ 'border-b-2 border-transparent'"
+ @if (!$hasVolumes) disabled @endif
+ class="px-4 py-2 -mb-px font-medium transition-colors {{ $hasVolumes ? 'dark:text-neutral-400 dark:hover:text-white text-neutral-600 hover:text-black cursor-pointer' : 'opacity-50 cursor-not-allowed' }} focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-coollabs dark:focus-visible:ring-warning focus-visible:ring-offset-2 dark:focus-visible:ring-offset-coolgray-100">
+ Volumes ({{ $this->volumeCount }})
+ </button>
+ <button @click="activeTab = 'files'"
+ :class="activeTab === 'files' ? 'border-b-2 dark:border-white border-black' :
+ 'border-b-2 border-transparent'"
+ @if (!$hasFiles) disabled @endif
+ class="px-4 py-2 -mb-px font-medium transition-colors {{ $hasFiles ? 'dark:text-neutral-400 dark:hover:text-white text-neutral-600 hover:text-black cursor-pointer' : 'opacity-50 cursor-not-allowed' }} focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-coollabs dark:focus-visible:ring-warning focus-visible:ring-offset-2 dark:focus-visible:ring-offset-coolgray-100">
+ Files ({{ $this->fileCount }})
+ </button>
+ <button @click="activeTab = 'directories'"
+ :class="activeTab === 'directories' ? 'border-b-2 dark:border-white border-black' :
+ 'border-b-2 border-transparent'"
+ @if (!$hasDirectories) disabled @endif
+ class="px-4 py-2 -mb-px font-medium transition-colors {{ $hasDirectories ? 'dark:text-neutral-400 dark:hover:text-white text-neutral-600 hover:text-black cursor-pointer' : 'opacity-50 cursor-not-allowed' }} focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-coollabs dark:focus-visible:ring-warning focus-visible:ring-offset-2 dark:focus-visible:ring-offset-coolgray-100">
+ Directories ({{ $this->directoryCount }})
+ </button>
+ </div>
+
+ {{-- Tab Content --}}
+ <div class="pt-4">
+ {{-- Volumes Tab --}}
+ <div x-show="activeTab === 'volumes'" class="flex flex-col gap-4">
+ @if ($hasVolumes)
+ <livewire:project.shared.storages.all :resource="$resource" />
+ @else
+ <div class="text-center py-8 dark:text-neutral-500 text-neutral-400">
+ No volumes configured.
+ </div>
+ @endif
+ </div>
+
+ {{-- Files Tab --}}
+ <div x-show="activeTab === 'files'" class="flex flex-col gap-4">
+ @if ($hasFiles)
+ @foreach ($this->files as $fs)
+ <livewire:project.service.file-storage :fileStorage="$fs"
+ wire:key="file-{{ $fs->id }}" />
+ @endforeach
+ @else
+ <div class="text-center py-8 dark:text-neutral-500 text-neutral-400">
+ No file mounts configured.
+ </div>
+ @endif
+ </div>
+
+ {{-- Directories Tab --}}
+ <div x-show="activeTab === 'directories'" class="flex flex-col gap-4">
+ @if ($hasDirectories)
+ @foreach ($this->directories as $fs)
+ <livewire:project.service.file-storage :fileStorage="$fs"
+ wire:key="directory-{{ $fs->id }}" />
+ @endforeach
+ @else
+ <div class="text-center py-8 dark:text-neutral-500 text-neutral-400">
+ No directory mounts configured.
+ </div>
+ @endif
+ </div>
+ </div>
+ </div>
+ @endif
+ </div>
@endif
</div>
diff --git a/resources/views/livewire/project/shared/storages/show.blade.php b/resources/views/livewire/project/shared/storages/show.blade.php
index 8c0ba0c061..798a97d94a 100644
--- a/resources/views/livewire/project/shared/storages/show.blade.php
+++ b/resources/views/livewire/project/shared/storages/show.blade.php
@@ -1,6 +1,9 @@
<div>
<form wire:submit='submit' class="flex flex-col items-center gap-4 p-4 bg-white border lg:items-start dark:bg-base dark:border-coolgray-300 border-neutral-200">
@if ($isReadOnly)
+ <div class="w-full p-2 text-sm rounded bg-warning/10 text-warning">
+ This volume is mounted as read-only and cannot be modified from the UI.
+ </div>
@if ($isFirst)
<div class="flex gap-2 items-end w-full md:flex-row flex-col">
@if (