add cluster field when import builtin alerts

This commit is contained in:
Ulric Qin 2022-03-23 14:48:28 +08:00
parent 929c970b42
commit 4c22284ca7
1 changed files with 3 additions and 1 deletions

View File

@ -39,6 +39,7 @@ func alertRuleBuiltinList(c *gin.Context) {
type alertRuleBuiltinImportForm struct { type alertRuleBuiltinImportForm struct {
Name string `json:"name" binding:"required"` Name string `json:"name" binding:"required"`
Cluster string `json:"cluster" binding:"required"`
} }
func alertRuleBuiltinImport(c *gin.Context) { func alertRuleBuiltinImport(c *gin.Context) {
@ -70,6 +71,7 @@ func alertRuleBuiltinImport(c *gin.Context) {
reterr := make(map[string]string) reterr := make(map[string]string)
for i := 0; i < count; i++ { for i := 0; i < count; i++ {
lst[i].Id = 0 lst[i].Id = 0
lst[i].Cluster = f.Cluster
lst[i].GroupId = bgid lst[i].GroupId = bgid
lst[i].CreateBy = username lst[i].CreateBy = username
lst[i].UpdateBy = username lst[i].UpdateBy = username