New field to disable a repeated alarm
All checks were successful
continuous-integration/drone/tag Build is passing
continuous-integration/drone/push Build is passing

This commit is contained in:
nemunaire 2022-12-15 18:45:20 +01:00
commit 5526940e61
4 changed files with 13 additions and 1 deletions

View file

@ -149,6 +149,7 @@ type AlarmRepeated struct {
FollowingRoutines []Identifier `json:"routines"`
IgnoreExceptions bool `json:"ignore_exceptions"`
Comment string `json:"comment,omitempty"`
Disabled bool `json:"disabled,omitempty"`
Excepts Exceptions `json:"excepts,omitempty"`
NextTime *time.Time `json:"next_time,omitempty"`
}
@ -185,6 +186,10 @@ func (a *AlarmRepeated) FillExcepts(cfg *config.Config, db *LevelDBStorage) erro
}
func (a *AlarmRepeated) GetNextOccurence(cfg *config.Config, db *LevelDBStorage) *time.Time {
if a.Disabled {
return nil
}
if len(a.Excepts) == 0 {
a.FillExcepts(cfg, db)
}