- 后端新增 GET /api/meta 端点(checkerRegistry.supportedTypes)及 MetaResponse 类型 - 前端 hook 拆分为 use-queries.ts(全局查询+useMeta)和 use-target-detail.ts(Drawer状态) - TargetDetailDrawer 拆分为 OverviewTab + HistoryTab + history-table-columns + stats.ts - 类型筛选器由 meta API 动态驱动,删除 target-type-display 静态映射 - 列定义改为工厂函数 createTargetTableColumns(checkerTypes),TargetGroup 新增 columns prop - 修复 StatusDonut key、StatusBar maxSlots prop、TrendChart 移除 loading prop - 补充 utils/time、utils/stats、动态列工厂测试,删除旧 mapping 测试 - 同步 delta specs 到主 specs,归档 frontend-architecture-refactor change
78 lines
1.4 KiB
TypeScript
78 lines
1.4 KiB
TypeScript
export interface ApiErrorResponse {
|
|
error: string;
|
|
status: number;
|
|
}
|
|
|
|
export interface CheckFailure {
|
|
actual?: unknown;
|
|
expected?: unknown;
|
|
kind: "error" | "mismatch";
|
|
message: string;
|
|
path: string;
|
|
phase: string;
|
|
}
|
|
|
|
export interface CheckResult {
|
|
durationMs: null | number;
|
|
failure: CheckFailure | null;
|
|
matched: boolean;
|
|
statusDetail: null | string;
|
|
timestamp: string;
|
|
}
|
|
|
|
export interface HealthResponse {
|
|
ok: true;
|
|
service: "dial-server";
|
|
timestamp: string;
|
|
}
|
|
|
|
export interface HistoryResponse {
|
|
items: CheckResult[];
|
|
page: number;
|
|
pageSize: number;
|
|
total: number;
|
|
}
|
|
|
|
export interface MetaResponse {
|
|
checkerTypes: string[];
|
|
}
|
|
|
|
export interface RecentSample {
|
|
durationMs: null | number;
|
|
timestamp: string;
|
|
up: boolean;
|
|
}
|
|
|
|
export type RuntimeMode = "development" | "production" | "test";
|
|
|
|
export interface SummaryResponse {
|
|
down: number;
|
|
lastCheckTime: null | string;
|
|
total: number;
|
|
up: number;
|
|
}
|
|
|
|
export interface TargetStats {
|
|
availability: number;
|
|
totalChecks: number;
|
|
}
|
|
|
|
export interface TargetStatus {
|
|
group: string;
|
|
id: number;
|
|
interval: string;
|
|
latestCheck: CheckResult | null;
|
|
name: string;
|
|
recentSamples: RecentSample[];
|
|
stats: TargetStats;
|
|
target: string;
|
|
type: string;
|
|
}
|
|
|
|
export interface TrendPoint {
|
|
availability: number;
|
|
avgDurationMs: null | number;
|
|
hour: string;
|
|
totalChecks: number;
|
|
}
|