ts errors
This commit is contained in:
1 parent
51081a6a0e
commit
ba7cc3bb0c
13 files changed
+34
-58
No files matched your search
@@ -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<number | string>;
|
||||
availabilityCellSx?: SxProps;
|
||||
responseCellSx?: SxProps;
|
||||
@@ -27,7 +27,7 @@ export const HeatmapResponseTime = ({
|
||||
|
||||
const latestChecks = checks.slice(-25).reverse();
|
||||
|
||||
let data: Array<ICheck | { status: "placeholder" }>;
|
||||
let data: Array<Check | { status: "placeholder" }>;
|
||||
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,
|
||||
|
||||
@@ -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<number | string>;
|
||||
gap?: ResponsiveStyleValue<number | string>;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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<any>();
|
||||
|
||||
@@ -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<string, ICheck[]>;
|
||||
checksMap: Record<string, Check[]>;
|
||||
count: number;
|
||||
page: number;
|
||||
setPage: (page: number) => void;
|
||||
|
||||
@@ -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 = () => {
|
||||
|
||||
@@ -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<string, ICheck[]>;
|
||||
checksMap: Record<string, Check[]>;
|
||||
refetch: Function;
|
||||
setSelectedMonitor: Function;
|
||||
sortField: string;
|
||||
|
||||
@@ -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<string, ICheck[]>;
|
||||
checksMap: Record<string, Check[]>;
|
||||
refetch: Function;
|
||||
setSelectedMonitor: Function;
|
||||
sortField: string;
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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<ICheck>[] = [
|
||||
const headers: Header<Check>[] = [
|
||||
{
|
||||
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}`);
|
||||
}}
|
||||
/>
|
||||
<Pagination
|
||||
|
||||
@@ -14,7 +14,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";
|
||||
import type { ChartType } from "@/features/uiSlice";
|
||||
@@ -35,7 +35,7 @@ export const MonitorTable = ({
|
||||
setRowsPerPage,
|
||||
}: {
|
||||
monitors: IMonitor[];
|
||||
checksMap: Record<string, ICheck[]>;
|
||||
checksMap: Record<string, Check[]>;
|
||||
refetch: Function;
|
||||
setSelectedMonitor: Function;
|
||||
sortField: string;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<string, ICheck[]>;
|
||||
checksMap: Record<string, Check[]>;
|
||||
}
|
||||
|
||||
export interface IMonitorWithMonitorStats {
|
||||
|
||||
Reference in new issue
Block a user