Documentation
¶
Overview ¶
Package hopperui is a web UI for hopper: an http.Handler that browses queues, jobs, history, workflows, subscriptions, stream consumers and clients, and can retry, cancel, delete, pause, resume and seek when the application allows it.
mux.Handle("/hopper/", http.StripPrefix("/hopper", hopperui.New(client, &hopperui.Config{
Prefix: "/hopper",
Authorize: func(r *http.Request, action hopperui.Action) error { return requireAdmin(r) },
})))
The UI is server-rendered HTML with no scripts and no external assets. Without an Authorize hook it is read-only.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Action ¶
type Action string
Action is something the UI does to the cluster on the operator's behalf.
type Config ¶
type Config struct {
// Prefix is the path the handler is mounted under ("/hopper"), used to
// build links. Mount with http.StripPrefix so the handler sees paths
// without it.
Prefix string
// Authorize is asked before every action; returning an error refuses
// it with 403. With no hook the UI is read-only.
Authorize func(r *http.Request, action Action) error
// Title is shown in the header. Defaults to "hopper".
Title string
// PageSize is how many jobs a page lists. Defaults to 50.
PageSize int
}
Config tunes the UI. A nil *Config means the defaults.
Click to show internal directories.
Click to hide internal directories.