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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
Merge remote-tracking branch 'origin/next' into automation/sync-main-to-next
Andras Bacsai09e98222640a
diff --cc app/Actions/Database/StartDatabase.phpindex cd7e083286,c7fbff37b5..cb1c517539--- a/app/Actions/Database/StartDatabase.php+++ b/app/Actions/Database/StartDatabase.php@@@ -28,37 -32,34 +32,37 @@@ class StartDatabasif (! $server->isFunctional()) {return 'Server is not functional';}- $database->resetRestartLimit();+ $database->update([+ 'restart_count' => 0,+ 'last_restart_at' => null,+ 'last_restart_type' => null,+ ]);- switch ($database->getMorphClass()) {- case StandalonePostgresql::class:- $activity = StartPostgresql::run($database);- break;- case StandaloneRedis::class:- $activity = StartRedis::run($database);- break;- case StandaloneMongodb::class:- $activity = StartMongodb::run($database);- break;- case StandaloneMysql::class:- $activity = StartMysql::run($database);- break;- case StandaloneMariadb::class:- $activity = StartMariadb::run($database);- break;- case StandaloneKeydb::class:- $activity = StartKeydb::run($database);- break;- case StandaloneDragonfly::class:- $activity = StartDragonfly::run($database);- break;- case StandaloneClickhouse::class:- $activity = StartClickhouse::run($database);- break;++ $activity = activity()+ ->withProperties([+ 'server_uuid' => $server->uuid,+ 'type' => ActivityTypes::INLINE->value,+ 'type_uuid' => $database->uuid,+ 'status' => ProcessStatus::QUEUED->value,+ 'team_id' => $server->team_id,+ 'operation' => 'database-start',+ ])+ ->performedOn($database)+ ->event(ActivityTypes::INLINE->value)+ ->log('[]');++ if ($activity === null) {+ return 'Database start could not be queued because activity logging is disabled.';-}++ DatabaseStartJob::dispatch(+ $database->getMorphClass(),+ (int) $database->getKey(),+ (int) $database->team()->id,+ (int) $activity->getKey(),+ auth()->id(),+ );+if ($database->is_public && $database->public_port) {StartDatabaseProxy::dispatch($database);}diff --cc app/Livewire/Project/Database/BackupEdit.phpindex 4a709d2b96,1d223b6967..d938ebde8d--- a/app/Livewire/Project/Database/BackupEdit.php+++ b/app/Livewire/Project/Database/BackupEdit.php@@@ -242,18 -245,15 +250,23 @@@ class BackupEdit extends Componentry {$this->authorize('manageBackups', $this->backup->database);+ $database = $this->backup->database->refresh();+ $this->status = $database->status;+ if ($database->id !== 0 && ! str($database->status)->startsWith('running')) {+ $this->dispatch('error', 'The database must be running to start a backup.');++ return;+ }+DatabaseBackupJob::dispatch($this->backup);- $this->dispatch('success', 'Backup queued. It will be available in a few minutes.');-$database = $this->backup->database;+ auditLog('ui.database.backup_started', [+ 'team_id' => $database->team()?->id,+ 'database_uuid' => $database->uuid,+ 'database_name' => $database->name,+ 'backup_uuid' => $this->backup->uuid,+ ]);+ $this->dispatch('success', 'Backup queued. It will be available in a few minutes.');if ($database instanceof ServiceDatabase) {return redirect()->route('project.service.database.backup.executions', [diff --cc app/Livewire/Project/Database/BackupNow.phpindex 8c83e33556,e45c797d1e..39a1960119--- a/app/Livewire/Project/Database/BackupNow.php+++ b/app/Livewire/Project/Database/BackupNow.php@@@ -17,14 -17,14 +17,21 @@@ class BackupNow extends Componentry {$this->authorize('manageBackups', $this->backup->database);+ $database = $this->backup->database->refresh();+ if ($database->id !== 0 && ! str($database->status)->startsWith('running')) {+ $this->dispatch('error', 'The database must be running to start a backup.');++ return;+ }+DatabaseBackupJob::dispatch($this->backup);+ $database = $this->backup->database;+ auditLog('ui.database.backup_started', [+ 'team_id' => $database->team()?->id,+ 'database_uuid' => $database->uuid,+ 'database_name' => $database->name,+ 'backup_uuid' => $this->backup->uuid,+ ]);$this->dispatch('success', 'Backup queued. It will be available in a few minutes.');} catch (\Throwable $e) {return handleError($e, $this);diff --cc app/Models/StandaloneClickhouse.phpindex 7ca45cc3b7,a627d00aa6..6265345ee9--- a/app/Models/StandaloneClickhouse.php+++ b/app/Models/StandaloneClickhouse.php@@@ -5,15 -6,21 +6,18 @@@ use App\Traits\Auditableuse App\Traits\ClearsGlobalSearchCache;use App\Traits\HasDatabaseHealthCheck;use App\Traits\HasMetrics;-use App\Traits\HasRestartLimit;use App\Traits\HasSafeStringAttribute;+ use App\Traits\HasSecretManager;use Illuminate\Database\Eloquent\Casts\Attribute;use Illuminate\Database\Eloquent\Factories\HasFactory;use Illuminate\Database\Eloquent\SoftDeletes;class StandaloneClickhouse extends BaseModel{- use ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasSafeStringAttribute, SoftDeletes;-- use Auditable, ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasRestartLimit, HasSafeStringAttribute, HasSecretManager, SoftDeletes;++ use Auditable, ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasSafeStringAttribute, HasSecretManager, SoftDeletes;++ protected array $auditExclude = ['last_online_at'];-protected $fillable = ['uuid','name',diff --cc app/Models/StandaloneDragonfly.phpindex 769d9f00c4,8371bd0493..da4804dd2d--- a/app/Models/StandaloneDragonfly.php+++ b/app/Models/StandaloneDragonfly.php@@@ -5,14 -6,18 +6,15 @@@ use App\Traits\Auditableuse App\Traits\ClearsGlobalSearchCache;use App\Traits\HasDatabaseHealthCheck;use App\Traits\HasMetrics;-use App\Traits\HasRestartLimit;use App\Traits\HasSafeStringAttribute;+ use App\Traits\HasSecretManager;use Illuminate\Database\Eloquent\Casts\Attribute;use Illuminate\Database\Eloquent\Factories\HasFactory;use Illuminate\Database\Eloquent\SoftDeletes;class StandaloneDragonfly extends BaseModel{- use ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasSafeStringAttribute, SoftDeletes;-- use Auditable, ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasRestartLimit, HasSafeStringAttribute, HasSecretManager, SoftDeletes;-++ use Auditable, ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasSafeStringAttribute, HasSecretManager, SoftDeletes;protected $fillable = ['uuid',diff --cc app/Models/StandaloneKeydb.phpindex 15a1fe2f82,bbe55a4f5a..f4dbaec210--- a/app/Models/StandaloneKeydb.php+++ b/app/Models/StandaloneKeydb.php@@@ -5,14 -6,18 +6,15 @@@ use App\Traits\Auditableuse App\Traits\ClearsGlobalSearchCache;use App\Traits\HasDatabaseHealthCheck;use App\Traits\HasMetrics;-use App\Traits\HasRestartLimit;use App\Traits\HasSafeStringAttribute;+ use App\Traits\HasSecretManager;use Illuminate\Database\Eloquent\Casts\Attribute;use Illuminate\Database\Eloquent\Factories\HasFactory;use Illuminate\Database\Eloquent\SoftDeletes;class StandaloneKeydb extends BaseModel{- use ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasSafeStringAttribute, SoftDeletes;-- use Auditable, ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasRestartLimit, HasSafeStringAttribute, HasSecretManager, SoftDeletes;-++ use Auditable, ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasSafeStringAttribute, HasSecretManager, SoftDeletes;protected $fillable = ['uuid',diff --cc app/Models/StandaloneMariadb.phpindex 378d36395d,d35509ce99..c923b489bd--- a/app/Models/StandaloneMariadb.php+++ b/app/Models/StandaloneMariadb.php@@@ -5,7 -6,9 +6,8 @@@ use App\Traits\Auditableuse App\Traits\ClearsGlobalSearchCache;use App\Traits\HasDatabaseHealthCheck;use App\Traits\HasMetrics;-use App\Traits\HasRestartLimit;use App\Traits\HasSafeStringAttribute;+ use App\Traits\HasSecretManager;use Illuminate\Database\Eloquent\Casts\Attribute;use Illuminate\Database\Eloquent\Factories\HasFactory;use Illuminate\Database\Eloquent\Relations\MorphTo;@@@ -13,7 -16,9 +15,7 @@@ use Illuminate\Database\Eloquent\SoftDeclass StandaloneMariadb extends BaseModel{- use ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasSafeStringAttribute, SoftDeletes;-- use Auditable, ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasRestartLimit, HasSafeStringAttribute, HasSecretManager, SoftDeletes;-++ use Auditable, ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasSafeStringAttribute, HasSecretManager, SoftDeletes;protected $fillable = ['uuid',diff --cc app/Models/StandaloneMongodb.phpindex 1010ca5f37,faf54e0e71..70b108087a--- a/app/Models/StandaloneMongodb.php+++ b/app/Models/StandaloneMongodb.php@@@ -5,14 -6,18 +6,15 @@@ use App\Traits\Auditableuse App\Traits\ClearsGlobalSearchCache;use App\Traits\HasDatabaseHealthCheck;use App\Traits\HasMetrics;-use App\Traits\HasRestartLimit;use App\Traits\HasSafeStringAttribute;+ use App\Traits\HasSecretManager;use Illuminate\Database\Eloquent\Casts\Attribute;use Illuminate\Database\Eloquent\Factories\HasFactory;use Illuminate\Database\Eloquent\SoftDeletes;class StandaloneMongodb extends BaseModel{- use ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasSafeStringAttribute, SoftDeletes;-- use Auditable, ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasRestartLimit, HasSafeStringAttribute, HasSecretManager, SoftDeletes;-++ use Auditable, ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasSafeStringAttribute, HasSecretManager, SoftDeletes;protected $fillable = ['uuid',diff --cc app/Models/StandaloneMysql.phpindex 90828bf012,5a1ecb8425..6a08a4dc45--- a/app/Models/StandaloneMysql.php+++ b/app/Models/StandaloneMysql.php@@@ -5,14 -6,18 +6,15 @@@ use App\Traits\Auditableuse App\Traits\ClearsGlobalSearchCache;use App\Traits\HasDatabaseHealthCheck;use App\Traits\HasMetrics;-use App\Traits\HasRestartLimit;use App\Traits\HasSafeStringAttribute;+ use App\Traits\HasSecretManager;use Illuminate\Database\Eloquent\Casts\Attribute;use Illuminate\Database\Eloquent\Factories\HasFactory;use Illuminate\Database\Eloquent\SoftDeletes;class StandaloneMysql extends BaseModel{- use ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasSafeStringAttribute, SoftDeletes;-- use Auditable, ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasRestartLimit, HasSafeStringAttribute, HasSecretManager, SoftDeletes;-++ use Auditable, ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasSafeStringAttribute, HasSecretManager, SoftDeletes;protected $fillable = ['uuid',diff --cc app/Models/StandalonePostgresql.phpindex e7db812858,e91539d55b..f8dc5c0caa--- a/app/Models/StandalonePostgresql.php+++ b/app/Models/StandalonePostgresql.php@@@ -5,14 -6,18 +6,15 @@@ use App\Traits\Auditableuse App\Traits\ClearsGlobalSearchCache;use App\Traits\HasDatabaseHealthCheck;use App\Traits\HasMetrics;-use App\Traits\HasRestartLimit;use App\Traits\HasSafeStringAttribute;+ use App\Traits\HasSecretManager;use Illuminate\Database\Eloquent\Casts\Attribute;use Illuminate\Database\Eloquent\Factories\HasFactory;use Illuminate\Database\Eloquent\SoftDeletes;class StandalonePostgresql extends BaseModel{- use ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasSafeStringAttribute, SoftDeletes;-- use Auditable, ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasRestartLimit, HasSafeStringAttribute, HasSecretManager, SoftDeletes;-++ use Auditable, ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasSafeStringAttribute, HasSecretManager, SoftDeletes;protected $fillable = ['uuid',diff --cc app/Models/StandaloneRedis.phpindex 3262611903,674f7867fd..3bfcc5434e--- a/app/Models/StandaloneRedis.php+++ b/app/Models/StandaloneRedis.php@@@ -5,15 -6,21 +6,18 @@@ use App\Traits\Auditableuse App\Traits\ClearsGlobalSearchCache;use App\Traits\HasDatabaseHealthCheck;use App\Traits\HasMetrics;-use App\Traits\HasRestartLimit;use App\Traits\HasSafeStringAttribute;+ use App\Traits\HasSecretManager;use Illuminate\Database\Eloquent\Casts\Attribute;use Illuminate\Database\Eloquent\Factories\HasFactory;use Illuminate\Database\Eloquent\SoftDeletes;class StandaloneRedis extends BaseModel{- use ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasSafeStringAttribute, SoftDeletes;-- use Auditable, ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasRestartLimit, HasSafeStringAttribute, HasSecretManager, SoftDeletes;++ use Auditable, ClearsGlobalSearchCache, HasDatabaseHealthCheck, HasFactory, HasMetrics, HasSafeStringAttribute, HasSecretManager, SoftDeletes;++ protected array $auditExclude = ['last_online_at'];-protected $fillable = ['uuid','name',diff --cc resources/views/livewire/project/service/heading.blade.phpindex 22ce7dab3e,7604d7d0cc..8c6531f3bc--- a/resources/views/livewire/project/service/heading.blade.php+++ b/resources/views/livewire/project/service/heading.blade.php@@@ -72,15 -65,9 +72,14 @@@{{ $service->name }}</h1><div class="relative flex w-full min-w-0 items-center gap-2">- <x-status-summary :status="$displayStatus" :title="$selectedResource ? 'Resource status' : 'Service status'"- :container-name="$selectedResource ? 'Container' : 'Containers'" />+ <x-status-summary :status="$service->status" title="Service status" container-name="Containers" /><x-services.links :service="$service" compact /></div>+ <div class="flex w-full flex-wrap gap-1">+ @if ($selectedResource)+ <x-application.restart-limit-warning :application="$selectedResource" />+ @endif+ </div></div></div>@@@ -184,33 -124,13 +136,32 @@@Force Cleanup Containers</button>@endif- </div>- </div>+ </x-split-action>@endcan@else- <a href="{{ $environmentVariablesUrl }}" {{ wireNavigate() }}- class="mb-3 inline-flex" aria-label="Open required environment variables">- <x-status-badge status="Required variables missing" type="error" />- </a>+ @can('deploy', $service)+ <div id="service-mobile-actions" class="relative mb-3"+ x-data="{ open: false }" @click.outside="open = false"+ @keydown.escape.window="open = false">+ <button type="button" class="button w-full justify-between" @click="open = !open"+ :aria-expanded="open" aria-haspopup="menu">+ <span>Actions</span>+ <span class="inline-flex transition-transform" :class="open && 'rotate-180'">+ <x-reicon name="chevron-down" class="size-3 opacity-55" />+ </span>+ </button>++ <div x-cloak x-show="open" x-transition.origin.top.left+ class="listbox-panel top-full! left-0! right-0! mt-1! w-full! min-w-0!" role="menu">+ <div class="listbox-option cursor-default! justify-start! gap-2.5! text-neutral-400! dark:text-fg-faint!"+ role="menuitem" aria-disabled="true">+ <x-reicon name="play-circle" class="size-3.5 opacity-70" />+ <span>Deploy (<a href="{{ $environmentVariablesUrl }}" {{ wireNavigate() }}+ class="cursor-pointer underline underline-offset-2">missing required env vars</a>)</span>+ </div>+ </div>+ </div>+ @endcan@endif</div>@@@ -281,45 -170,38 +201,54 @@@<x-reicon name="refresh" class="size-3.5 opacity-70" />Force Restart</button>- @elseif (! $serviceStatus->contains('running'))- <button type="button" class="listbox-option justify-start! gap-2.5!"- @disabled(!auth()->user()->can('deploy', $service))- @click="$wire.dispatch('forceDeployEvent'); open = false">- <x-reicon name="refresh" class="size-3.5 opacity-70" />- Force Deploy- </button>- <button type="button" class="listbox-option justify-start! gap-2.5!"- @disabled(!auth()->user()->can('stop', $service))- @click="$wire.dispatch('cleanupEvent'); open = false">- <x-reicon name="trash" class="size-3.5 opacity-70" />- Force Cleanup Containers- </button>@endif- @endif- </div>- </div>+ <button type="button" class="listbox-option justify-start! gap-2.5!"+ @disabled(!auth()->user()->can('stop', $service))+ @click="open = false; document.getElementById('service-stop-trigger')?.click()" role="menuitem">+ <x-reicon name="stop-circle" class="size-3.5 text-error" />+ Stop+ </button>+ @else+ <x-slot:main x-bind:disabled="deploying" @click="deploying = true; $wire.dispatch('startEvent')">+ <x-loading-on-button x-show="deploying" x-cloak />+ <x-reicon name="play-circle" class="size-3.5" x-show="!deploying" />+ <span x-text="deploying ? 'Deploying…' : 'Deploy'">Deploy</span>+ </x-slot:main>+ <button type="button" class="listbox-option justify-start! gap-2.5!"+ @click="$wire.dispatch('forceDeployEvent'); open = false" role="menuitem">+ <x-reicon name="refresh" class="size-3.5 opacity-70" />+ Force Deploy+ </button>+ <button type="button" class="listbox-option justify-start! gap-2.5!"+ @disabled(!auth()->user()->can('stop', $service))+ @click="$wire.dispatch('cleanupEvent'); open = false" role="menuitem">+ <x-reicon name="trash" class="size-3.5 opacity-70" />+ Force Cleanup Containers+ </button>+ @endif+ </x-split-action>@endcan@else- <a href="{{ $environmentVariablesUrl }}" {{ wireNavigate() }}- aria-label="Open required environment variables">- <x-status-badge status="Required variables missing" type="error" />- </a>+ @can('deploy', $service)+ <div id="service-desktop-actions" class="relative" x-data="{ open: false }"+ x-effect="$dispatch('resource-actions-toggled', { open })"+ @click.outside="open = false" @keydown.escape.window="open = false">+ <button type="button" class="button button-highlighted" @click="open = !open"+ :aria-expanded="open" aria-haspopup="menu">+ Actions+ <x-reicon name="chevron-down" class="size-3 opacity-55" />+ </button>+ <div x-cloak x-show="open" x-transition.origin.top.right+ class="listbox-panel top-full! right-0! left-auto! mt-1! w-64! min-w-0!" role="menu">+ <div class="listbox-option cursor-default! justify-start! gap-2.5! text-neutral-400! dark:text-fg-faint!"+ role="menuitem" aria-disabled="true">+ <x-reicon name="play-circle" class="size-3.5 opacity-70" />+ <span>Deploy (<a href="{{ $environmentVariablesUrl }}" {{ wireNavigate() }}+ class="cursor-pointer underline underline-offset-2">missing required env vars</a>)</span>+ </div>+ </div>+ </div>+ @endcan@endif</div></div>diff --cc tests/Feature/PersistentStorageVolumesLayoutTest.phpindex 91dcab3d26,6546a00e31..a567a6e5c8--- a/tests/Feature/PersistentStorageVolumesLayoutTest.php+++ b/tests/Feature/PersistentStorageVolumesLayoutTest.php@@@ -43,6 -44,8 +43,7 @@@ it('keeps nested storage component key->not->toContain('wire:key="svc-volumes-{{ $resource->id }}-{{ $this->volumeCount }}"');});-+ use App\Livewire\Project\Service\Storage;use App\Livewire\Project\Service\VolumeBackup\Create as CreateServiceVolumeBackup;use App\Livewire\Project\Shared\Storages\All;use App\Models\Application;@@@ -222,68 -211,62 +215,124 @@@ it('renders volumes as a data table wit->toMatch('/\.application-settings-form label\s*\{[^}]*font-size:\s*13px/s');});+it('renders volume actions and PR suffix controls as valid markup', function () {+ [$application] = createApplicationWithVolume();+ LocalPersistentVolume::create([+ 'uuid' => (string) Str::uuid(),+ 'name' => $application->uuid.'-cache',+ 'mount_path' => '/cache',+ 'resource_id' => $application->id,+ 'resource_type' => $application->getMorphClass(),+ 'is_preview_suffix_enabled' => true,+ ]);++ $html = Livewire::test(All::class, ['resource' => $application])->html();+ $document = new DOMDocument;+ $previousState = libxml_use_internal_errors(true);+ $loaded = $document->loadHTML($html);+ libxml_clear_errors();+ libxml_use_internal_errors($previousState);+ $xpath = new DOMXPath($document);+ $helperText = 'Adds -pr-N to the storage name or path so each preview uses isolated data. Disabling it shares production data with previews.';++ expect($loaded)->toBeTrue()+ ->and($xpath->query("//*[contains(concat(' ', normalize-space(@class), ' '), ' volumes-col-actions ')]//button[normalize-space(.)='Backup']"))->toHaveCount(2)+ ->and($xpath->query("//*[contains(concat(' ', normalize-space(@class), ' '), ' volumes-col-actions ')]//button[normalize-space(.)='Backup']//svg"))->toHaveCount(0)+ ->and($xpath->query("//button[@aria-label='More information']/following-sibling::*[@role='tooltip'][contains(normalize-space(.), '{$helperText}')]"))->toHaveCount(3)+ ->and($xpath->query("//template[@x-teleport='body']/*[@role='listbox']"))->toHaveCount(2);+});++it('declares explicit authorization on the changed storage controls', function () {+ $view = file_get_contents(resource_path('views/livewire/project/shared/storages/all.blade.php'));++ preg_match(+ '/<x-forms\.listbox\s+id="forms\.\{\{ \$id \}\}\.isPreviewSuffixEnabled"[\s\S]*?\/>/',+ $view,+ $previewSuffixListbox+ );++ expect($previewSuffixListbox[0] ?? '')+ ->toContain('canGate="update"')+ ->toContain(':canResource="$resource"');++ preg_match_all('/<x-forms\.button\b[^>]*>\s*Backup\s*<\/x-forms\.button>/s', $view, $backupButtons);++ expect($backupButtons[0])->toHaveCount(3);++ foreach ($backupButtons[0] as $backupButton) {+ expect($backupButton)+ ->toContain('canGate="update"')+ ->toContain(':canResource="$resource"');+ }+});++it('uses valid block wrappers around PR suffix helpers', function () {+ $view = file_get_contents(resource_path('views/livewire/project/shared/storages/all.blade.php'));++ expect($view)+ ->not->toContain('<span class="volumes-col-pr flex items-center gap-1.5">')+ ->not->toContain('<span class="volumes-mobile-label volumes-field-label flex items-center gap-1.5">');++ expect(substr_count($view, '<x-helper helper="Adds -pr-N to the storage name or path so each preview uses isolated data. Disabling it shares production data with previews." />'))+ ->toBe(3);+});++ it('keeps bind mount source paths out of the add volume form', function () {+ $storageView = file_get_contents(resource_path('views/livewire/project/service/storage.blade.php'));+ $volumesView = file_get_contents(resource_path('views/livewire/project/shared/storages/all.blade.php'));++ expect($storageView)+ ->not->toContain('id="host_path"')+ ->not->toContain('Swarm Mode detected')+ ->and($volumesView)+ ->toMatch('/<x-modal-confirmation title="Remove Source Path\?"[^>]*canGate="update"[^>]*:canResource="\$resource"/')+ ->toContain('The next deployment will use a named Docker volume instead.')+ ->toContain('Data from the existing host directory will not be copied to the named volume.');+ });++ it('creates named volumes without a host path in swarm mode', function () {+ [$application] = createApplicationWithVolume();+ $application->persistentStorages()->delete();++ Livewire::test(Storage::class, ['resource' => $application])+ ->set('isSwarm', true)+ ->set('name', 'storage-app-data')+ ->set('mount_path', '/data')+ ->call('submitPersistentVolume')+ ->assertHasNoErrors();++ expect($application->persistentStorages()->first())+ ->name->toBe($application->uuid.'-storage-app-data')+ ->host_path->toBeNull();+ });++ it('uses a resource based default name for new volumes', function () {+ [$application] = createApplicationWithVolume(['name' => 'Storage App']);++ Livewire::test(Storage::class, ['resource' => $application])+ ->assertSet('name', 'storage-app-data');+ });++ it('uses a valid fallback default volume name when the resource name has no slug characters', function () {+ [$application] = createApplicationWithVolume(['name' => '---']);++ Livewire::test(Storage::class, ['resource' => $application])+ ->assertSet('name', 'volume-data');+ });++ it('removes existing bind mount source paths from the volume table', function () {+ [$application, $volume] = createApplicationWithVolume(volumeAttributes: [+ 'host_path' => '/srv/storage',+ ]);++ Livewire::test(All::class, ['resource' => $application])+ ->assertSet("forms.{$volume->id}.hostPath", '/srv/storage')+ ->call('clearHostPath', $volume->id)+ ->assertHasNoErrors();++ expect($volume->refresh()->host_path)->toBeNull();+ });+it('creates and exposes volume backups for service storage', function () {$service = Service::factory()->create(['environment_id' => $this->environment->id,