Feature: Proxmox status & stats integration (#5385)
Some checks failed
Crowdin Action / Crowdin Sync (push) Has been cancelled
Docker CI / Linting Checks (push) Has been cancelled
Docker CI / Docker Build & Push (push) Has been cancelled
Repository Maintenance / Stale (push) Has been cancelled
Repository Maintenance / Lock Old Threads (push) Has been cancelled
Repository Maintenance / Close Answered Discussions (push) Has been cancelled
Repository Maintenance / Close Outdated Discussions (push) Has been cancelled
Repository Maintenance / Close Unsupported Feature Requests (push) Has been cancelled

Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
Albin Médoc
2025-06-06 16:25:21 +02:00
committed by GitHub
parent 30abf4e422
commit 5759596a37
9 changed files with 293 additions and 29 deletions

View File

@@ -0,0 +1,32 @@
import Block from "components/services/widget/block";
import Container from "components/services/widget/container";
import { useTranslation } from "next-i18next";
import useSWR from "swr";
export default function ProxmoxVM({ service }) {
const { t } = useTranslation();
const { widget } = service;
const { data, error } = useSWR(`/api/proxmox/stats/${widget.node}/${widget.vmid}?type=${widget.type || "qemu"}`);
if (error) {
return <Container service={service} error={error} />;
}
if (!data) {
return (
<Container service={service}>
<Block label="resources.cpu" />
<Block label="resources.mem" />
</Container>
);
}
return (
<Container service={service}>
<Block label="resources.cpu" value={t("common.percent", { value: data.cpu })} />
<Block label="resources.mem" value={t("common.bytes", { value: data.mem })} />
</Container>
);
}