mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
alerting: only check frequency when not send once
This commit is contained in:
@@ -192,17 +192,7 @@ func GetAlertNotifications(c *m.ReqContext) Response {
|
||||
result := make([]*dtos.AlertNotification, 0)
|
||||
|
||||
for _, notification := range query.Result {
|
||||
result = append(result, &dtos.AlertNotification{
|
||||
Id: notification.Id,
|
||||
Name: notification.Name,
|
||||
Type: notification.Type,
|
||||
IsDefault: notification.IsDefault,
|
||||
Created: notification.Created,
|
||||
Updated: notification.Updated,
|
||||
Frequency: notification.Frequency.String(),
|
||||
NotifyOnce: notification.NotifyOnce,
|
||||
Settings: notification.Settings,
|
||||
})
|
||||
result = append(result, dtos.NewAlertNotification(notification))
|
||||
}
|
||||
|
||||
return JSON(200, result)
|
||||
@@ -218,19 +208,7 @@ func GetAlertNotificationByID(c *m.ReqContext) Response {
|
||||
return Error(500, "Failed to get alert notifications", err)
|
||||
}
|
||||
|
||||
result := &dtos.AlertNotification{
|
||||
Id: query.Result.Id,
|
||||
Name: query.Result.Name,
|
||||
Type: query.Result.Type,
|
||||
IsDefault: query.Result.IsDefault,
|
||||
Created: query.Result.Created,
|
||||
Updated: query.Result.Updated,
|
||||
Frequency: query.Result.Frequency.String(),
|
||||
NotifyOnce: query.Result.NotifyOnce,
|
||||
Settings: query.Result.Settings,
|
||||
}
|
||||
|
||||
return JSON(200, result)
|
||||
return JSON(200, dtos.NewAlertNotification(query.Result))
|
||||
}
|
||||
|
||||
func CreateAlertNotification(c *m.ReqContext, cmd m.CreateAlertNotificationCommand) Response {
|
||||
@@ -240,19 +218,7 @@ func CreateAlertNotification(c *m.ReqContext, cmd m.CreateAlertNotificationComma
|
||||
return Error(500, "Failed to create alert notification", err)
|
||||
}
|
||||
|
||||
result := &dtos.AlertNotification{
|
||||
Id: cmd.Result.Id,
|
||||
Name: cmd.Result.Name,
|
||||
Type: cmd.Result.Type,
|
||||
IsDefault: cmd.Result.IsDefault,
|
||||
Created: cmd.Result.Created,
|
||||
Updated: cmd.Result.Updated,
|
||||
Frequency: cmd.Result.Frequency.String(),
|
||||
NotifyOnce: cmd.Result.NotifyOnce,
|
||||
Settings: cmd.Result.Settings,
|
||||
}
|
||||
|
||||
return JSON(200, result)
|
||||
return JSON(200, dtos.NewAlertNotification(cmd.Result))
|
||||
}
|
||||
|
||||
func UpdateAlertNotification(c *m.ReqContext, cmd m.UpdateAlertNotificationCommand) Response {
|
||||
@@ -262,19 +228,7 @@ func UpdateAlertNotification(c *m.ReqContext, cmd m.UpdateAlertNotificationComma
|
||||
return Error(500, "Failed to update alert notification", err)
|
||||
}
|
||||
|
||||
result := &dtos.AlertNotification{
|
||||
Id: cmd.Result.Id,
|
||||
Name: cmd.Result.Name,
|
||||
Type: cmd.Result.Type,
|
||||
IsDefault: cmd.Result.IsDefault,
|
||||
Created: cmd.Result.Created,
|
||||
Updated: cmd.Result.Updated,
|
||||
Frequency: cmd.Result.Frequency.String(),
|
||||
NotifyOnce: cmd.Result.NotifyOnce,
|
||||
Settings: cmd.Result.Settings,
|
||||
}
|
||||
|
||||
return JSON(200, result)
|
||||
return JSON(200, dtos.NewAlertNotification(cmd.Result))
|
||||
}
|
||||
|
||||
func DeleteAlertNotification(c *m.ReqContext) Response {
|
||||
|
||||
Reference in New Issue
Block a user