mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-15 22:14:53 +00:00
feat: implement formatContainerStatus helper for human-readable status formatting and add unit tests
This commit is contained in:
1 parent
840d25a729
commit
01609e7f8b
4 files changed
+247
-72
No files matched your search
@@ -1,26 +1,5 @@
|
||||
@php
|
||||
// Transform colon format to human-readable format for UI display
|
||||
// running:healthy → Running (healthy)
|
||||
// running:unhealthy:excluded → Running (unhealthy, excluded)
|
||||
// exited:excluded → Exited (excluded)
|
||||
$isExcluded = str($complexStatus)->endsWith(':excluded');
|
||||
$parts = explode(':', $complexStatus);
|
||||
|
||||
if ($isExcluded) {
|
||||
if (count($parts) === 3) {
|
||||
// Has health status: running:unhealthy:excluded → Running (unhealthy, excluded)
|
||||
$displayStatus = str($parts[0])->headline() . ' (' . $parts[1] . ', excluded)';
|
||||
} else {
|
||||
// No health status: exited:excluded → Exited (excluded)
|
||||
$displayStatus = str($parts[0])->headline() . ' (excluded)';
|
||||
}
|
||||
} elseif (count($parts) >= 2 && !str($complexStatus)->startsWith('Proxy')) {
|
||||
// Regular colon format: running:healthy → Running (healthy)
|
||||
$displayStatus = str($parts[0])->headline() . ' (' . $parts[1] . ')';
|
||||
} else {
|
||||
// No transformation needed (simple status or already in parentheses format)
|
||||
$displayStatus = str($complexStatus)->headline();
|
||||
}
|
||||
$displayStatus = formatContainerStatus($complexStatus);
|
||||
@endphp
|
||||
@if (str($displayStatus)->lower()->contains('running'))
|
||||
<x-status.running :status="$displayStatus" />
|
||||
|
||||
Reference in new issue
Block a user