diff --git a/src/components/services/kubernetes-status.jsx b/src/components/services/kubernetes-status.jsx index 06dde6faa..4739980be 100644 --- a/src/components/services/kubernetes-status.jsx +++ b/src/components/services/kubernetes-status.jsx @@ -6,7 +6,7 @@ export default function KubernetesStatus({ service }) { const { data, error } = useSWR(`/api/kubernetes/status/${service.namespace}/${service.app}?${podSelectorString}`); if (error) { -
+
{t("docker.error")}
} diff --git a/src/components/services/status.jsx b/src/components/services/status.jsx index 70cad6b27..7ef6a079f 100644 --- a/src/components/services/status.jsx +++ b/src/components/services/status.jsx @@ -7,52 +7,54 @@ export default function Status({ service }) { const { data, error } = useSWR(`/api/docker/status/${service.container}/${service.server || ""}`); if (error) { -
+
{t("docker.error")}
} - let statusLabel = ""; + if (data) { + let statusLabel = ""; + + if (data.status?.includes("running")) { + if (data.health === "starting") { + return ( +
+
{t("docker.starting")}
+
+ ); + } + + if (data.health === "unhealthy") { + return ( +
+
{t("docker.unhealthy")}
+
+ ); + } + + if (!data.health) { + statusLabel = data.status.replace("running", t("docker.running")) + } else { + statusLabel = data.health === "healthy" ? t("docker.healthy") : data.health + } - if (data && data.status?.includes("running")) { - if (data.health === "starting") { return ( -
-
{t("docker.starting")}
+
+
{statusLabel}
); } - - if (data.health === "unhealthy") { + + if (data.status === "not found" || data.status === "exited" || data.status?.startsWith("partial")) { + if (data.status === "not found") statusLabel = t("docker.not_found") + else if (data.status === "exited") statusLabel = t("docker.exited") + else statusLabel = data.status.replace("partial", t("docker.partial")) return ( -
-
{t("docker.unhealthy")}
+
+
{statusLabel}
); } - - if (!data.health) { - statusLabel = data.status.replace("running", t("docker.running")) - } else { - statusLabel = data.health === "healthy" ? t("docker.healthy") : data.health - } - - return ( -
-
{statusLabel}
-
- ); - } - - if (data && (data.status === "not found" || data.status === "exited" || data.status?.startsWith("partial"))) { - if (data.status === "not found") statusLabel = t("docker.not_found") - else if (data.status === "exited") statusLabel = t("docker.exited") - else statusLabel = data.status.replace("partial", t("docker.partial")) - return ( -
-
{statusLabel}
-
- ); } return (