ui

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2020 License: Apache-2.0, Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DeltaSign signals a diff.
	DeltaSign = "Δ"
	// PlusSign signals inc.
	PlusSign = "[red::b]↑"
	// MinusSign signal dec.
	MinusSign = "[green::b]↓"
)
View Source
const (
	Key0 int32 = iota + 48
	Key1
	Key2
	Key3
	Key4
	Key5
	Key6
	Key7
	Key8
	Key9
)

Defines numeric keys for container actions

View Source
const (
	KeyShift0 int32 = 41
	KeyShift1 int32 = 33
	KeyShift2 int32 = 64
	KeyShift3 int32 = 35
	KeyShift4 int32 = 36
	KeyShift5 int32 = 37
	KeyShift6 int32 = 94
	KeyShift7 int32 = 38
	KeyShift8 int32 = 42
	KeyShift9 int32 = 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

View Source
const (
	// SearchFmt represents a filter view title.
	SearchFmt = "<[filter:bg:r]/%s[fg:bg:-]> "

	// NSTitleFmt represents a namespaced view title.
	NSTitleFmt = "[fg:bg:b] %s([hilite:bg:b]%s[fg:bg:-])[fg:bg:-][[count:bg:b]%d[fg:bg:-]][fg:bg:-] "

	// TitleFmt represents a standard view title.
	TitleFmt = "[fg:bg:b] %s[fg:bg:-][[count:bg:b]%d[fg:bg:-]][fg:bg:-] "

	// FullFmat specifies a namespaced dump file name.
	FullFmat = "%s-%s-%d.csv"

	// NoNSFmat specifies a cluster wide dump file name.
	NoNSFmat = "%s-%d.csv"
)

Variables

View Source
var (
	// LableRx identifies a label query
	LableRx = regexp.MustCompile(`\A\-l`)
)
View Source
var LogoBig = []string{
	` ____  __.________      _________ .____    .___ `,
	`|    |/ _/   __   \_____\_   ___ \|    |   |   |`,
	`|      < \____    /  ___/    \  \/|    |   |   |`,
	`|    |  \   /    /\___ \\     \___|    |___|   |`,
	`|____|__ \ /____//____  >\______  /_______ \___|`,
	`        \/            \/        \/        \/    `,
}

LogoBig K9s big logo for splash page.

View Source
var LogoSmall = []string{
	` ____  __.________       `,
	`|    |/ _/   __   \______`,
	`|      < \____    /  ___/`,
	`|    |  \   /    /\___ \ `,
	`|____|__ \ /____//____  >`,
	`        \/            \/ `,
}

LogoSmall K9s small log.

View Source
var NumKeys = map[int]int32{
	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 added in v0.14.0

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

AsKey converts rune to keyboard key.,

func AsPercDelta added in v0.13.5

func AsPercDelta(ov, nv float64) string

AsPercDelta represents a percentage with a delta indicator.

func BenchConfig

func BenchConfig(cluster string) string

BenchConfig location of the benchmarks configuration file.

func ComputeMaxColumns

func ComputeMaxColumns(pads MaxyPad, sortCol int, header render.HeaderRow, ee render.RowEvents)

ComputeMaxColumns figures out column max size and necessary padding.

func Deltas

func Deltas(o, n string) string

Deltas signals diffs between 2 strings.

func IsASCII

func IsASCII(s string) bool

IsASCII checks if table cell has all ascii characters.

func IsFuzzySelector

func IsFuzzySelector(s string) bool

IsFuzzySelector checks if query is fuzzy.

func IsLabelSelector

func IsLabelSelector(s string) bool

IsLabelSelector checks if query is a label query.

func Pad

func Pad(s string, width int) string

Pad a string up to the given length or truncates if greater than length.

func SkinTitle

func SkinTitle(fmat string, style config.Frame) string

SkinTitle decorates a title.

func TrimCell

func TrimCell(tv *SelectTable, row, col int) string

TrimCell removes superfluous padding.

func TrimLabelSelector

func TrimLabelSelector(s string) string

TrimLabelSelector extracts label query.

func Truncate

func Truncate(str string, width int) string

Truncate a string to the given l and suffix ellipsis if needed.

Types

type ActionHandler

type ActionHandler func(*tcell.EventKey) *tcell.EventKey

ActionHandler handles a keyboard command.

type App

type App struct {
	*tview.Application
	Configurator

	Main *Pages
	// contains filtered or unexported fields
}

App represents an application.

func NewApp

func NewApp(context string) *App

NewApp returns a new app.

func (*App) ActivateCmd

func (a *App) ActivateCmd(b bool)

ActivateCmd toggle command mode.

func (*App) AddActions

func (a *App) AddActions(aa KeyActions)

AddActions returns the application actiona.

func (*App) BailOut

func (a *App) BailOut()

BailOut exists the application.

func (*App) BufferActive

func (a *App) BufferActive(state bool, _ BufferKind)

BufferActive indicates the buff activity changed.

func (*App) BufferChanged

func (a *App) BufferChanged(s string)

BufferChanged indicates the buffer was changed.

func (*App) Cmd

func (a *App) Cmd() *Command

Cmd returns app cmd.

func (*App) CmdBuff

func (a *App) CmdBuff() *CmdBuff

CmdBuff returns a cmd buffer.

func (*App) Conn

func (a *App) Conn() client.Connection

Conn returns an api server connection.

func (*App) Crumbs

func (a *App) Crumbs() *Crumbs

Crumbs return app crumba.

func (*App) Flash

func (a *App) Flash() *Flash

Flash returns app flash.

func (*App) GetActions

func (a *App) GetActions() KeyActions

GetActions returns a collection of actiona.

func (*App) GetCmd

func (a *App) GetCmd() string

GetCmd retrieves user command.

func (*App) HasCmd

func (a *App) HasCmd() bool

HasCmd check if cmd buffer is active and has a command.

func (*App) InCmdMode

func (a *App) InCmdMode() bool

InCmdMode check if command mode is active.

func (*App) Init

func (a *App) Init()

Init initializes the application.

func (a *App) Logo() *Logo

Logo return the app logo.

func (*App) Menu

func (a *App) Menu() *Menu

Menu returns app menu.

func (*App) ReloadStyles

func (a *App) ReloadStyles(context string)

ReloadStyles reloads skin file.

func (*App) ResetCmd

func (a *App) ResetCmd()

ResetCmd clear out user command.

func (*App) StylesChanged

func (a *App) StylesChanged(s *config.Styles)

StylesChanged notifies the skin changed.

func (*App) Views

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

Views return the application root viewa.

type BuffWatcher

type BuffWatcher interface {
	// Changed indicates the buffer was changed.
	BufferChanged(s string)

	// Active indicates the buff activity changed.
	BufferActive(state bool, kind BufferKind)
}

BuffWatcher represents a command buffer listener.

type BufferKind

type BufferKind int8

BufferKind indicates a buffer type

const (
	// CommandBuff indicates a command buffer.
	CommandBuff BufferKind = 1 << iota
	// FilterBuff indicates a search buffer.
	FilterBuff
)

type CmdBuff

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

CmdBuff represents user command input.

func NewCmdBuff

func NewCmdBuff(key rune, kind BufferKind) *CmdBuff

NewCmdBuff returns a new command buffer.

func (*CmdBuff) Add

func (c *CmdBuff) Add(r rune)

Add adds a new charater to the buffer.

func (*CmdBuff) AddListener

func (c *CmdBuff) AddListener(w ...BuffWatcher)

AddListener registers a cmd buffer listener.

func (*CmdBuff) Clear

func (c *CmdBuff) Clear()

Clear clears out command buffer.

func (*CmdBuff) Delete

func (c *CmdBuff) Delete()

Delete removes the last character from the buffer.

func (*CmdBuff) Empty

func (c *CmdBuff) Empty() bool

Empty returns true is no cmd, false otherwise.

func (*CmdBuff) InCmdMode

func (c *CmdBuff) InCmdMode() bool

InCmdMode checks if a command exists and the buffer is active.

func (*CmdBuff) IsActive

func (c *CmdBuff) IsActive() bool

IsActive checks if command buffer is active.

func (*CmdBuff) IsSticky

func (c *CmdBuff) IsSticky() bool

IsSticky checks if the cmd is going to perist or not.

func (*CmdBuff) RemoveListener

func (c *CmdBuff) RemoveListener(l BuffWatcher)

RemoveListener unregisters a listener.

func (*CmdBuff) Reset

func (c *CmdBuff) Reset()

Reset clears out the command buffer and deactives it.

func (*CmdBuff) Set

func (c *CmdBuff) Set(cmd string)

Set initializes the buffer with a command.

func (*CmdBuff) SetActive

func (c *CmdBuff) SetActive(b bool)

SetActive toggles cmd buffer active state.

func (*CmdBuff) SetSticky

func (c *CmdBuff) SetSticky(b bool)

SetSticky returns cmd stickness.

func (*CmdBuff) String

func (c *CmdBuff) String() string

String turns rune to string (Stringer protocol)

type ColorerFunc

type ColorerFunc func(ns string, evt render.RowEvent) tcell.Color

ColorerFunc represents a row colorer.

type Command

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

Command captures users free from command input.

func NewCommand

func NewCommand(styles *config.Styles) *Command

NewCommand returns a new command view.

func (*Command) BufferActive

func (c *Command) BufferActive(f bool, k BufferKind)

BufferActive indicates the buff activity changed.

func (*Command) BufferChanged

func (c *Command) BufferChanged(s string)

BufferChanged indicates the buffer was changed.

func (*Command) InCmdMode

func (c *Command) InCmdMode() bool

InCmdMode returns true if command is active, false otherwise.

func (*Command) StylesChanged

func (c *Command) StylesChanged(s *config.Styles)

StylesChanged notifies skin changed.

type Configurator

type Configurator struct {
	Config *config.Config
	Styles *config.Styles
	Bench  *config.Bench
	// contains filtered or unexported fields
}

Configurator represents an application configurationa.

func (*Configurator) HasSkins

func (c *Configurator) HasSkins() bool

HasSkins returns true if a skin file was located.

func (*Configurator) InitBench

func (c *Configurator) InitBench(cluster string)

InitBench load benchmark configuration if any.

func (*Configurator) RefreshStyles

func (c *Configurator) RefreshStyles(context string)

RefreshStyles load for skin configuration changes.

func (*Configurator) StylesUpdater

func (c *Configurator) StylesUpdater(ctx context.Context, s synchronizer) error

StylesUpdater watches for skin file changes.

type Crumbs

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

Crumbs represents user breadcrumbs.

func NewCrumbs

func NewCrumbs(styles *config.Styles) *Crumbs

NewCrumbs returns a new breadcrumb view.

func (*Crumbs) StackPopped

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

StackPopped indicates an item was deleted

func (*Crumbs) StackPushed

func (c *Crumbs) StackPushed(comp model.Component)

StackPushed indicates a new item was added.

func (*Crumbs) StackTop

func (c *Crumbs) StackTop(top model.Component)

StackTop indicates the top of the stack

func (*Crumbs) StylesChanged

func (c *Crumbs) StylesChanged(s *config.Styles)

StylesChanged notifies skin changed.

type DecorateFunc

type DecorateFunc func(render.TableData) render.TableData

DecorateFunc represents a row decorator.

type Flash

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

Flash represents a flash message indicator.

func NewFlash

func NewFlash(app *App, m string) *Flash

NewFlash returns a new flash view.

func (*Flash) Err

func (f *Flash) Err(err error)

Err displays an error flash message.

func (*Flash) Errf

func (f *Flash) Errf(fmat string, args ...interface{})

Errf displays a formatted error flash message.

func (*Flash) Info

func (f *Flash) Info(msg string)

Info displays an info flash message.

func (*Flash) Infof

func (f *Flash) Infof(fmat string, args ...interface{})

Infof displays a formatted info flash message.

func (*Flash) SetMessage

func (f *Flash) SetMessage(level FlashLevel, msg ...string)

SetMessage sets flash message and level.

func (*Flash) StylesChanged

func (f *Flash) StylesChanged(s *config.Styles)

StylesChanged notifies listener the skin changed.

func (*Flash) TestMode added in v0.13.1

func (f *Flash) TestMode()

TestMode for testing...

func (*Flash) Warn

func (f *Flash) Warn(msg string)

Warn displays a warning flash message.

func (*Flash) Warnf

func (f *Flash) Warnf(fmat string, args ...interface{})

Warnf displays a formatted warning flash message.

type FlashLevel

type FlashLevel int

FlashLevel represents flash message severity.

const (
	// FlashInfo represents an info message.
	FlashInfo FlashLevel = iota
	// FlashWarn represents an warning message.
	FlashWarn
	// FlashErr represents an error message.
	FlashErr
	// FlashFatal represents an fatal message.
	FlashFatal
)

type KeyAction

type KeyAction struct {
	Description string
	Action      ActionHandler
	Visible     bool
	Shared      bool
}

KeyAction represents a keyboard action.

func NewKeyAction

func NewKeyAction(d string, a ActionHandler, display bool) KeyAction

NewKeyAction returns a new keyboard action.

func NewSharedKeyAction

func NewSharedKeyAction(d string, a ActionHandler, display bool) KeyAction

NewSharedKeyAction returns a new shared keyboard action.

type KeyActions

type KeyActions map[tcell.Key]KeyAction

KeyActions tracks mappings between keystrokes and actions.

func (KeyActions) Add

func (a KeyActions) Add(aa KeyActions)

Add sets up keyboard action listener.

func (KeyActions) Clear

func (a KeyActions) Clear()

Clear remove all actions.

func (KeyActions) Delete

func (a KeyActions) Delete(kk ...tcell.Key)

Delete deletes actions by the given keys.

func (KeyActions) Hints

func (a KeyActions) Hints() model.MenuHints

Hints returns a collection of hints.

func (KeyActions) Set

func (a KeyActions) Set(aa KeyActions)

Set replace actions with new ones.

type KeyListenerFunc added in v0.13.3

type KeyListenerFunc func()

KeyListenerFunc listens to key presses.

type Lister

type Lister interface {
	// Get returns a resource instance.
	Get(ctx context.Context, path string) (runtime.Object, error)

	// ToYAML returns a resource yaml representation.
	ToYAML(ctx context.Context, path string) (string, error)

	// Describes describes a given resource.
	Describe(ctx context.Context, path string) (string, error)
}

Lister represents a viewable resource.

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

Logo represents a K9s logo.

func NewLogo(styles *config.Styles) *Logo

NewLogo returns a new logo.

func (*Logo) Err

func (l *Logo) Err(msg string)

Err displays a log error state.

func (*Logo) Info

func (l *Logo) Info(msg string)

Info displays a log info state.

func (l *Logo) Logo() *tview.TextView

Logo returns the logo viewer.

func (*Logo) Reset

func (l *Logo) Reset()

Reset clears out the logo view and resets colors.

func (*Logo) Status

func (l *Logo) Status() *tview.TextView

Status returns the status viewer.

func (*Logo) StylesChanged

func (l *Logo) StylesChanged(s *config.Styles)

StylesChanged notifies the skin changed.

func (*Logo) Warn

func (l *Logo) Warn(msg string)

Warn displays a log warning state.

type MaxyPad

type MaxyPad []int

MaxyPad tracks uniform column padding.

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

Menu presents menu options.

func NewMenu

func NewMenu(styles *config.Styles) *Menu

NewMenu returns a new menu.

func (m *Menu) HydrateMenu(hh model.MenuHints)

HydrateMenu populate menu ui from hints.

func (m *Menu) StackPopped(o, top model.Component)

StackPopped notifies a component was removed.

func (m *Menu) StackPushed(c model.Component)

StackPushed notifies a component was added.

func (m *Menu) StackTop(t model.Component)

StackTop notifies the top component.

func (m *Menu) StylesChanged(s *config.Styles)

StylesChanged notifies skin changed.

type Namespaceable

type Namespaceable interface {
	// ClusterWide returns true if the model represents resource in all namespaces.
	ClusterWide() bool

	// GetNamespace returns the model namespace.
	GetNamespace() string

	// SetNamespace changes the model namespace.
	SetNamespace(string)

	// InNamespace check if current namespace matches models.
	InNamespace(string) bool
}

Namespaceable represents a namespaceable model.

type Pages

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

Pages represents a stack of view pages.

func NewPages

func NewPages() *Pages

NewPages return a new view.

func (*Pages) Current

func (p *Pages) Current() model.Component

Current returns the current component.

func (*Pages) Dump

func (p *Pages) Dump()

Dump for debug.

func (*Pages) Show

func (p *Pages) Show(c model.Component)

Show displays a given page.

func (*Pages) StackPopped

func (p *Pages) StackPopped(o, top model.Component)

StackPopped notifies a component was removed.

func (*Pages) StackPushed

func (p *Pages) StackPushed(c model.Component)

StackPushed notifies a new component was pushed.

func (*Pages) StackTop

func (p *Pages) StackTop(top model.Component)

StackTop notifies a new component is at the top of the stack.

type SelectTable

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

SelectTable represents a table with selections.

func (*SelectTable) ClearMarks

func (s *SelectTable) ClearMarks()

ClearMarks delete all marked items.

func (*SelectTable) ClearSelection

func (s *SelectTable) ClearSelection()

ClearSelection reset selected row.

func (*SelectTable) DeleteMark

func (s *SelectTable) DeleteMark(k string)

DeleteMark delete a marked item.

func (*SelectTable) GetModel

func (s *SelectTable) GetModel() Tabular

GetModel returns the current model.

func (*SelectTable) GetSelectedCell

func (s *SelectTable) GetSelectedCell(col int) string

GetSelectedCell returns the content of a cell for the currently selected row.

func (*SelectTable) GetSelectedItem

func (s *SelectTable) GetSelectedItem() string

GetSelectedItem returns the currently selected item name.

func (*SelectTable) GetSelectedItems

func (s *SelectTable) GetSelectedItems() []string

GetSelectedItems return currently marked or selected items names.

func (*SelectTable) GetSelectedRowIndex

func (s *SelectTable) GetSelectedRowIndex() int

GetSelectedRowIndex fetch the currently selected row index.

func (*SelectTable) SelectFirstRow

func (s *SelectTable) SelectFirstRow()

SelectFirstRow select first data row if any.

func (*SelectTable) SelectRow

func (s *SelectTable) SelectRow(r int, broadcast bool)

SelectRow select a given row by index.

func (*SelectTable) SetModel

func (s *SelectTable) SetModel(m Tabular)

SetModel sets the table model.

func (*SelectTable) SetSelectedFn

func (s *SelectTable) SetSelectedFn(f func(string) string)

SetSelectedFn defines a function that cleanse the current selection.

func (*SelectTable) ToggleMark

func (s *SelectTable) ToggleMark()

ToggleMark toggles marked row

type SelectedRowFunc

type SelectedRowFunc func(r int)

SelectedRowFunc a table selection callback.

type SortColumn

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

SortColumn represents a sortable column.

type SortFn

type SortFn func(rows render.Rows, sortCol SortColumn)

SortFn represent a function that can sort columnar data.

type Splash

type Splash struct {
	*tview.Flex
}

Splash represents a splash screen.

func NewSplash

func NewSplash(styles *config.Styles, version string) *Splash

NewSplash instantiates a new splash screen with product and company info.

type StatusIndicator

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

StatusIndicator represents a status indicator when main header is collapsed.

func NewStatusIndicator

func NewStatusIndicator(app *App, styles *config.Styles) *StatusIndicator

NewStatusIndicator returns a new status indicator.

func (*StatusIndicator) ClusterInfoChanged added in v0.13.5

func (s *StatusIndicator) ClusterInfoChanged(prev, cur model.ClusterMeta)

ClusterInfoChanged notifies the cluster meta was changed.

func (*StatusIndicator) ClusterInfoUpdated added in v0.13.5

func (s *StatusIndicator) ClusterInfoUpdated(data model.ClusterMeta)

ClusterInfoUpdated notifies the cluster meta was updated.

func (*StatusIndicator) Err

func (s *StatusIndicator) Err(msg string)

Err displays a log error state.

func (*StatusIndicator) Info

func (s *StatusIndicator) Info(msg string)

Info displays a log info state.

func (*StatusIndicator) Reset

func (s *StatusIndicator) Reset()

Reset clears out the logo view and resets colors.

func (*StatusIndicator) SetPermanent

func (s *StatusIndicator) SetPermanent(info string)

SetPermanent sets permanent title to be reset to after updates

func (*StatusIndicator) StylesChanged

func (s *StatusIndicator) StylesChanged(styles *config.Styles)

StylesChanged notifies the skins changed.

func (*StatusIndicator) Warn

func (s *StatusIndicator) Warn(msg string)

Warn displays a log warning state.

type Table

type Table struct {
	*SelectTable

	BaseTitle string
	Path      string
	// contains filtered or unexported fields
}

Table represents tabular data.

func NewTable

func NewTable(gvr string) *Table

NewTable returns a new table view.

func (*Table) Actions

func (t *Table) Actions() KeyActions

Actions returns active menu bindings.

func (*Table) AddHeaderCell

func (t *Table) AddHeaderCell(col int, h render.Header)

AddHeaderCell configures a table cell header.

func (*Table) ClearMarks

func (t *Table) ClearMarks()

ClearMarks clear out marked items.

func (*Table) ExtraHints added in v0.13.3

func (t *Table) ExtraHints() map[string]string

ExtraHints returns additional hints.

func (*Table) GetFilteredData

func (t *Table) GetFilteredData() render.TableData

GetFilteredData fetch filtered tabular data.

func (*Table) GetSelectedRow

func (t *Table) GetSelectedRow() render.Row

GetSelectedRow returns the entire selected row.

func (*Table) Hints

func (t *Table) Hints() model.MenuHints

Hints returns the view hints.

func (*Table) Init

func (t *Table) Init(ctx context.Context)

Init initializes the component.

func (*Table) IsMarked

func (s *Table) IsMarked(item string) bool

IsMarked returns true if this item was marked.

func (*Table) NameColIndex

func (t *Table) NameColIndex() int

NameColIndex returns the index of the resource name column.

func (*Table) Refresh

func (t *Table) Refresh()

Refresh update the table data.

func (*Table) SearchBuff

func (t *Table) SearchBuff() *CmdBuff

SearchBuff returns the associated command buffer.

func (*Table) SendKey

func (t *Table) SendKey(evt *tcell.EventKey)

SendKey sends an keyboard event (testing only!).

func (*Table) SetColorerFn

func (t *Table) SetColorerFn(f render.ColorerFunc)

SetColorerFn specifies the default colorer.

func (*Table) SetDecorateFn

func (t *Table) SetDecorateFn(f DecorateFunc)

SetDecorateFn specifies the default row decorator.

func (*Table) SetSortCol

func (t *Table) SetSortCol(index, count int, asc bool)

SetSortCol sets in sort column index and order.

func (*Table) ShowDeleted

func (t *Table) ShowDeleted()

ShowDeleted marks row as deleted.

func (*Table) SortColCmd

func (t *Table) SortColCmd(col int, asc bool) func(evt *tcell.EventKey) *tcell.EventKey

SortColCmd designates a sorted column.

func (*Table) SortInvertCmd

func (t *Table) SortInvertCmd(evt *tcell.EventKey) *tcell.EventKey

SortInvertCmd reverses sorting order.

func (*Table) Styles

func (t *Table) Styles() *config.Styles

Styles returns styling configurator.

func (*Table) StylesChanged

func (t *Table) StylesChanged(s *config.Styles)

StylesChanged notifies the skin changed.

func (*Table) Update

func (t *Table) Update(data render.TableData)

Update table content.

func (*Table) UpdateTitle

func (t *Table) UpdateTitle()

UpdateTitle refreshes the table title.

type Tabular

type Tabular interface {
	Namespaceable
	Lister

	SetInstance(string)

	// Empty returns true if model has no data.
	Empty() bool

	// Peek returns current model data.
	Peek() render.TableData

	// Watch watches a given resource for changes.
	Watch(context.Context)

	// SetRefreshRate sets the model watch loop rate.
	SetRefreshRate(time.Duration)

	// AddListener registers a model listener.
	AddListener(model.TableListener)

	// Delete a resource.
	Delete(ctx context.Context, path string, cascade, force bool) error
}

Tabular represents a tabular model.

type Tree added in v0.13.3

type Tree struct {
	*tview.TreeView

	Count int
	// contains filtered or unexported fields
}

Tree represents a tree view.

func NewTree added in v0.13.3

func NewTree() *Tree

NewTree returns a new view.

func (*Tree) Actions added in v0.13.3

func (t *Tree) Actions() KeyActions

Actions returns active menu bindings.

func (*Tree) ClearSelection added in v0.13.3

func (t *Tree) ClearSelection()

ClearSelection clears the currently selected node.

func (*Tree) CmdBuff added in v0.13.3

func (t *Tree) CmdBuff() *CmdBuff

CmdBuff returns the filter command.

func (*Tree) ExpandNodes added in v0.13.3

func (t *Tree) ExpandNodes() bool

ExpandNodes returns true if nodes are expanded or false otherwise.

func (*Tree) ExtraHints added in v0.13.3

func (t *Tree) ExtraHints() map[string]string

ExtraHints returns additional hints.

func (*Tree) GetSelectedItem added in v0.13.3

func (t *Tree) GetSelectedItem() string

GetSelectedItem returns the currently selected item or blank if none.

func (*Tree) Hints added in v0.13.3

func (t *Tree) Hints() model.MenuHints

Hints returns the view hints.

func (*Tree) Init added in v0.13.3

func (t *Tree) Init(ctx context.Context) error

Init initializes the view

func (*Tree) SetKeyListenerFn added in v0.13.3

func (t *Tree) SetKeyListenerFn(f KeyListenerFunc)

SetKeyListenerFn sets a key entered listener.

func (*Tree) SetSelectedItem added in v0.13.3

func (t *Tree) SetSelectedItem(s string)

SetSelectedItem sets the currently selected node.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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