feat(alerting): requests looks to be working again

This commit is contained in:
Torkel Ödegaard
2016-06-06 17:11:46 +02:00
parent d1acfb4494
commit 34e17f7282
33 changed files with 471 additions and 93 deletions
+2 -2
View File
@@ -22,7 +22,7 @@ func ValidateOrgAlert(c *middleware.Context) {
}
}
// GET /api/alerts/changes
// GET /api/alerting/changes
func GetAlertChanges(c *middleware.Context) Response {
query := models.GetAlertChangesQuery{
OrgId: c.OrgId,
@@ -69,7 +69,7 @@ func GetAlerts(c *middleware.Context) Response {
WarnLevel: alert.WarnLevel,
CritLevel: alert.CritLevel,
Frequency: alert.Frequency,
Title: alert.Title,
Name: alert.Name,
Description: alert.Description,
QueryRange: alert.QueryRange,
Aggregator: alert.Aggregator,
-2
View File
@@ -244,9 +244,7 @@ func Register(r *macaron.Macaron) {
r.Group("/alerts", func() {
r.Group("/rules", func() {
r.Get("/:alertId/states", wrap(GetAlertStates))
r.Put("/:alertId/state", bind(m.UpdateAlertStateCommand{}), wrap(PutAlertState))
r.Get("/:alertId", ValidateOrgAlert, wrap(GetAlert))
//r.Delete("/:alertId", ValidateOrgAlert, wrap(DelAlert)) disabled until we know how to handle it dashboard updates
r.Get("/", wrap(GetAlerts))
+1 -1
View File
@@ -77,7 +77,7 @@ func getDatasource(id int64, orgId int64) (*m.DataSource, error) {
return nil, err
}
return &query.Result, nil
return query.Result, nil
}
func ProxyDataSourceRequest(c *middleware.Context) {
+2 -4
View File
@@ -123,9 +123,7 @@ func GetDataSourceByName(c *middleware.Context) Response {
return ApiError(500, "Failed to query datasources", err)
}
ds := query.Result
dtos := convertModelToDtos(ds)
dtos := convertModelToDtos(query.Result)
return Json(200, &dtos)
}
@@ -148,7 +146,7 @@ func GetDataSourceIdByName(c *middleware.Context) Response {
return Json(200, &dtos)
}
func convertModelToDtos(ds m.DataSource) dtos.DataSource {
func convertModelToDtos(ds *m.DataSource) dtos.DataSource {
return dtos.DataSource{
Id: ds.Id,
OrgId: ds.OrgId,
+1 -1
View File
@@ -11,7 +11,7 @@ type AlertRuleDTO struct {
WarnOperator string `json:"warnOperator"`
CritOperator string `json:"critOperator"`
Frequency int64 `json:"frequency"`
Title string `json:"title"`
Name string `json:"name"`
Description string `json:"description"`
QueryRange int `json:"queryRange"`
Aggregator string `json:"aggregator"`