mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-09 14:58:47 +00:00
Enhancement: support different bytes multipliers for disk space for resources / glances and metrics widgets (#2966)
This commit is contained in:
parent
3fae59c2bd
commit
291bf422f9
8 changed files with 22 additions and 12 deletions
|
@ -5,8 +5,9 @@ import { useTranslation } from "next-i18next";
|
|||
import Resource from "../widget/resource";
|
||||
import Error from "../widget/error";
|
||||
|
||||
export default function Disk({ options, expanded, refresh = 1500 }) {
|
||||
export default function Disk({ options, expanded, diskUnits, refresh = 1500 }) {
|
||||
const { t } = useTranslation();
|
||||
const diskUnitsName = diskUnits === "bbytes" ? "common.bbytes" : "common.bytes";
|
||||
|
||||
const { data, error } = useSWR(`/api/widgets/resources?type=disk&target=${options.disk}`, {
|
||||
refreshInterval: refresh,
|
||||
|
@ -36,9 +37,9 @@ export default function Disk({ options, expanded, refresh = 1500 }) {
|
|||
return (
|
||||
<Resource
|
||||
icon={FiHardDrive}
|
||||
value={t("common.bytes", { value: data.drive.available })}
|
||||
value={t(diskUnitsName, { value: data.drive.available })}
|
||||
label={t("resources.free")}
|
||||
expandedValue={t("common.bytes", { value: data.drive.size })}
|
||||
expandedValue={t(diskUnitsName, { value: data.drive.size })}
|
||||
expandedLabel={t("resources.total")}
|
||||
percentage={percent}
|
||||
expanded={expanded}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue