Skip to content

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.

fix default checkbox state false or true

ayntk-ai3b3bc6c33b34
diff --git a/app/Livewire/Project/Shared/Danger.php b/app/Livewire/Project/Shared/Danger.php
index ea489ef5e7..d0f05d0ec7 100644
--- a/app/Livewire/Project/Shared/Danger.php
+++ b/app/Livewire/Project/Shared/Danger.php
@@ -118,4 +118,16 @@ class Danger extends Component
return handleError($e, $this);
}
}
+
+ public function render()
+ {
+ return view('livewire.project.shared.danger', [
+ 'checkboxes' => [
+ ['id' => 'delete_volumes', 'label' => 'All associated volumes with this resource will be permanently deleted'],
+ ['id' => 'delete_connected_networks', 'label' => 'All connected networks with this resource will be permanently deleted (predefined networks will not be deleted)'],
+ ['id' => 'delete_configurations', 'label' => 'All configuration files will be permanently deleted form the server'],
+ ['id' => 'docker_cleanup', 'label' => 'Docker cleanup will be run on the server which removes builder cache and unused images']
+ ]
+ ]);
+ }
}
diff --git a/resources/views/components/modal-confirmation.blade.php b/resources/views/components/modal-confirmation.blade.php
index a1a2ef3c8b..060e627c6f 100644
--- a/resources/views/components/modal-confirmation.blade.php
+++ b/resources/views/components/modal-confirmation.blade.php
@@ -34,13 +34,13 @@
copied: false,
submitAction: @js($submitAction),
passwordError: '',
- selectedActions: @js(collect($checkboxes)->pluck('id')->all()),
+ selectedActions: @js(collect($checkboxes)->pluck('id')->filter(fn($id) => $this->$id)->values()->all()),
resetModal() {
this.step = this.initialStep;
this.deleteText = '';
this.password = '';
this.userConfirmationText = '';
- this.selectedActions = @js(collect($checkboxes)->pluck('id')->all());
+ this.selectedActions = @js(collect($checkboxes)->pluck('id')->filter(fn($id) => $this->$id)->values()->all());
$wire.$refresh();
},
step1ButtonText: @js($step1ButtonText),
@@ -156,10 +156,10 @@
@foreach($checkboxes as $index => $checkbox)
<x-forms.checkbox
:id="$checkbox['id']"
- :wire:model="$checkbox['model']"
+ :wire:model="$checkbox['id']"
:label="$checkbox['label']"
x-on:change="toggleAction('{{ $checkbox['id'] }}')"
- :checked="true"
+ :checked="$this->{$checkbox['id']}"
x-bind:checked="selectedActions.includes('{{ $checkbox['id'] }}')"
></x-forms.checkbox>
@endforeach