diff --git a/resources/views/components/status-badge.blade.php b/resources/views/components/status-badge.blade.php new file mode 100644 index 000000000..71f9817f6 --- /dev/null +++ b/resources/views/components/status-badge.blade.php @@ -0,0 +1,38 @@ +@props([ + 'label' => null, + 'status' => null, + 'type' => 'neutral', + 'as' => 'span', +]) + +@php + $typeClasses = [ + 'neutral' => 'border-neutral-200 bg-neutral-100 text-black dark:border-coolgray-300 dark:bg-coolgray-200 dark:text-white', + 'success' => 'border-green-200 bg-green-50 text-green-800 dark:border-green-900 dark:bg-green-950/30 dark:text-green-300', + 'warning' => 'border-yellow-300 bg-yellow-50 text-yellow-900 dark:border-yellow-800 dark:bg-yellow-950/30 dark:text-yellow-200', + 'error' => 'border-red-300 bg-red-50 text-red-800 dark:border-red-900 dark:bg-red-950/30 dark:text-red-300', + ]; +@endphp + +@if ($as === 'button') + +@elseif ($as === 'a') + class([ + 'inline-flex h-5 max-w-full items-center gap-1 rounded-sm border px-1.5 text-xs font-medium leading-4 transition-colors', + $typeClasses[$type] ?? $typeClasses['neutral'], + ]) }}> + {{ collect([$label, $status])->filter()->join(' ') }} + +@else + class([ + 'inline-flex h-5 max-w-full items-center gap-1 rounded-sm border px-1.5 text-xs font-medium leading-4', + $typeClasses[$type] ?? $typeClasses['neutral'], + ]) }}> + {{ collect([$label, $status])->filter()->join(' ') }} + +@endif diff --git a/resources/views/components/status/degraded.blade.php b/resources/views/components/status/degraded.blade.php index fbd068c72..99ae2d4cd 100644 --- a/resources/views/components/status/degraded.blade.php +++ b/resources/views/components/status/degraded.blade.php @@ -2,32 +2,18 @@ 'status' => 'Degraded', ]) @php - // Handle both colon format (backend) and parentheses format (from services.blade.php) - // degraded:unhealthy → Degraded (unhealthy) - // degraded (unhealthy) → degraded (unhealthy) (already formatted, display as-is) - if (str($status)->contains('(')) { - // Already in parentheses format from services.blade.php - use as-is $displayStatus = $status; - $healthStatus = str($status)->after('(')->before(')')->trim()->value(); - } elseif (str($status)->contains(':') && !str($status)->startsWith('Proxy')) { - // Colon format from backend - transform it + $healthStatus = null; + } elseif (str($status)->contains(':') && ! str($status)->startsWith('Proxy')) { $parts = explode(':', $status); - $displayStatus = str($parts[0])->headline(); + $displayStatus = str($parts[0])->headline()->value(); $healthStatus = $parts[1] ?? null; } else { - // Simple status without health - $displayStatus = str($status)->headline(); + $displayStatus = str($status)->headline()->value(); $healthStatus = null; } + + $badgeStatus = $healthStatus ? "{$displayStatus} ({$healthStatus})" : $displayStatus; @endphp -
- - -
-
{{ $displayStatus }}
- @if ($healthStatus && !str($displayStatus)->contains('(')) -
({{ $healthStatus }})
- @endif -
-
+ diff --git a/resources/views/components/status/index.blade.php b/resources/views/components/status/index.blade.php index b54e35bd5..7e8fd50a5 100644 --- a/resources/views/components/status/index.blade.php +++ b/resources/views/components/status/index.blade.php @@ -32,19 +32,9 @@ @endif @if (!str($resource->status)->contains('exited') && $showRefreshButton) - - + @endif diff --git a/resources/views/components/status/restarting.blade.php b/resources/views/components/status/restarting.blade.php index 353bf1097..8ed7494e8 100644 --- a/resources/views/components/status/restarting.blade.php +++ b/resources/views/components/status/restarting.blade.php @@ -5,42 +5,23 @@ 'noLoading' => false, ]) @php - // Handle both colon format (backend) and parentheses format (from services.blade.php) - // starting:unknown → Starting (unknown) - // starting (unknown) → starting (unknown) (already formatted, display as-is) - if (str($status)->contains('(')) { - // Already in parentheses format from services.blade.php - use as-is $displayStatus = $status; - $healthStatus = str($status)->after('(')->before(')')->trim()->value(); - } elseif (str($status)->contains(':') && !str($status)->startsWith('Proxy')) { - // Colon format from backend - transform it + $healthStatus = null; + } elseif (str($status)->contains(':') && ! str($status)->startsWith('Proxy')) { $parts = explode(':', $status); - $displayStatus = str($parts[0])->headline(); + $displayStatus = str($parts[0])->headline()->value(); $healthStatus = $parts[1] ?? null; } else { - // Simple status without health - $displayStatus = str($status)->headline(); + $displayStatus = str($status)->headline()->value(); $healthStatus = null; } + + $badgeStatus = $healthStatus ? "{$displayStatus} ({$healthStatus})" : $displayStatus; @endphp -
- @if (!$noLoading) - - @endif - -
-
- @if ($lastDeploymentLink) - - {{ $displayStatus }} - - @else - {{ $displayStatus }} - @endif -
- @if ($healthStatus && !str($displayStatus)->contains('(')) -
({{ $healthStatus }})
- @endif -
-
+@if ($lastDeploymentLink) + +@else + +@endif diff --git a/resources/views/components/status/running.blade.php b/resources/views/components/status/running.blade.php index eb2964a86..7686d30bb 100644 --- a/resources/views/components/status/running.blade.php +++ b/resources/views/components/status/running.blade.php @@ -5,80 +5,47 @@ 'noLoading' => false, ]) @php - // Handle both colon format (backend) and parentheses format (from services.blade.php) - // running:healthy → Running (healthy) - // running (healthy) → running (healthy) (already formatted, display as-is) - if (str($status)->contains('(')) { - // Already in parentheses format from services.blade.php - use as-is $displayStatus = $status; - $healthStatus = str($status)->after('(')->before(')')->trim()->value(); - } elseif (str($status)->contains(':') && !str($status)->startsWith('Proxy')) { - // Colon format from backend - transform it + $healthStatus = null; + } elseif (str($status)->contains(':') && ! str($status)->startsWith('Proxy')) { $parts = explode(':', $status); - $displayStatus = str($parts[0])->headline(); + $displayStatus = str($parts[0])->headline()->value(); $healthStatus = $parts[1] ?? null; } else { - // Simple status without health - $displayStatus = str($status)->headline(); + $displayStatus = str($status)->headline()->value(); $healthStatus = null; } + + $badgeStatus = $healthStatus ? "{$displayStatus} ({$healthStatus})" : $displayStatus; + $showUnknownHelper = ! str($status)->startsWith('Proxy') && (str($status)->contains('unknown') || str($healthStatus)->contains('unknown')); + $showUnhealthyHelper = ! str($status)->startsWith('Proxy') && (str($status)->contains('unhealthy') || str($healthStatus)->contains('unhealthy')); @endphp -
-
-
-
-
- @if ($lastDeploymentLink) - - {{ $displayStatus }} - - @else - {{ $displayStatus }} - @endif -
- @if ($healthStatus && !str($displayStatus)->contains('(')) -
({{ $healthStatus }})
- @endif - @php - $showUnknownHelper = - !str($status)->startsWith('Proxy') && - (str($status)->contains('unknown') || str($healthStatus)->contains('unknown')); - $showUnhealthyHelper = - !str($status)->startsWith('Proxy') && - (str($status)->contains('unhealthy') || str($healthStatus)->contains('unhealthy')); - @endphp - @if ($showUnknownHelper) -
+
+ @if ($lastDeploymentLink) + + @else + + @endif + @if ($showUnknownHelper) +
- +
- @endif - @if ($showUnhealthyHelper) -
+ @endif + @if ($showUnhealthyHelper) +
- +
- @endif -
- + @endif
diff --git a/resources/views/components/status/services.blade.php b/resources/views/components/status/services.blade.php index ff1862c73..0f90751b5 100644 --- a/resources/views/components/status/services.blade.php +++ b/resources/views/components/status/services.blade.php @@ -14,19 +14,9 @@ @endif @if (!str($complexStatus)->contains('exited') && $showRefreshButton) - - + @endif
diff --git a/resources/views/components/status/stopped.blade.php b/resources/views/components/status/stopped.blade.php index 0af349d40..221ba5e67 100644 --- a/resources/views/components/status/stopped.blade.php +++ b/resources/views/components/status/stopped.blade.php @@ -3,46 +3,12 @@ 'noLoading' => false, ]) @php - // Handle both colon format (backend) and parentheses format (from services.blade.php) - // For exited containers, health status is hidden (health checks don't run on stopped containers) - // exited:unhealthy → Exited - // exited (unhealthy) → Exited - if (str($status)->contains('(')) { - // Already in parentheses format from services.blade.php - use as-is - $displayStatus = $status; - $healthStatus = str($status)->after('(')->before(')')->trim()->value(); - - // Don't show health status for exited containers (health checks don't run on stopped containers) - if (str($displayStatus)->lower()->contains('exited')) { - $displayStatus = str($status)->before('(')->trim()->headline(); - $healthStatus = null; - } + $displayStatus = str($status)->before('(')->trim()->headline()->value(); } elseif (str($status)->contains(':')) { - // Colon format from backend - transform it - $parts = explode(':', $status); - $displayStatus = str($parts[0])->headline(); - $healthStatus = $parts[1] ?? null; - - // Don't show health status for exited containers (health checks don't run on stopped containers) - if (str($displayStatus)->lower()->contains('exited')) { - $healthStatus = null; - } + $displayStatus = str(explode(':', $status)[0])->headline()->value(); } else { - // Simple status without health - $displayStatus = str($status)->headline(); - $healthStatus = null; + $displayStatus = str($status)->headline()->value(); } @endphp -
- @if (!$noLoading) - - @endif - -
-
{{ $displayStatus }}
- @if ($healthStatus && !str($displayStatus)->contains('(')) -
({{ $healthStatus }})
- @endif -
-
+ diff --git a/resources/views/livewire/project/service/resource-card.blade.php b/resources/views/livewire/project/service/resource-card.blade.php index 47fb00914..95af5a732 100644 --- a/resources/views/livewire/project/service/resource-card.blade.php +++ b/resources/views/livewire/project/service/resource-card.blade.php @@ -43,7 +43,15 @@ class="w-4 h-4 dark:text-warning text-coollabs" @endcan @endif -
$isApplication, 'text-xs'])>{{ formatContainerStatus($resource->status) }}
+
$isApplication])> + @if (str($resource->status)->contains('running')) + + @elseif (str($resource->status)->contains(['starting', 'restarting', 'degraded'])) + + @else + + @endif +
@if ($isDatabase && ($resource->isBackupSolutionAvailable() || $resource->is_migrated)) diff --git a/resources/views/livewire/server/navbar.blade.php b/resources/views/livewire/server/navbar.blade.php index bf55ca7f6..ed7d59980 100644 --- a/resources/views/livewire/server/navbar.blade.php +++ b/resources/views/livewire/server/navbar.blade.php @@ -12,65 +12,50 @@ -
-

Server

- @if ($server->proxySet()) -
-
- @if ($proxyStatus === 'running') - - @elseif ($proxyStatus === 'restarting') - - @elseif ($proxyStatus === 'stopping') - - @elseif ($proxyStatus === 'starting') - - @elseif (data_get($server, 'proxy.force_stop')) -
- -
- @elseif ($proxyStatus === 'exited') -
- +
+
+

Server

+ @if ($server->proxySet() || $server->isSentinelEnabled()) +
+ @if ($server->proxySet()) +
+ @if ($proxyStatus === 'running') + + @elseif ($proxyStatus === 'restarting') + + @elseif ($proxyStatus === 'stopping') + + @elseif ($proxyStatus === 'starting') + + @elseif (data_get($server, 'proxy.force_stop')) + + @elseif ($proxyStatus === 'exited') + + @endif +
@endif -
-
- Checking Ports Availability... -
- @if ($proxyStatus !== 'exited') - - + @if ($server->isSentinelEnabled()) + @if ($server->isSentinelLive()) + + @else + + @endif + @endif + @if ($server->proxySet()) + @endif
-
- @endif - @if ($server->isSentinelEnabled()) -
-
- @if ($server->isSentinelLive()) - - @else - - @endif -
-
- @endif + @endif +
+
{{ data_get($server, 'name') }}
-
{{ data_get($server, 'name') }}