mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(alerting): trying to get things to work with new model
This commit is contained in:
@@ -38,6 +38,10 @@ func updateDashboardAlerts(cmd *UpdateDashboardAlertsCommand) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func getTimeDurationStringToSeconds(str string) int64 {
|
||||
return 60
|
||||
}
|
||||
|
||||
func ConvetAlertModelToAlertRule(ruleDef *m.Alert) (*AlertRule, error) {
|
||||
model := &AlertRule{}
|
||||
model.Id = ruleDef.Id
|
||||
@@ -58,7 +62,7 @@ func ConvetAlertModelToAlertRule(ruleDef *m.Alert) (*AlertRule, error) {
|
||||
Level: warning.Get("level").MustFloat64(),
|
||||
}
|
||||
|
||||
model.Frequency = ruleDef.Expression.Get("frequency").MustInt64()
|
||||
model.Frequency = getTimeDurationStringToSeconds(ruleDef.Expression.Get("frequency").MustString())
|
||||
model.Transform = ruleDef.Expression.Get("transform").Get("type").MustString()
|
||||
model.TransformParams = *ruleDef.Expression.Get("transform")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user