diff --git a/client/src/components/common/HeatmapResponseTime.tsx b/client/src/components/common/HeatmapResponseTime.tsx index 502e81949..cce90c4d8 100644 --- a/client/src/components/common/HeatmapResponseTime.tsx +++ b/client/src/components/common/HeatmapResponseTime.tsx @@ -1,12 +1,12 @@ import Box from "@mui/material/Box"; import { useTheme } from "@mui/material/styles"; -import type { ICheck } from "@/types/check"; +import type { Check } from "@/types/check"; import { getResponseColor } from "@/utils/DataUtils"; import { HeatmapResponseTimeTooltip } from "./HeatmapResponseTimeTooltip"; import type { SxProps } from "@mui/material/styles"; import type { ResponsiveStyleValue } from "@mui/system"; interface HeatmapResponseTimeProps { - checks: ICheck[]; + checks: Check[]; gap?: ResponsiveStyleValue; availabilityCellSx?: SxProps; responseCellSx?: SxProps; @@ -27,7 +27,7 @@ export const HeatmapResponseTime = ({ const latestChecks = checks.slice(-25).reverse(); - let data: Array; + let data: Array; if (latestChecks.length !== 25) { const placeholders = Array(25 - latestChecks.length).fill({ status: "placeholder" as const, @@ -57,7 +57,7 @@ export const HeatmapResponseTime = ({ const respBg = check.status === "placeholder" ? theme.palette.action.hover - : getResponseColor(check.responseTime, { + : getResponseColor(check.responseTime || 0, { start: theme.palette.success.main, mid: theme.palette.warning.main, end: theme.palette.error.main, diff --git a/client/src/components/common/HistogramResponseTime.tsx b/client/src/components/common/HistogramResponseTime.tsx index 660c32dac..31170b28d 100644 --- a/client/src/components/common/HistogramResponseTime.tsx +++ b/client/src/components/common/HistogramResponseTime.tsx @@ -1,12 +1,12 @@ import Box from "@mui/material/Box"; import { useTheme } from "@mui/material/styles"; import type { ResponsiveStyleValue } from "@mui/system"; -import type { ICheck } from "@/types/check"; +import type { Check } from "@/types/check"; import { normalizeResponseTimes } from "@/utils/DataUtils"; import { HeatmapResponseTimeTooltip } from "./HeatmapResponseTimeTooltip"; interface HistogramResponseTimeProps { - checks: ICheck[]; + checks: Check[]; height?: ResponsiveStyleValue; gap?: ResponsiveStyleValue; } diff --git a/client/src/components/monitors/HistogramPageSpeed.tsx b/client/src/components/monitors/HistogramPageSpeed.tsx index 87745dbc0..e9e3a68a6 100644 --- a/client/src/components/monitors/HistogramPageSpeed.tsx +++ b/client/src/components/monitors/HistogramPageSpeed.tsx @@ -9,16 +9,16 @@ import { import { HistogramPageSpeedTooltip } from "@/components/monitors/HistogramPageSpeedTooltip"; import { useTheme } from "@mui/material/styles"; -import type { ICheck } from "@/types/check"; +import type { Check } from "@/types/check"; import type { MonitorStatus } from "@/types/monitor"; import { getStatusColor } from "@/utils/MonitorUtils"; -const processData = (checks: ICheck[]) => { +const processData = (checks: Check[]) => { if (checks.length === 0) return []; const formattedData: { score: number; date: string }[] = []; - const calculateScore = (entry: ICheck) => { + const calculateScore = (entry: Check) => { const accessibility = entry?.lighthouse?.accessibility || 0; const bestPractices = entry?.lighthouse?.bestPractices || 0; const performance = entry?.lighthouse?.performance || 0; @@ -41,7 +41,7 @@ export const HistogramPageSpeed = ({ checks, status, }: { - checks: ICheck[]; + checks: Check[]; status: MonitorStatus; }) => { const theme = useTheme(); diff --git a/client/src/components/status-pages/HistogramStatusPage.tsx b/client/src/components/status-pages/HistogramStatusPage.tsx index 7ef2b5aba..01dc0172f 100644 --- a/client/src/components/status-pages/HistogramStatusPage.tsx +++ b/client/src/components/status-pages/HistogramStatusPage.tsx @@ -1,12 +1,12 @@ import Stack from "@mui/material/Stack"; import Box from "@mui/material/Box"; import { useTheme } from "@mui/material/styles"; -import type { ICheck } from "@/types/check"; +import type { Check } from "@/types/check"; import { normalizeResponseTimes } from "@/utils/DataUtils"; import { HeatmapResponseTimeTooltip } from "../common/HeatmapResponseTimeTooltip"; const BAR_HEIGHT = "50px"; -export const HistogramStatusPage = ({ checks }: { checks: ICheck[] }) => { +export const HistogramStatusPage = ({ checks }: { checks: Check[] }) => { const theme = useTheme(); const normalChecks = normalizeResponseTimes(checks, "responseTime"); let data = Array(); diff --git a/client/src/pages/docker/DockerMonitorsTable.tsx b/client/src/pages/docker/DockerMonitorsTable.tsx index e7f77e770..529e44f30 100644 --- a/client/src/pages/docker/DockerMonitorsTable.tsx +++ b/client/src/pages/docker/DockerMonitorsTable.tsx @@ -6,7 +6,7 @@ import { usePatch } from "@/hooks/UseApi"; import { useNavigate } from "react-router-dom"; import { useTheme } from "@mui/material/styles"; -import type { ICheck } from "@/types/check"; +import type { Check } from "@/types/check"; import type { Header } from "@/components/design-elements/Table"; import type { IMonitor } from "@/types/monitor"; import { useTranslation } from "react-i18next"; @@ -23,7 +23,7 @@ export const DockerMonitorsTable = ({ setSelectedMonitor, }: { monitors: IMonitor[]; - checksMap: Record; + checksMap: Record; count: number; page: number; setPage: (page: number) => void; diff --git a/client/src/pages/incidents/IncidentDetails.tsx b/client/src/pages/incidents/IncidentDetails.tsx index ec484ea40..8f7187b9c 100644 --- a/client/src/pages/incidents/IncidentDetails.tsx +++ b/client/src/pages/incidents/IncidentDetails.tsx @@ -12,7 +12,6 @@ import { formatDateWithTz } from "@/utils/TimeUtils"; import { useAppSelector } from "@/hooks/AppHooks"; import prettyMilliseconds from "pretty-ms"; import { getMonitorPath } from "@/utils/MonitorUtils"; -import type { MonitorType } from "@/types/monitor"; import { useTranslation } from "react-i18next"; const IncidentDetailsPage = () => { diff --git a/client/src/pages/infrastructure/InfraMonitorsTable.tsx b/client/src/pages/infrastructure/InfraMonitorsTable.tsx index 8c3e17a99..3dfc7c4df 100644 --- a/client/src/pages/infrastructure/InfraMonitorsTable.tsx +++ b/client/src/pages/infrastructure/InfraMonitorsTable.tsx @@ -12,7 +12,7 @@ import { useTheme } from "@mui/material/styles"; import { useNavigate } from "react-router-dom"; import { usePatch } from "@/hooks/UseApi"; -import type { ICheck } from "@/types/check"; +import type { Check } from "@/types/check"; import type { IMonitor } from "@/types/monitor"; import type { ActionMenuItem } from "@/components/actions-menu"; @@ -32,7 +32,7 @@ export const InfraMonitorsTable = ({ setRowsPerPage, }: { monitors: IMonitor[]; - checksMap: Record; + checksMap: Record; refetch: Function; setSelectedMonitor: Function; sortField: string; diff --git a/client/src/pages/pagespeed/PageSpeedMonitorTable.tsx b/client/src/pages/pagespeed/PageSpeedMonitorTable.tsx index d27b7867f..fdd822890 100644 --- a/client/src/pages/pagespeed/PageSpeedMonitorTable.tsx +++ b/client/src/pages/pagespeed/PageSpeedMonitorTable.tsx @@ -13,7 +13,7 @@ import { useTheme } from "@mui/material/styles"; import { useNavigate } from "react-router-dom"; import { usePatch } from "@/hooks/UseApi"; -import type { ICheck } from "@/types/check"; +import type { Check } from "@/types/check"; import type { IMonitor } from "@/types/monitor"; import type { ActionMenuItem } from "@/components/actions-menu"; @@ -33,7 +33,7 @@ export const PageSpeedMonitorTable = ({ setRowsPerPage, }: { monitors: IMonitor[]; - checksMap: Record; + checksMap: Record; refetch: Function; setSelectedMonitor: Function; sortField: string; diff --git a/client/src/pages/settings/DummyChart.tsx b/client/src/pages/settings/DummyChart.tsx index 202736cbd..f55897129 100644 --- a/client/src/pages/settings/DummyChart.tsx +++ b/client/src/pages/settings/DummyChart.tsx @@ -1,23 +1,23 @@ import { useMemo } from "react"; -import type { ICheck } from "@/types/check"; +import type { Check } from "@/types/check"; import { HeatmapResponseTime } from "@/components/common/HeatmapResponseTime"; import { HistogramResponseTime } from "@/components/common/HistogramResponseTime"; import type { ChartType } from "@/features/uiSlice"; -const buildDummyChecks = (): ICheck[] => { +const buildDummyChecks = (): Check[] => { const now = Date.now(); - const arr: ICheck[] = [] as any; + const arr: Check[] = [] as any; for (let i = 0; i < 25; i++) { const ms = Math.floor(50 + Math.random() * 800); arr.push({ - _id: `chk-${i}`, - metadata: { monitorId: "m1", type: "http", teamId: "t1" }, + id: `chk-${i}`, + monitorId: "m1", + type: "http", + teamId: "t1", status: Math.random() > 0.3 ? "up" : "down", message: "", responseTime: ms, - normalResponseTime: 0, httpStatusCode: 200, - ack: false, expiry: new Date(now - i * 60000).toISOString(), createdAt: new Date(now - i * 60000).toISOString(), updatedAt: new Date(now - i * 60000).toISOString(), diff --git a/client/src/pages/uptime/CheckTable.tsx b/client/src/pages/uptime/CheckTable.tsx index e6276169c..a999d222e 100644 --- a/client/src/pages/uptime/CheckTable.tsx +++ b/client/src/pages/uptime/CheckTable.tsx @@ -2,7 +2,7 @@ import { Table, Pagination, StatusLabel } from "@/components/design-elements"; import Box from "@mui/material/Box"; import type { Header } from "@/components/design-elements/Table"; -import type { ICheck, IChecksWithCount } from "@/types/check"; +import type { Check, IChecksWithCount } from "@/types/check"; import type { ApiResponse } from "@/types/api"; import type { MonitorStatus } from "@/types/monitor"; @@ -14,7 +14,7 @@ import { formatDateWithTz } from "@/utils/TimeUtils"; import { useAppSelector } from "@/hooks/AppHooks"; const getHeaders = (t: Function, uiTimezone: string) => { - const headers: Header[] = [ + const headers: Header[] = [ { id: "status", content: t("common.table.headers.status"), @@ -93,7 +93,7 @@ export const CheckTable = ({ monitorId }: { monitorId: string }) => { headers={headers} data={checks} onRowClick={(row) => { - navigate(`/checks/${row._id}`); + navigate(`/checks/${row.id}`); }} /> ; + checksMap: Record; refetch: Function; setSelectedMonitor: Function; sortField: string; diff --git a/client/src/types/check.ts b/client/src/types/check.ts index 7ceac80b4..a1b331355 100644 --- a/client/src/types/check.ts +++ b/client/src/types/check.ts @@ -109,29 +109,6 @@ export interface ICaptureInfo { mode?: string; } -export interface ICheck { - _id: string; - metadata: { - monitorId: string; - type: MonitorType; - teamId: string; - }; - status: string; - message: string; - responseTime: number; - normalResponseTime?: number; - httpStatusCode: number; - ack: boolean; - expiry: string; - createdAt: string; - updatedAt: string; - timings: GotTimings; - lighthouse?: ICheckLighthouseFields; - system?: ISystemInfo; - // Present for docker monitor checks - dockerContainers?: IDockerContainerSummary[]; -} - export interface Check { id: string; monitorId: string; @@ -226,7 +203,7 @@ export interface IDokcerCheck { } export interface IChecksWithCount { - checks: ICheck[]; + checks: Check[]; count: number; } diff --git a/client/src/types/monitor.ts b/client/src/types/monitor.ts index 21ac36308..93581e8f7 100644 --- a/client/src/types/monitor.ts +++ b/client/src/types/monitor.ts @@ -1,4 +1,4 @@ -import type { AggregateCheck, ICheck } from "@/types/check"; +import type { AggregateCheck, Check } from "@/types/check"; import type { IMonitorStats } from "./monitorStats"; export const MonitorTypes = [ @@ -26,7 +26,7 @@ export type MonitorStatus = (typeof MonitorStatuses)[number]; export interface IMonitor { id: string; - checks: ICheck[]; + checks: Check[]; createdAt: string; createdBy: string; interval: number; @@ -57,7 +57,7 @@ export interface IMonitorWithStats { upCount: number; pausedCount: number; monitors: IMonitor[]; - checksMap: Record; + checksMap: Record; } export interface IMonitorWithMonitorStats {