handlers

package
v0.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BumpHandler added in v0.9.0

func BumpHandler(mgr *heartbeat.Manager, hist history.Store, logger *slog.Logger) http.Handler

BumpHandler handles POST/GET /heartbeat/{id}.

func FailHandler added in v0.9.0

func FailHandler(mgr *heartbeat.Manager, hist history.Store, logger *slog.Logger) http.Handler

FailHandler handles POST/GET /heartbeat/{id}/fail.

func Healthz

func Healthz() http.HandlerFunc

Healthz returns the HTTP handler for the /healthz endpoint.

func HomeHandler added in v0.9.0

func HomeHandler(webFS fs.FS, version string) http.HandlerFunc

HomeHandler renders the base template with navbar and footer.

func Metrics added in v0.9.0

func Metrics() http.HandlerFunc

Metrics returns the HTTP handler for the /metrics endpoint.

func PartialHandler added in v0.9.0

func PartialHandler(
	webFS fs.FS,
	siteRoot string,
	mgr *heartbeat.Manager,
	hist history.Store,
	disp *notifier.Dispatcher,
	logger *slog.Logger,
) http.HandlerFunc

PartialHandler serves HTML snippets for dashboard sections: heartbeats, receivers, history.

Types

type HeartbeatView added in v0.9.0

type HeartbeatView struct {
	ID              string
	Status          string
	Description     string
	Interval        string
	IntervalSeconds float64 // for table sorting
	Grace           string
	GraceSeconds    float64 // for table sorting
	LastBump        time.Time
	URL             string // full URL to copy
	Receivers       []string
	HasHistory      bool
}

type HistoryView added in v0.9.0

type HistoryView struct {
	Timestamp   time.Time
	Type        string // EventType
	HeartbeatID string
	Details     string // e.g. "Notification Sent", "old → new", or blank
}

HistoryView is what the template actually sees. Details is already formatted for display.

type ReceiverView added in v0.9.0

type ReceiverView struct {
	ID          string // receiver ID
	Type        string // "slack", "email", etc.
	Destination string // e.g. channel name, email addrs
	LastSent    time.Time
	LastErr     error
}

ReceiverView for rendering each notifier instance.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL