dashboard

package
v5.3.3-pre21 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: AGPL-3.0 Imports: 5 Imported by: 5

README

后台仪表盘

Documentation

Index

Constants

View Source
const (
	TypeCards          = `Cards`
	TypeBlocks         = `Blocks`
	TypeGlobalHeads    = `GlobalHeads`
	TypeGlobalFooters  = `GlobalFooters`
	TypeTopButtons     = `TopButtons`
	TypeGroupedButtons = `GroupedButtons`
)

Variables

View Source
var Default = &Dashboards{
	Backend: &Dashboard{
		Cards:         cards,
		Blocks:        &blocks,
		GlobalHeads:   &globalHeads,
		GlobalFooters: &globalFooters,
		TopButtons:    &topButtons,
		Extend:        map[string]*Dashboard{},
	},
	Frontend: &Dashboard{
		Extend: map[string]*Dashboard{},
	},
}

Functions

func BlockAdd

func BlockAdd(index int, block ...*Block)

func BlockRegister

func BlockRegister(block ...*Block)

func BlockRemove

func BlockRemove(index int)

BlockRemove 删除元素

func BlockSet

func BlockSet(index int, list ...*Block)

BlockSet 设置元素

func CardAdd

func CardAdd(index int, card ...*Card)

func CardRegister

func CardRegister(card ...*Card)

func CardRemove

func CardRemove(index int)

CardRemove 删除元素

func CardSet

func CardSet(index int, list ...*Card)

CardSet 设置元素

func GlobalFooterAdd

func GlobalFooterAdd(index int, footer ...*GlobalFooter)

func GlobalFooterRegister

func GlobalFooterRegister(footer ...*GlobalFooter)

func GlobalFooterRemove

func GlobalFooterRemove(index int)

GlobalFooterRemove 删除元素

func GlobalFooterSet

func GlobalFooterSet(index int, list ...*GlobalFooter)

GlobalFooterSet 设置元素

func GlobalHeadAdd

func GlobalHeadAdd(index int, footer ...*GlobalHead)

func GlobalHeadRegister

func GlobalHeadRegister(footer ...*GlobalHead)

func GlobalHeadRemove

func GlobalHeadRemove(index int)

GlobalHeadRemove 删除元素

func GlobalHeadSet

func GlobalHeadSet(index int, list ...*GlobalHead)

GlobalHeadSet 设置元素

func TopButtonAdd

func TopButtonAdd(index int, topButton ...*Button)

func TopButtonFindTmpl

func TopButtonFindTmpl(tmpl string) int

func TopButtonRegister

func TopButtonRegister(topButton ...*Button)

func TopButtonRemove

func TopButtonRemove(index int)

TopButtonRemove 删除元素

func TopButtonRemoveByTmpl

func TopButtonRemoveByTmpl(tmpl string)

func TopButtonSearch

func TopButtonSearch(cb func(*Button) bool) int

func TopButtonSet

func TopButtonSet(index int, list ...*Button)

TopButtonSet 设置元素

Types

type Block

type Block struct {
	Title  string `json:",omitempty" xml:",omitempty"` // 标题
	Ident  string `json:",omitempty" xml:",omitempty"` // 英文标识
	Extra  echo.H `json:",omitempty" xml:",omitempty"` // 附加数据
	Hidden sql.NullBool
	Tmpl   string //模板文件
	Footer string //页脚模板文件
	// contains filtered or unexported fields
}

func NewBlock

func NewBlock(content func(echo.Context) error) *Block

func (*Block) IsHidden

func (c *Block) IsHidden(ctx echo.Context) (hidden bool)

func (*Block) Ready

func (c *Block) Ready(ctx echo.Context) error

func (*Block) SetContentGenerator

func (c *Block) SetContentGenerator(content func(echo.Context) error) *Block

func (*Block) SetExtra

func (c *Block) SetExtra(extra echo.H) *Block

func (*Block) SetExtraKV

func (c *Block) SetExtraKV(key string, value interface{}) *Block

func (*Block) SetFooter

func (c *Block) SetFooter(footer string) *Block

func (*Block) SetHidden

func (c *Block) SetHidden(hidden bool) *Block

func (*Block) SetHiddenDetector

func (c *Block) SetHiddenDetector(hidden func(echo.Context) bool) *Block

func (*Block) SetIdent

func (c *Block) SetIdent(ident string) *Block

func (*Block) SetTitle

func (c *Block) SetTitle(title string) *Block

func (*Block) SetTmpl

func (c *Block) SetTmpl(tmpl string) *Block

type Blocks

type Blocks []*Block

func BlockAll

func BlockAll(ctx echo.Context) Blocks

func (*Blocks) Add

func (c *Blocks) Add(index int, list ...*Block)

Add 添加列表项

func (*Blocks) FindTmpl

func (c *Blocks) FindTmpl(tmpl string) int

func (*Blocks) Ready

func (c *Blocks) Ready(ctx echo.Context) error

func (*Blocks) Remove

func (c *Blocks) Remove(index int)

Remove 删除元素

func (*Blocks) RemoveByTmpl

func (c *Blocks) RemoveByTmpl(tmpl string)

func (*Blocks) Search

func (c *Blocks) Search(cb func(*Block) bool) int

func (*Blocks) Set

func (c *Blocks) Set(index int, list ...*Block)

Set 设置元素

func (*Blocks) Size

func (c *Blocks) Size() int

type Button

type Button = Tmplx

func NewButton

func NewButton(tmpl string, handle ...func(echo.Context) error) *Button

type Buttons

type Buttons = Tmplxs

func TopButtonAll

func TopButtonAll(_ echo.Context) Buttons

type Card

type Card struct {
	IconName  string      //图标名称:fa-tasks
	IconColor string      //图标颜色:primary、success、danger、warning、info
	Short     string      //简称
	Name      string      //中文名称
	Summary   string      //说明
	Content   interface{} //数字等内容
	Hidden    sql.NullBool
	// contains filtered or unexported fields
}

func NewCard

func NewCard(content func(echo.Context) interface{}) *Card

func (*Card) Build

func (c *Card) Build(ctx echo.Context) *Card

func (*Card) IsHidden

func (c *Card) IsHidden(ctx echo.Context) (hidden bool)

func (*Card) SetContentGenerator

func (c *Card) SetContentGenerator(content func(echo.Context) interface{}) *Card

func (*Card) SetHidden

func (c *Card) SetHidden(hidden bool) *Card

func (*Card) SetHiddenDetector

func (c *Card) SetHiddenDetector(hidden func(echo.Context) bool) *Card

type Cards

type Cards []*Card

func CardAll

func CardAll(_ echo.Context) *Cards

func (*Cards) Add

func (c *Cards) Add(index int, list ...*Card)

func (*Cards) Build

func (c *Cards) Build(ctx echo.Context) Cards

func (*Cards) FindShort

func (c *Cards) FindShort(short string) int

func (*Cards) Remove

func (c *Cards) Remove(index int)

Remove 删除元素

func (*Cards) RemoveByShort

func (c *Cards) RemoveByShort(tmpl string)

func (*Cards) Search

func (c *Cards) Search(cb func(*Card) bool) int

func (*Cards) Set

func (c *Cards) Set(index int, list ...*Card)

Set 设置元素

func (*Cards) Size

func (c *Cards) Size() int

type Dashboard

type Dashboard struct {
	Cards          *Cards
	Blocks         *Blocks
	GlobalHeads    *GlobalHeads
	GlobalFooters  *GlobalFooters
	TopButtons     *Buttons
	GroupedButtons map[string]*Buttons
	Extend         map[string]*Dashboard
}

func New added in v5.1.1

func New() *Dashboard

func (*Dashboard) Get added in v5.1.1

func (d *Dashboard) Get(c echo.Context, dtype string) interface{}

func (*Dashboard) GetButtonsByGroup added in v5.1.1

func (d *Dashboard) GetButtonsByGroup(group string) (btn *Buttons)

func (*Dashboard) GetExtend added in v5.1.1

func (d *Dashboard) GetExtend(name string) (dashboard *Dashboard)

func (*Dashboard) GetOrNewExtend added in v5.1.1

func (d *Dashboard) GetOrNewExtend(name string) (dashboard *Dashboard)

func (*Dashboard) GetOrNewGroupedButtons added in v5.1.1

func (d *Dashboard) GetOrNewGroupedButtons(name string) (btn *Buttons)

func (*Dashboard) SetExtend added in v5.1.1

func (d *Dashboard) SetExtend(name string, dashboard *Dashboard)

func (*Dashboard) SetGroupedButtons added in v5.1.1

func (d *Dashboard) SetGroupedButtons(group string, btn *Buttons)

type Dashboards

type Dashboards struct {
	Backend  *Dashboard
	Frontend *Dashboard
}
type GlobalFooter = Tmplx

func NewGlobalFooter

func NewGlobalFooter(tmpl string, handle ...func(echo.Context) error) *GlobalFooter

type GlobalFooters

type GlobalFooters = Tmplxs

func GlobalFooterAll

func GlobalFooterAll(_ echo.Context) GlobalFooters
type GlobalHead = Tmplx

func NewGlobalHead

func NewGlobalHead(tmpl string, handle ...func(echo.Context) error) *GlobalHead

type GlobalHeads

type GlobalHeads = Tmplxs

func GlobalHeadAll

func GlobalHeadAll(_ echo.Context) GlobalHeads

type IReady added in v5.1.1

type IReady interface {
	Ready(ctx echo.Context) error
}

type IsHidden

type IsHidden interface {
	IsHidden(ctx echo.Context) (hidden bool)
}

type Page

type Page struct {
	Key   string
	Tmpls map[string][]string
	// contains filtered or unexported fields
}

func NewPage

func NewPage(key string, atmpls ...map[string][]string) *Page

func (*Page) AddTmpl

func (s *Page) AddTmpl(position string, tmpl ...string) *Page

func (*Page) Fire

func (s *Page) Fire(ctx echo.Context) error

func (*Page) On

func (s *Page) On(method string, hook func(echo.Context) error) *Page

func (*Page) Tmpl

func (s *Page) Tmpl(position string) []string

type Tmplx

type Tmplx struct {
	Tmpl string //模板文件
	// contains filtered or unexported fields
}

func NewTmplx

func NewTmplx(tmpl string, handle ...func(echo.Context) error) *Tmplx

func (*Tmplx) Ready

func (c *Tmplx) Ready(ctx echo.Context) error

func (*Tmplx) SetContentGenerator

func (c *Tmplx) SetContentGenerator(content func(echo.Context) error) *Tmplx

func (*Tmplx) SetTmpl

func (c *Tmplx) SetTmpl(tmpl string) *Tmplx

type Tmplxs

type Tmplxs []*Tmplx

func (*Tmplxs) Add

func (c *Tmplxs) Add(index int, list ...*Tmplx)

func (*Tmplxs) FindTmpl

func (c *Tmplxs) FindTmpl(tmpl string) int

func (*Tmplxs) Ready

func (c *Tmplxs) Ready(ctx echo.Context) error

func (*Tmplxs) Remove

func (c *Tmplxs) Remove(index int)

Remove 删除元素

func (*Tmplxs) RemoveByTmpl

func (c *Tmplxs) RemoveByTmpl(tmpl string)

func (*Tmplxs) Search

func (c *Tmplxs) Search(cb func(*Tmplx) bool) int

func (*Tmplxs) Set

func (c *Tmplxs) Set(index int, list ...*Tmplx)

Set 设置元素

func (*Tmplxs) Size

func (c *Tmplxs) Size() int

Jump to

Keyboard shortcuts

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