feat(alerting): add basic tables for alerting definitions

This commit is contained in:
bergquist
2016-04-13 10:33:45 +02:00
parent 6b8921c8c5
commit 91a1a823e2
5 changed files with 119 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
package models
import (
//"github.com/grafana/grafana/pkg/components/simplejson"
)
type Alert struct {
Id int64
DashboardId int64
PanelId int64
Query string
QueryRefId string
WarnLevel int64
ErrorLevel int64
CheckInterval string
Title string
Description string
QueryRange string
}
func (cmd *SaveDashboardCommand) GetAlertModels() *[]Alert {
dash := NewDashboardFromJson(cmd.Dashboard)
alerts := make([]Alert, 0)
alerts = append(alerts, Alert{
DashboardId: dash.Id,
Id: 1,
PanelId: 1,
Query: "",
QueryRefId: "",
WarnLevel: 0,
ErrorLevel: 0,
CheckInterval: "5s",
Title: dash.Title + " Alert",
Description: dash.Title + " Description",
QueryRange: "10m",
})
return &alerts
}
// Commands
type SaveAlertsCommand struct {
DashboardId int64
UserId int64
OrgId int64
Alerts *[]Alert
}