conditionally render charts
This commit is contained in:
1 parent
4e495eed33
commit
81aab35961
3 files changed
+227
-77
No files matched your search
@@ -31,7 +31,10 @@ import type { RootState } from "@/Types/state";
|
||||
import { formatDateWithTz } from "@/Utils/TimeUtils";
|
||||
import { t } from "i18next";
|
||||
import { Typography } from "@mui/material";
|
||||
import { HistogramDetailsStacked } from "@/Components/monitors/charts/HistogramDetailsStacked";
|
||||
import {
|
||||
HistogramDetailsStacked,
|
||||
PHASE_KEYS,
|
||||
} from "@/Components/monitors/charts/HistogramDetailsStacked";
|
||||
|
||||
const certificateDateFormat = "MMM D, YYYY h A";
|
||||
|
||||
@@ -77,6 +80,14 @@ const UptimeDetailsPage = () => {
|
||||
const monitor = monitorData?.monitor;
|
||||
const monitorStats = monitorDetailsData?.monitorStats ?? null;
|
||||
|
||||
const hasTimingPhases = useMemo(
|
||||
() =>
|
||||
(monitorData?.groupedChecks ?? []).some((check) =>
|
||||
PHASE_KEYS.some((key) => check[key] > 0)
|
||||
),
|
||||
[monitorData]
|
||||
);
|
||||
|
||||
// Certificate fetch - only for HTTP monitors
|
||||
const certificateUrl = useMemo(() => {
|
||||
if (!monitorId || monitor?.type !== "http") {
|
||||
@@ -225,13 +236,15 @@ const UptimeDetailsPage = () => {
|
||||
/>
|
||||
</Stack>
|
||||
<HistogramDetails
|
||||
checks={monitorData?.groupedChecks || []}
|
||||
range={dateRange}
|
||||
/>
|
||||
<HistogramDetailsStacked
|
||||
checks={monitorData.groupedChecks}
|
||||
range={dateRange}
|
||||
/>
|
||||
{hasTimingPhases && (
|
||||
<HistogramDetailsStacked
|
||||
checks={monitorData.groupedChecks}
|
||||
range={dateRange}
|
||||
/>
|
||||
)}
|
||||
<ChecksTable
|
||||
checks={checks}
|
||||
count={checksCount}
|
||||
|
||||
Reference in new issue
Block a user