view

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Key0 tcell.Key = iota + 48
	Key1
	Key2
	Key3
	Key4
	Key5
	Key6
	Key7
	Key8
	Key9
)

Defines numeric keys for container actions.

View Source
const (
	KeyShift0 tcell.Key = 41
	KeyShift1 tcell.Key = 33
	KeyShift2 tcell.Key = 64
	KeyShift3 tcell.Key = 35
	KeyShift4 tcell.Key = 36
	KeyShift5 tcell.Key = 37
	KeyShift6 tcell.Key = 94
	KeyShift7 tcell.Key = 38
	KeyShift8 tcell.Key = 42
	KeyShift9 tcell.Key = 40
)

Defines numeric keys for container actions.

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
	KeyHelp  = 63
	KeySlash = 47
	KeyColon = 58
	KeySpace = 32
)

Defines char keystrokes.

View Source
const (
	KeyShiftA tcell.Key = iota + 65
	KeyShiftB
	KeyShiftC
	KeyShiftD
	KeyShiftE
	KeyShiftF
	KeyShiftG
	KeyShiftH
	KeyShiftI
	KeyShiftJ
	KeyShiftK
	KeyShiftL
	KeyShiftM
	KeyShiftN
	KeyShiftO
	KeyShiftP
	KeyShiftQ
	KeyShiftR
	KeyShiftS
	KeyShiftT
	KeyShiftU
	KeyShiftV
	KeyShiftW
	KeyShiftX
	KeyShiftY
	KeyShiftZ
)

Define Shift Keys.

Variables

View Source
var LogoSmall = []string{
	`  ____ _   _  ___  ____  _____ ___   `,
	` / ___| | | |/ _ \|  _ \| ____/ _ \  `,
	`| |   | |_| | | | | |_) |  _|| | | | `,
	`| |___|  _  | |_| |  _ <| |__| |_| | `,
	` \____|_| |_|\___/|_| \_\_____\___/  `,
}
View Source
var NumKeys = map[int]tcell.Key{
	0: Key0,
	1: Key1,
	2: Key2,
	3: Key3,
	4: Key4,
	5: Key5,
	6: Key6,
	7: Key7,
	8: Key8,
	9: Key9,
}

NumKeys tracks number keys.

Functions

func AsKey

func AsKey(evt *tcell.EventKey) tcell.Key

AsKey converts rune to keyboard key.,.

func CalculateMaxWidths

func CalculateMaxWidths(table *tview.Table) []int

func CleanTable

func CleanTable(table *tview.Table)

func CleanTableRows

func CleanTableRows(table *tview.Table, exists func(row int) bool)

func LogoString

func LogoString() string

func NewDummy

func NewDummy(ctx context.Context) error

func NewHeaderTableCell

func NewHeaderTableCell(text string) *tview.TableCell

func NewResource

func NewResource(ctx context.Context, parent Page, apiGroup *discoverypb.APIResource)

func NewResourceInstance

func NewResourceInstance(ctx context.Context, parent Page, u *unstructured.Unstructured)

func NewResources

func NewResources(ctx context.Context, parent Page)

func NewTicker

func NewTicker(app *tview.Application, frequency time.Duration, f func()) *ticker

func SetTableHeader

func SetTableHeader(table *tview.Table, maxColumnWidth []int, headers ...string)

func YamlToString

func YamlToString(u *unstructured.Unstructured) string

Types

type ActionHandler

type ActionHandler func()

ActionHandler handles a keyboard command.

type App

type App struct {
	*tview.Application

	Main *tview.Pages // this might have to become a stack
	// contains filtered or unexported fields
}

func NewApp

func NewApp(f util.Factory) *App

func (*App) Init

func (a *App) Init(ctx context.Context) error

func (*App) Run

func (a *App) Run(ctx context.Context) error

Run starts the application loop.

type ContextKey

type ContextKey string

ContextKey represents context key.

const (
	KeyApp ContextKey = "app"
)

A collection of context keys.

type Dummy

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

func (*Dummy) Activate

func (r *Dummy) Activate(ctx context.Context)

func (*Dummy) Update

func (r *Dummy) Update(ctx context.Context) error

type Info

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

func NewInfo

func NewInfo(ctx context.Context) *Info

NewInfo creates a new Info view.

func (*Info) SetKeyValue

func (r *Info) SetKeyValue(row int, key, value string)

type KeyActions

type KeyActions struct {
	// contains filtered or unexported fields
}

KeyActions tracks mappings between keystrokes and actions.

func NewKeyActions

func NewKeyActions() *KeyActions

func (*KeyActions) Add

func (a *KeyActions) Add(k tcell.Key, h ActionHandler)

Add adds a new key action.

func (*KeyActions) Get

func (a *KeyActions) Get(key tcell.Key) (ActionHandler, bool)
type Logo struct {
	*tview.TextView
	// contains filtered or unexported fields
}
func NewLogo(ctx context.Context) *Logo

NewLogo returns a new logo.

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

func NewMenu

func NewMenu(ctx context.Context) *Menu

NewInfo creates a new Info view.

func (r *Menu) Activate(ctx context.Context)
func (r *Menu) Name() string

type Page

type Page interface {
	Name() string
	Activate(ctx context.Context)
}

type Resource

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

func (*Resource) Activate

func (r *Resource) Activate(ctx context.Context)

func (*Resource) DataTableName

func (r *Resource) DataTableName() string

func (*Resource) FindResourceInstanceRow

func (r *Resource) FindResourceInstanceRow(resourceID string) int

func (*Resource) GetResourceInstanceRow

func (r *Resource) GetResourceInstanceRow(row int) string

func (*Resource) HeaderTableName

func (r *Resource) HeaderTableName() string

func (*Resource) Name

func (r *Resource) Name() string

func (*Resource) SetResourceInstanceRow

func (r *Resource) SetResourceInstanceRow(row int, u *unstructured.Unstructured)

func (*Resource) Update

func (r *Resource) Update(ctx context.Context) error

type ResourceInstance

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

func (*ResourceInstance) Activate

func (r *ResourceInstance) Activate(ctx context.Context)

func (*ResourceInstance) Name

func (r *ResourceInstance) Name() string

func (*ResourceInstance) Update

func (r *ResourceInstance) Update(ctx context.Context) error

type Resources

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

func (*Resources) Activate

func (r *Resources) Activate(ctx context.Context)

func (*Resources) DataTableName

func (r *Resources) DataTableName() string

func (*Resources) FindResourcesRow

func (r *Resources) FindResourcesRow(resourceID string) int

func (*Resources) GetResourcesRow

func (r *Resources) GetResourcesRow(row int) string

func (*Resources) HeaderTableName

func (r *Resources) HeaderTableName() string

func (*Resources) Name

func (r *Resources) Name() string

func (*Resources) SetResourcesRow

func (r *Resources) SetResourcesRow(row int, resource *discoverypb.APIResource)

func (*Resources) Update

func (r *Resources) Update(ctx context.Context) error

type YAMLStyle

type YAMLStyle struct {
	KeyColor   tcell.Color `json:"keyColor" yaml:"keyColor"`
	ValueColor tcell.Color `json:"valueColor" yaml:"valueColor"`
	ColonColor tcell.Color `json:"colonColor" yaml:"colonColor"`
}

Jump to

Keyboard shortcuts

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