import { useTranslation } from "next-i18next"; import Error from "../components/error"; import Container from "../components/container"; import Block from "../components/block"; import useWidgetAPI from "utils/proxy/use-widget-api"; export default function Component({ service }) { const { t } = useTranslation(); const { widget } = service; const { chart } = widget; const [, fsName] = widget.metric.split("fs:"); const { data, error } = useWidgetAPI(widget, "fs", { refreshInterval: 1000, }); if (error) { return ( ); } if (!data) { return ( - ); } const fsData = data.find((item) => item[item.key] === fsName); if (!fsData) { return ( - ); } return ( {chart && (
)} {fsData.used && chart && (
{t("common.bbytes", { value: fsData.used, maximumFractionDigits: 0, })}{" "} {t("resources.used")}
)}
{t("common.bbytes", { value: fsData.free, maximumFractionDigits: 1, })}{" "} {t("resources.free")}
{!chart && ( {fsData.used && (
{t("common.bbytes", { value: fsData.used, maximumFractionDigits: 0, })}{" "} {t("resources.used")}
)}
)}
{t("common.bbytes", { value: fsData.size, maximumFractionDigits: 1, })}{" "} {t("resources.total")}
); }