mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-05 13:07:44 +03:00
read from config instead of stats
This commit is contained in:
parent
281122e8f3
commit
d6409ae1cb
@ -82,8 +82,6 @@ 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
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { useTheme } from "@/context/theme-provider";
|
||||
import { FrigateConfig } from "@/types/frigateConfig";
|
||||
import { generateColors } from "@/utils/colorUtil";
|
||||
import { useEffect, useMemo } from "react";
|
||||
import Chart from "react-apexcharts";
|
||||
@ -19,14 +20,13 @@ import { getUnitSize } from "@/utils/storageUtil";
|
||||
|
||||
import { CiCircleAlert } from "react-icons/ci";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import useSWR from "swr";
|
||||
|
||||
type CameraStorage = {
|
||||
[key: string]: {
|
||||
bandwidth: number;
|
||||
usage: number;
|
||||
usage_percent: number;
|
||||
record_retain_mode: string;
|
||||
record_retain_days: number;
|
||||
};
|
||||
};
|
||||
|
||||
@ -45,6 +45,9 @@ export function CombinedStorageGraph({
|
||||
cameraStorage,
|
||||
totalStorage,
|
||||
}: CombinedStorageGraphProps) {
|
||||
const { data: config } = useSWR<FrigateConfig>("config", {
|
||||
revalidateOnFocus: false,
|
||||
});
|
||||
const { t } = useTranslation(["views/system"]);
|
||||
|
||||
const { theme, systemTheme } = useTheme();
|
||||
@ -58,8 +61,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,
|
||||
retentionMode: config?.cameras[entity].record.retain.mode,
|
||||
retentionDays: config?.cameras[entity].record.retain.days,
|
||||
}));
|
||||
|
||||
// Add the unused percentage to the series
|
||||
|
||||
@ -20,8 +20,6 @@ type CameraStorage = {
|
||||
bandwidth: number;
|
||||
usage: number;
|
||||
usage_percent: number;
|
||||
record_retain_mode: string;
|
||||
record_retain_days: number;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user