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:
1 parent
e8dbe65955
commit
73b5a48df9
37 files changed
+5148
-5237
No files matched your search
@@ -55,7 +55,8 @@ func Register(r *gin.Engine, db *gorm.DB, log *zap.Logger, cfg *config.Config) {
|
||||
{
|
||||
user.GET("/profile", authHandler.GetProfile)
|
||||
user.PUT("/profile", authHandler.UpdateProfile)
|
||||
user.PUT("/password", authHandler.ChangePassword)
|
||||
user.POST("/change-password", authHandler.ChangePassword)
|
||||
user.GET("/roles", authHandler.ListRoles)
|
||||
}
|
||||
|
||||
// 管理员路由
|
||||
@@ -274,6 +275,36 @@ func Register(r *gin.Engine, db *gorm.DB, log *zap.Logger, cfg *config.Config) {
|
||||
// 任务执行记录(脚本/定时任务执行历史)
|
||||
authorized.GET("/task-executions", automationHandler.ListExecutions)
|
||||
|
||||
// Ansible 自动化路由 // Logan.Li
|
||||
ansibleHandler := handlers.NewAnsibleHandler(db)
|
||||
ansible := authorized.Group("/ansible")
|
||||
{
|
||||
ansible.GET("/playbooks", ansibleHandler.ListPlaybooks)
|
||||
ansible.POST("/playbooks", ansibleHandler.CreatePlaybook)
|
||||
ansible.GET("/playbooks/:id", ansibleHandler.GetPlaybook)
|
||||
ansible.PUT("/playbooks/:id", ansibleHandler.UpdatePlaybook)
|
||||
ansible.DELETE("/playbooks/:id", ansibleHandler.DeletePlaybook)
|
||||
ansible.POST("/playbooks/:id/execute", ansibleHandler.ExecutePlaybook)
|
||||
|
||||
ansible.GET("/jobs", ansibleHandler.ListJobs)
|
||||
ansible.GET("/jobs/:id", ansibleHandler.GetJob)
|
||||
|
||||
ansible.GET("/inventories", ansibleHandler.ListInventories)
|
||||
ansible.POST("/inventories", ansibleHandler.CreateInventory)
|
||||
ansible.PUT("/inventories/:id", ansibleHandler.UpdateInventory)
|
||||
ansible.DELETE("/inventories/:id", ansibleHandler.DeleteInventory)
|
||||
}
|
||||
|
||||
// 日志监控路由 // Logan.Li
|
||||
logHandler := handlers.NewLogHandler(db)
|
||||
logs := authorized.Group("/logs")
|
||||
{
|
||||
logs.GET("", logHandler.QueryLogs)
|
||||
logs.GET("/sources", logHandler.ListSources)
|
||||
logs.POST("/sources", logHandler.CreateSource)
|
||||
logs.DELETE("/sources/:id", logHandler.DeleteSource)
|
||||
}
|
||||
|
||||
// 审批流程路由
|
||||
approvalHandler := handlers.NewApprovalHandler(db)
|
||||
approvals := authorized.Group("/approvals")
|
||||
|
||||
Reference in new issue
Block a user