From 46c50a13f4215a134f5a69991f6ea7a79b7a10e1 Mon Sep 17 00:00:00 2001 From: attacker Date: Mon, 15 Jun 2026 13:07:22 +0800 Subject: [PATCH] docs: update dev-log - AlertCenter split --- docs/dev-log.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/dev-log.md b/docs/dev-log.md index 18664ce..da0d66f 100644 --- a/docs/dev-log.md +++ b/docs/dev-log.md @@ -932,3 +932,25 @@ cd ~/devops/aiops - AlertCenter.tsx(726行) 略超700行限制,可考虑拆分 - 监控告警模块(AgentAlerts/GrafanaDashboard/TraceView)主题色排查 - 各模块前后端联调验证 + +## 2026-06-15 自动推进 + +- **任务**: AlertCenter.tsx 拆分(723行超700限制 → 390行 + 3个子文件)+ 修复 TopologyView 类型错误 +- **修改**: + - `frontend/src/components/monitor/alert-center/alert-center-helpers.tsx` — **新建**(127行): 共享 Alert/AlertRule/NotificationChannel 类型 + mapAlert 字段映射 + getSeverityBadge/getStatusBadge/getChannelIcon/getChannelTypeLabel helpers + - `frontend/src/components/monitor/alert-center/AlertChannelDialog.tsx` — **新建**(121行): 通知渠道创建/编辑对话框,useEffect 同步编辑数据,自包含保存逻辑 + - `frontend/src/components/monitor/alert-center/AlertChannelsTab.tsx` — **新建**(152行): 通知渠道 Tab 自包含(状态管理+API调用+卡片渲染+CRUD操作) + - `frontend/src/components/monitor/alert-center/AlertCenter.tsx` — 723→390行: 移除内联类型/helpers/渠道管理全部逻辑,改 import 子组件 + - `frontend/src/components/monitor/alert-center/AlertCenterDetail.tsx` — 去重 getSeverityBadge(原本地副本),统一从 helpers 导入 + 补回 Badge import + - `frontend/src/components/k8s/TopologyView.tsx` — 修复 editForm.type 类型推断(`string` → `TopologyNode['type']`),解决 npm run build 的 2 处 TS2322 错误 +- **结果**: + - tsc --noEmit 零错误 ✅ + - npm run build 通过(3.32s)✅ + - 浏览器验证: 4个统计卡片(6/3/2/14)正常渲染 ✅,告警列表Tab(20条告警+严重/警告/信息Badge+触发中/已解决状态+操作按钮) ✅,通知渠道API返回3条 ✅ + - console 零错误零警告 ✅ + - git push 成功 (commit 76a41f5) ✅ + +**下一步建议**: +- sidebar.tsx(689行) 略低于700但属于shadcn基础组件,可考虑提取 context/variants +- 后端 alert.go(586行) 超400行限制,可考虑按 alerts/rules/channels 拆分 +- 后端 pipeline.go(541行)、billing.go(476行)、server.go(446行) 均略超400行限制