Revert changes post code review and move them to notification page

This commit is contained in:
John Baublitz
2018-06-04 13:19:14 +02:00
committed by bergquist
parent e068be4c26
commit 3cb0e27e1c
34 changed files with 215 additions and 107 deletions
-9
View File
@@ -72,9 +72,6 @@ type Alert struct {
Silenced bool
ExecutionError string
Frequency int64
NotifyOnce bool
NotifyFreq uint64
NotifyEval uint64
EvalData *simplejson.Json
NewStateDate time.Time
@@ -98,8 +95,6 @@ func (this *Alert) ContainsUpdates(other *Alert) bool {
result := false
result = result || this.Name != other.Name
result = result || this.Message != other.Message
result = result || this.NotifyOnce != other.NotifyOnce
result = result || (!other.NotifyOnce && this.NotifyFreq != other.NotifyFreq)
if this.Settings != nil && other.Settings != nil {
json1, err1 := this.Settings.Encode()
@@ -164,10 +159,6 @@ type SetAlertStateCommand struct {
Timestamp time.Time
}
type IncAlertEvalCommand struct {
AlertId int64
}
//Queries
type GetAlertsQuery struct {
OrgId int64
+54 -17
View File
@@ -7,32 +7,38 @@ import (
)
type AlertNotification struct {
Id int64 `json:"id"`
OrgId int64 `json:"-"`
Name string `json:"name"`
Type string `json:"type"`
IsDefault bool `json:"isDefault"`
Settings *simplejson.Json `json:"settings"`
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
Id int64 `json:"id"`
OrgId int64 `json:"-"`
Name string `json:"name"`
Type string `json:"type"`
NotifyOnce bool `json:"notifyOnce"`
Frequency time.Duration `json:"frequency"`
IsDefault bool `json:"isDefault"`
Settings *simplejson.Json `json:"settings"`
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
}
type CreateAlertNotificationCommand struct {
Name string `json:"name" binding:"Required"`
Type string `json:"type" binding:"Required"`
IsDefault bool `json:"isDefault"`
Settings *simplejson.Json `json:"settings"`
Name string `json:"name" binding:"Required"`
Type string `json:"type" binding:"Required"`
NotifyOnce bool `json:"notifyOnce" binding:"Required"`
Frequency time.Duration `json:"frequency"`
IsDefault bool `json:"isDefault"`
Settings *simplejson.Json `json:"settings"`
OrgId int64 `json:"-"`
Result *AlertNotification
}
type UpdateAlertNotificationCommand struct {
Id int64 `json:"id" binding:"Required"`
Name string `json:"name" binding:"Required"`
Type string `json:"type" binding:"Required"`
IsDefault bool `json:"isDefault"`
Settings *simplejson.Json `json:"settings" binding:"Required"`
Id int64 `json:"id" binding:"Required"`
Name string `json:"name" binding:"Required"`
Type string `json:"type" binding:"Required"`
NotifyOnce string `json:"notifyOnce" binding:"Required"`
Frequency string `json:"frequency"`
IsDefault bool `json:"isDefault"`
Settings *simplejson.Json `json:"settings" binding:"Required"`
OrgId int64 `json:"-"`
Result *AlertNotification
@@ -63,3 +69,34 @@ type GetAllAlertNotificationsQuery struct {
Result []*AlertNotification
}
type NotificationJournal struct {
Id int64
OrgId int64
AlertId int64
NotifierId int64
SentAt time.Time
Success bool
}
type RecordNotificationJournalCommand struct {
OrgId int64
AlertId int64
NotifierId int64
SentAt time.Time
Success bool
}
type GetLatestNotificationQuery struct {
OrgId int64
AlertId int64
NotifierId int64
Result *NotificationJournal
}
type CleanNotificationJournalCommand struct {
OrgId int64
AlertId int64
NotifierId int64
}