-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new status format, new podSelector field, more accurate pod stats
* renamed pod label prefix from "homepage" to "gethomepage.dev" which is more inline with typical kubernetes practices
- Loading branch information
Showing
8 changed files
with
65 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,35 @@ | ||
import useSWR from "swr"; | ||
import { t } from "i18next"; | ||
|
||
export default function KubernetesStatus({ service }) { | ||
const { data, error } = useSWR(`/api/kubernetes/status/${service.namespace}/${service.app}`); | ||
const podSelectorString = service.podSelector !== undefined ? `podSelector=${service.podSelector}` : ""; | ||
const { data, error } = useSWR(`/api/kubernetes/status/${service.namespace}/${service.app}?${podSelectorString}`); | ||
|
||
if (error) { | ||
return <div className="w-3 h-3 bg-rose-300 dark:bg-rose-500 rounded-full" />; | ||
<div className="w-auto px-1.5 py-0.5 text-center bg-theme-500/10 dark:bg-theme-900/50 rounded-b-[3px] overflow-hidden" title={data.status}> | ||
<div className="text-[8px] font-bold text-rose-500/80 uppercase">{t("docker.error")}</div> | ||
</div> | ||
} | ||
|
||
if (data && data.status === "running") { | ||
return <div className="w-3 h-3 bg-emerald-300 dark:bg-emerald-500 rounded-full" />; | ||
return ( | ||
<div className="w-auto px-1.5 py-0.5 text-center bg-theme-500/10 dark:bg-theme-900/50 rounded-b-[3px] overflow-hidden" title={data.health ?? data.status}> | ||
<div className="text-[8px] font-bold text-emerald-500/80 uppercase">{data.health ?? data.status}</div> | ||
</div> | ||
); | ||
} | ||
|
||
if (data && data.status === "not found") { | ||
return <div className="h-2.5 w-2.5 bg-orange-400/50 dark:bg-yellow-200/40 -rotate-45" />; | ||
if (data && (data.status === "not found" || data.status === "down" || data.status === "partial")) { | ||
return ( | ||
<div className="w-auto px-1.5 py-0.5 text-center bg-theme-500/10 dark:bg-theme-900/50 rounded-b-[3px] overflow-hidden" title={data.status}> | ||
<div className="text-[8px] font-bold text-orange-400/50 dark:text-orange-400/80 uppercase">{data.status}</div> | ||
</div> | ||
); | ||
} | ||
|
||
return <div className="w-3 h-3 bg-black/20 dark:bg-white/40 rounded-full" />; | ||
return ( | ||
<div className="w-auto px-1.5 py-0.5 text-center bg-theme-500/10 dark:bg-theme-900/50 rounded-b-[3px] overflow-hidden"> | ||
<div className="text-[8px] font-bold text-black/20 dark:text-white/40 uppercase">{t("docker.unknown")}</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters