1
0
Files
DiAL/src/shared/api.ts
lanyuanxiaoyao 548b44d28e feat: 重构 Dashboard 为卡片式分组布局
表格布局替换为按分组展示的卡片式布局,新增 group 字段配置和 TargetBoard/TargetCard 等组件。模态框详情页支持时间范围筛选和分页,SummaryCards 减为 3 个。API 端点变更:trend/history 改用 from/to 参数,history 支持分页。recentSampleCount 硬编码为 30。
2026-05-11 08:54:21 +08:00

75 lines
1.3 KiB
TypeScript

export type RuntimeMode = "development" | "production" | "test";
export interface HealthResponse {
ok: true;
service: "gateway-checker";
timestamp: string;
}
export interface ApiErrorResponse {
error: string;
status: number;
}
export interface SummaryResponse {
total: number;
up: number;
down: number;
lastCheckTime: string | null;
}
export interface RecentSample {
timestamp: string;
durationMs: number | null;
up: boolean;
}
export interface TargetStatus {
id: number;
name: string;
type: string;
target: string;
group: string;
interval: string;
latestCheck: CheckResult | null;
stats: TargetStats;
recentSamples: RecentSample[];
}
export interface TargetStats {
totalChecks: number;
availability: number;
}
export interface HistoryResponse {
items: CheckResult[];
total: number;
page: number;
pageSize: number;
}
export interface CheckResult {
timestamp: string;
success: boolean;
matched: boolean;
durationMs: number | null;
statusDetail: string | null;
failure: CheckFailure | null;
}
export interface CheckFailure {
kind: "error" | "mismatch";
phase: string;
path: string;
expected?: unknown;
actual?: unknown;
message: string;
}
export interface TrendPoint {
hour: string;
avgDurationMs: number | null;
availability: number;
totalChecks: number;
}