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.

Added confirmation modal for enabling healtcheck + replaced enable checkbox with a button

ShadowArcanist48ccfa312484
diff --git a/app/Livewire/Project/Shared/HealthChecks.php b/app/Livewire/Project/Shared/HealthChecks.php
index ae94f7cf28..44f5c5e446 100644
--- a/app/Livewire/Project/Shared/HealthChecks.php
+++ b/app/Livewire/Project/Shared/HealthChecks.php
@@ -47,6 +47,18 @@ class HealthChecks extends Component
}
}
+ public function toggleHealthcheck()
+ {
+ try {
+ $this->authorize('update', $this->resource);
+ $this->resource->health_check_enabled = !$this->resource->health_check_enabled;
+ $this->resource->save();
+ $this->dispatch('success', 'Health check ' . ($this->resource->health_check_enabled ? 'enabled' : 'disabled') . '.');
+ } catch (\Throwable $e) {
+ return handleError($e, $this);
+ }
+ }
+
public function render()
{
return view('livewire.project.shared.health-checks');
diff --git a/resources/views/livewire/project/shared/health-checks.blade.php b/resources/views/livewire/project/shared/health-checks.blade.php
index 32033e4c55..acdf63f42c 100644
--- a/resources/views/livewire/project/shared/health-checks.blade.php
+++ b/resources/views/livewire/project/shared/health-checks.blade.php
@@ -2,6 +2,16 @@
<div class="flex items-center gap-2">
<h2>Healthchecks</h2>
<x-forms.button canGate="update" :canResource="$resource" type="submit">Save</x-forms.button>
+ @if (!$resource->health_check_enabled)
+ <x-modal-confirmation title="Confirm Healthcheck Enable?" buttonTitle="Enable Healthcheck"
+ submitAction="toggleHealthcheck" :actions="['Enable healthcheck for this resource.']"
+ warningMessage="If the health check fails, your application will become inaccessible. Please review the <a href='https://coolify.io/docs/knowledge-base/health-checks' target='_blank' class='underline text-white'>Health Checks</a> guide before proceeding!"
+ step2ButtonText="Enable Healthcheck" :confirmWithText="false" :confirmWithPassword="false"
+ isHighlightedButton>
+ </x-modal-confirmation>
+ @else
+ <x-forms.button canGate="update" :canResource="$resource" wire:click="toggleHealthcheck">Disable Healthcheck</x-forms.button>
+ @endif
</div>
<div class="pb-4">Define how your resource's health should be checked.</div>
<div class="flex flex-col gap-4">
@@ -9,9 +19,6 @@
<div class="dark:text-warning">A custom health check has been found and will be used until you enable this.
</div>
@endif
- <div class="w-32">
- <x-forms.checkbox canGate="update" :canResource="$resource" instantSave id="resource.health_check_enabled" label="Enabled" />
- </div>
<div class="flex gap-2">
<x-forms.select canGate="update" :canResource="$resource" id="resource.health_check_method" label="Method" required>
<option value="GET">GET</option>