mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-07-30 13:48:07 +02:00
Fixes (#19038)
* Fix Norwegian language code for date-fns module import * Fix incorrect apple compatibility change * Add other and unused as separate storage items --------- Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
This commit is contained in:
parent
178117183e
commit
cd54a81150
@ -491,6 +491,6 @@ def parse_preset_output_record(arg: Any, force_record_hvc1: bool) -> list[str]:
|
|||||||
|
|
||||||
if force_record_hvc1:
|
if force_record_hvc1:
|
||||||
# Apple only supports HEVC if it is hvc1 (vs. hev1)
|
# Apple only supports HEVC if it is hvc1 (vs. hev1)
|
||||||
preset += FFMPEG_HVC1_ARGS
|
return preset + FFMPEG_HVC1_ARGS
|
||||||
|
|
||||||
return preset
|
return preset
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { useTheme } from "@/context/theme-provider";
|
import { useTheme } from "@/context/theme-provider";
|
||||||
import { generateColors } from "@/utils/colorUtil";
|
import { generateColors } from "@/utils/colorUtil";
|
||||||
import { useEffect, useMemo } from "react";
|
import { useCallback, useEffect, useMemo } from "react";
|
||||||
import Chart from "react-apexcharts";
|
import Chart from "react-apexcharts";
|
||||||
import {
|
import {
|
||||||
Table,
|
Table,
|
||||||
@ -30,6 +30,7 @@ type CameraStorage = {
|
|||||||
|
|
||||||
type TotalStorage = {
|
type TotalStorage = {
|
||||||
used: number;
|
used: number;
|
||||||
|
camera: number;
|
||||||
total: number;
|
total: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -59,6 +60,13 @@ export function CombinedStorageGraph({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// Add the unused percentage to the series
|
// 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({
|
series.push({
|
||||||
name: "Unused",
|
name: "Unused",
|
||||||
data: [
|
data: [
|
||||||
@ -160,12 +168,27 @@ export function CombinedStorageGraph({
|
|||||||
ApexCharts.exec(graphId, "updateOptions", options, true, true);
|
ApexCharts.exec(graphId, "updateOptions", options, true, true);
|
||||||
}, [graphId, options]);
|
}, [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 (
|
return (
|
||||||
<div className="flex w-full flex-col gap-2.5">
|
<div className="flex w-full flex-col gap-2.5">
|
||||||
<div className="flex w-full items-center justify-between gap-1">
|
<div className="flex w-full items-center justify-between gap-1">
|
||||||
<div className="flex items-center gap-1">
|
<div className="flex items-center gap-1">
|
||||||
<div className="text-xs text-primary">
|
<div className="text-xs text-primary">
|
||||||
{getUnitSize(totalStorage.used)}
|
{getUnitSize(totalStorage.camera)}
|
||||||
</div>
|
</div>
|
||||||
<div className="text-xs text-primary">/</div>
|
<div className="text-xs text-primary">/</div>
|
||||||
<div className="text-xs text-muted-foreground">
|
<div className="text-xs text-muted-foreground">
|
||||||
@ -197,10 +220,8 @@ export function CombinedStorageGraph({
|
|||||||
className="size-3 rounded-md"
|
className="size-3 rounded-md"
|
||||||
style={{ backgroundColor: item.color }}
|
style={{ backgroundColor: item.color }}
|
||||||
></div>
|
></div>
|
||||||
{item.name === "Unused"
|
{getItemTitle(item.name)}
|
||||||
? t("storage.cameraStorage.unused.title")
|
{(item.name === "Unused" || item.name == "Other") && (
|
||||||
: item.name.replaceAll("_", " ")}
|
|
||||||
{item.name === "Unused" && (
|
|
||||||
<Popover>
|
<Popover>
|
||||||
<PopoverTrigger asChild>
|
<PopoverTrigger asChild>
|
||||||
<button
|
<button
|
||||||
@ -228,7 +249,7 @@ export function CombinedStorageGraph({
|
|||||||
<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>
|
||||||
{item.name === "Unused"
|
{item.name === "Unused" || item.name == "Other"
|
||||||
? "—"
|
? "—"
|
||||||
: `${getUnitSize(item.bandwidth)} / hour`}
|
: `${getUnitSize(item.bandwidth)} / hour`}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
@ -18,7 +18,7 @@ const localeMap: Record<string, () => Promise<Locale>> = {
|
|||||||
nl: () => import("date-fns/locale/nl").then((module) => module.nl),
|
nl: () => import("date-fns/locale/nl").then((module) => module.nl),
|
||||||
sv: () => import("date-fns/locale/sv").then((module) => module.sv),
|
sv: () => import("date-fns/locale/sv").then((module) => module.sv),
|
||||||
cs: () => import("date-fns/locale/cs").then((module) => module.cs),
|
cs: () => import("date-fns/locale/cs").then((module) => module.cs),
|
||||||
nb: () => import("date-fns/locale/nb").then((module) => module.nb),
|
"nb-NO": () => import("date-fns/locale/nb").then((module) => module.nb),
|
||||||
ko: () => import("date-fns/locale/ko").then((module) => module.ko),
|
ko: () => import("date-fns/locale/ko").then((module) => module.ko),
|
||||||
vi: () => import("date-fns/locale/vi").then((module) => module.vi),
|
vi: () => import("date-fns/locale/vi").then((module) => module.vi),
|
||||||
fa: () => import("date-fns/locale/fa-IR").then((module) => module.faIR),
|
fa: () => import("date-fns/locale/fa-IR").then((module) => module.faIR),
|
||||||
|
@ -42,12 +42,13 @@ export default function StorageMetrics({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const totalStorage = {
|
const totalStorage = {
|
||||||
used: 0,
|
used: stats.service.storage["/media/frigate/recordings"]["used"],
|
||||||
|
camera: 0,
|
||||||
total: stats.service.storage["/media/frigate/recordings"]["total"],
|
total: stats.service.storage["/media/frigate/recordings"]["total"],
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.values(cameraStorage).forEach(
|
Object.values(cameraStorage).forEach(
|
||||||
(cam) => (totalStorage.used += cam.usage),
|
(cam) => (totalStorage.camera += cam.usage),
|
||||||
);
|
);
|
||||||
setLastUpdated(Date.now() / 1000);
|
setLastUpdated(Date.now() / 1000);
|
||||||
return totalStorage;
|
return totalStorage;
|
||||||
@ -118,7 +119,7 @@ export default function StorageMetrics({
|
|||||||
</div>
|
</div>
|
||||||
<StorageGraph
|
<StorageGraph
|
||||||
graphId="general-recordings"
|
graphId="general-recordings"
|
||||||
used={totalStorage.used}
|
used={totalStorage.camera}
|
||||||
total={totalStorage.total}
|
total={totalStorage.total}
|
||||||
/>
|
/>
|
||||||
{earliestDate && (
|
{earliestDate && (
|
||||||
|
Loading…
Reference in New Issue
Block a user