webui

package
v3.8.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHashedFile

func RegisterHashedFile(original, hashed string)

RegisterHashedFile maps filenames to webpack generated hashed filenames

Types

type APIConfig

type APIConfig struct {
	Enabled bool   `json:"enabled" name:"enabled" description:"Enable this API"`
	BaseURL string `json:"base_url" name:"base-url" description:"Base URL to the HTTP API"`
}

APIConfig for upstream APIs.

func (APIConfig) MarshalJSON

func (c APIConfig) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

type AppTemplate

type AppTemplate struct {
	// contains filtered or unexported fields
}

AppTemplate wraps the application template for the web UI.

var Template *AppTemplate

Template for rendering the web UI. The context is expected to contain TemplateData as "template_data". The "app_config" will be rendered into the environment.

func NewAppTemplate

func NewAppTemplate(t *template.Template) *AppTemplate

NewAppTemplate instantiates a new application template for the web UI.

func (*AppTemplate) Handler

func (t *AppTemplate) Handler(c echo.Context) error

Handler is the echo.HandlerFunc that renders the web UI. The context is expected to contain TemplateData as "template_data". The "app_config" and "page_data" will be rendered into the environment.

func (*AppTemplate) Render

func (t *AppTemplate) Render(w io.Writer, _ string, pageData interface{}, c echo.Context) error

Render is the echo.Renderer that renders the web UI.

func (*AppTemplate) RenderError

func (t *AppTemplate) RenderError(c echo.Context, statusCode int, err error) error

RenderError implements web.ErrorRenderer.

type Data

type Data struct {
	TemplateData
	AppConfig interface{}
	PageData  interface{}
}

Data contains data to render templates.

type TemplateData

type TemplateData struct {
	SiteName        string   `name:"site-name" description:"The site name"`
	Title           string   `name:"title" description:"The page title"`
	SubTitle        string   `name:"sub-title" description:"The page sub-title"`
	Description     string   `name:"descriptions" description:"The page description"`
	Language        string   `name:"language" description:"The page language"`
	ThemeColor      string   `name:"theme-color" description:"The page theme color"`
	CanonicalURL    string   `name:"canonical-url" description:"The page canonical URL"`
	AssetsBaseURL   string   `name:"assets-base-url" description:"The base URL to the page assets"`
	BrandingBaseURL string   `name:"branding-base-url" description:"The base URL to the branding assets"`
	IconPrefix      string   `name:"icon-prefix" description:"The prefix to put before the page icons (favicon.ico, touch-icon.png, og-image.png)"`
	CSSFiles        []string `name:"css-file" description:"The names of the CSS files"`
	JSFiles         []string `name:"js-file" description:"The names of the JS files"`
	SentryDSN       string   `name:"sentry-dsn" description:"The Sentry DSN"`
}

TemplateData contains data to use in the App template.

func (TemplateData) MountPath

func (t TemplateData) MountPath() string

MountPath derives the mount path from the canonical URL of the config.

Jump to

Keyboard shortcuts

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