ui

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UserInterfaceArgs

type UserInterfaceArgs struct {
	Title                   string
	LogoURL                 string
	LogoDescription         string
	ActionEndpoint          string
	Message                 string
	MessageType             string
	PublicLinks             []UserInterfaceLink
	PrivateLinks            []UserInterfaceLink
	Realms                  []UserRealm
	Authenticated           bool
	Data                    map[string]interface{}
	RegistrationEnabled     bool
	PasswordRecoveryEnabled bool
	MfaEnabled              bool
}

UserInterfaceArgs is a collection of page attributes that needs to be passed to Render method.

type UserInterfaceFactory

type UserInterfaceFactory struct {
	//TemplatePrefix  string                            `json:"template_prefix,omitempty"`
	Templates               map[string]*UserInterfaceTemplate `json:"templates,omitempty"`
	Title                   string                            `json:"title,omitempty"`
	LogoURL                 string                            `json:"logo_url,omitempty"`
	LogoDescription         string                            `json:"logo_description,omitempty"`
	RegistrationEnabled     bool                              `json:"registration_enabled,omitempty"`
	PasswordRecoveryEnabled bool                              `json:"password_recovery_enabled,omitempty"`
	MfaEnabled              bool                              `json:"mfa_enabled,omitempty"`
	// The links visible to anonymoous user
	PublicLinks []UserInterfaceLink `json:"public_links,omitempty"`
	// The links visible to authenticated user
	PrivateLinks []UserInterfaceLink `json:"private_links,omitempty"`
	// The authentication realms/domains
	Realms []UserRealm `json:"realms,omitempty"`
	// The pass to authentication endpoint. This is where
	// user credentials will be passed to via POST.
	ActionEndpoint string `json:"-"`
}

UserInterfaceFactory represents a collection of HTML templates and associated methods for the creation of HTML user interfaces.

func NewUserInterfaceFactory

func NewUserInterfaceFactory() *UserInterfaceFactory

NewUserInterfaceFactory return an instance of a user interface factory.

func (*UserInterfaceFactory) AddBuiltinTemplate

func (f *UserInterfaceFactory) AddBuiltinTemplate(name string) error

AddBuiltinTemplate adds a built-in template to UserInterfaceFactory

func (*UserInterfaceFactory) AddBuiltinTemplates

func (f *UserInterfaceFactory) AddBuiltinTemplates() error

AddBuiltinTemplates adds all built-in template to UserInterfaceFactory

func (*UserInterfaceFactory) AddTemplate

func (f *UserInterfaceFactory) AddTemplate(s, tp string) error

AddTemplate adds a template to UserInterfaceFactory.

func (*UserInterfaceFactory) DeleteTemplates

func (f *UserInterfaceFactory) DeleteTemplates()

DeleteTemplates removes all templates from UserInterfaceFactory.

func (*UserInterfaceFactory) GetArgs

GetArgs return an instance of UserInterfaceArgs. Upon the receipt of the arguments, they can be manipulated and passed to UserInterfaceFactory.Render method. The manipulation means adding an error message, appending to the title of a page, adding arbitrary data etc.

func (*UserInterfaceFactory) Render

func (f *UserInterfaceFactory) Render(name string, args *UserInterfaceArgs) (*bytes.Buffer, error)

Render returns a pointer to a data buffer.

type UserInterfaceLink struct {
	Link  string `json:"link,omitempty"`
	Title string `json:"title,omitempty"`
	Style string `json:"style,omitempty"`
}

UserInterfaceLink represents a single HTML link.

type UserInterfaceTemplate

type UserInterfaceTemplate struct {
	Alias string `json:"alias,omitempty"`
	// Path could be `inline`, URL path, or file path
	Path     string             `json:"path,omitempty"`
	Template *template.Template `json:"-"`
}

UserInterfaceTemplate represents a user interface instance, e.g. a single HTML page.

func NewUserInterfaceTemplate

func NewUserInterfaceTemplate(s, tp string) (*UserInterfaceTemplate, error)

NewUserInterfaceTemplate returns a user interface template

type UserRealm

type UserRealm struct {
	Name  string `json:"name,omitempty"`
	Label string `json:"label,omitempty"`
}

UserRealm represents a single authentication realm/domain.

Jump to

Keyboard shortcuts

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