update types, add skeleton for stacked timing phase chart
This commit is contained in:
1 parent
0cf8cfa5dc
commit
13c921531c
4 files changed
+65
-3
No files matched your search
@@ -0,0 +1,39 @@
|
|||||||
|
import type { GroupedUptimeCheck } from "@/Types/Check";
|
||||||
|
import { Area, AreaChart, CartesianGrid, ResponsiveContainer } from "recharts";
|
||||||
|
|
||||||
|
import { useTheme } from "@mui/material";
|
||||||
|
|
||||||
|
export const HistogramDetailsStacked = ({
|
||||||
|
checks = [],
|
||||||
|
range,
|
||||||
|
}: {
|
||||||
|
checks: GroupedUptimeCheck[];
|
||||||
|
range: string;
|
||||||
|
}) => {
|
||||||
|
const theme = useTheme();
|
||||||
|
|
||||||
|
console.log(JSON.stringify(checks, null, 2));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ResponsiveContainer
|
||||||
|
width="100%"
|
||||||
|
height={300}
|
||||||
|
>
|
||||||
|
<AreaChart data={checks.slice()}>
|
||||||
|
<CartesianGrid
|
||||||
|
stroke={theme.palette.divider}
|
||||||
|
strokeWidth={1}
|
||||||
|
strokeOpacity={1}
|
||||||
|
fill="transparent"
|
||||||
|
vertical={false}
|
||||||
|
/>
|
||||||
|
<Area
|
||||||
|
type="monotone"
|
||||||
|
dataKey="avgResponseTime"
|
||||||
|
stroke={theme.palette.primary.main}
|
||||||
|
fill="url(#colorUv)"
|
||||||
|
/>
|
||||||
|
</AreaChart>
|
||||||
|
</ResponsiveContainer>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -31,6 +31,7 @@ import type { RootState } from "@/Types/state";
|
|||||||
import { formatDateWithTz } from "@/Utils/TimeUtils";
|
import { formatDateWithTz } from "@/Utils/TimeUtils";
|
||||||
import { t } from "i18next";
|
import { t } from "i18next";
|
||||||
import { Typography } from "@mui/material";
|
import { Typography } from "@mui/material";
|
||||||
|
import { HistogramDetailsStacked } from "@/Components/monitors/charts/HistogramDetailsStacked";
|
||||||
|
|
||||||
const certificateDateFormat = "MMM D, YYYY h A";
|
const certificateDateFormat = "MMM D, YYYY h A";
|
||||||
|
|
||||||
@@ -72,6 +73,7 @@ const UptimeDetailsPage = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const monitorData = monitorDetailsData?.monitorData;
|
const monitorData = monitorDetailsData?.monitorData;
|
||||||
|
|
||||||
const monitor = monitorData?.monitor;
|
const monitor = monitorData?.monitor;
|
||||||
const monitorStats = monitorDetailsData?.monitorStats ?? null;
|
const monitorStats = monitorDetailsData?.monitorStats ?? null;
|
||||||
|
|
||||||
@@ -165,10 +167,18 @@ const UptimeDetailsPage = () => {
|
|||||||
{ keepPreviousData: true, revalidateOnFocus: false }
|
{ keepPreviousData: true, revalidateOnFocus: false }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!monitorData) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!monitor) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const geoChecksForTable = geoChecksTableData?.geoChecks ?? [];
|
const geoChecksForTable = geoChecksTableData?.geoChecks ?? [];
|
||||||
const geoChecksCount = geoChecksTableData?.geoChecksCount ?? 0;
|
const geoChecksCount = geoChecksTableData?.geoChecksCount ?? 0;
|
||||||
|
|
||||||
const geoLocations = monitor?.geoCheckLocations;
|
const geoLocations = monitor.geoCheckLocations;
|
||||||
|
|
||||||
const checks = checksData?.checks ?? [];
|
const checks = checksData?.checks ?? [];
|
||||||
const checksCount = checksData?.checksCount ?? 0;
|
const checksCount = checksData?.checksCount ?? 0;
|
||||||
@@ -218,6 +228,10 @@ const UptimeDetailsPage = () => {
|
|||||||
checks={monitorData?.groupedChecks || []}
|
checks={monitorData?.groupedChecks || []}
|
||||||
range={dateRange}
|
range={dateRange}
|
||||||
/>
|
/>
|
||||||
|
<HistogramDetailsStacked
|
||||||
|
checks={monitorData.groupedChecks}
|
||||||
|
range={dateRange}
|
||||||
|
/>
|
||||||
<ChecksTable
|
<ChecksTable
|
||||||
checks={checks}
|
checks={checks}
|
||||||
count={checksCount}
|
count={checksCount}
|
||||||
|
|||||||
@@ -149,6 +149,15 @@ export interface GroupedCheck {
|
|||||||
totalChecks: number;
|
totalChecks: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface GroupedUptimeCheck extends GroupedCheck {
|
||||||
|
avgDns: number;
|
||||||
|
avgTcp: number;
|
||||||
|
avgTls: number;
|
||||||
|
avgRequest: number;
|
||||||
|
avgFirstByte: number;
|
||||||
|
avgDownload: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface PageSpeedGroupedCheck {
|
export interface PageSpeedGroupedCheck {
|
||||||
bucketDate: string;
|
bucketDate: string;
|
||||||
performance: number;
|
performance: number;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { GroupedCheck, CheckSnapshot } from "@/Types/Check";
|
import type { GroupedCheck, CheckSnapshot, GroupedUptimeCheck } from "@/Types/Check";
|
||||||
import type { PageSpeedGroupedCheck } from "@/Types/Check";
|
import type { PageSpeedGroupedCheck } from "@/Types/Check";
|
||||||
import type { GeoContinent } from "@/Types/GeoCheck";
|
import type { GeoContinent } from "@/Types/GeoCheck";
|
||||||
export type { GeoContinent } from "@/Types/GeoCheck";
|
export type { GeoContinent } from "@/Types/GeoCheck";
|
||||||
@@ -137,7 +137,7 @@ export interface MonitorStats {
|
|||||||
|
|
||||||
export interface MonitorData {
|
export interface MonitorData {
|
||||||
monitor: Monitor;
|
monitor: Monitor;
|
||||||
groupedChecks: GroupedCheck[];
|
groupedChecks: GroupedUptimeCheck[];
|
||||||
groupedUpChecks: GroupedCheck[];
|
groupedUpChecks: GroupedCheck[];
|
||||||
groupedDownChecks: GroupedCheck[];
|
groupedDownChecks: GroupedCheck[];
|
||||||
groupedAvgResponseTime: number;
|
groupedAvgResponseTime: number;
|
||||||
|
|||||||
Reference in new issue
Block a user