From 180585806b10c18efa7b291c698d648f93af69f5 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Tue, 31 Dec 2024 20:12:50 -0800 Subject: [PATCH] Add last checked --- Client/src/Pages/Infrastructure/Details/index.jsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Client/src/Pages/Infrastructure/Details/index.jsx b/Client/src/Pages/Infrastructure/Details/index.jsx index 5c131deec..10e070ee4 100644 --- a/Client/src/Pages/Infrastructure/Details/index.jsx +++ b/Client/src/Pages/Infrastructure/Details/index.jsx @@ -206,7 +206,7 @@ const InfrastructureDetails = () => { ]; const [monitor, setMonitor] = useState(null); const { authToken } = useSelector((state) => state.auth); - const [dateRange, setDateRange] = useState("all"); + const [dateRange, setDateRange] = useState("day"); const { statusColor, statusStyles, determineState } = useUtils(); // These calculations are needed because ResponsiveContainer // doesn't take padding of parent/siblings into account @@ -514,7 +514,8 @@ const InfrastructureDetails = () => { ); const gaugeBoxConfigs = buildGaugeBoxConfigs(monitor?.stats ?? {}); const areaChartConfigs = buildAreaChartConfigs(monitor?.stats?.checks ?? []); - + const lastChecked = + Date.now() - new Date(monitor?.stats?.aggregateData?.latestCheck?.createdAt); return ( @@ -544,8 +545,8 @@ const InfrastructureDetails = () => { Checking every {formatDurationRounded(monitor?.interval)} - Last checked {formatDurationSplit(monitor?.lastChecked).time}{" "} - {formatDurationSplit(monitor?.lastChecked).format} ago + Last checked {formatDurationSplit(lastChecked).time}{" "} + {formatDurationSplit(lastChecked).format} ago