webui

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: AGPL-3.0 Imports: 27 Imported by: 13

Documentation

Overview

Copyright (c) 2016 Justin Campbell

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultTabs = []Tab{
		{"Home", "/"},
		{"Busy", "/busy"},
		{"Queues", "/queues"},
		{"Retries", "/retries"},
		{"Scheduled", "/scheduled"},
		{"Dead", "/morgue"},
	}

	LicenseStatus = func(w io.Writer, req *http.Request) string {
		return ""
	}
)
View Source
var (
	AssetLookups = []assetLookup{
		localeFiles.ReadFile,
	}
)
View Source
var (
	LAST_ELEMENT = regexp.MustCompile(`/([^/]+)\z`)
)

Functions

func DebugLog

func DebugLog(ui *WebUI, pass http.HandlerFunc) http.HandlerFunc

The stats handler is hit a lot and adds much noise to the log, quiet it down.

func GetOnly

func GetOnly(h http.HandlerFunc) http.HandlerFunc

func Layout added in v1.5.0

func Layout(w io.Writer, req *http.Request, yield func())

func Log

func Log(ui *WebUI, pass http.HandlerFunc) http.HandlerFunc

func PostOnly

func PostOnly(h http.HandlerFunc) http.HandlerFunc

func Proxy added in v1.5.0

func Proxy(ui *WebUI) http.HandlerFunc

func Redirect added in v1.5.0

func Redirect(w http.ResponseWriter, r *http.Request, path string, code int)

func Timeago

func Timeago(t time.Time) string

Types

type Context

type Context interface {
	context.Context

	Request() string
	Response() string
}

type DefaultContext

type DefaultContext struct {
	context.Context

	Root string
	// contains filtered or unexported fields
}

func NewContext added in v1.5.0

func NewContext(ui *WebUI, req *http.Request, resp http.ResponseWriter) *DefaultContext

func (*DefaultContext) Locale

func (d *DefaultContext) Locale() string

func (*DefaultContext) Request

func (d *DefaultContext) Request() *http.Request

func (*DefaultContext) Response

func (d *DefaultContext) Response() http.ResponseWriter

func (*DefaultContext) Server added in v1.5.0

func (d *DefaultContext) Server() *server.Server

func (*DefaultContext) Store added in v1.5.0

func (d *DefaultContext) Store() storage.Store

func (*DefaultContext) Translation

func (d *DefaultContext) Translation(str string) string

func (*DefaultContext) UseCsrf added in v1.5.0

func (d *DefaultContext) UseCsrf() bool

type Lifecycle added in v1.5.0

type Lifecycle struct {
	WebUI *WebUI
	// contains filtered or unexported fields
}

func Subsystem added in v1.5.0

func Subsystem(binding string) *Lifecycle

func (*Lifecycle) Name added in v1.5.0

func (l *Lifecycle) Name() string

func (*Lifecycle) Reload added in v1.5.0

func (l *Lifecycle) Reload(s *server.Server) error

func (*Lifecycle) Shutdown added in v1.5.0

func (l *Lifecycle) Shutdown(s *server.Server) error

func (*Lifecycle) Start added in v1.5.0

func (l *Lifecycle) Start(s *server.Server) error

type Options added in v1.5.0

type Options struct {
	Binding    string
	Password   string
	EnableCSRF bool
}

type Queue

type Queue struct {
	Name     string
	Size     uint64
	IsPaused bool
}

type Tab

type Tab struct {
	Name string
	Path string
}

type Translator added in v1.5.0

type Translator interface {
	Locale() string
	Translation(string) string
}

type WebUI added in v1.5.0

type WebUI struct {
	Options     Options
	Server      *server.Server
	App         *http.ServeMux
	Title       string
	ExtraCssUrl string
	// contains filtered or unexported fields
}

func (*WebUI) Run added in v1.5.0

func (ui *WebUI) Run() (func(), error)

Jump to

Keyboard shortcuts

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