1
0

refactor: 前端架构重构 — hook拆分、组件拆分、类型筛选器动态化、Meta API

- 后端新增 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
This commit is contained in:
2026-05-13 20:55:42 +08:00
parent a62007083d
commit 31aeee6d60
41 changed files with 713 additions and 902 deletions

View File

@@ -163,6 +163,7 @@ JSON Schema仓库根目录导出 `probe-config.schema.json`,可在 YAML 文
| 端点 | 说明 |
| ----------------------------------------------------------------- | ------------------------------------------------------------ |
| `GET /health` | 健康检查 |
| `GET /api/meta` | 运行时元信息checker 类型列表) |
| `GET /api/summary` | 总览统计total/up/down/lastCheckTime |
| `GET /api/targets` | 目标列表及最新状态、分组和采样数据 |
| `GET /api/targets/:id/history?from=ISO&to=ISO&page=1&pageSize=20` | 指定目标的拨测记录(时间范围 + 分页,`pageSize` 最大 `200` |
@@ -172,7 +173,9 @@ JSON Schema仓库根目录导出 `probe-config.schema.json`,可在 YAML 文
**SummaryResponse**: `total``up``down``lastCheckTime`
**TargetStatus**: `id``name``type`http/command`target`URL 或命令摘要)、`group``interval``latestCheck``stats``recentSamples`
**MetaResponse**: `checkerTypes`(已注册 checker 类型标识符列表)
**TargetStatus**: `id``name``type`checker 类型,如 http/command`target`URL 或命令摘要)、`group``interval``latestCheck``stats``recentSamples`
**RecentSample**: `timestamp``durationMs``up`