feat(alerting): add support for alert_rule updates
This commit is contained in:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user