lint
This commit is contained in:
parent
cb716120d0
commit
e9c00511d9
@ -1,7 +1,7 @@
|
|||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
import { t } from "i18next";
|
import { t } from "i18next";
|
||||||
|
|
||||||
export default function KubernetesStatus({ service }) {
|
export default function KubernetesStatus({ service, style }) {
|
||||||
const podSelectorString = service.podSelector !== undefined ? `podSelector=${service.podSelector}` : "";
|
const podSelectorString = service.podSelector !== undefined ? `podSelector=${service.podSelector}` : "";
|
||||||
const { data, error } = useSWR(`/api/kubernetes/status/${service.namespace}/${service.app}?${podSelectorString}`);
|
const { data, error } = useSWR(`/api/kubernetes/status/${service.namespace}/${service.app}?${podSelectorString}`);
|
||||||
|
|
||||||
@ -11,16 +11,19 @@ export default function KubernetesStatus({ service }) {
|
|||||||
let colorClass = "text-black/20 dark:text-white/40 ";
|
let colorClass = "text-black/20 dark:text-white/40 ";
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
statusLabel = statusTitle = t("docker.error");
|
statusTitle = t("docker.error");
|
||||||
|
statusLabel = statusTitle;
|
||||||
colorClass = "text-rose-500/80";
|
colorClass = "text-rose-500/80";
|
||||||
} else if (data) {
|
} else if (data) {
|
||||||
if (data.status === "running") {
|
if (data.status === "running") {
|
||||||
statusLabel = statusTitle = data.health ?? data.status;
|
statusTitle = data.health ?? data.status;
|
||||||
|
statusLabel = statusTitle;
|
||||||
colorClass = "text-emerald-500/80";
|
colorClass = "text-emerald-500/80";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.status === "not found" || data.status === "down" || data.status === "partial") {
|
if (data.status === "not found" || data.status === "down" || data.status === "partial") {
|
||||||
statusLabel = statusTitle = data.status;
|
statusTitle = data.status;
|
||||||
|
statusLabel = statusTitle;
|
||||||
colorClass = "text-orange-400/50 dark:text-orange-400/80";
|
colorClass = "text-orange-400/50 dark:text-orange-400/80";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -33,7 +36,7 @@ export default function KubernetesStatus({ service }) {
|
|||||||
return (
|
return (
|
||||||
<div className={`w-auto text-center overflow-hidden ${backgroundClass} rounded-b-[3px] k8s-status-${statusLabel.toLowerCase().replace(' ', '')}`} title={statusTitle}>
|
<div className={`w-auto text-center overflow-hidden ${backgroundClass} rounded-b-[3px] k8s-status-${statusLabel.toLowerCase().replace(' ', '')}`} title={statusTitle}>
|
||||||
{style !== 'dot' && <div className={`text-[8px] font-bold ${colorClass} uppercase`}>{statusLabel}</div>}
|
{style !== 'dot' && <div className={`text-[8px] font-bold ${colorClass} uppercase`}>{statusLabel}</div>}
|
||||||
{style == 'dot' && <div className={`rounded-full h-3 w-3 ${colorClass}`}></div>}
|
{style === 'dot' && <div className={`rounded-full h-3 w-3 ${colorClass}`}/>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,7 +49,7 @@ export default function Ping({ group, service, style }) {
|
|||||||
return (
|
return (
|
||||||
<div className={`w-auto text-center rounded-b-[3px] overflow-hidden ping-status ${backgroundClass}`} title={statusTitle}>
|
<div className={`w-auto text-center rounded-b-[3px] overflow-hidden ping-status ${backgroundClass}`} title={statusTitle}>
|
||||||
{style !== 'dot' && <div className={`font-bold uppercase text-[8px] ${colorClass}`}>{statusText}</div>}
|
{style !== 'dot' && <div className={`font-bold uppercase text-[8px] ${colorClass}`}>{statusText}</div>}
|
||||||
{style == 'dot' && <div className={`rounded-full h-3 w-3 ${colorClass}`}></div>}
|
{style === 'dot' && <div className={`rounded-full h-3 w-3 ${colorClass}`}/>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,7 +52,7 @@ export default function Status({ service, style }) {
|
|||||||
return (
|
return (
|
||||||
<div className={`w-auto text-center overflow-hidden ${backgroundClass} rounded-b-[3px] docker-status-${statusLabel.toLowerCase().replace(' ', '')}`} title={statusTitle}>
|
<div className={`w-auto text-center overflow-hidden ${backgroundClass} rounded-b-[3px] docker-status-${statusLabel.toLowerCase().replace(' ', '')}`} title={statusTitle}>
|
||||||
{style !== 'dot' && <div className={`text-[8px] font-bold ${colorClass} uppercase`}>{statusLabel}</div>}
|
{style !== 'dot' && <div className={`text-[8px] font-bold ${colorClass} uppercase`}>{statusLabel}</div>}
|
||||||
{style == 'dot' && <div className={`rounded-full h-3 w-3 ${colorClass}`}></div>}
|
{style === 'dot' && <div className={`rounded-full h-3 w-3 ${colorClass}`}/>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user