From 281122e8f38b000a43c16c595cd936cb72b98cc7 Mon Sep 17 00:00:00 2001 From: leccelecce <24962424+leccelecce@users.noreply.github.com> Date: Mon, 31 Mar 2025 20:25:33 +0100 Subject: [PATCH] Stats: add record retain mode/days to camera stats --- frigate/storage.py | 2 ++ web/public/locales/en/views/system.json | 3 +++ .../components/graph/CombinedStorageGraph.tsx | 19 +++++++++++++++++++ web/src/views/system/StorageMetrics.tsx | 2 ++ 4 files changed, 26 insertions(+) diff --git a/frigate/storage.py b/frigate/storage.py index 1c4650271..ecff0234a 100644 --- a/frigate/storage.py +++ b/frigate/storage.py @@ -82,6 +82,8 @@ class StorageMaintainer(threading.Thread): "bandwidth": self.camera_storage_stats.get(camera, {}).get( "bandwidth", 0 ), + "record_retain_mode": self.config.cameras[camera].record.retain.mode, + "record_retain_days": self.config.cameras[camera].record.retain.days, } return usages diff --git a/web/public/locales/en/views/system.json b/web/public/locales/en/views/system.json index 98583134c..f8c98bab0 100644 --- a/web/public/locales/en/views/system.json +++ b/web/public/locales/en/views/system.json @@ -91,6 +91,9 @@ "cameraStorage": { "title": "Camera Storage", "camera": "Camera", + "retention": "Retention", + "day": "day", + "days": "days", "unusedStorageInformation": "Unused Storage Information", "storageUsed": "Storage", "percentageOfTotalUsed": "Percentage of Total", diff --git a/web/src/components/graph/CombinedStorageGraph.tsx b/web/src/components/graph/CombinedStorageGraph.tsx index ad8dafd63..731409b5e 100644 --- a/web/src/components/graph/CombinedStorageGraph.tsx +++ b/web/src/components/graph/CombinedStorageGraph.tsx @@ -25,6 +25,8 @@ type CameraStorage = { bandwidth: number; usage: number; usage_percent: number; + record_retain_mode: string; + record_retain_days: number; }; }; @@ -56,6 +58,8 @@ export function CombinedStorageGraph({ usage: cameraStorage[entity].usage, bandwidth: cameraStorage[entity].bandwidth, color: colors[index], // Assign the corresponding color + retentionMode: cameraStorage[entity].record_retain_mode, + retentionDays: cameraStorage[entity].record_retain_days, })); // Add the unused percentage to the series @@ -67,6 +71,8 @@ export function CombinedStorageGraph({ usage: totalStorage.total - totalStorage.used, bandwidth: 0, color: (systemTheme || theme) == "dark" ? "#404040" : "#E5E5E5", + retentionMode: "", + retentionDays: 0, }); const options = useMemo(() => { @@ -181,6 +187,7 @@ export function CombinedStorageGraph({ {t("storage.cameraStorage.camera")} + {t("storage.cameraStorage.retention")} {t("storage.cameraStorage.storageUsed")} {t("storage.cameraStorage.percentageOfTotalUsed")} @@ -225,6 +232,18 @@ export function CombinedStorageGraph({ )} + + {item.name === "Unused" + ? "—" + : t("effectiveRetainMode.modes." + item.retentionMode) + + (" (" + + item.retentionDays + + " " + + (item.retentionDays === 1 + ? t("storage.cameraStorage.day") + : t("storage.cameraStorage.days")) + + ")")} + {getUnitSize(item.usage ?? 0)} {item.data[0].toFixed(2)}% diff --git a/web/src/views/system/StorageMetrics.tsx b/web/src/views/system/StorageMetrics.tsx index 4e7ff646d..b4abe21be 100644 --- a/web/src/views/system/StorageMetrics.tsx +++ b/web/src/views/system/StorageMetrics.tsx @@ -20,6 +20,8 @@ type CameraStorage = { bandwidth: number; usage: number; usage_percent: number; + record_retain_mode: string; + record_retain_days: number; }; };