refactor: 全局代码模块化重构 — 所有文件<700行

后端 handler 拆分:
- automation.go(1067→4文件), server.go(1011→5文件), ldap.go(815→3文件), user.go(704→2文件)

前端组件拆分:
- SystemManager(1782→569), AlertManager(1133→220), K8sClusters(1062→4文件)
- Dashboard(941→4文件), ServerManager(905→640), ApprovalFlow(830→548)
- AlertCenter(775→693), AIPredictiveAnalytics(760→670)
- CloudBilling(728→663), GrafanaDashboard(717→643), sidebar(726→689)

Mock 数据模块化:
- mocks/data.ts(2552行→barrel+11个domain模块)

新增 CLAUDE.md 项目全局开发规范

修复: AlertCenter/LogManager ListResponse.data→.list 类型不匹配
验证: go build ✅ + tsc --noEmit ✅ + npm run build ✅
This commit is contained in:
attacker committed 2026-06-15 01:32:15 +08:00
1 parent e8dbe65955
commit 73b5a48df9
37 files changed
+5148 -5237

No files matched your search

+60 -23
View File
@@ -6,24 +6,42 @@
aiops/
├── frontend/ # 前端 (React 18 + TypeScript + Vite)
│ ├── src/
│ │ ├── components/ # 业务组件
│ │ │ ├── aiops/ # AI 智能运维组件
│ │ │ ├── approval/ # 审批流程
│ │ ├── components/ # 业务组件(每个 <700行,超限已模块化拆分)
│ │ │ ├── agent/ # Agent 监控
│ │ │ ├── aiops/ # AI 智能运维(AIPredictiveAnalytics 含 PredictiveCapacityTab)
│ │ │ ├── approval/ # 审批流程(ApprovalFlow + Process/Template Tab)
│ │ │ ├── audit/ # SQL 审计
│ │ │ ├── automation/ # 自动化运维
│ │ │ ├── cloud/ # 云平台管理
│ │ │ ├── dashboard/ # 仪表盘
│ │ │ ├── automation/ # 自动化运维(CronJob/Script/Ansible)
│ │ │ ├── cloud/ # 云平台管理(CloudBilling + Helpers 子组件)
│ │ │ ├── dashboard/ # 仪表盘(Charts/Recent/Stats 子组件)
│ │ │ ├── deploy/ # CI/CD 部署
│ │ │ ├── k8s/ # K8s 集群管理
│ │ │ ├── k8s/ # K8s 集群管理(Detail/Dialog/Topology 子组件)
│ │ │ ├── layout/ # 布局组件
│ │ │ ├── monitor/ # 监控告警
│ │ │ ├── monitor/ # 监控告警(AlertManager + Events/Rules Tab + Dialog 子组件)
│ │ │ │ ├── alert-center/ # 告警中心(AlertCenter + Detail 子组件)
│ │ │ │ ├── dashboard/ # Grafana 仪表盘(GrafanaPanelContent 子组件)
│ │ │ │ ├── logs/ # 日志管理
│ │ │ │ └── trace/ # 链路追踪
│ │ │ ├── navigation/ # 导航管理
│ │ │ ├── server/ # 服务器管理
│ │ │ ├── system/ # 系统管理
│ │ │ └── ui/ # shadcn/ui 基础组件
│ │ │ ├── server/ # 服务器管理(ServerManager + Form/BatchImport 子组件)
│ │ │ ├── system/ # 系统管理(SystemManager + User/Settings/Logs/Roles/LDAP Tab 子组件)
│ │ │ └── ui/ # shadcn/ui 基础组件(sidebar.tsx + sidebar-context.tsx)
│ │ ├── hooks/ # 自定义 Hooks
│ │ ├── lib/ # 工具库
│ │ ├── mocks/ # Mock 数据
│ │ ├── mocks/ # Mock 数据(按 domain 模块化,barrel 统一导出)
│ │ │ ├── data.ts # Barrel re-export(统一入口)
│ │ │ └── modules/ # 按业务域分组
│ │ │ ├── servers.ts # 服务器/机柜
│ │ │ ├── cloud.ts # 云平台
│ │ │ ├── k8s.ts # K8s
│ │ │ ├── alerts.ts # 告警
│ │ │ ├── dashboard.ts # 仪表盘
│ │ │ ├── cicd.ts # CI/CD
│ │ │ ├── automation.ts # 自动化
│ │ │ ├── system.ts # 系统
│ │ │ ├── approval.ts # 审批
│ │ │ ├── monitor.ts # 监控
│ │ │ └── misc.ts # SQL审计/Ansible/导航等
│ │ ├── services/ # API 封装
│ │ ├── store/ # Zustand 状态管理
│ │ ├── types/ # TypeScript 类型定义
@@ -41,17 +59,36 @@ aiops/
│ │ └── main.go # 应用入口
│ ├── internal/
│ │ ├── api/
│ │ │ ├── handlers/ # HTTP 处理器
│ │ │ │ ├── alert.go # 告警管理
│ │ │ │ ├── approval.go # 审批流程
│ │ │ │ ├── audit.go # 审计日志
│ │ │ │ ├── automation.go # 自动化运维
│ │ │ │ ├── dashboard.go # 仪表盘
│ │ │ │ ├── k8s.go # K8s 管理
│ │ │ │ ├── navigation.go # 导航管理
│ │ │ │ ├── pipeline.go # CI/CD 流水线
│ │ │ │ ├── server.go # 服务器管理
│ │ │ │ └── user.go # 用户认证
│ │ │ ├── handlers/ # HTTP 处理器(模块化拆分)
│ │ │ │ ├── agent.go # Agent 管理
│ │ │ │ ├── agent_task.go # Agent 任务分发
│ │ │ │ ├── alert.go # 告警管理
│ │ │ │ ├── alert_engine.go # 告警引擎
│ │ │ │ ├── ansible.go # Ansible Playbook
│ │ │ │ ├── approval.go # 审批流程
│ │ │ │ ├── audit.go # 审计日志
│ │ │ │ ├── automation.go # 自动化运维(入口)
│ │ │ │ ├── automation_cron.go # 定时任务
│ │ │ │ ├── automation_script.go # 脚本管理
│ │ │ │ ├── automation_playbook.go # Playbook
│ │ │ │ ├── billing.go # 云账单
│ │ │ │ ├── cloud_accounts.go # 云账号
│ │ │ │ ├── cloud_domain.go # 域名
│ │ │ │ ├── cloud_platform.go # 云平台
│ │ │ │ ├── cloud_region.go # 区域
│ │ │ │ ├── dashboard.go # 仪表盘
│ │ │ │ ├── k8s.go # K8s 管理
│ │ │ │ ├── ldap.go # LDAP(入口)
│ │ │ │ ├── ldap_ou.go # LDAP OU 管理
│ │ │ │ ├── ldap_users.go # LDAP 用户同步
│ │ │ │ ├── log.go # 日志管理
│ │ │ │ ├── navigation.go # 导航管理
│ │ │ │ ├── pipeline.go # CI/CD 流水线
│ │ │ │ ├── resource_model.go # 资源模型
│ │ │ │ ├── server.go # 服务器管理(入口)
│ │ │ │ ├── user.go # 用户认证
│ │ │ │ ├── user_admin.go # 用户管理(管理员)
│ │ │ │ └── webshell.go # Web 终端
│ │ │ ├── middleware/ # 中间件
│ │ │ │ └── auth.go # JWT 认证 + RBAC
│ │ │ └── routes/