refactoring

This commit is contained in:
Alex Holliday committed 2026-01-12 22:58:46 +00:00
1 parent e090d3cfd3
commit 7a6b0d5da4
19 files changed
+699 -116

No files matched your search

+50 -7
View File
@@ -1,5 +1,11 @@
import type { MonitorType } from "@/types/index.js";
export interface CheckMetadata {
monitorId: string;
teamId: string;
type: MonitorType;
}
export interface CheckTimingPhases {
wait: number;
dns: number;
@@ -50,29 +56,66 @@ export interface CheckCaptureInfo {
mode: string;
}
export interface CheckDiskInfo {}
export interface CheckDiskInfo {
device: string;
mountpoint: string;
read_speed_bytes: number;
write_speed_bytes: number;
total_bytes: number;
free_bytes: number;
usage_percent: number;
}
export interface CheckNetInfo {}
export interface CheckErrorInfo {
metric: string[];
err: string;
}
export interface CheckNetworkInterfaceInfo {
name: string;
bytes_sent: number;
bytes_recv: number;
packets_sent: number;
packets_recv: number;
err_in: number;
err_out: number;
drop_in: number;
drop_out: number;
fifo_in: number;
fifo_out: number;
}
export interface CheckAudits {
cls: number;
si: number;
fcp: number;
lcp: number;
tbt: number;
}
export interface Check {
id: string;
monitorId: string;
teamId: string;
type: MonitorType;
metadata: CheckMetadata;
status: boolean;
responseTime: number;
timings: CheckTimings;
statusCode: number;
message: string;
ack: boolean;
ackAt?: string | null;
expiry: string;
cpu: CheckCpuInfo;
memory: CheckMemoryInfo;
disk: CheckDiskInfo[];
host: CheckHostInfo;
errors: string[];
errors: CheckErrorInfo[];
capture: CheckCaptureInfo;
net: CheckNetInfo[];
net: CheckNetworkInterfaceInfo[];
accessibility?: number;
bestPractices?: number;
seo?: number;
performance?: number;
audits?: CheckAudits;
__v: number;
createdAt: string;
updatedAt: string;
+21 -4
View File
@@ -1,29 +1,46 @@
export const MonitorTypes = ["http", "ping", "pagespeed", "hardware", "docker", "port", "game"] as const;
export type MonitorType = (typeof MonitorTypes)[number];
export interface MonitorThresholds {
usage_cpu?: number;
usage_memory?: number;
usage_disk?: number;
usage_temperature?: number;
}
export type MonitorMatchMethod = "equal" | "include" | "regex" | "";
export interface Monitor {
id: string;
userId: string;
teamId: string;
name: string;
description: string;
description?: string;
status?: boolean;
statusWindow: boolean[];
statusWindowSize: number;
statusWindowThreshold: number;
type: MonitorType;
ignoreTlsErrors: boolean;
jsonPath?: string;
expectedValue?: string;
matchMethod?: MonitorMatchMethod;
url: string;
port?: number;
isActive: boolean;
interval: number;
uptimePercentage?: number;
notifications: string[];
secret?: string;
thresholds?: MonitorThresholds;
alertThreshold: number;
selectedDisks: string[];
group: string | null;
cpuAlertThreshold: number;
memoryAlertThreshold: number;
diskAlertThreshold: number;
tempAlertThreshold: number;
selectedDisks: string[];
gameId?: string;
group: string | null;
createdAt: string;
updatedAt: string;
status: boolean;
}