dashboard

package
v0.6.11 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: AGPL-3.0 Imports: 6 Imported by: 11

README

后台仪表盘

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func Render

func Render(ctx echo.Context, tmpl string, data interface{}) template.HTML

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 (*Blocks) Add

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

Add 添加列表项

func (Blocks) All

func (c Blocks) All(ctx echo.Context) Blocks

func (*Blocks) FindTmpl

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

func (*Blocks) Ready

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

func (*Blocks) Register

func (c *Blocks) Register(block ...*Block)

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

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 (*Cards) Add

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

func (*Cards) All

func (c *Cards) All(_ echo.Context) *Cards

func (*Cards) Build

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

func (*Cards) FindShort

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

func (*Cards) Register

func (c *Cards) Register(card ...*Card)

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

func New() *Dashboard

func (*Dashboard) Get

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

func (*Dashboard) GetButtonsByGroup

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

func (*Dashboard) GetExtend

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

func (*Dashboard) GetOrNewExtend

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

func (*Dashboard) GetOrNewGroupedButtons

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

func (*Dashboard) SetExtend

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

func (*Dashboard) SetGroupedButtons

func (d *Dashboard) SetGroupedButtons(group string, btn *Buttons)
type GlobalFooter = Tmplx

func NewGlobalFooter

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

type GlobalFooters

type GlobalFooters = Tmplxs
type GlobalHead = Tmplx

func NewGlobalHead

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

type GlobalHeads

type GlobalHeads = Tmplxs

type IReady

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) Render

func (c Tmplx) Render(ctx echo.Context) template.HTML

func (*Tmplx) SetContentGenerator

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

func (*Tmplx) SetTmpl

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

func (*Tmplx) SetTmplNamer

func (c *Tmplx) SetTmplNamer(tmplNamer func(echo.Context) string) *Tmplx

type Tmplxs

type Tmplxs []*Tmplx

func (*Tmplxs) Add

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

func (Tmplxs) All

func (c Tmplxs) All(_ echo.Context) Tmplxs

func (Tmplxs) ButtonAll

func (c Tmplxs) ButtonAll(_ echo.Context) Buttons

func (*Tmplxs) FindTmpl

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

func (Tmplxs) FooterAll

func (c Tmplxs) FooterAll(_ echo.Context) GlobalFooters

func (Tmplxs) HeadAll

func (c Tmplxs) HeadAll(_ echo.Context) GlobalHeads

func (*Tmplxs) Ready

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

func (*Tmplxs) Register

func (c *Tmplxs) Register(footer ...*GlobalFooter)

func (*Tmplxs) Remove

func (c *Tmplxs) Remove(index int)

Remove 删除元素

func (*Tmplxs) RemoveByTmpl

func (c *Tmplxs) RemoveByTmpl(tmpl string)

func (Tmplxs) Render

func (c Tmplxs) Render(ctx echo.Context) template.HTML

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