Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Banners ¶
type Banners struct { observable.Implementation // contains filtered or unexported fields }
Banners fetches banner information from remote.
func NewBanners ¶
NewBanners makes a new Banners instance.
func (*Banners) Activate ¶
func (banners *Banners) Activate(key MessageKey)
Activate invokes showing the message for the given key.
func (*Banners) Deactivate ¶
func (banners *Banners) Deactivate(key MessageKey)
Deactivate removes the message key from the active map and makes the frontend reload the banner.
func (*Banners) GetMessage ¶
func (banners *Banners) GetMessage(key MessageKey) *Message
GetMessage gets a message for a key if it was activated. nil otherwise, or if no msg exists.
type Message ¶
type Message struct { // map of language code to message. Message map[string]string `json:"message"` // ID is a unique id of the message. ID string `json:"id"` // Link, if present, will be appended to the message. Link *struct { Href string `json:"href"` Text *string `json:"text"` } `json:"link"` // Dismissible: if true the ID field will be the key of config.frontend map to keep // trace of dismissed banners (see status.tsx for details). Dismissible *bool `json:"dismissible"` Type *TypeCode `json:"type"` }
Message is one entry in the banners json.
type MessageKey ¶
type MessageKey string
MessageKey enumerates the possible keys in the banners json.
const ( // KeyBitBox01 is the message key for the event when a BitBox01 gets connected. KeyBitBox01 MessageKey = "bitbox01" // KeyBitBox02 is the message key for the event when a BitBox02 gets connected. KeyBitBox02 MessageKey = "bitbox02" // KeyBitBox02Nova is the message key for the event when a BitBox02 Nova gets connected. KeyBitBox02Nova MessageKey = "bitbox02nova" )
type TypeCode ¶
type TypeCode string
TypeCode determines the type of banner.
const ( // TypeWarning means the banner will be shown and styled as a warning. TypeWarning TypeCode = "warning" // TypeSuccess means the banner will be shown and styled as a success message. TypeSuccess TypeCode = "success" // TypeInfo means the banner will be shown and styled as an info. TypeInfo TypeCode = "info" )
Click to show internal directories.
Click to hide internal directories.