fix: fix system stats i18n (#22600)

* fix: fix system stats i18n

* chore: lint
This commit is contained in:
GuoQing Liu
2026-03-24 06:49:05 -06:00
committed by GitHub
parent d27ee166bc
commit 6c5801ac83
3 changed files with 22 additions and 15 deletions
+16 -12
View File
@@ -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]}