Stats: add record retain mode/days to camera stats

This commit is contained in:
leccelecce 2025-03-31 20:25:33 +01:00
parent 1dd5007fa8
commit 281122e8f3
4 changed files with 26 additions and 0 deletions

View File

@ -82,6 +82,8 @@ class StorageMaintainer(threading.Thread):
"bandwidth": self.camera_storage_stats.get(camera, {}).get( "bandwidth": self.camera_storage_stats.get(camera, {}).get(
"bandwidth", 0 "bandwidth", 0
), ),
"record_retain_mode": self.config.cameras[camera].record.retain.mode,
"record_retain_days": self.config.cameras[camera].record.retain.days,
} }
return usages return usages

View File

@ -91,6 +91,9 @@
"cameraStorage": { "cameraStorage": {
"title": "Camera Storage", "title": "Camera Storage",
"camera": "Camera", "camera": "Camera",
"retention": "Retention",
"day": "day",
"days": "days",
"unusedStorageInformation": "Unused Storage Information", "unusedStorageInformation": "Unused Storage Information",
"storageUsed": "Storage", "storageUsed": "Storage",
"percentageOfTotalUsed": "Percentage of Total", "percentageOfTotalUsed": "Percentage of Total",

View File

@ -25,6 +25,8 @@ type CameraStorage = {
bandwidth: number; bandwidth: number;
usage: number; usage: number;
usage_percent: number; usage_percent: number;
record_retain_mode: string;
record_retain_days: number;
}; };
}; };
@ -56,6 +58,8 @@ export function CombinedStorageGraph({
usage: cameraStorage[entity].usage, usage: cameraStorage[entity].usage,
bandwidth: cameraStorage[entity].bandwidth, bandwidth: cameraStorage[entity].bandwidth,
color: colors[index], // Assign the corresponding color 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 // Add the unused percentage to the series
@ -67,6 +71,8 @@ export function CombinedStorageGraph({
usage: totalStorage.total - totalStorage.used, usage: totalStorage.total - totalStorage.used,
bandwidth: 0, bandwidth: 0,
color: (systemTheme || theme) == "dark" ? "#404040" : "#E5E5E5", color: (systemTheme || theme) == "dark" ? "#404040" : "#E5E5E5",
retentionMode: "",
retentionDays: 0,
}); });
const options = useMemo(() => { const options = useMemo(() => {
@ -181,6 +187,7 @@ export function CombinedStorageGraph({
<TableHeader> <TableHeader>
<TableRow> <TableRow>
<TableHead>{t("storage.cameraStorage.camera")}</TableHead> <TableHead>{t("storage.cameraStorage.camera")}</TableHead>
<TableHead>{t("storage.cameraStorage.retention")}</TableHead>
<TableHead>{t("storage.cameraStorage.storageUsed")}</TableHead> <TableHead>{t("storage.cameraStorage.storageUsed")}</TableHead>
<TableHead> <TableHead>
{t("storage.cameraStorage.percentageOfTotalUsed")} {t("storage.cameraStorage.percentageOfTotalUsed")}
@ -225,6 +232,18 @@ export function CombinedStorageGraph({
</Popover> </Popover>
)} )}
</TableCell> </TableCell>
<TableCell>
{item.name === "Unused"
? "—"
: t("effectiveRetainMode.modes." + item.retentionMode) +
(" (" +
item.retentionDays +
" " +
(item.retentionDays === 1
? t("storage.cameraStorage.day")
: t("storage.cameraStorage.days")) +
")")}
</TableCell>
<TableCell>{getUnitSize(item.usage ?? 0)}</TableCell> <TableCell>{getUnitSize(item.usage ?? 0)}</TableCell>
<TableCell>{item.data[0].toFixed(2)}%</TableCell> <TableCell>{item.data[0].toFixed(2)}%</TableCell>
<TableCell> <TableCell>

View File

@ -20,6 +20,8 @@ type CameraStorage = {
bandwidth: number; bandwidth: number;
usage: number; usage: number;
usage_percent: number; usage_percent: number;
record_retain_mode: string;
record_retain_days: number;
}; };
}; };