docs: update dev-log - AgentMonitor 拆分
This commit is contained in:
1 parent
e544360398
commit
67066041b3
1 file changed
+21
@@ -1152,3 +1152,24 @@ cd ~/devops/aiops
|
||||
- 前端接近700行限制可提取子组件: AgentMonitor.tsx(672)、AIPredictiveAnalytics.tsx(670)、ApprovalFlow.tsx(666)
|
||||
- sidebar.tsx(689行) 已提取 context,剩余为 shadcn 标准 UI 组件无需拆分
|
||||
- 后端 sql_audit.go(435行) 超限但属已移除菜单死代码(保留不拆)
|
||||
|
||||
|
||||
## 2026-06-16 05:04 自动推进(cron)
|
||||
|
||||
- **任务**: 拆分 AgentMonitor.tsx(672行→463行),远离700行硬上限
|
||||
- **背景**: dev-log 上次建议的预防性维护项;AgentMonitor.tsx 是当前最接近 700 行限制的业务组件
|
||||
- **拆分方案**:
|
||||
- `frontend/src/components/agent/agentUtils.ts` — **新建**(31行):提取 `isOnline`/`timeAgo`/`asList` 三个工具函数,供主组件+详情弹窗共享
|
||||
- `frontend/src/components/agent/HostDetailDialog.tsx` — **新建**(201行):提取主机详情弹窗(`HostDetailDialog`)+`InfoCell`子组件+趋势图(recharts)
|
||||
- `frontend/src/components/agent/AgentMonitor.tsx` — 主组件保留页头/统计卡片/主机列表网格/远程命令弹窗/`MetricBar` 子组件;从 672 行降至 463 行;移除未使用的 recharts import
|
||||
- **结果**:
|
||||
- `npx tsc --noEmit` 零错误 ✅
|
||||
- `npm run build` 通过(3.12s, 2597 modules) ✅
|
||||
- `./run.sh restart` 后 /health 正常 + 前端 200 ✅
|
||||
- 浏览器验证 `/agent-monitor`:4 台主机正常渲染(主机总数4/在线0/离线4);点击"详情"按钮 `HostDetailDialog` 弹窗正常打开(IP/OS/最后上报/端口数+指标趋势选择器+远程命令/关闭按钮);console 零 JS 错误 ✅
|
||||
- grep 确认无其他文件从 `./AgentMonitor` 导入(零结果),无遗留引用
|
||||
- git push 成功 (commit e544360) ✅
|
||||
- **下一步建议**:
|
||||
- 前端仍有接近700行可拆分: AIPredictiveAnalytics.tsx(670)、ApprovalFlow.tsx(666)、CloudBilling.tsx(663)、CronJobManager.tsx(652)、AppRelease.tsx(650)
|
||||
- sidebar.tsx(689行) 为 shadcn 标准 UI 组件,context 已提取,剩余无需拆分
|
||||
- 后端 sql_audit.go(435行) 属已移除菜单死代码(保留不拆)
|
||||
Reference in new issue
Block a user