feat(alerting): add support for alert_rule updates

This commit is contained in:
bergquist
2016-04-25 16:18:28 +02:00
parent c83af353b2
commit 25f6ec8b53
4 changed files with 99 additions and 5 deletions
+10
View File
@@ -2,10 +2,12 @@ package models
import (
"github.com/grafana/grafana/pkg/components/simplejson"
"time"
)
type AlertRule struct {
Id int64
OrgId int64
DashboardId int64
PanelId int64
Query string
@@ -19,6 +21,13 @@ type AlertRule struct {
Aggregator string
}
type AlertRuleChange struct {
OrgId int64
AlertId int64
Type string
Created time.Time
}
func (cmd *SaveDashboardCommand) GetAlertModels() *[]AlertRule {
alerts := make([]AlertRule, 0)
@@ -31,6 +40,7 @@ func (cmd *SaveDashboardCommand) GetAlertModels() *[]AlertRule {
alerting := panel.Get("alerting")
alert := AlertRule{
DashboardId: cmd.Result.Id,
OrgId: cmd.Result.OrgId,
PanelId: panel.Get("id").MustInt64(),
Id: alerting.Get("id").MustInt64(),
QueryRefId: alerting.Get("query_ref").MustString(),