feat: 完善告警规则配置页面 — 增删改查弹窗 + 修复白屏bug + UpdateRule notify_channels序列化修复

- AlertManager: 新建/编辑告警规则弹窗(规则名称/描述/类型/数据源/表达式/级别/持续时间/通知渠道Switch)
- AlertManager: 修复白屏bug — getRules返回{list,total}未解包导致rules.map崩溃(Frontend Pitfall #1)
- AlertManager: 修复规则列表字段显示 — 原引用不存在的rule.metric/operator/threshold字段,改为rule.source/expression
- AlertManager: 新增规则删除按钮(带确认)
- alert.go: 修复UpdateRule notify_channels序列化bug — 原直接赋值[]string到text列导致500,改用toJSON()
- 同步提交前序未提交改动(WebShell/K8s/Server/Login等组件改进)
This commit is contained in:
attacker committed 2026-06-14 03:07:44 +08:00
1 parent 170818c141
commit 00d5510366
13 files changed
+2170 -496

No files matched your search

+6
View File
@@ -13,7 +13,10 @@ type K8sCluster struct {
Code string `gorm:"size:64;uniqueIndex;not null" json:"code"`
Version string `gorm:"size:32" json:"version"`
Status string `gorm:"size:32;default:healthy" json:"status"` // healthy, warning, error
ConfigType int `gorm:"default:1" json:"config_type"` // 0=token, 1=kubeconfig
APIServer string `gorm:"size:255" json:"api_server"`
APIEndpoint string `gorm:"size:255" json:"api_endpoint"`
Token string `gorm:"type:text" json:"-"`
KubeConfig string `gorm:"type:text" json:"-"`
NodeCount int `gorm:"default:0" json:"node_count"`
PodCount int `gorm:"default:0" json:"pod_count"`
@@ -171,7 +174,10 @@ type CreateK8sClusterRequest struct {
Name string `json:"name" binding:"required"`
Code string `json:"code" binding:"required"`
Version string `json:"version"`
ConfigType int `json:"config_type"` // 0=token, 1=kubeconfig
APIServer string `json:"api_server"`
APIEndpoint string `json:"api_endpoint"`
Token string `json:"token"`
KubeConfig string `json:"kube_config"`
Description string `json:"description"`
}