2022-10-25 13:35:38 -05:00
|
|
|
import { useTranslation } from "next-i18next";
|
2023-06-03 01:10:15 +01:00
|
|
|
import { FaThermometerHalf } from "react-icons/fa";
|
2022-10-25 13:35:38 -05:00
|
|
|
|
2023-06-10 23:30:44 -07:00
|
|
|
import UsageBar from "../resources/usage-bar";
|
2023-06-03 01:10:15 +01:00
|
|
|
import SingleResource from "../widget/single_resource";
|
|
|
|
import WidgetIcon from "../widget/widget_icon";
|
|
|
|
import ResourceValue from "../widget/resource_value";
|
|
|
|
import ResourceLabel from "../widget/resource_label";
|
|
|
|
import WidgetLabel from "../widget/widget_label";
|
2022-10-25 13:35:38 -05:00
|
|
|
|
|
|
|
export default function Node({ data, expanded, labels }) {
|
|
|
|
const { t } = useTranslation();
|
|
|
|
|
2023-06-03 01:10:15 +01:00
|
|
|
return <SingleResource expanded={expanded}>
|
|
|
|
<WidgetIcon icon={FaThermometerHalf} />
|
|
|
|
<ResourceValue>{t("common.bytes", { value: data.node.available })}</ResourceValue>
|
|
|
|
<ResourceLabel>{t("resources.free")}</ResourceLabel>
|
|
|
|
<ResourceValue>{t("common.bytes", { value: data.node.maximum })}</ResourceValue>
|
|
|
|
<ResourceLabel>{t("resources.total")}</ResourceLabel>
|
|
|
|
<UsageBar percent={Math.round(((data.node.maximum - data.node.available) / data.node.maximum) * 100)} />
|
|
|
|
{ labels && <WidgetLabel label={data.node.id} /> }
|
|
|
|
</SingleResource>
|
2022-10-25 13:35:38 -05:00
|
|
|
}
|