From 6ae1b4eba2b91e9299200e0369aa34aee2e07a28 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Wed, 15 Jul 2026 20:36:23 +0200 Subject: [PATCH] fix(backups): show setup prompt when no S3 storage is available --- .../project/database/backup-edit/s3.blade.php | 25 +++++++++++-------- .../storages/volume-backups/s3.blade.php | 25 +++++++++++-------- tests/Feature/BackupEditValidationTest.php | 25 ++++++++++++++----- tests/Feature/VolumeBackupTest.php | 18 ++++++++++--- 4 files changed, 63 insertions(+), 30 deletions(-) diff --git a/resources/views/livewire/project/database/backup-edit/s3.blade.php b/resources/views/livewire/project/database/backup-edit/s3.blade.php index e8405170a..31161e032 100644 --- a/resources/views/livewire/project/database/backup-edit/s3.blade.php +++ b/resources/views/livewire/project/database/backup-edit/s3.blade.php @@ -1,10 +1,19 @@ +@if ($availableS3Storages->isEmpty()) +
+

S3

+
+ No validated S3 available. Configure one here. +
+
+@else

S3

Save @if (!$saveS3) Enable S3 + wire:target="toggleS3" isHighlighted>Enable S3 @else Disable S3 @@ -20,15 +29,10 @@ @endif
- - @if ($availableS3Storages->isEmpty()) - - @else - @foreach ($availableS3Storages as $s3) - - @endforeach - @endif + + @foreach ($availableS3Storages as $s3) + + @endforeach @@ -43,3 +47,4 @@ +@endif diff --git a/resources/views/livewire/project/shared/storages/volume-backups/s3.blade.php b/resources/views/livewire/project/shared/storages/volume-backups/s3.blade.php index 3bc0fb9ac..be3120ee0 100644 --- a/resources/views/livewire/project/shared/storages/volume-backups/s3.blade.php +++ b/resources/views/livewire/project/shared/storages/volume-backups/s3.blade.php @@ -1,10 +1,19 @@ +@if ($availableS3Storages->isEmpty()) +
+

S3

+
+ No validated S3 available. Configure one here. +
+
+@else

S3

Save @if (!$saveToS3) Enable S3 + wire:target="toggleS3" isHighlighted>Enable S3 @else Disable S3 @@ -20,15 +29,10 @@ @endif
- - @if ($availableS3Storages->isEmpty()) - - @else - @foreach ($availableS3Storages as $s3Storage) - - @endforeach - @endif + + @foreach ($availableS3Storages as $s3Storage) + + @endforeach @@ -43,3 +47,4 @@ +@endif diff --git a/tests/Feature/BackupEditValidationTest.php b/tests/Feature/BackupEditValidationTest.php index 3218c3b8d..1e4582124 100644 --- a/tests/Feature/BackupEditValidationTest.php +++ b/tests/Feature/BackupEditValidationTest.php @@ -171,8 +171,10 @@ function createS3StorageForBackupEditValidationTest(Team|int $team, string $name $this->get($generalUrl.'/s3') ->assertOk() - ->assertSeeInOrder(['S3 Storage', 'Disable Local Backup']) - ->assertSee('S3 Storage') + ->assertSeeText('No validated S3 available. Configure one here.') + ->assertDontSee('Disable Local Backup') + ->assertDontSee('Enable S3') + ->assertDontSee('Disable S3') ->assertDontSee('S3 Storage Retention') ->assertDontSee('Local Backup Retention') ->assertDontSee('Frequency') @@ -357,14 +359,23 @@ function createS3StorageForBackupEditValidationTest(Team|int $team, string $name ->assertSee('Second S3'); }); -it('shows disabled S3 storage dropdown when no storages are available', function () { +it('shows only an empty S3 state when no storages are available', function () { $backup = createBackupForEditValidationTest($this->team, [ 'save_s3' => false, 's3_storage_id' => null, ]); Livewire::test(BackupEdit::class, ['backup' => $backup->fresh(), 'availableS3Storages' => $this->team->s3s, 'section' => 's3']) - ->assertSee('No S3 storage available'); + ->assertSeeHtml('

S3

') + ->assertSeeText('No validated S3 available. Configure one here.') + ->assertSeeHtml('href="'.route('storage.index').'"') + ->assertSeeHtml('>here') + ->assertDontSee('Save') + ->assertDontSee('Enable S3') + ->assertDontSee('Disable S3') + ->assertDontSee('S3 Storage') + ->assertDontSee('Disable Local Backup') + ->assertDontSee('No S3 storage available'); }); it('allows S3 backups to be disabled when no usable storage remains', function () { @@ -379,10 +390,12 @@ function createS3StorageForBackupEditValidationTest(Team|int $team, string $name 'section' => 's3', ]) ->assertSet('saveS3', true) - ->assertSee('Disable S3') + ->assertSeeText('No validated S3 available. Configure one here.') + ->assertDontSee('Disable S3') ->call('toggleS3') ->assertDispatched('success') - ->assertSee('Enable S3'); + ->assertSet('saveS3', false) + ->assertDontSee('Enable S3'); expect($backup->refresh()->save_s3)->toBeFalsy() ->and($backup->s3_storage_id)->toBeNull(); diff --git a/tests/Feature/VolumeBackupTest.php b/tests/Feature/VolumeBackupTest.php index 3020afadb..fe2aac015 100644 --- a/tests/Feature/VolumeBackupTest.php +++ b/tests/Feature/VolumeBackupTest.php @@ -252,8 +252,10 @@ $this->get($generalUrl.'/s3') ->assertOk() - ->assertSeeInOrder(['S3 Storage', 'Disable Local Backup']) - ->assertSee('S3 Storage') + ->assertSeeText('No validated S3 available. Configure one here.') + ->assertDontSee('Disable Local Backup') + ->assertDontSee('Enable S3') + ->assertDontSee('Disable S3') ->assertDontSee('S3 Storage Retention') ->assertDontSee('Local Backup Retention') ->assertDontSee('Frequency') @@ -957,10 +959,18 @@ function signInForVolumeBackups($testCase, Team $team): User 'section' => 's3', ]) ->assertSet('saveToS3', true) - ->assertSee('Disable S3') + ->assertSeeHtml('

S3

') + ->assertSeeText('No validated S3 available. Configure one here.') + ->assertSeeHtml('href="'.route('storage.index').'"') + ->assertSeeHtml('>here') + ->assertDontSee('Save') + ->assertDontSee('Disable S3') + ->assertDontSee('S3 Storage') + ->assertDontSee('Disable Local Backup') ->call('toggleS3') ->assertDispatched('success') - ->assertSee('Enable S3'); + ->assertSet('saveToS3', false) + ->assertDontSee('Enable S3'); expect($backup->refresh()->save_s3)->toBeFalse() ->and($backup->s3_storage_id)->toBeNull();