fix pretty name bug, ordering bug

This commit is contained in:
Alex Holliday committed 2026-08-04 14:46:52 -07:00
1 parent dfcb3b4b21
commit 4c8342f379
8 files changed
+22 -17

No files matched your search

@@ -11,7 +11,8 @@ export const StatusBoxes = ({ monitor }: { monitor: Monitor }) => {
const { t } = useTranslation();
const theme = useTheme();
const latestCheck = monitor?.recentChecks?.[0];
const recentChecks = monitor?.recentChecks ?? [];
const latestCheck = recentChecks[recentChecks.length - 1];
// Get data from latest check
const physicalCores = getCores(latestCheck?.cpu?.physical_core);
const logicalCores = getCores(latestCheck?.cpu?.logical_core);
@@ -21,13 +22,7 @@ export const StatusBoxes = ({ monitor }: { monitor: Monitor }) => {
const memoryTotalBytes = latestCheck?.memory?.total_bytes ?? 0;
const diskTotalBytes =
latestCheck?.disk?.reduce((acc, disk) => acc + (disk.total_bytes || 0), 0) || 0;
const os = getOsAndPlatform(latestCheck?.host);
const platform = latestCheck?.host?.platform ?? undefined;
const osPlatform =
typeof os === "undefined" && typeof platform === "undefined"
? undefined
: `${os} ${platform}`;
const osPlatform = getOsAndPlatform(latestCheck?.host);
return (
<Stack
@@ -21,10 +21,11 @@ export const TabOverview = ({
}
const checks = stats?.checks || [];
const recentChecks = monitor.recentChecks ?? [];
return (
<Stack gap={theme.spacing(8)}>
<StatusBoxes monitor={monitor} />
<InfraDetailsGauges snapshot={monitor.recentChecks?.[0]} />
<InfraDetailsGauges snapshot={recentChecks[recentChecks.length - 1]} />
<InfraDetailsCharts
checks={checks}
dateRange={dateRange}
@@ -248,7 +248,8 @@ export const InfraMonitorsTable = ({
id: "cpu",
content: t("pages.infrastructure.table.headers.cpu"),
render: (row) => {
const check = row.recentChecks?.[0];
const recentChecks = row.recentChecks ?? [];
const check = recentChecks[recentChecks.length - 1];
const cpuUsage = (check?.cpu?.usage_percent || 0) * 100;
return <Gauge progress={cpuUsage} />;
},
@@ -257,7 +258,8 @@ export const InfraMonitorsTable = ({
id: "memory",
content: t("pages.infrastructure.table.headers.memory"),
render: (row) => {
const check = row.recentChecks?.[0];
const recentChecks = row.recentChecks ?? [];
const check = recentChecks[recentChecks.length - 1];
const memoryUsage = (check?.memory?.usage_percent || 0) * 100;
return <Gauge progress={memoryUsage} />;
},
@@ -266,7 +268,8 @@ export const InfraMonitorsTable = ({
id: "disk",
content: t("pages.infrastructure.table.headers.disk"),
render: (row) => {
const check = row.recentChecks?.[0];
const recentChecks = row.recentChecks ?? [];
const check = recentChecks[recentChecks.length - 1];
const totalDiskUsage = check?.disk?.reduce(
(acc, disk) => acc + (disk?.usage_percent || 0),