fix: alert rule put

This commit is contained in:
710leo 2021-07-30 10:58:42 +08:00
parent dde431b422
commit 853053f56d
2 changed files with 6 additions and 3 deletions

View File

@ -47,7 +47,7 @@ func alertRuleAdd(c *gin.Context) {
bind(c, &f)
me := loginUser(c).MustPerm("alert_rule_create")
var ids []int64
for _, alertRule := range f {
arg := AlertRuleGroup(alertRule.GroupId)
alertRuleWritePermCheck(arg, me)
@ -74,9 +74,10 @@ func alertRuleAdd(c *gin.Context) {
UpdateBy: me.Username,
}
dangerous(ar.Add())
ids = append(ids, ar.Id)
}
renderMessage(c, nil)
renderData(c, ids, nil)
}
func alertRulePut(c *gin.Context) {
@ -90,6 +91,7 @@ func alertRulePut(c *gin.Context) {
ar.Name = f.Name
ar.Note = f.Note
ar.Type = f.Type
ar.Status = f.Status
ar.AlertDuration = f.AlertDuration
ar.Expression = f.Expression
@ -111,6 +113,7 @@ func alertRulePut(c *gin.Context) {
renderMessage(c, ar.Update(
"name",
"note",
"type",
"status",
"alert_duration",
"expression",

View File

@ -55,7 +55,7 @@ func userGroupAdd(c *gin.Context) {
// 顺便把创建者也作为团队的一员,失败了也没关系,用户会重新添加成员
models.UserGroupMemberAdd(ug.Id, me.Id)
renderMessage(c, nil)
renderData(c, ug.Id, nil)
}
func userGroupPut(c *gin.Context) {