feat(store): detect overlapping maintenance windows
CI / test (pull_request) Successful in 1m46s
CI / lint (pull_request) Successful in 1m16s
CI / vulncheck (pull_request) Successful in 56s

Warn via log when creating a maintenance window that overlaps with an
existing one for the same monitor, parent group, or global scope.
Handles both timed and indefinite windows.
This commit was merged in pull request #151.
This commit is contained in:
2026-06-27 10:58:43 -04:00
parent 5cc1a005ea
commit 3a089e7c1d
5 changed files with 150 additions and 1 deletions
+6 -1
View File
@@ -256,6 +256,11 @@ func (m *Model) submitMaintForm() tea.Cmd {
st := m.store
m.state = stateDashboard
return writeCmd("Add maintenance window", func() error {
return st.AddMaintenanceWindow(context.Background(), mw)
ctx := context.Background()
overlaps, _ := st.GetOverlappingMaintenanceWindows(ctx, mw.MonitorID, mw.StartTime, mw.EndTime)
if len(overlaps) > 0 {
_ = st.SaveLog(ctx, fmt.Sprintf("Overlap: new window %q overlaps with existing %q", mw.Title, overlaps[0].Title))
}
return st.AddMaintenanceWindow(ctx, mw)
})
}