From 56b21f0d9ef1dd493f6695d2dfba302258e69854 Mon Sep 17 00:00:00 2001 From: beckerinj Date: Thu, 12 Jan 2023 17:08:09 -0500 Subject: [PATCH] fix core historical stats query filter: specify server_id --- core/src/api/server.rs | 2 +- frontend/src/components/home/Home.tsx | 2 +- frontend/src/components/home/Tree/Server.tsx | 2 +- frontend/src/components/stats/Charts.tsx | 23 +++++++++----------- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/core/src/api/server.rs b/core/src/api/server.rs index ea1106ea5..b8fbcaf79 100644 --- a/core/src/api/server.rs +++ b/core/src/api/server.rs @@ -486,7 +486,7 @@ impl State { "ts", limit, query.page as u64 * limit as u64, - doc! { "ts": { "$mod": [ts_mod, 0] } }, + doc! { "server_id": server_id, "ts": { "$mod": [ts_mod, 0] } }, projection, ) .await diff --git a/frontend/src/components/home/Home.tsx b/frontend/src/components/home/Home.tsx index 4737fa5c4..2703630f3 100644 --- a/frontend/src/components/home/Home.tsx +++ b/frontend/src/components/home/Home.tsx @@ -25,7 +25,7 @@ const Home: Component<{}> = (p) => { = 1200}> - + diff --git a/frontend/src/components/home/Tree/Server.tsx b/frontend/src/components/home/Tree/Server.tsx index 2b6d76ce8..5b8cdc486 100644 --- a/frontend/src/components/home/Tree/Server.tsx +++ b/frontend/src/components/home/Tree/Server.tsx @@ -107,7 +107,7 @@ const Server: Component<{ id: string }> = (p) => { - + e.stopPropagation()}> diff --git a/frontend/src/components/stats/Charts.tsx b/frontend/src/components/stats/Charts.tsx index 7ac2a72b6..070159746 100644 --- a/frontend/src/components/stats/Charts.tsx +++ b/frontend/src/components/stats/Charts.tsx @@ -60,12 +60,12 @@ export const LoadChart: Component<{ disableScroll?: boolean; }> = (p) => { const line = () => { - return p.stats()?.filter(s => s.system_load !== undefined).map((s) => { + return p.stats()?.map((s) => { return { time: convertTsMsToLocalUnixTsInSecs( (s as SystemStatsRecord).ts || (s as SystemStats).refresh_ts ), - value: s.system_load!, + value: s.system_load || 0, }; }); }; @@ -114,17 +114,14 @@ export const CpuFreqChart: Component<{ disableScroll?: boolean; }> = (p) => { const line = () => { - return p - .stats() - ?.filter((s) => s.cpu_freq_mhz !== undefined) - .map((s) => { - return { - time: convertTsMsToLocalUnixTsInSecs( - (s as SystemStatsRecord).ts || (s as SystemStats).refresh_ts - ), - value: s.cpu_freq_mhz! / 1000, - }; - }); + return p.stats()?.map((s) => { + return { + time: convertTsMsToLocalUnixTsInSecs( + (s as SystemStatsRecord).ts || (s as SystemStats).refresh_ts + ), + value: (s.cpu_freq_mhz || 0) / 1000, + }; + }); }; return (