feat(alerting): add quiet hours to alert groups
ci / image (pull_request) Successful in 6m35s
ci / test (pull_request) Successful in 7m56s
ci / build (pull_request) Successful in 8m24s
ci / lint (pull_request) Successful in 11m55s

This commit is contained in:
Sebastian Unterschütz committed 2026-11-22 19:18:23 +01:00
1 parent bf529a7711
commit ee3769f578
21 files changed
+1310 -130

No files matched your search

+10 -1
View File
@@ -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