component

package
v1.6.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KeyHelp corresponding value of keyboard key "?"
	KeyHelp = 63
	// KeySlash corresponding value of keyboard key "/"
	KeySlash = 47
	// KeyColon corresponding value of keyboard key ":"
	KeyColon = 58
	// KeySpace corresponding value of keyboard key "SPACE"
	KeySpace = 32
)
View Source
const (
	KeyA tcell.Key = iota + 97
	KeyB
	KeyC
	KeyD
	KeyE
	KeyF
	KeyG
	KeyH
	KeyI
	KeyJ
	KeyK
	KeyL
	KeyM
	KeyN
	KeyO
	KeyP
	KeyQ
	KeyR
	KeyS
	KeyT
	KeyU
	KeyV
	KeyW
	KeyX
	KeyY
	KeyZ
)

Defines char keystrokes.

Variables

This section is empty.

Functions

func StandardizeKey

func StandardizeKey(event *tcell.EventKey) tcell.Key

StandardizeKey standardized combined key event and return corresponding key

Types

type App

type App struct {
	*tview.Application

	Main *Pages
	// contains filtered or unexported fields
}

App represent the ui of application

func NewApp

func NewApp() *App

NewApp return the ui of application

func (*App) AddAction

func (a *App) AddAction(actions model.KeyActions)

AddAction add a new keyAction

func (*App) Components

func (a *App) Components() map[string]tview.Primitive

Components return the application root components.

func (*App) Crumbs

func (a *App) Crumbs() *Crumbs

Crumbs return the crumbs component

func (*App) DelAction

func (a *App) DelAction(keys []tcell.Key)

DelAction delete a keyAction

func (*App) HasAction

func (a *App) HasAction(key tcell.Key) (model.KeyAction, bool)

HasAction judge whether the key has the corresponding action

func (*App) InfoBoard

func (a *App) InfoBoard() *InfoBoard

InfoBoard return system info component

func (*App) Init

func (a *App) Init()

Init the ui of application init

func (a *App) Logo() *Logo

Logo return logo component

func (*App) Menu

func (a *App) Menu() *Menu

Menu return key action menu component

func (*App) QueueUpdateDraw

func (a *App) QueueUpdateDraw(f func())

QueueUpdateDraw queues up a ui action and redraw the ui.

type Crumbs

type Crumbs struct {
	*tview.Flex
}

Crumbs component lay on footer of app and indicate resource level

func NewCrumbs

func NewCrumbs() *Crumbs

NewCrumbs return a new crumbs component

func (*Crumbs) StackPop

func (c *Crumbs) StackPop(_, _ model.Component)

StackPop change itself when accept "pop" notify from app's main view

func (*Crumbs) StackPush

func (c *Crumbs) StackPush(component model.Component)

StackPush change itself when accept "push" notify from app's main view

type InfoBoard

type InfoBoard struct {
	*tview.Table
}

InfoBoard a component which display system info

func NewInfo

func NewInfo() *InfoBoard

NewInfo return an info component instance

func (*InfoBoard) Init

func (board *InfoBoard) Init(restConf *rest.Config)

Init info component init

func (*InfoBoard) UpdateInfo

func (board *InfoBoard) UpdateInfo(restConf *rest.Config)

UpdateInfo update the info of system info board

type Logo struct {
	*tview.TextView
}

Logo logo component in header

func NewLogo() *Logo

NewLogo return logo ui component

type Menu struct {
	*tview.Table
}

Menu is menu component which display key actions of app's main view

func NewMenu

func NewMenu() *Menu

NewMenu return a new menu instance

func (m *Menu) StackPop(old, new model.Component)

StackPop change itself when accept "pop" notify from app's main view

func (m *Menu) StackPush(component model.Component)

StackPush change itself when accept "push" notify from app's main view

func (m *Menu) UpdateMenu(hints []model.MenuHint)

UpdateMenu update menu component

type Pages

type Pages struct {
	*tview.Pages
	*model.Stack
}

Pages is the app's main content view component

func NewPages

func NewPages() *Pages

NewPages return a page component

func (*Pages) Hint

func (p *Pages) Hint() []model.MenuHint

Hint return key action menu hints of the component

func (*Pages) Init

func (p *Pages) Init()

Init table component

func (*Pages) Name

func (p *Pages) Name() string

Name return pages' name

func (*Pages) StackPop

func (p *Pages) StackPop(old, _ model.Component)

StackPop change itself when accept "pop" notify from app's main view

func (*Pages) StackPush

func (p *Pages) StackPush(component model.Component)

StackPush change itself when accept "push" notify from app's main view

func (*Pages) Start

func (p *Pages) Start()

Start table component

func (*Pages) Stop

func (p *Pages) Stop()

Stop table component

type Table

type Table struct {
	*tview.Table
	// contains filtered or unexported fields
}

Table is a base table component which can be reused by other component

func NewTable

func NewTable() *Table

NewTable return a new table component

func (*Table) Actions

func (t *Table) Actions() model.KeyActions

Actions return actions

func (*Table) Hint

func (t *Table) Hint() []model.MenuHint

Hint return key action menu hints of the component

func (*Table) Init

func (t *Table) Init()

Init table component

func (*Table) Name

func (t *Table) Name() string

Name return table's name

func (*Table) Start

func (t *Table) Start()

Start table component

func (*Table) Stop

func (t *Table) Stop()

Stop table component

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳