diff --git a/web/src/components/graph/SystemGraph.tsx b/web/src/components/graph/SystemGraph.tsx
index 36f90ce71..492f51187 100644
--- a/web/src/components/graph/SystemGraph.tsx
+++ b/web/src/components/graph/SystemGraph.tsx
@@ -137,14 +137,8 @@ type StorageGraphProps = {
graphId: string;
used: number;
total: number;
- data: ApexAxisChartSeries;
};
-export function StorageGraph({
- graphId,
- used,
- total,
- data,
-}: StorageGraphProps) {
+export function StorageGraph({ graphId, used, total }: StorageGraphProps) {
const { theme, systemTheme } = useTheme();
const options = useMemo(() => {
@@ -225,7 +219,14 @@ export function StorageGraph({
-
+
);
diff --git a/web/src/pages/System.tsx b/web/src/pages/System.tsx
index af81543be..f2748ab43 100644
--- a/web/src/pages/System.tsx
+++ b/web/src/pages/System.tsx
@@ -71,12 +71,7 @@ function System() {
setLastUpdated={setLastUpdated}
/>
)}
- {page == "storage" && (
-
- )}
+ {page == "storage" && }
);
}
diff --git a/web/src/views/system/StorageMetrics.tsx b/web/src/views/system/StorageMetrics.tsx
index d428aba4f..d275e72fe 100644
--- a/web/src/views/system/StorageMetrics.tsx
+++ b/web/src/views/system/StorageMetrics.tsx
@@ -1,4 +1,5 @@
import { StorageGraph } from "@/components/graph/SystemGraph";
+import { FrigateStats } from "@/types/stats";
import { useMemo } from "react";
import useSWR from "swr";
@@ -11,30 +12,32 @@ type CameraStorage = {
};
type StorageMetricsProps = {
- lastUpdated: number;
setLastUpdated: (last: number) => void;
};
export default function StorageMetrics({
- lastUpdated,
setLastUpdated,
}: StorageMetricsProps) {
- const { data: storage } = useSWR("recordings/storage");
+ const { data: cameraStorage } = useSWR("recordings/storage");
+ const { data: stats } = useSWR("stats");
const totalStorage = useMemo(() => {
- if (!storage) {
+ if (!cameraStorage || !stats) {
return undefined;
}
const totalStorage = {
- total: 0,
+ used: 0,
+ total: stats.service.storage["/media/frigate/recordings"]["total"],
};
- Object.values(storage).forEach((cam) => (totalStorage.total += cam.usage));
-
+ Object.values(cameraStorage).forEach(
+ (cam) => (totalStorage.used += cam.usage),
+ );
+ setLastUpdated(Date.now() / 1000);
return totalStorage;
- }, [storage]);
+ }, [cameraStorage, stats, setLastUpdated]);
- if (!totalStorage) {
+ if (!cameraStorage || !stats || !totalStorage) {
return;
}
@@ -48,11 +51,41 @@ export default function StorageMetrics({
Recordings
+
+
+
+
+ Camera Storage
+
+
+ {Object.keys(cameraStorage).map((camera) => (
+
+
{camera.replaceAll("_", " ")}
+
+
+ ))}
);