AlertCurEventGetByIds
This commit is contained in:
parent
9ccdd6c3e7
commit
8bdd35975e
|
@ -350,6 +350,17 @@ func AlertCurEventGetAll(cluster string) ([]*AlertCurEvent, error) {
|
|||
return lst, err
|
||||
}
|
||||
|
||||
func AlertCurEventGetByIds(ids []int64) ([]*AlertCurEvent, error) {
|
||||
var lst []*AlertCurEvent
|
||||
|
||||
if len(ids) == 0 {
|
||||
return lst, nil
|
||||
}
|
||||
|
||||
err := DB().Where("id in ?", ids).Order("id desc").Find(&lst).Error
|
||||
return lst, err
|
||||
}
|
||||
|
||||
func AlertCurEventGetByRule(ruleId int64) ([]*AlertCurEvent, error) {
|
||||
var lst []*AlertCurEvent
|
||||
err := DB().Where("rule_id=?", ruleId).Find(&lst).Error
|
||||
|
|
|
@ -221,7 +221,7 @@ func configRoute(r *gin.Engine, version string) {
|
|||
// card logic
|
||||
pages.GET("/alert-cur-events/list", jwtAuth(), alertCurEventsList)
|
||||
pages.GET("/alert-cur-events/card", jwtAuth(), alertCurEventsCard)
|
||||
pages.GET("/alert-cur-events/card/details", jwtAuth(), alertCurEventsCardDetails)
|
||||
pages.POST("/alert-cur-events/card/details", jwtAuth(), alertCurEventsCardDetails)
|
||||
pages.GET("/alert-his-events/list", jwtAuth(), alertHisEventsList)
|
||||
pages.DELETE("/alert-cur-events", jwtAuth(), user(), perm("/alert-cur-events/del"), alertCurEventDel)
|
||||
|
||||
|
|
|
@ -87,7 +87,11 @@ type AlertCard struct {
|
|||
}
|
||||
|
||||
func alertCurEventsCardDetails(c *gin.Context) {
|
||||
var f idsForm
|
||||
ginx.BindJSON(c, &f)
|
||||
|
||||
lst, err := models.AlertCurEventGetByIds(f.Ids)
|
||||
ginx.NewRender(c).Data(lst, err)
|
||||
}
|
||||
|
||||
// 列表方式,拉取活跃告警
|
||||
|
|
Loading…
Reference in New Issue