view

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const AllScopes = "all"

AllScopes represents actions available for all views.

Variables

View Source
var (
	ExitStatus = ""
)

ExitStatus indicates UI exit conditions.

Functions

This section is empty.

Types

type ActionExtender

type ActionExtender interface {
	// BindKeys injects new menu actions.
	BindKeys(ResourceViewer)
}

ActionExtender enhances a given viewer by adding new menu actions.

type App

type App struct {
	*ui.App
	Content *PageStack
	// contains filtered or unexported fields
}

App represents an application view.

func NewApp

func NewApp(cfg *config.Config) *App

NewApp returns a W2 app instance.

func (*App) ActiveView

func (a *App) ActiveView() model.Component

ActiveView returns the currently active view.

func (*App) BailOut

func (a *App) BailOut()

BailOut exists the application.

func (*App) ClearStatus

func (a *App) ClearStatus(flash bool)

ClearStatus reset logo back to normal.

func (*App) ConOK

func (a *App) ConOK() bool

ConOK checks the connection is cool, returns false otherwise.

func (*App) Halt

func (a *App) Halt()

Halt stop the application event loop.

func (*App) Init

func (a *App) Init(version string, rate int) error

Init initializes the application.

func (*App) IsBenchmarking

func (a *App) IsBenchmarking() bool

IsBenchmarking check if benchmarks are active.

func (*App) PrevCmd

func (a *App) PrevCmd(evt *tcell.EventKey) *tcell.EventKey

PrevCmd pops the command stack.

func (*App) Resume

func (a *App) Resume()

Resume restarts the app event loop.

func (*App) Run

func (a *App) Run() error

Run starts the application loop.

func (*App) Status

func (a *App) Status(l model.FlashLevel, msg string)

Status reports a new app status for display.

type BindKeysFunc

type BindKeysFunc func(ui.KeyActions)

BindKeysFunc adds new menu actions.

type BoostActionsFunc

type BoostActionsFunc func(ui.KeyActions)

BoostActionsFunc extends viewer keyboard actions.

type Browser

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

Browser represents a generic resource browser.

func (*Browser) Aliases

func (b *Browser) Aliases() []string

Aliases returns all available aliases.

func (*Browser) BufferActive

func (b *Browser) BufferActive(state bool, k model.BufferKind)

BufferActive indicates the buff activity changed.

func (*Browser) BufferChanged

func (b *Browser) BufferChanged(_, _ string)

BufferChanged indicates the buffer was changed.

func (*Browser) BufferCompleted

func (b *Browser) BufferCompleted(text, _ string)

BufferCompleted indicates input was accepted.

func (*Browser) GetTable

func (b *Browser) GetTable() *Table

GetTable returns the underlying table.

func (*Browser) InCmdMode

func (b *Browser) InCmdMode() bool

InCmdMode checks if prompt is active.

func (*Browser) Init

func (b *Browser) Init(ctx context.Context) error

Init watches all running pods in given namespace.

func (*Browser) Name

func (b *Browser) Name() string

Name returns the component name.

func (*Browser) Refresh

func (b *Browser) Refresh()

func (*Browser) SetContextFn

func (b *Browser) SetContextFn(f ContextFunc)

SetContextFn populates a custom context.

func (*Browser) SetInstance

func (b *Browser) SetInstance(path string)

SetInstance sets a single instance view.

func (*Browser) Start

func (b *Browser) Start()

Start initializes browser updates.

func (*Browser) Stop

func (b *Browser) Stop()

Stop terminates browser updates.

func (*Browser) TableDataChanged

func (b *Browser) TableDataChanged(data render.TableData)

TableDataChanged notifies view new data is available.

func (*Browser) TableLoadFailed

func (b *Browser) TableLoadFailed(err error)

TableLoadFailed notifies view something went south.

func (*Browser) TableTick

func (b *Browser) TableTick()

type ClusterInfo

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

ClusterInfo represents a cluster info view.

func NewClusterInfo

func NewClusterInfo(app *App) *ClusterInfo

NewClusterInfo returns a new cluster info view.

func (*ClusterInfo) AddListener

func (c *ClusterInfo) AddListener(l ClusterInfoListener)

AddListener adds a new model listener.

func (*ClusterInfo) Init

func (c *ClusterInfo) Init()

Init initializes the view.

func (*ClusterInfo) RemoveListener

func (c *ClusterInfo) RemoveListener(l ClusterInfoListener)

RemoveListener delete a listener from the list.

func (*ClusterInfo) StylesChanged

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

StylesChanged notifies skin changed.

func (*ClusterInfo) TableDataChanged

func (c *ClusterInfo) TableDataChanged(data render.TableData)

func (*ClusterInfo) TableLoadFailed

func (c *ClusterInfo) TableLoadFailed(_ error)

type ClusterInfoListener

type ClusterInfoListener interface {
	// ClusterInfoChanged notifies the cluster meta was changed.
	ClusterInfoChanged(c model.Cluster)
}

ClusterInfoListener registers a listener for model changes.

type Command

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

Command represents a user command.

func NewCommand

func NewCommand(app *App) *Command

NewCommand returns a new command.

func (*Command) Init

func (c *Command) Init() error

Init initializes the command.

type ContextFunc

type ContextFunc func(context.Context) context.Context

ContextFunc enhances a given context.

type Cow

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

Cow represents a bomb viewer.

func NewCow

func NewCow(app *App, says string) *Cow

NewCow returns a have a cow viewer.

func (*Cow) Actions

func (c *Cow) Actions() ui.KeyActions

Actions returns menu actions.

func (*Cow) ExtraHints

func (c *Cow) ExtraHints() map[string]string

ExtraHints returns additional hints.

func (*Cow) Hints

func (c *Cow) Hints() model.MenuHints

Hints returns menu hints.

func (*Cow) InCmdMode

func (*Cow) InCmdMode() bool

InCmdMode checks if prompt is active.

func (*Cow) Init

func (c *Cow) Init(_ context.Context) error

Init initializes the viewer.

func (*Cow) Name

func (c *Cow) Name() string

Name returns the component name.

func (*Cow) Start

func (c *Cow) Start()

Start starts the view updater.

func (*Cow) Stop

func (c *Cow) Stop()

Stop terminates the updater.

func (*Cow) StylesChanged

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

StylesChanged notifies the skin changes.

type EnterFunc

type EnterFunc func(app *App, model ui.Tabular, cat, path string)

EnterFunc represents an enter key action.

type Help

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

Help presents a help viewer.

func NewHelp

func NewHelp(app *App) *Help

NewHelp returns a new help viewer.

func (*Help) InCmdMode

func (*Help) InCmdMode() bool

InCmdMode checks if prompt is active.

func (*Help) Init

func (h *Help) Init(ctx context.Context) error

Init initializes the component.

func (*Help) StylesChanged

func (h *Help) StylesChanged(s *config.Styles)

StylesChanged notifies skin changed.

type HelpFunc

type HelpFunc func() model.MenuHints

HelpFunc processes menu hints.

type Hinter

type Hinter interface {
	// Hints returns a collection of hints.
	Hints() model.MenuHints
}

Hinter represents a view that can produce menu hints.

type LogViewer

type LogViewer interface {
	ResourceViewer

	ShowLogs(prev bool)
}

LogViewer represents a log viewer.

type MetaViewer

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

MetaViewer represents a registered meta viewer.

type MetaViewers

type MetaViewers map[string]MetaViewer

MetaViewers represents a collection of meta viewers.

type Namespace

type Namespace struct {
	ResourceViewer
	// contains filtered or unexported fields
}

Namespace represents a namespace viewer.

type Node

type Node struct {
	ResourceViewer
}

Node represents a node view.

type PageStack

type PageStack struct {
	*ui.Pages
	// contains filtered or unexported fields
}

PageStack represents a stack of pages.

func NewPageStack

func NewPageStack() *PageStack

NewPageStack returns a new page stack.

func (*PageStack) Init

func (p *PageStack) Init(ctx context.Context) (err error)

Init initializes the view.

func (*PageStack) StackPopped

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

StackPopped notifies a page was removed.

func (*PageStack) StackPushed

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

StackPushed notifies a new page was added.

func (*PageStack) StackTop

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

StackTop notifies for the top component.

type Process

type Process struct {
	ResourceViewer
	// contains filtered or unexported fields
}

Process represents a process viewer.

func (*Process) Stop

func (p *Process) Stop()

type ResourceViewer

type ResourceViewer interface {
	TableViewer

	// SetContextFn provision a custom context.
	SetContextFn(ContextFunc)

	// AddBindKeysFn provision additional key bindings.
	AddBindKeysFn(BindKeysFunc)

	// SetInstance sets a parent FQN
	SetInstance(string)
}

ResourceViewer represents a generic resource viewer.

func NewBrowser

func NewBrowser(cat string, fn dao.FactoryFn) ResourceViewer

NewBrowser returns a new browser.

func NewNamespace

func NewNamespace() ResourceViewer

NewNamespace returns a new viewer.

func NewNode

func NewNode(cat string) ResourceViewer

NewNode returns a new node view.

func NewProcess

func NewProcess() ResourceViewer

NewProcess returns a new viewer.

type RestartableViewer

type RestartableViewer interface {
	LogViewer
}

RestartableViewer represents a viewer with restartable resources.

type Runner

type Runner interface {
	App() *App
	GetSelectedItem() string
	Aliases() []string
}

Runner represents a runnable action handler.

type ScalableViewer

type ScalableViewer interface {
	LogViewer
}

ScalableViewer represents a viewer with scalable resources.

type SubjectViewer

type SubjectViewer interface {
	ResourceViewer

	// SetSubject sets the active subject.
	SetSubject(s string)
}

SubjectViewer represents a policy viewer.

type Table

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

Table represents a table viewer.

func NewTable

func NewTable(cat string) *Table

NewTable returns a new viewer.

func (*Table) AddBindKeysFn

func (t *Table) AddBindKeysFn(f BindKeysFunc)

AddBindKeysFn adds additional key bindings.

func (*Table) App

func (t *Table) App() *App

App returns the current app handle.

func (*Table) BufferActive

func (t *Table) BufferActive(state bool, k model.BufferKind)

BufferActive indicates the buff activity changed.

func (*Table) BufferChanged

func (t *Table) BufferChanged(_, _ string)

BufferChanged indicates the buffer was changed.

func (*Table) BufferCompleted

func (t *Table) BufferCompleted(text, _ string)

BufferCompleted indicates input was accepted.

func (*Table) HeaderIndex

func (t *Table) HeaderIndex(colName string) (int, bool)

HeaderIndex returns index of a given column or false if not found.

func (*Table) Init

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

Init initializes the component.

func (*Table) Name

func (t *Table) Name() string

Name returns the table name.

func (*Table) SendKey

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

SendKey sends an keyboard event (testing only!).

func (*Table) SetEnterFn

func (t *Table) SetEnterFn(f EnterFunc)

SetEnterFn specifies the default enter behavior.

func (*Table) SetExtraActionsFn

func (t *Table) SetExtraActionsFn(BoostActionsFunc)

SetExtraActionsFn specifies custom keyboard behavior.

func (*Table) Start

func (t *Table) Start()

Start runs the component.

func (*Table) Stop

func (t *Table) Stop()

Stop terminates the component.

type TableViewer

type TableViewer interface {
	Viewer

	// GetTable returns a table component.
	GetTable() *Table
}

TableViewer represents a tabular viewer.

type Viewer

type Viewer interface {
	model.Component

	// Actions returns active menu bindings.
	Actions() ui.KeyActions

	// App returns an app handle.
	App() *App

	// Refresh updates the viewer
	Refresh()
}

Viewer represents a component viewer.

type ViewerFunc

type ViewerFunc func() ResourceViewer

ViewerFunc returns a viewer matching a given gvr.

Jump to

Keyboard shortcuts

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