feat(alerting): refactoring
This commit is contained in:
+1
-37
@@ -84,7 +84,7 @@ func AlertTest(c *middleware.Context, dto dtos.AlertTestCommand) Response {
|
||||
}
|
||||
|
||||
if err := bus.Dispatch(&backendCmd); err != nil {
|
||||
if validationErr, ok := err.(alerting.AlertValidationError); ok {
|
||||
if validationErr, ok := err.(alerting.ValidationError); ok {
|
||||
return ApiError(422, validationErr.Error(), nil)
|
||||
}
|
||||
return ApiError(500, "Failed to test rule", err)
|
||||
@@ -139,42 +139,6 @@ func DelAlert(c *middleware.Context) Response {
|
||||
return Json(200, resp)
|
||||
}
|
||||
|
||||
// // GET /api/alerts/events/:id
|
||||
// func GetAlertStates(c *middleware.Context) Response {
|
||||
// alertId := c.ParamsInt64(":alertId")
|
||||
//
|
||||
// query := models.GetAlertsStateQuery{
|
||||
// AlertId: alertId,
|
||||
// }
|
||||
//
|
||||
// if err := bus.Dispatch(&query); err != nil {
|
||||
// return ApiError(500, "Failed get alert state log", err)
|
||||
// }
|
||||
//
|
||||
// return Json(200, query.Result)
|
||||
// }
|
||||
//
|
||||
// // PUT /api/alerts/events/:id
|
||||
// func PutAlertState(c *middleware.Context, cmd models.UpdateAlertStateCommand) Response {
|
||||
// cmd.AlertId = c.ParamsInt64(":alertId")
|
||||
// cmd.OrgId = c.OrgId
|
||||
//
|
||||
// query := models.GetAlertByIdQuery{Id: cmd.AlertId}
|
||||
// if err := bus.Dispatch(&query); err != nil {
|
||||
// return ApiError(500, "Failed to get alertstate", err)
|
||||
// }
|
||||
//
|
||||
// if query.Result.OrgId != 0 && query.Result.OrgId != c.OrgId {
|
||||
// return ApiError(500, "Alert not found", nil)
|
||||
// }
|
||||
//
|
||||
// if err := bus.Dispatch(&cmd); err != nil {
|
||||
// return ApiError(500, "Failed to set new state", err)
|
||||
// }
|
||||
//
|
||||
// return Json(200, cmd.Result)
|
||||
// }
|
||||
|
||||
func GetAlertNotifications(c *middleware.Context) Response {
|
||||
query := &models.GetAlertNotificationsQuery{OrgId: c.OrgId}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user