mirror of
https://github.com/coollabsio/coolify.git
synced 2026-08-24 02:24:11 -05:00
fix(ui): flag pending proxy updates and Sentinel outages
This commit is contained in:
@@ -70,6 +70,7 @@
|
||||
'icon' => 'shield-star',
|
||||
'group' => 'Platform',
|
||||
'visible' => $server->isFunctional() && ! $server->isSwarm() && ! $server->settings->is_build_server && auth()->user()?->can('viewSentinel', $server),
|
||||
'warning' => $server->isSentinelEnabled() && ! $server->isSentinelLive(),
|
||||
'children' => [
|
||||
['label' => 'Configuration', 'route' => 'server.sentinel', 'active' => request()->routeIs('server.sentinel'), 'icon' => 'settings'],
|
||||
['label' => 'Logs', 'route' => 'server.sentinel.logs', 'active' => request()->routeIs('server.sentinel.logs'), 'icon' => 'file-content'],
|
||||
|
||||
@@ -6,7 +6,10 @@
|
||||
|
||||
@php
|
||||
$serverReady = $server->isFunctional();
|
||||
$proxyNeedsAttention = $server->proxySet() && ! in_array($proxyStatus, ['running'], true);
|
||||
$proxyUpdateAvailable = $server->proxySet()
|
||||
&& ($server->hasCurrentTraefikOutdatedInfo() || $server->hasPendingProxyConfiguration());
|
||||
$proxyNeedsAttention = $server->proxySet()
|
||||
&& (! in_array($proxyStatus, ['running'], true) || $proxyUpdateAvailable);
|
||||
$sentinelNeedsAttention = $showSentinelStatus && ! $server->isSentinelLive();
|
||||
|
||||
[$summaryLabel, $summaryType] = match (true) {
|
||||
@@ -58,9 +61,9 @@
|
||||
class="listbox-option gap-2.5!" @click="open = false" role="menuitem">
|
||||
<span @class([
|
||||
'size-1.5 shrink-0 rounded-full',
|
||||
'bg-success' => $proxyStatus === 'running',
|
||||
'bg-warning' => in_array($proxyStatus, ['starting', 'restarting', 'stopping'], true),
|
||||
'bg-error' => ! in_array($proxyStatus, ['running', 'starting', 'restarting', 'stopping'], true),
|
||||
'bg-success' => $proxyStatus === 'running' && ! $proxyUpdateAvailable,
|
||||
'bg-warning' => $proxyNeedsAttention && ($proxyUpdateAvailable || in_array($proxyStatus, ['starting', 'restarting', 'stopping'], true)),
|
||||
'bg-error' => $proxyNeedsAttention && ! $proxyUpdateAvailable && ! in_array($proxyStatus, ['starting', 'restarting', 'stopping'], true),
|
||||
])></span>
|
||||
<span class="flex-1">Proxy</span>
|
||||
<span>{{ str($proxyStatus ?: 'unknown')->headline() }}</span>
|
||||
@@ -69,7 +72,11 @@
|
||||
@if ($showSentinelStatus)
|
||||
<a href="{{ route('server.sentinel', ['server_uuid' => $server->uuid]) }}" {{ wireNavigate() }}
|
||||
class="listbox-option gap-2.5!" @click="open = false" role="menuitem">
|
||||
<span class="size-1.5 shrink-0 rounded-full {{ $server->isSentinelLive() ? 'bg-success' : 'bg-error' }}"></span>
|
||||
<span @class([
|
||||
'size-1.5 shrink-0 rounded-full',
|
||||
'bg-success' => ! $sentinelNeedsAttention,
|
||||
'bg-warning' => $sentinelNeedsAttention,
|
||||
])></span>
|
||||
<span class="flex-1">Sentinel</span>
|
||||
<span>{{ $server->isSentinelLive() ? 'In sync' : 'Out of sync' }}</span>
|
||||
</a>
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
<div class="grid min-w-0 grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4">
|
||||
@foreach ($dashboardServers as $server)
|
||||
@php
|
||||
$proxyNeedsAttention = $server->proxySet() && $server->proxy->status !== 'running';
|
||||
$proxyNeedsAttention = $server->proxySet() && ($server->proxy->status !== 'running' || $server->hasCurrentTraefikOutdatedInfo());
|
||||
$sentinelNeedsAttention = $server->isSentinelEnabled() && ! $server->isSentinelLive();
|
||||
|
||||
[$serverStatus, $serverStatusType] = match (true) {
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
&& $server->settings->is_usable
|
||||
&& ! $server->settings->force_disabled
|
||||
&& ! $isTransferredAway;
|
||||
$proxyNeedsAttention = $isReady && $server->proxySet() && $server->proxy->status !== 'running';
|
||||
$proxyNeedsAttention = $isReady && $server->proxySet()
|
||||
&& ($server->proxy->status !== 'running' || $server->hasCurrentTraefikOutdatedInfo());
|
||||
$sentinelNeedsAttention = $isReady && $server->isSentinelEnabled() && ! $server->isSentinelLive();
|
||||
|
||||
$status = match (true) {
|
||||
|
||||
@@ -36,6 +36,13 @@ it('uses the shield-star reicon for sentinel in the server sidebar', function ()
|
||||
->toMatch("/'label' => 'Sentinel',\s*'route' => 'server\.sentinel',\s*'active' => request\(\)->routeIs\('server\.sentinel', 'server\.sentinel\.\*'\),\s*'icon' => 'shield-star'/s");
|
||||
});
|
||||
|
||||
it('shows a warning icon when sentinel is enabled but not working', function () {
|
||||
$contents = file_get_contents(resource_path('views/components/server/sidebar.blade.php'));
|
||||
|
||||
expect($contents)
|
||||
->toContain("'warning' => \$server->isSentinelEnabled() && ! \$server->isSentinelLive()");
|
||||
});
|
||||
|
||||
it('uses the network reicon for proxy in the server sidebar', function () {
|
||||
$contents = file_get_contents(resource_path('views/components/server/sidebar.blade.php'));
|
||||
|
||||
|
||||
@@ -13,7 +13,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("\$proxyNeedsAttention = \$isReady && \$server->proxySet() && \$server->proxy->status !== 'running'")
|
||||
->toContain("&& (\$server->proxy->status !== 'running' || \$server->hasCurrentTraefikOutdatedInfo())")
|
||||
->toContain('$sentinelNeedsAttention = $isReady && $server->isSentinelEnabled() && ! $server->isSentinelLive()')
|
||||
->toContain("\$proxyNeedsAttention || \$sentinelNeedsAttention => 'warning'")
|
||||
->toContain("\$isReady => 'success'")
|
||||
@@ -29,11 +29,21 @@ test('dashboard server cards warn when proxy or sentinel needs attention', funct
|
||||
$dashboard = file_get_contents(resource_path('views/livewire/dashboard.blade.php'));
|
||||
|
||||
expect($dashboard)
|
||||
->toContain("\$proxyNeedsAttention = \$server->proxySet() && \$server->proxy->status !== 'running'")
|
||||
->toContain("\$proxyNeedsAttention = \$server->proxySet() && (\$server->proxy->status !== 'running' || \$server->hasCurrentTraefikOutdatedInfo())")
|
||||
->toContain('$sentinelNeedsAttention = $server->isSentinelEnabled() && ! $server->isSentinelLive()')
|
||||
->toContain("\$proxyNeedsAttention || \$sentinelNeedsAttention => ['Attention required', 'warning']");
|
||||
});
|
||||
|
||||
test('server status summary uses warning indicators for proxy updates and sentinel outages', function () {
|
||||
$summary = file_get_contents(resource_path('views/components/server/status-summary.blade.php'));
|
||||
|
||||
expect($summary)
|
||||
->toContain('$server->hasCurrentTraefikOutdatedInfo()')
|
||||
->toContain("'bg-warning' => \$proxyNeedsAttention && (\$proxyUpdateAvailable")
|
||||
->toContain("'bg-warning' => \$sentinelNeedsAttention")
|
||||
->not->toContain("\$server->isSentinelLive() ? 'bg-success' : 'bg-error'");
|
||||
});
|
||||
|
||||
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