feat: page long and truncated lists
ci / image (pull_request) Successful in 3m18s
ci / build (pull_request) Successful in 8m38s
ci / test (pull_request) Successful in 12m6s
ci / lint (pull_request) Successful in 15m0s

Lists that were cut off by a fixed LIMIT, or could grow without bound,
are paged by keyset: the cursor holds the sort key and an ID, so pages
neither skip nor repeat items as others are added. The audit logs had a
timestamp-only cursor that could skip entries with equal times.

The API returns at most 100 items per list (limit takes up to 500) with
next_cursor and prev_cursor, passed back as after and before. The
console shows Newer/Older (or Previous/Next) links and To the start,
without JavaScript.

Paged: incidents (optionally of one monitor), a monitor's results and
evidence, a checker's results, the audit logs, members, maintenance
windows, firing Alertmanager alerts, the monitors API and the admin
lists of status pages and organizations, which move to their own admin
pages. A monitor's page shows its latest incidents and results and links
to all of them. The dashboard caps every group at 50 of its own monitors
with a link to a paged view of the group, and gains a search by name or
target. Lists filtered by permission after reading may show fewer items
on a page.

Closes #116

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-22 21:40:25 +01:00
1 parent 98fb5d3a82
commit d7c5cd711e
63 files changed
+5427 -3041

No files matched your search

+27 -10
View File
@@ -20,11 +20,12 @@ type Querier interface {
AddMonitorRegion(ctx context.Context, arg AddMonitorRegionParams) error
AddStatusPageMonitor(ctx context.Context, arg AddStatusPageMonitorParams) error
// System scope: organizations with their usage, limit overrides and owner,
// newest first, matching search in name, slug or owner email.
// matching search in name, slug or owner email; newest first, a page from a
// keyset cursor.
AdminListOrgs(ctx context.Context, arg AdminListOrgsParams) ([]AdminListOrgsRow, error)
// System scope: public status pages and suspended ones, with their
// organization and its owner, newest first, matching search in title,
// slug, domain, organization or owner email.
// organization and its owner, matching search in title, slug, domain,
// organization or owner email; newest first, a page from a keyset cursor.
AdminListStatusPages(ctx context.Context, arg AdminListStatusPagesParams) ([]AdminListStatusPagesRow, error)
AgentInstancesByID(ctx context.Context, ids []uuid.UUID) ([]AgentInstancesByIDRow, error)
// System scope: enabled alertmanager monitors of org, with when they last
@@ -102,11 +103,16 @@ type Querier interface {
EnqueueNotification(ctx context.Context, arg EnqueueNotificationParams) error
// An empty name names a new region after its key and keeps an existing name.
EnsurePlatformRegion(ctx context.Context, arg EnsurePlatformRegionParams) (Region, error)
// Evidence of a monitor in a time span, to link results to it.
EvidenceBetween(ctx context.Context, arg EvidenceBetweenParams) ([]EvidenceBetweenRow, error)
// System scope: resolves a request to a page by verified custom domain or
// by slug.
FindPublishedPage(ctx context.Context, arg FindPublishedPageParams) (StatusPage, error)
// Alerts of org that fire and were repeated within the stale period.
FiringAlerts(ctx context.Context, arg FiringAlertsParams) ([]FiringAlertsRow, error)
// FiringAlerts newest first, a page from a keyset cursor (see paging.go)
// whose string key is the fingerprint.
FiringAlertsPage(ctx context.Context, arg FiringAlertsPageParams) ([]FiringAlertsPageRow, error)
// When each monitor and region first reported, to the day.
FirstDataDaily(ctx context.Context, orgID uuid.UUID) ([]FirstDataDailyRow, error)
// When each monitor and region first reported since $2, exactly. Used for
@@ -171,24 +177,36 @@ type Querier interface {
ListAlertGroups(ctx context.Context) ([]ListAlertGroupsRow, error)
ListAlertmanagerReceivers(ctx context.Context) ([]ListAlertmanagerReceiversRow, error)
ListAssignments(ctx context.Context, orgID uuid.UUID) ([]ListAssignmentsRow, error)
// Newest first, paged by time. kind narrows to one kind; the row policy
// already limits what the scope can see.
// Newest first, a page from a keyset cursor (see paging.go). kind narrows
// to one kind; the row policy already limits what the scope can see.
ListAuditEvents(ctx context.Context, arg ListAuditEventsParams) ([]ListAuditEventsRow, error)
ListChannels(ctx context.Context) ([]NotificationChannel, error)
// System scope: every enabled monitor with its regions, for reconciling the
// schedule.
ListEnabledMonitorsForSchedule(ctx context.Context) ([]ListEnabledMonitorsForScheduleRow, error)
ListEnabledSSOProviders(ctx context.Context) ([]ListEnabledSSOProvidersRow, error)
ListEvidence(ctx context.Context, monitorID uuid.UUID) ([]ListEvidenceRow, error)
// Newest first, a page from a keyset cursor (see paging.go).
ListEvidence(ctx context.Context, arg ListEvidenceParams) ([]ListEvidenceRow, error)
ListGroups(ctx context.Context) ([]MonitorGroup, error)
ListIncidents(ctx context.Context) ([]ListIncidentsRow, error)
// Newest first, a page from a keyset cursor (see paging.go); optionally of
// one monitor.
ListIncidents(ctx context.Context, arg ListIncidentsParams) ([]ListIncidentsRow, error)
ListMaintenance(ctx context.Context) ([]MaintenanceWindow, error)
// Latest start first, a page from a keyset cursor (see paging.go).
ListMaintenancePage(ctx context.Context, arg ListMaintenancePageParams) ([]MaintenanceWindow, error)
ListMaintenanceTargets(ctx context.Context) ([]MaintenanceTarget, error)
ListMonitors(ctx context.Context) ([]Monitor, error)
// By name, a page from a keyset cursor (see paging.go).
ListMonitorsPage(ctx context.Context, arg ListMonitorsPageParams) ([]Monitor, error)
ListOrgMembers(ctx context.Context, orgID uuid.UUID) ([]ListOrgMembersRow, error)
// By email, a page from a keyset cursor (see paging.go).
ListOrgMembersPage(ctx context.Context, arg ListOrgMembersPageParams) ([]ListOrgMembersPageRow, error)
ListOrgs(ctx context.Context) ([]Org, error)
ListPendingInvitations(ctx context.Context) ([]ListPendingInvitationsRow, error)
ListPlatformRegions(ctx context.Context) ([]Region, error)
// A monitor's results newest first, a page from a keyset cursor (see
// paging.go) whose string key is region and checker.
ListResults(ctx context.Context, arg ListResultsParams) ([]ListResultsRow, error)
ListRoles(ctx context.Context) ([]Role, error)
ListSSOProviders(ctx context.Context) ([]SsoProvider, error)
ListStatusPageGroups(ctx context.Context, pageID uuid.UUID) ([]StatusPageGroup, error)
@@ -213,7 +231,6 @@ type Querier interface {
MemberGrants(ctx context.Context, arg MemberGrantsParams) ([]MemberGrantsRow, error)
MonitorAlertGroups(ctx context.Context, monitorID uuid.UUID) ([]uuid.UUID, error)
MonitorAlertRoutes(ctx context.Context, monitorID uuid.UUID) ([]MonitorAlertRoutesRow, error)
MonitorIncidents(ctx context.Context, monitorID uuid.UUID) ([]Incident, error)
MonitorRegions(ctx context.Context, monitorID uuid.UUID) ([]uuid.UUID, error)
// System scope: monitors to hand to a checker of region, skipping ones that
// were disabled, deleted or moved out of the region since dispatch. An
@@ -251,7 +268,6 @@ type Querier interface {
RangeBucketsDaily(ctx context.Context, arg RangeBucketsDailyParams) ([]RangeBucketsDailyRow, error)
// The hourly aggregate rebucketed by width, for ranges of days.
RangeBucketsHourly(ctx context.Context, arg RangeBucketsHourlyParams) ([]RangeBucketsHourlyRow, error)
RecentResults(ctx context.Context, arg RecentResultsParams) ([]RecentResultsRow, error)
// One monitor's raw results per region.
RegionBuckets(ctx context.Context, arg RegionBucketsParams) ([]RegionBucketsRow, error)
RegionBucketsDaily(ctx context.Context, arg RegionBucketsDailyParams) ([]RegionBucketsDailyRow, error)
@@ -266,7 +282,8 @@ type Querier interface {
// Heartbeats of an organization wait afresh after its suspension, during
// which pings were refused.
RestartHeartbeatWait(ctx context.Context, orgID uuid.UUID) error
// The organization's latest results run by one checker instance.
// The organization's results run by one checker instance, newest first, a
// page from a keyset cursor whose string key is monitor and region.
ResultsByChecker(ctx context.Context, arg ResultsByCheckerParams) ([]ResultsByCheckerRow, error)
ScrubAuditEmail(ctx context.Context, email string) error
SetAgentAllowPrivate(ctx context.Context, arg SetAgentAllowPrivateParams) (int64, error)