diff --git a/packages/translation/src/lang/en.json b/packages/translation/src/lang/en.json index 7c31ce087..e7c63f9f6 100644 --- a/packages/translation/src/lang/en.json +++ b/packages/translation/src/lang/en.json @@ -2498,7 +2498,17 @@ "systemResources": { "name": "System resources", "description": "CPU, Memory, Disk and other hardware usage of your system", - "option": {}, + "option": { + "visibleCharts": { + "label": "Visible charts", + "description": "Select the charts you want to be visible.", + "option": { + "cpu": "CPU", + "memory": "Memory", + "network": "Network" + } + } + }, "card": { "cpu": "CPU", "memory": "MEM", diff --git a/packages/widgets/src/system-resources/component.module.css b/packages/widgets/src/system-resources/component.module.css deleted file mode 100644 index da1a998ed..000000000 --- a/packages/widgets/src/system-resources/component.module.css +++ /dev/null @@ -1,14 +0,0 @@ -.grid { - display: grid; - grid-template-rows: repeat(3, 1fr); - grid-template-columns: repeat(2, 1fr); - gap: 8px; - padding: 8px; - - height: 100%; -} - -.colSpanWide { - grid-column-start: 1; - grid-column-end: 3; -} diff --git a/packages/widgets/src/system-resources/component.tsx b/packages/widgets/src/system-resources/component.tsx index 501eddc65..648f91da6 100644 --- a/packages/widgets/src/system-resources/component.tsx +++ b/packages/widgets/src/system-resources/component.tsx @@ -1,6 +1,7 @@ "use client"; import { useState } from "react"; +import { Box, Group, Stack } from "@mantine/core"; import { useElementSize } from "@mantine/hooks"; import { clientApi } from "@homarr/api/client"; @@ -10,11 +11,10 @@ import { CombinedNetworkTrafficChart } from "./chart/combined-network-traffic"; import { SystemResourceCPUChart } from "./chart/cpu-chart"; import { SystemResourceMemoryChart } from "./chart/memory-chart"; import { NetworkTrafficChart } from "./chart/network-traffic"; -import classes from "./component.module.css"; const MAX_QUEUE_SIZE = 15; -export default function SystemResources({ integrationIds }: WidgetComponentProps<"systemResources">) { +export default function SystemResources({ integrationIds, options }: WidgetComponentProps<"systemResources">) { const { ref, width } = useElementSize(); const [data] = clientApi.widget.healthMonitoring.getSystemHealthStatus.useSuspenseQuery({ @@ -49,34 +49,40 @@ export default function SystemResources({ integrationIds }: WidgetComponentProps }, ); - const showNetwork = items.length === 0 || items.every((item) => item.network !== null); + const showNetwork = + items.length === 0 || (items.every((item) => item.network !== null) && options.visibleCharts.includes("network")); + const rowHeight = `calc((100% - ${(options.visibleCharts.length - 1) * 8}px) / ${options.visibleCharts.length})`; return ( -