feat(alerting): add quiet hours to alert groups
This commit is contained in:
1 parent
bf529a7711
commit
ee3769f578
21 files changed
+1310
-130
No files matched your search
+10
-1
@@ -770,11 +770,20 @@ func (s *Server) channelsView(c *gin.Context, p *principal, page web.Page, me we
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
now := time.Now()
|
||||
for _, g := range groups {
|
||||
row := web.AlertGroupRow{ID: g.ID.String(), Name: g.Name, Default: g.IsDefault}
|
||||
qh := decodeQuietHours(g.QuietHours)
|
||||
row := web.AlertGroupRow{ID: g.ID.String(), Name: g.Name, Default: g.IsDefault, QuietNow: isQuietAt(qh, now)}
|
||||
for _, ch := range rows {
|
||||
row.Channels = append(row.Channels, web.AlertGroupOption{ID: ch.ID.String(), Name: ch.Name, Checked: slices.Contains(g.ChannelIds, ch.ID)})
|
||||
}
|
||||
for _, w := range qh {
|
||||
days := map[int]bool{}
|
||||
for _, d := range w.Weekdays {
|
||||
days[d] = true
|
||||
}
|
||||
row.QuietHours = append(row.QuietHours, web.AlertGroupQuietRow{Start: w.Start, End: w.End, TimeZone: w.TimeZone, Weekdays: days})
|
||||
}
|
||||
v.AlertGroups = append(v.AlertGroups, row)
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user