mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-10 15:28:47 +00:00
Kubernetes support
* Total CPU and Memory usage for the entire cluster * Total CPU and Memory usage for kubernetes pods * Service discovery via annotations on ingress * No storage stats yet * No network stats yet
This commit is contained in:
parent
b25ba09e18
commit
c4333fd2dc
18 changed files with 479 additions and 19 deletions
|
@ -5,10 +5,10 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import UsageBar from "./usage-bar";
|
||||
|
||||
export default function Cpu({ expanded }) {
|
||||
export default function Cpu({ expanded, backend }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { data, error } = useSWR(`/api/widgets/resources?type=cpu`, {
|
||||
const { data, error } = useSWR(`/api/widgets/${backend || 'resources'}?type=cpu`, {
|
||||
refreshInterval: 1500,
|
||||
});
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import UsageBar from "./usage-bar";
|
||||
|
||||
export default function Disk({ options, expanded }) {
|
||||
export default function Disk({ options, expanded, backend }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { data, error } = useSWR(`/api/widgets/resources?type=disk&target=${options.disk}`, {
|
||||
const { data, error } = useSWR(`/api/widgets/${backend || 'resources'}?type=disk&target=${options.disk}`, {
|
||||
refreshInterval: 1500,
|
||||
});
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import UsageBar from "./usage-bar";
|
||||
|
||||
export default function Memory({ expanded }) {
|
||||
export default function Memory({ expanded, backend }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { data, error } = useSWR(`/api/widgets/resources?type=memory`, {
|
||||
const { data, error } = useSWR(`/api/widgets/${backend || 'resources'}?type=memory`, {
|
||||
refreshInterval: 1500,
|
||||
});
|
||||
|
||||
|
|
|
@ -3,15 +3,15 @@ import Cpu from "./cpu";
|
|||
import Memory from "./memory";
|
||||
|
||||
export default function Resources({ options }) {
|
||||
const { expanded } = options;
|
||||
const { expanded, backend } = options;
|
||||
return (
|
||||
<div className="flex flex-col max-w:full sm:basis-auto self-center grow-0 flex-wrap">
|
||||
<div className="flex flex-row self-center flex-wrap justify-between">
|
||||
{options.cpu && <Cpu expanded={expanded} />}
|
||||
{options.memory && <Memory expanded={expanded} />}
|
||||
{options.cpu && <Cpu expanded={expanded} backend={backend} />}
|
||||
{options.memory && <Memory expanded={expanded} backend={backend} />}
|
||||
{Array.isArray(options.disk)
|
||||
? options.disk.map((disk) => <Disk key={disk} options={{ disk }} expanded={expanded} />)
|
||||
: options.disk && <Disk options={options} expanded={expanded} />}
|
||||
? options.disk.map((disk) => <Disk key={disk} options={{ disk }} expanded={expanded} backend={backend} />)
|
||||
: options.disk && <Disk options={options} expanded={expanded} backend={backend} />}
|
||||
</div>
|
||||
{options.label && (
|
||||
<div className="ml-6 pt-1 text-center text-theme-800 dark:text-theme-200 text-xs">{options.label}</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue