hopperui

package module
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

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

func New

func New[TTx any](client *hopper.Client[TTx], cfg *Config) http.Handler

New returns the UI handler for a client. The client need not be started; an insert-only client works.

Types

type Action

type Action string

Action is something the UI does to the cluster on the operator's behalf.

const (
	ActionRetry  Action = "retry"
	ActionCancel Action = "cancel"
	ActionDelete Action = "delete"
	ActionPause  Action = "pause"
	ActionResume Action = "resume"
	ActionSeek   Action = "seek"
)

The actions Config.Authorize is asked about.

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.

Directories

Path Synopsis
cmd
hopperui command
Command hopperui serves the hopper web UI on its own, for operators who do not embed it in an application.
Command hopperui serves the hopper web UI on its own, for operators who do not embed it in an application.

Jump to

Keyboard shortcuts

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