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
This commit is contained in:
parent
f217fc86a7
commit
7b589abfbe
2 changed files with 12 additions and 8 deletions
|
|
@ -482,18 +482,18 @@ public function instantSave()
|
||||||
$oldPortsExposes = $this->application->ports_exposes;
|
$oldPortsExposes = $this->application->ports_exposes;
|
||||||
$oldIsContainerLabelEscapeEnabled = $this->application->settings->is_container_label_escape_enabled;
|
$oldIsContainerLabelEscapeEnabled = $this->application->settings->is_container_label_escape_enabled;
|
||||||
$oldIsPreserveRepositoryEnabled = $this->application->settings->is_preserve_repository_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);
|
$this->syncData(toModel: true);
|
||||||
|
|
||||||
if ($this->application->settings->isDirty('is_spa')) {
|
if ($oldIsSpa !== $this->isSpa) {
|
||||||
$this->generateNginxConfiguration($this->application->settings->is_spa ? 'spa' : 'static');
|
$this->generateNginxConfiguration($this->isSpa ? 'spa' : 'static');
|
||||||
}
|
}
|
||||||
if ($this->application->isDirty('is_http_basic_auth_enabled')) {
|
if ($oldIsHttpBasicAuthEnabled !== $this->isHttpBasicAuthEnabled) {
|
||||||
$this->application->save();
|
$this->application->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->application->settings->save();
|
|
||||||
|
|
||||||
$this->dispatch('success', 'Settings saved.');
|
$this->dispatch('success', 'Settings saved.');
|
||||||
$this->application->refresh();
|
$this->application->refresh();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,9 +70,13 @@
|
||||||
placeholder="Empty means default configuration will be used." label="Custom Nginx Configuration"
|
placeholder="Empty means default configuration will be used." label="Custom Nginx Configuration"
|
||||||
helper="You can add custom Nginx configuration here." x-bind:disabled="!canUpdate" />
|
helper="You can add custom Nginx configuration here." x-bind:disabled="!canUpdate" />
|
||||||
@can('update', $application)
|
@can('update', $application)
|
||||||
<x-forms.button wire:click="generateNginxConfiguration">
|
<x-modal-confirmation title="Confirm Nginx Configuration Generation?"
|
||||||
Generate Default Nginx Configuration
|
buttonTitle="Generate Default Nginx Configuration" buttonFullWidth
|
||||||
</x-forms.button>
|
submitAction="generateNginxConfiguration('{{ $application->settings->is_spa ? 'spa' : 'static' }}')"
|
||||||
|
:actions="[
|
||||||
|
'This will overwrite your current custom Nginx configuration.',
|
||||||
|
'The default configuration will be generated based on your application type (' . ($application->settings->is_spa ? 'SPA' : 'static') . ').',
|
||||||
|
]" />
|
||||||
@endcan
|
@endcan
|
||||||
@endif
|
@endif
|
||||||
<div class="w-96 pb-6">
|
<div class="w-96 pb-6">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue