diff --git a/web/src/components/graph/CombinedStorageGraph.tsx b/web/src/components/graph/CombinedStorageGraph.tsx index cad56056c..97b42ab9d 100644 --- a/web/src/components/graph/CombinedStorageGraph.tsx +++ b/web/src/components/graph/CombinedStorageGraph.tsx @@ -1,6 +1,6 @@ import { useTheme } from "@/context/theme-provider"; import { generateColors } from "@/utils/colorUtil"; -import { useEffect, useMemo } from "react"; +import { useCallback, useEffect, useMemo } from "react"; import Chart from "react-apexcharts"; import { Table, @@ -30,6 +30,7 @@ type CameraStorage = { type TotalStorage = { used: number; + camera: number; total: number; }; @@ -59,6 +60,13 @@ export function CombinedStorageGraph({ })); // Add the unused percentage to the series + series.push({ + name: "Other", + data: [(totalStorage.used / totalStorage.total) * 100], + usage: totalStorage.used, + bandwidth: 0, + color: (systemTheme || theme) == "dark" ? "#606060" : "#D5D5D5", + }); series.push({ name: "Unused", data: [ @@ -160,12 +168,27 @@ export function CombinedStorageGraph({ ApexCharts.exec(graphId, "updateOptions", options, true, true); }, [graphId, options]); + // convenience + + const getItemTitle = useCallback( + (name: string) => { + if (name == "Unused") { + return t("storage.cameraStorage.unused.title"); + } else if (name == "Other") { + return t("label.other", { ns: "common" }); + } else { + return name.replaceAll("_", " "); + } + }, + [t], + ); + return (