Skip to content

NVR with realtime local object detection for IP cameras

fix: fix system stats i18n (#22600)

GuoQing Liu6c5801ac8397
diff --git a/web/src/components/graph/SystemGraph.tsx b/web/src/components/graph/SystemGraph.tsx
index fcafeda22a..eaf4ae2261 100644
--- a/web/src/components/graph/SystemGraph.tsx
+++ b/web/src/components/graph/SystemGraph.tsx
@@ -11,7 +11,7 @@ import useSWR from "swr";
type ThresholdBarGraphProps = {
graphId: string;
- name: string;
+ name?: string;
unit: string;
threshold: Threshold;
updateTimes: number[];
@@ -25,6 +25,7 @@ export function ThresholdBarGraph({
updateTimes,
data,
}: ThresholdBarGraphProps) {
+ const displayName = name || data[0]?.name || "";
const { data: config } = useSWR<FrigateConfig>("config", {
revalidateOnFocus: false,
});
@@ -186,7 +187,7 @@ export function ThresholdBarGraph({
return (
<div className="flex w-full flex-col">
<div className="flex items-center gap-1">
- <div className="text-xs text-secondary-foreground">{name}</div>
+ <div className="text-xs text-secondary-foreground">{displayName}</div>
<div className="text-xs text-primary">
{lastValue}
{unit}
diff --git a/web/src/components/overlay/CameraInfoDialog.tsx b/web/src/components/overlay/CameraInfoDialog.tsx
index a15d9c5908..fce1f6fd02 100644
--- a/web/src/components/overlay/CameraInfoDialog.tsx
+++ b/web/src/components/overlay/CameraInfoDialog.tsx
@@ -159,7 +159,9 @@ export default function CameraInfoDialog({
</div>
) : (
<div className="text-muted-foreground">
- <div className="ml-2 mt-1">Audio:</div>
+ <div className="ml-2 mt-1">
+ {t("cameras.info.audio")}
+ </div>
<div className="ml-4">
{t("cameras.info.codec")}{" "}
<span className="text-primary">
diff --git a/web/src/views/system/GeneralMetrics.tsx b/web/src/views/system/GeneralMetrics.tsx
index cdf35c28be..2bac7cd2ba 100644
--- a/web/src/views/system/GeneralMetrics.tsx
+++ b/web/src/views/system/GeneralMetrics.tsx
@@ -548,7 +548,10 @@ export default function GeneralMetrics({
Object.entries(stats.processes).forEach(([key, procStats]) => {
if (procStats.pid.toString() in stats.cpu_usages) {
if (!(key in series)) {
- series[key] = { name: key, data: [] };
+ series[key] = {
+ name: t(`general.otherProcesses.series.${key}`),
+ data: [],
+ };
}
const data = stats.cpu_usages[procStats.pid.toString()]?.cpu;
@@ -563,7 +566,7 @@ export default function GeneralMetrics({
});
});
return Object.keys(series).length > 0 ? Object.values(series) : [];
- }, [statsHistory]);
+ }, [statsHistory, t]);
const otherProcessMemSeries = useMemo(() => {
if (!statsHistory) {
@@ -582,7 +585,10 @@ export default function GeneralMetrics({
Object.entries(stats.processes).forEach(([key, procStats]) => {
if (procStats.pid.toString() in stats.cpu_usages) {
if (!(key in series)) {
- series[key] = { name: key, data: [] };
+ series[key] = {
+ name: t(`general.otherProcesses.series.${key}`),
+ data: [],
+ };
}
const data = stats.cpu_usages[procStats.pid.toString()]?.mem;
@@ -597,7 +603,7 @@ export default function GeneralMetrics({
});
});
return Object.values(series);
- }, [statsHistory]);
+ }, [statsHistory, t]);
return (
<>
@@ -964,11 +970,10 @@ export default function GeneralMetrics({
<div className="mb-5">
{t("general.otherProcesses.processCpuUsage")}
</div>
- {otherProcessCpuSeries.map((series) => (
+ {otherProcessCpuSeries.map((series, index) => (
<ThresholdBarGraph
- key={series.name}
- graphId={`${series.name}-cpu`}
- name={t(`general.otherProcesses.series.${series.name}`)}
+ key={`other-process-cpu-${index}`}
+ graphId={`other-process-cpu-${index}`}
unit="%"
threshold={DetectorCpuThreshold}
updateTimes={updateTimes}
@@ -984,12 +989,11 @@ export default function GeneralMetrics({
<div className="mb-5">
{t("general.otherProcesses.processMemoryUsage")}
</div>
- {otherProcessMemSeries.map((series) => (
+ {otherProcessMemSeries.map((series, index) => (
<ThresholdBarGraph
- key={series.name}
- graphId={`${series.name}-mem`}
+ key={`other-process-mem-${index}`}
+ graphId={`other-process-mem-${index}`}
unit="%"
- name={series.name.replaceAll("_", " ")}
threshold={DetectorMemThreshold}
updateTimes={updateTimes}
data={[series]}