From 7b589abfbeaf8df9b462080bff3203eddbcef091 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Tue, 4 Nov 2025 09:48:59 +0100 Subject: [PATCH] fix: fix SPA toggle nginx regeneration and add confirmation modal - Fix SPA toggle not triggering nginx configuration regeneration by capturing old value before syncData - Fix similar issue with is_http_basic_auth_enabled using value comparison instead of isDirty - Remove redundant application settings save() call - Add confirmation modal to nginx generation button to prevent accidental overwrites - Pass correct type parameter (spa/static) to generateNginxConfiguration method --- app/Livewire/Project/Application/General.php | 10 +++++----- .../livewire/project/application/general.blade.php | 10 +++++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/Livewire/Project/Application/General.php b/app/Livewire/Project/Application/General.php index 7e606459b..fb306e092 100644 --- a/app/Livewire/Project/Application/General.php +++ b/app/Livewire/Project/Application/General.php @@ -482,18 +482,18 @@ public function instantSave() $oldPortsExposes = $this->application->ports_exposes; $oldIsContainerLabelEscapeEnabled = $this->application->settings->is_container_label_escape_enabled; $oldIsPreserveRepositoryEnabled = $this->application->settings->is_preserve_repository_enabled; + $oldIsSpa = $this->application->settings->is_spa; + $oldIsHttpBasicAuthEnabled = $this->application->is_http_basic_auth_enabled; $this->syncData(toModel: true); - if ($this->application->settings->isDirty('is_spa')) { - $this->generateNginxConfiguration($this->application->settings->is_spa ? 'spa' : 'static'); + if ($oldIsSpa !== $this->isSpa) { + $this->generateNginxConfiguration($this->isSpa ? 'spa' : 'static'); } - if ($this->application->isDirty('is_http_basic_auth_enabled')) { + if ($oldIsHttpBasicAuthEnabled !== $this->isHttpBasicAuthEnabled) { $this->application->save(); } - $this->application->settings->save(); - $this->dispatch('success', 'Settings saved.'); $this->application->refresh(); diff --git a/resources/views/livewire/project/application/general.blade.php b/resources/views/livewire/project/application/general.blade.php index 2484005ef..bfec17dc6 100644 --- a/resources/views/livewire/project/application/general.blade.php +++ b/resources/views/livewire/project/application/general.blade.php @@ -70,9 +70,13 @@ placeholder="Empty means default configuration will be used." label="Custom Nginx Configuration" helper="You can add custom Nginx configuration here." x-bind:disabled="!canUpdate" /> @can('update', $application) - - Generate Default Nginx Configuration - + @endcan @endif