webui

package
v1.0.1-1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2019 License: GPL-3.0 Imports: 28 Imported by: 0

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 (
	AssetLookups = []assetLookup{Asset}
)
View Source
var (
	DefaultTabs = []Tab{
		{"Home", "/"},
		{"Busy", "/busy"},
		{"Queues", "/queues"},
		{"Retries", "/retries"},
		{"Scheduled", "/scheduled"},
		{"Dead", "/morgue"},
	}
)
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

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 Timeago

func Timeago(t time.Time) string

Types

type AssetDirectory

type AssetDirectory struct {
	AssetFile
	ChildrenRead int
	Children     []os.FileInfo
}

func NewAssetDirectory

func NewAssetDirectory(name string, children []string, fs *AssetFS) *AssetDirectory

func (*AssetDirectory) Readdir

func (f *AssetDirectory) Readdir(count int) ([]os.FileInfo, error)

func (*AssetDirectory) Stat

func (f *AssetDirectory) Stat() (os.FileInfo, error)

type AssetFS

type AssetFS struct {
	Asset    func(path string) ([]byte, error)
	AssetDir func(path string) ([]string, error)
	Prefix   string
}

func (*AssetFS) Open

func (fs *AssetFS) Open(name string) (http.File, error)

type AssetFile

type AssetFile struct {
	*bytes.Reader
	io.Closer
	*DummyFile
}

func NewAssetFile

func NewAssetFile(name string, content []byte) *AssetFile

func (*AssetFile) Readdir

func (f *AssetFile) Readdir(count int) ([]os.FileInfo, error)

func (*AssetFile) Size

func (f *AssetFile) Size() int64

func (*AssetFile) Stat

func (f *AssetFile) Stat() (os.FileInfo, error)

type Context

type Context interface {
	context.Context

	Request() string
	Response() string
}

type DefaultContext

type DefaultContext struct {
	context.Context
	// contains filtered or unexported fields
}

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

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

func (*DefaultContext) Store

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

func (*DefaultContext) Translation

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

func (*DefaultContext) UseCsrf

func (d *DefaultContext) UseCsrf() bool

type DummyFile

type DummyFile struct {
	Path string
	Dir  bool
	Len  int64
}

func (*DummyFile) IsDir

func (f *DummyFile) IsDir() bool

func (*DummyFile) ModTime

func (f *DummyFile) ModTime() time.Time

func (*DummyFile) Mode

func (f *DummyFile) Mode() os.FileMode

func (*DummyFile) Name

func (f *DummyFile) Name() string

func (*DummyFile) Size

func (f *DummyFile) Size() int64

func (*DummyFile) Sys

func (f *DummyFile) Sys() interface{}

type Lifecycle

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

func Subsystem

func Subsystem(binding string) *Lifecycle

func (*Lifecycle) Name

func (l *Lifecycle) Name() string

func (*Lifecycle) Reload

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

func (*Lifecycle) Shutdown

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

func (*Lifecycle) Start

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

type Options

type Options struct {
	Binding    string
	Password   string
	EnableCSRF bool
}

type Queue

type Queue struct {
	Name string
	Size uint64
}

type Tab

type Tab struct {
	Name string
	Path string
}

type Translator

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

type WebUI

type WebUI struct {
	Options Options
	Server  *server.Server
	Mux     *http.ServeMux
}

func (*WebUI) Run

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

Jump to

Keyboard shortcuts

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