From 4cb806b47241d3ce6610626cea0b0e811693a883 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Tue, 8 Sep 2026 10:21:34 +0200 Subject: [PATCH] feat(ui): move preview deployment toggle into section actions Replace the preview deployments listbox with an Enable/Disable action button that calls togglePreviewDeployments and persists the setting. --- app/Livewire/Project/Application/Previews.php | 8 +++++++ .../project/application/previews.blade.php | 23 +++++++++++++------ .../ApplicationPreviewSettingsTest.php | 11 +++++++++ 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/app/Livewire/Project/Application/Previews.php b/app/Livewire/Project/Application/Previews.php index 832a0d55cf..acc7dc8608 100644 --- a/app/Livewire/Project/Application/Previews.php +++ b/app/Livewire/Project/Application/Previews.php @@ -68,6 +68,14 @@ class Previews extends Component $this->dispatch('configurationChanged'); } + public function togglePreviewDeployments(): void + { + $this->authorize('update', $this->application); + + $this->isPreviewDeploymentsEnabled = ! $this->isPreviewDeploymentsEnabled; + $this->savePreviewSettings(); + } + private function syncDockerTags(): void { $this->previewDockerTags = []; diff --git a/resources/views/livewire/project/application/previews.blade.php b/resources/views/livewire/project/application/previews.blade.php index b85d769af3..54c8b9dfd3 100644 --- a/resources/views/livewire/project/application/previews.blade.php +++ b/resources/views/livewire/project/application/previews.blade.php @@ -5,13 +5,22 @@ @endphp -
- + + @can('update', $application) + @if ($isPreviewDeploymentsEnabled) + + Disable preview deployments + + @else + + Enable preview deployments + + @endif + @endcan + + +
call('togglePreviewDeployments') + ->assertSee('Disable preview deployments') + ->assertSet('isPreviewDeploymentsEnabled', true); + + expect($this->application->fresh()->settings->is_preview_deployments_enabled)->toBeTrue(); +}); + it('does not show git preview settings for non-git applications', function (string $buildPack, ?string $dockerfile) { $this->application->update(['build_pack' => $buildPack, 'dockerfile' => $dockerfile]);