Skip to content

Commit

Permalink
refactor: alert subscribe gets api
Browse files Browse the repository at this point in the history
  • Loading branch information
710leo committed Aug 18, 2023
1 parent 212e0aa commit 9c4775f
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions center/router/router_alert_subscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,18 @@ import (
func (rt *Router) alertSubscribeGets(c *gin.Context) {
bgid := ginx.UrlParamInt64(c, "id")
lst, err := models.AlertSubscribeGets(rt.Ctx, bgid)
if err == nil {
ugcache := make(map[int64]*models.UserGroup)
for i := 0; i < len(lst); i++ {
ginx.Dangerous(lst[i].FillUserGroups(rt.Ctx, ugcache))
}

rulecache := make(map[int64]string)
for i := 0; i < len(lst); i++ {
ginx.Dangerous(lst[i].FillRuleName(rt.Ctx, rulecache))
}

for i := 0; i < len(lst); i++ {
ginx.Dangerous(lst[i].FillDatasourceIds(rt.Ctx))
}
ginx.Dangerous(err)

ugcache := make(map[int64]*models.UserGroup)
rulecache := make(map[int64]string)

for i := 0; i < len(lst); i++ {
ginx.Dangerous(lst[i].FillUserGroups(rt.Ctx, ugcache))
ginx.Dangerous(lst[i].FillRuleName(rt.Ctx, rulecache))
ginx.Dangerous(lst[i].FillDatasourceIds(rt.Ctx))
ginx.Dangerous(lst[i].DB2FE())
}

ginx.NewRender(c).Data(lst, err)
}

Expand Down

0 comments on commit 9c4775f

Please sign in to comment.