diff --git a/src/State/DashboardProvider.php b/src/State/DashboardProvider.php new file mode 100644 index 0000000..c47c005 --- /dev/null +++ b/src/State/DashboardProvider.php @@ -0,0 +1,50 @@ +applicationRepository->findAll(); + + $dto = new Dashboard(); + + foreach ($applications as $app) { + $envs = []; + + foreach ($app->getEnvironments() as $env) { + $containerStatus = $this->dockerService->getContainerStatus($env->getContainerName()); + + $envs[] = [ + 'id' => $env->getId(), + 'name' => $env->getName(), + 'status' => $containerStatus['status'], + 'version' => $containerStatus['version'], + ]; + } + + $dto->applications[] = [ + 'name' => $app->getName(), + 'slug' => $app->getSlug(), + 'giteaUrl' => $app->getGiteaUrl(), + 'environments' => $envs, + ]; + } + + return $dto; + } +}