feat(alerting): add api route for alert changes
This commit is contained in:
@@ -21,6 +21,19 @@ func ValidateOrgAlert(c *middleware.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// GET /api/alert_rule
|
||||
func GetAlertChanges(c *middleware.Context) Response {
|
||||
query := models.GetAlertChangesQuery{
|
||||
OrgId: c.OrgId,
|
||||
}
|
||||
|
||||
if err := bus.Dispatch(&query); err != nil {
|
||||
return ApiError(500, "List alerts failed", err)
|
||||
}
|
||||
|
||||
return Json(200, query.Result)
|
||||
}
|
||||
|
||||
// GET /api/alert_rule
|
||||
func GetAlerts(c *middleware.Context) Response {
|
||||
query := models.GetAlertsQuery{
|
||||
|
||||
@@ -237,6 +237,7 @@ func Register(r *macaron.Macaron) {
|
||||
r.Get("/metrics/test", GetTestMetrics)
|
||||
|
||||
r.Group("/alert_rule", func() {
|
||||
r.Get("/changes", wrap(GetAlertChanges))
|
||||
r.Get("/", wrap(GetAlerts))
|
||||
r.Get("/:id", ValidateOrgAlert, wrap(GetAlert))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user