mirror of
https://github.com/coollabsio/coolify.git
synced 2026-09-26 17:30:46 -04:00
fix(server): distinguish pending Sentinel reports from out-of-sync state
This commit is contained in:
@@ -16,7 +16,13 @@
|
||||
$traefikUpdateAvailable => 'Update available',
|
||||
default => str($proxyStatus ?: 'unknown')->headline(),
|
||||
};
|
||||
$sentinelNeedsAttention = $showSentinelStatus && ! $server->isSentinelLive();
|
||||
$sentinelStatus = $server->sentinelStatus();
|
||||
$sentinelNeedsAttention = $showSentinelStatus && $sentinelStatus === 'out_of_sync';
|
||||
$sentinelStatusLabel = match ($sentinelStatus) {
|
||||
'waiting' => 'Waiting for first report',
|
||||
'in_sync' => 'In sync',
|
||||
default => 'Out of sync',
|
||||
};
|
||||
|
||||
[$summaryLabel, $summaryType] = match (true) {
|
||||
! $serverReady => ['Unavailable', 'error'],
|
||||
@@ -80,11 +86,12 @@
|
||||
class="listbox-option gap-2.5!" @click="open = false" role="menuitem">
|
||||
<span @class([
|
||||
'size-1.5 shrink-0 rounded-full',
|
||||
'bg-success' => ! $sentinelNeedsAttention,
|
||||
'bg-warning' => $sentinelNeedsAttention,
|
||||
'bg-success' => $sentinelStatus === 'in_sync',
|
||||
'bg-neutral-400 dark:bg-fg-faint' => $sentinelStatus === 'waiting',
|
||||
'bg-warning' => $sentinelStatus === 'out_of_sync',
|
||||
])></span>
|
||||
<span class="flex-1">Sentinel</span>
|
||||
<span>{{ $server->isSentinelLive() ? 'In sync' : 'Out of sync' }}</span>
|
||||
<span>{{ $sentinelStatusLabel }}</span>
|
||||
</a>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
@foreach ($dashboardServers as $server)
|
||||
@php
|
||||
$proxyNeedsAttention = $server->proxySet() && ($server->proxy->status !== 'running' || $server->hasCurrentTraefikOutdatedInfo());
|
||||
$sentinelNeedsAttention = $server->isSentinelEnabled() && ! $server->isSentinelLive();
|
||||
$sentinelNeedsAttention = $server->isSentinelEnabled() && $server->sentinelStatus() === 'out_of_sync';
|
||||
|
||||
[$serverStatus, $serverStatusType] = match (true) {
|
||||
$server->settings->force_disabled => ['Disabled', 'error'],
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
&& ! $isTransferredAway;
|
||||
$proxyNeedsAttention = $isReady && $server->proxySet()
|
||||
&& ($server->proxy->status !== 'running' || $server->hasCurrentTraefikOutdatedInfo());
|
||||
$sentinelNeedsAttention = $isReady && $server->isSentinelEnabled() && ! $server->isSentinelLive();
|
||||
$sentinelNeedsAttention = $isReady && $server->isSentinelEnabled() && $server->sentinelStatus() === 'out_of_sync';
|
||||
|
||||
$status = match (true) {
|
||||
$isTransferredAway => 'Transferred away',
|
||||
|
||||
@@ -11,9 +11,16 @@
|
||||
helper="Search, filter, follow, copy, or download recent output from the Sentinel container."
|
||||
flush class="logs-settings-section">
|
||||
@if ($server->isSentinelEnabled())
|
||||
@php
|
||||
$sentinelStatus = $server->sentinelStatus();
|
||||
[$sentinelStatusLabel, $sentinelStatusType] = match ($sentinelStatus) {
|
||||
'waiting' => ['Waiting for first report', 'neutral'],
|
||||
'in_sync' => ['In sync', 'success'],
|
||||
default => ['Out of sync', 'warning'],
|
||||
};
|
||||
@endphp
|
||||
<x-slot:actions>
|
||||
<x-status-badge :status="$server->isSentinelLive() ? 'In sync' : 'Out of sync'"
|
||||
:type="$server->isSentinelLive() ? 'success' : 'warning'"
|
||||
<x-status-badge :status="$sentinelStatusLabel" :type="$sentinelStatusType"
|
||||
class="logs-section-status-badge" />
|
||||
</x-slot:actions>
|
||||
<div class="settings-log-panel">
|
||||
|
||||
@@ -54,6 +54,20 @@ it('shows sentinel sync status after the server is validated', function () {
|
||||
->assertSee('In sync');
|
||||
});
|
||||
|
||||
it('shows the first Sentinel report as pending instead of requiring attention', function () {
|
||||
[$server] = makeNavbarServer(isFunctional: true);
|
||||
$server->forceFill([
|
||||
'sentinel_updated_at' => now()->subDay(),
|
||||
'sentinel_waiting_since' => now(),
|
||||
])->save();
|
||||
|
||||
Livewire::test('server.navbar', ['server' => $server->fresh()])
|
||||
->assertSee('Ready')
|
||||
->assertSee('Waiting for first report')
|
||||
->assertDontSee('Attention required')
|
||||
->assertDontSee('Out of sync');
|
||||
});
|
||||
|
||||
it('places mobile status badges on a separate row below the server title', function () {
|
||||
$navbar = file_get_contents(resource_path('views/livewire/server/navbar.blade.php'));
|
||||
|
||||
@@ -75,7 +89,7 @@ it('places mobile status badges on a separate row below the server title', funct
|
||||
->toString();
|
||||
|
||||
$titlePos = strpos($titleBlock, 'data-testid="server-subtitle"');
|
||||
$badgesRowPos = strpos($titleBlock, 'flex min-w-0 flex-wrap items-center gap-2');
|
||||
$badgesRowPos = strpos($titleBlock, 'flex w-full min-w-0 items-center gap-2');
|
||||
|
||||
expect($titlePos)->not->toBeFalse()
|
||||
->and($badgesRowPos)->not->toBeFalse()
|
||||
|
||||
@@ -14,7 +14,7 @@ test('server cards use warning icons instead of colored icon borders', function
|
||||
expect(substr_count($serverIndex, '<x-status-badge'))->toBe(1)
|
||||
->and($serverIndex)
|
||||
->toContain("&& (\$server->proxy->status !== 'running' || \$server->hasCurrentTraefikOutdatedInfo())")
|
||||
->toContain('$sentinelNeedsAttention = $isReady && $server->isSentinelEnabled() && ! $server->isSentinelLive()')
|
||||
->toContain("\$sentinelNeedsAttention = \$isReady && \$server->isSentinelEnabled() && \$server->sentinelStatus() === 'out_of_sync'")
|
||||
->toContain("\$proxyNeedsAttention || \$sentinelNeedsAttention => 'warning'")
|
||||
->toContain("\$isReady => 'success'")
|
||||
->toContain("\$isTransferredAway || \$server->settings->force_disabled => 'error'")
|
||||
@@ -30,7 +30,7 @@ test('dashboard server cards warn when proxy or sentinel needs attention', funct
|
||||
|
||||
expect($dashboard)
|
||||
->toContain("\$proxyNeedsAttention = \$server->proxySet() && (\$server->proxy->status !== 'running' || \$server->hasCurrentTraefikOutdatedInfo())")
|
||||
->toContain('$sentinelNeedsAttention = $server->isSentinelEnabled() && ! $server->isSentinelLive()')
|
||||
->toContain("\$sentinelNeedsAttention = \$server->isSentinelEnabled() && \$server->sentinelStatus() === 'out_of_sync'")
|
||||
->toContain("\$proxyNeedsAttention || \$sentinelNeedsAttention => ['Attention required', 'warning']");
|
||||
});
|
||||
|
||||
@@ -39,15 +39,27 @@ test('server status summary uses warning indicators for proxy updates and sentin
|
||||
|
||||
expect($summary)
|
||||
->toContain('$server->hasCurrentTraefikOutdatedInfo()')
|
||||
->toContain('$sentinelStatus = $server->sentinelStatus()')
|
||||
->toContain("'waiting' => 'Waiting for first report'")
|
||||
->toContain('$proxyStatusLabel = match (true)')
|
||||
->toContain("\$proxyConfigurationPending => 'Restart required'")
|
||||
->toContain("\$traefikUpdateAvailable => 'Update available'")
|
||||
->toContain('{{ $proxyStatusLabel }}')
|
||||
->toContain("'bg-warning' => \$proxyNeedsAttention && (\$proxyUpdateAvailable")
|
||||
->toContain("'bg-warning' => \$sentinelNeedsAttention")
|
||||
->toContain("'bg-warning' => \$sentinelStatus === 'out_of_sync'")
|
||||
->not->toContain("\$server->isSentinelLive() ? 'bg-success' : 'bg-error'");
|
||||
});
|
||||
|
||||
test('Sentinel logs show the pending first report state without an out-of-sync warning', function () {
|
||||
$logs = file_get_contents(resource_path('views/livewire/server/sentinel/logs.blade.php'));
|
||||
|
||||
expect($logs)
|
||||
->toContain("'waiting' => ['Waiting for first report', 'neutral']")
|
||||
->toContain("'in_sync' => ['In sync', 'success']")
|
||||
->toContain("default => ['Out of sync', 'warning']")
|
||||
->not->toContain("\$server->isSentinelLive() ? 'In sync' : 'Out of sync'");
|
||||
});
|
||||
|
||||
test('server table keeps status text without a badge', function () {
|
||||
$serverIndex = file_get_contents(resource_path('views/livewire/server/index.blade.php'));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user