feat(alerting): moved alerting models back to alerting package, models is more for storage dtos
This commit is contained in:
@@ -112,24 +112,3 @@ type GetAlertChangesQuery struct {
|
||||
|
||||
Result []AlertRuleChange
|
||||
}
|
||||
|
||||
type AlertJob struct {
|
||||
Offset int64
|
||||
Delay bool
|
||||
Running bool
|
||||
RetryCount int
|
||||
Rule AlertRule
|
||||
}
|
||||
|
||||
type AlertResult struct {
|
||||
Id int64
|
||||
State string
|
||||
ActualValue float64
|
||||
Duration float64
|
||||
Description string
|
||||
AlertJob *AlertJob
|
||||
}
|
||||
|
||||
func (ar *AlertResult) IsResultIncomplete() bool {
|
||||
return ar.State == AlertStatePending
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/alerting/alertstates"
|
||||
)
|
||||
|
||||
type AlertState struct {
|
||||
@@ -13,25 +15,8 @@ type AlertState struct {
|
||||
Info string `json:"info"`
|
||||
}
|
||||
|
||||
var (
|
||||
VALID_STATES = []string{
|
||||
AlertStateOk,
|
||||
AlertStateWarn,
|
||||
AlertStateCritical,
|
||||
AlertStateAcknowledged,
|
||||
AlertStateMaintenance,
|
||||
}
|
||||
|
||||
AlertStateOk = "OK"
|
||||
AlertStateWarn = "WARN"
|
||||
AlertStateCritical = "CRITICAL"
|
||||
AlertStateAcknowledged = "ACKNOWLEDGED"
|
||||
AlertStateMaintenance = "MAINTENANCE"
|
||||
AlertStatePending = "PENDING"
|
||||
)
|
||||
|
||||
func (this *UpdateAlertStateCommand) IsValidState() bool {
|
||||
for _, v := range VALID_STATES {
|
||||
for _, v := range alertstates.ValidStates {
|
||||
if this.NewState == v {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package models
|
||||
|
||||
type TimeSeries struct {
|
||||
Name string `json:"name"`
|
||||
Points [][2]float64 `json:"points"`
|
||||
}
|
||||
|
||||
type TimeSeriesSlice []*TimeSeries
|
||||
|
||||
func NewTimeSeries(name string, points [][2]float64) *TimeSeries {
|
||||
return &TimeSeries{
|
||||
Name: name,
|
||||
Points: points,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user