This commit is contained in:
Andras Bacsai
2023-09-21 21:30:13 +02:00
parent 6b75ff7de4
commit e1a1490911
10 changed files with 139 additions and 40 deletions

View File

@@ -16,31 +16,7 @@ class Services extends Component
public Service $service,
public string $complexStatus = 'exited',
) {
$foundRunning = false;
$isDegraded = false;
$applications = $service->applications;
$databases = $service->databases;
foreach ($applications as $application) {
if ($application->status === 'running') {
$foundRunning = true;
} else {
$isDegraded = true;
}
}
foreach ($databases as $database) {
if ($database->status === 'running') {
$foundRunning = true;
} else {
$isDegraded = true;
}
}
if ($foundRunning && !$isDegraded) {
$this->complexStatus = 'running';
} else if ($foundRunning && $isDegraded) {
$this->complexStatus = 'degraded';
} else if (!$foundRunning && $isDegraded) {
$this->complexStatus = 'exited';
}
$this->complexStatus = serviceStatus($service);
}
/**