mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
feat(ui): link healthcheck status row to the healthcheck page
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
e2f75393e5
commit
f09de9c359
@@ -27,6 +27,12 @@ class Status extends Component
|
||||
|
||||
public function render(): View
|
||||
{
|
||||
return view('livewire.project.application.status');
|
||||
return view('livewire.project.application.status', [
|
||||
'healthcheckUrl' => route('project.application.healthcheck', [
|
||||
'project_uuid' => $this->application->project()->uuid,
|
||||
'environment_uuid' => $this->application->environment->uuid,
|
||||
'application_uuid' => $this->application->uuid,
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,12 @@ class Status extends Component
|
||||
|
||||
public function render(): View
|
||||
{
|
||||
return view('livewire.project.database.status');
|
||||
return view('livewire.project.database.status', [
|
||||
'healthcheckUrl' => route('project.database.healthcheck', [
|
||||
'project_uuid' => $this->database->environment->project->uuid,
|
||||
'environment_uuid' => $this->database->environment->uuid,
|
||||
'database_uuid' => $this->database->uuid,
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
@props(['status', 'title' => 'Application status', 'containerName' => 'Container', 'align' => 'left'])
|
||||
@props([
|
||||
'status',
|
||||
'title' => 'Application status',
|
||||
'containerName' => 'Container',
|
||||
'align' => 'left',
|
||||
'healthcheckUrl' => null,
|
||||
])
|
||||
|
||||
@php
|
||||
$rawStatus = str((string) $status)->lower()->trim()->value();
|
||||
@@ -79,21 +85,40 @@
|
||||
<span class="flex-1">{{ $containerName }}</span>
|
||||
<span>{{ $containerLabel }}</span>
|
||||
</div>
|
||||
<div class="listbox-option cursor-default! gap-2.5!">
|
||||
<span @class([
|
||||
@php
|
||||
$healthDot = [
|
||||
'size-1.5 shrink-0 rounded-full',
|
||||
'bg-success' => $healthType === 'success',
|
||||
'bg-warning' => $healthType === 'warning',
|
||||
'bg-error' => $healthType === 'error',
|
||||
])></span>
|
||||
<span class="flex-1">Healthcheck</span>
|
||||
<span class="inline-flex items-center gap-1.5">
|
||||
{{ $healthLabel }}
|
||||
];
|
||||
$healthHelper = 'No healthcheck is configured, so Coolify can only report the container state. Traffic can still be routed to the container, but Coolify cannot verify that the application inside it is ready to receive requests.';
|
||||
@endphp
|
||||
@if ($healthcheckUrl)
|
||||
<div class="listbox-option gap-0! p-0!">
|
||||
<a href="{{ $healthcheckUrl }}" {{ wireNavigate() }} role="menuitem"
|
||||
class="flex min-h-8 flex-1 items-center gap-2.5 px-2 py-1.5">
|
||||
<span @class($healthDot)></span>
|
||||
<span class="flex-1">Healthcheck</span>
|
||||
<span>{{ $healthLabel }}</span>
|
||||
</a>
|
||||
@if ($healthLabel === 'Not configured')
|
||||
<x-helper label="About unconfigured healthchecks"
|
||||
helper="No healthcheck is configured, so Coolify can only report the container state. Traffic can still be routed to the container, but Coolify cannot verify that the application inside it is ready to receive requests." />
|
||||
<span class="inline-flex pr-2">
|
||||
<x-helper label="About unconfigured healthchecks" :helper="$healthHelper" />
|
||||
</span>
|
||||
@endif
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<div class="listbox-option cursor-default! gap-2.5!">
|
||||
<span @class($healthDot)></span>
|
||||
<span class="flex-1">Healthcheck</span>
|
||||
<span class="inline-flex items-center gap-1.5">
|
||||
{{ $healthLabel }}
|
||||
@if ($healthLabel === 'Not configured')
|
||||
<x-helper label="About unconfigured healthchecks" :helper="$healthHelper" />
|
||||
@endif
|
||||
</span>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
{{ $application->name }}
|
||||
</h1>
|
||||
<div class="relative flex w-full min-w-0 items-center gap-2">
|
||||
<x-status-summary :status="$application->status" align="right" />
|
||||
<x-status-summary :status="$application->status" align="right"
|
||||
:healthcheck-url="route('project.application.healthcheck', $parameters)" />
|
||||
<x-applications.links :application="$application" compact />
|
||||
@if ($this->runningDeploymentUrl)
|
||||
<x-deploying-indicator :href="$this->runningDeploymentUrl" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div wire:poll.10000ms="refreshStatus" class="flex items-center gap-1">
|
||||
<x-status-summary :status="$application->status" />
|
||||
<x-status-summary :status="$application->status" :healthcheck-url="$healthcheckUrl" />
|
||||
<x-application.restart-limit-warning :application="$application" />
|
||||
</div>
|
||||
|
||||
@@ -65,7 +65,8 @@
|
||||
{{ $database->name }}
|
||||
</h1>
|
||||
<div class="relative flex w-full min-w-0 items-center gap-2">
|
||||
<x-status-summary :status="$database->status" title="Database status" />
|
||||
<x-status-summary :status="$database->status" title="Database status"
|
||||
:healthcheck-url="route('project.database.healthcheck', $parameters)" />
|
||||
@if ($isDeploymentProgress)
|
||||
<x-deploying-indicator label="Working" />
|
||||
@endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div wire:poll.10000ms="refreshStatus" class="flex items-center gap-1">
|
||||
<x-status-summary :status="$database->status" title="Database status" />
|
||||
<x-status-summary :status="$database->status" title="Database status" :healthcheck-url="$healthcheckUrl" />
|
||||
<x-application.restart-limit-warning :application="$database" />
|
||||
</div>
|
||||
|
||||
@@ -98,3 +98,20 @@ it('refreshes the breadcrumb application status after it changes', function () {
|
||||
expect($component->instance()->getListeners())
|
||||
->toHaveKey("echo-private:team.{$this->team->id},ServiceChecked", 'refreshStatus');
|
||||
});
|
||||
|
||||
it('links the application healthcheck status to the healthcheck page', function () {
|
||||
$this->actingAs($this->admin);
|
||||
session(['currentTeam' => $this->team]);
|
||||
|
||||
$healthcheckUrl = route('project.application.healthcheck', [
|
||||
'project_uuid' => $this->project->uuid,
|
||||
'environment_uuid' => $this->environment->uuid,
|
||||
'application_uuid' => $this->application->uuid,
|
||||
]);
|
||||
|
||||
Livewire::test(ApplicationStatus::class, ['application' => $this->application])
|
||||
->assertSeeHtml('href="'.$healthcheckUrl.'"');
|
||||
|
||||
Livewire::test(ApplicationHeading::class, ['application' => $this->application])
|
||||
->assertSeeHtml('href="'.$healthcheckUrl.'"');
|
||||
});
|
||||
|
||||
@@ -28,3 +28,22 @@ it('shows degraded aggregate service status as a warning', function () {
|
||||
->toContain('bg-warning')
|
||||
->not->toContain('bg-error');
|
||||
});
|
||||
|
||||
it('links the healthcheck row to the healthcheck page and keeps the helper outside the link', function () {
|
||||
$html = Blade::render('<x-status-summary status="running:unknown" healthcheck-url="https://coolify.test/healthcheck" />');
|
||||
$link = str($html)->after('href="https://coolify.test/healthcheck"')->before('</a>')->toString();
|
||||
|
||||
expect($html)->toContain('href="https://coolify.test/healthcheck"')
|
||||
->and($link)
|
||||
->toContain('Healthcheck')
|
||||
->toContain('Not configured')
|
||||
->not->toContain('About unconfigured healthchecks')
|
||||
->and(str($html)->after('</a>')->toString())
|
||||
->toContain('aria-label="About unconfigured healthchecks"');
|
||||
});
|
||||
|
||||
it('does not link the healthcheck row without a healthcheck url', function () {
|
||||
$html = Blade::render('<x-status-summary status="running:healthy" />');
|
||||
|
||||
expect($html)->not->toContain('role="menuitem"');
|
||||
});
|
||||
|
||||
@@ -44,7 +44,12 @@ it('refreshes the breadcrumb database status after it changes', function () {
|
||||
]);
|
||||
|
||||
$component = Livewire::test(DatabaseStatus::class, ['database' => $database])
|
||||
->assertSee('Running');
|
||||
->assertSee('Running')
|
||||
->assertSeeHtml('href="'.route('project.database.healthcheck', [
|
||||
'project_uuid' => $this->project->uuid,
|
||||
'environment_uuid' => $this->environment->uuid,
|
||||
'database_uuid' => $database->uuid,
|
||||
]).'"');
|
||||
|
||||
$database->update(['status' => 'exited']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user