feat: Ansible 完整工作流页面(模板→主机→预览→执行→监控)

**新组件 AnsibleWorkflow.tsx(~670行):**
- Step 1: 模板选择 — 卡片网格,按分类/标签搜索过滤
- Step 2: 主机匹配 — 正则/前缀/模糊搜索,checkable 表格,全选
- Step 3: 确认执行 — Playbook 摘要 + 主机列表 + YAML 预览
- Step 4: 执行监控 — 状态指示器 + 终端输出 + 耗时统计
- 执行记录 Tab — 历史列表 + 输出展开

**路由调整:**
- /ansible → AnsibleWorkflow(主工作流)
- /ansible/manage → AnsibleManager(模板 CRUD)

**类型补全:**
- ExecutionRecord 增加 triggered_by 字段
This commit is contained in:
attacker committed 2026-06-19 13:41:04 +00:00
1 parent c9b6647831
commit f05cf71121
5 files changed
+699 -6

No files matched your search

+3 -3
View File
@@ -11,7 +11,7 @@ type CronJob struct {
Name string `gorm:"size:128;not null" json:"name"`
Description string `gorm:"size:500" json:"description"`
CronExpr string `gorm:"size:64;not null" json:"cron_expr"`
Type string `gorm:"size:32;not null" json:"type"` // script, command, playbook
Type string `gorm:"size:32;not null" json:"type"` // shell, python, command
Content string `gorm:"type:text" json:"content"`
ScriptID *uint `json:"script_id"`
TargetType string `gorm:"size:32;default:server" json:"target_type"` // server, group, tag
@@ -124,7 +124,7 @@ type CreateCronJobRequest struct {
Name string `json:"name" binding:"required"`
Description string `json:"description"`
CronExpr string `json:"cron_expr" binding:"required"`
Type string `json:"type" binding:"required,oneof=script command playbook"`
Type string `json:"type" binding:"required,oneof=shell python command"`
Content string `json:"content"`
ScriptID *uint `json:"script_id"`
TargetType string `json:"target_type" binding:"omitempty,oneof=server group tag"`
@@ -138,7 +138,7 @@ type CreateScriptRequest struct {
Name string `json:"name" binding:"required"`
Code string `json:"code" binding:"required"`
Description string `json:"description"`
Type string `json:"type" binding:"omitempty,oneof=shell python powershell yaml"`
Type string `json:"type" binding:"omitempty,oneof=shell python"`
Content string `json:"content" binding:"required"`
Params string `json:"params"`
Timeout int `json:"timeout"`