view

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2020 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 Alias

type Alias struct {
	ResourceViewer
}

Alias represents a command alias view.

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 K9s 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 log back to normal.

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

Run starts the application loop

func (*App) Status

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

Status reports a new app status for display.

type Benchmark

type Benchmark struct {
	ResourceViewer
}

Benchmark represents a service benchmark results view.

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

func (b *Browser) GetTable() *Table

GetTable returns the underlying table.

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

func (b *Browser) SetContextFn(f ContextFunc)

SetContextFn populates a custom context.

func (*Browser) SetInstance

func (b *Browser) SetInstance(path string)

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.

type Chart

type Chart struct {
	ResourceViewer
}

Chart represents a helm chart view.

type ClusterInfo

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

ClusterInfo represents a cluster info view.

func NewClusterInfo

func NewClusterInfo(app *App, mx *client.MetricsServer) *ClusterInfo

NewClusterInfo returns a new cluster info view.

func (*ClusterInfo) Init

func (c *ClusterInfo) Init(version string)

Init initializes the view.

func (*ClusterInfo) StylesChanged

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

StylesChanged notifies skin changed.

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.

func (*Command) Reset

func (c *Command) Reset() error

Reset resets Command and reload aliases.

type Container

type Container struct {
	ResourceViewer
}

Container represents a container view.

func (*Container) Name

func (c *Container) Name() string

Name returns the component name.

type ContainerFunc

type ContainerFunc func() string

ContainerFunc returns the active container name.

type Context

type Context struct {
	ResourceViewer
}

Context presents a context viewer.

type ContextFunc

type ContextFunc func(context.Context) context.Context

ContextFunc enhances a given context.

type CronJob

type CronJob struct {
	ResourceViewer
}

CronJob represents a cronjob viewer.

type DaemonSet

type DaemonSet struct {
	ResourceViewer
}

DaemonSet represents a daemon set custom viewer.

type Deploy

type Deploy struct {
	ResourceViewer
}

Deploy represents a deployment view.

type Details

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

Details represents a generic text viewer.

func NewDetails

func NewDetails(app *App, title, subject string) *Details

NewDetails returns a details viewer.

func (*Details) Actions

func (d *Details) Actions() ui.KeyActions

Actions returns menu actions

func (*Details) Hints

func (d *Details) Hints() model.MenuHints

Hints returns menu hints.

func (*Details) Init

func (d *Details) Init(_ context.Context) error

Init initializes the viewer.

func (*Details) Name

func (d *Details) Name() string

Name returns the component name.

func (*Details) SetSubject

func (d *Details) SetSubject(s string)

SetSubject updates the subject.

func (*Details) Start

func (d *Details) Start()

Start starts the view updater.

func (*Details) Stop

func (d *Details) Stop()

Stop terminates the updater.

func (*Details) StylesChanged

func (d *Details) StylesChanged(s *config.Styles)

StylesChanged notifies the skin changed.

func (*Details) Update

func (d *Details) Update(buff string) *Details

Update updates the view content.

type EnterFunc

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

EnterFunc represents an enter key action.

type EnvFunc

type EnvFunc func() K9sEnv

EnvFunc represent the current view exposed environment.

type Event

type Event struct {
	ResourceViewer
}

Event represents a command alias view.

type Group

type Group struct {
	ResourceViewer
}

Group presents a RBAC group viewer.

type Help

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

Help presents a help viewer.

func NewHelp

func NewHelp() *Help

NewHelp returns a new help viewer.

func (*Help) Init

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

Init initializes the component.

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 Job

type Job struct {
	ResourceViewer
}

Job represents a job viewer.

type K9sEnv

type K9sEnv map[string]string

K9sEnv represent K9s available env variables.

type Log

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

Log represents a generic log viewer.

func NewLog

func NewLog(gvr client.GVR, path, co string, prev bool) *Log

NewLog returns a new viewer.

func (*Log) BufferActive

func (l *Log) BufferActive(state bool, k ui.BufferKind)

BufferActive indicates the buff activity changed.

func (*Log) BufferChanged

func (l *Log) BufferChanged(s string)

BufferChanged indicates the buffer was changed.

func (*Log) Flush

func (l *Log) Flush(lines []string)

Flush write logs to viewer.

func (*Log) GetModel

func (l *Log) GetModel() *model.Log

GetModel returns the log model.

func (*Log) Hints

func (l *Log) Hints() model.MenuHints

Hints returns a collection of menu hints.

func (*Log) Indicator

func (l *Log) Indicator() *LogIndicator

Indicator returns the scroll mode viewer.

func (*Log) Init

func (l *Log) Init(ctx context.Context) (err error)

Init initialiazes the viewer.

func (*Log) LogChanged

func (l *Log) LogChanged(lines []string)

LogChanged updates the logs.

func (*Log) LogCleared

func (l *Log) LogCleared()

LogCleared clears the logs.

func (*Log) LogFailed

func (l *Log) LogFailed(err error)

LogFailed notifies an error occurred.

func (*Log) Logs

func (l *Log) Logs() *Details

Logs returns the log viewer.

func (*Log) Name

func (l *Log) Name() string

Name returns the component name.

func (*Log) SaveCmd

func (l *Log) SaveCmd(evt *tcell.EventKey) *tcell.EventKey

SaveCmd dumps the logs to file.

func (*Log) Start

func (l *Log) Start()

Start runs the component.

func (*Log) Stop

func (l *Log) Stop()

Stop terminates the component.

func (*Log) StylesChanged

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

StylesChanged reports skin changes.

func (*Log) ToggleAutoScrollCmd

func (l *Log) ToggleAutoScrollCmd(evt *tcell.EventKey) *tcell.EventKey

ToggleAutoScrollCmd toggles autoscroll status.

type LogIndicator

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

LogIndicator represents a log view indicator.

func NewLogIndicator

func NewLogIndicator(cfg *config.Config, styles *config.Styles) *LogIndicator

NewLogIndicator returns a new indicator.

func (*LogIndicator) AutoScroll

func (l *LogIndicator) AutoScroll() bool

AutoScroll reports the current scrolling status.

func (*LogIndicator) FullScreen

func (l *LogIndicator) FullScreen() bool

FullScreen reports the current screen mode.

func (*LogIndicator) Refresh

func (l *LogIndicator) Refresh()

Refresh updates the view.

func (*LogIndicator) TextWrap

func (l *LogIndicator) TextWrap() bool

TextWrap reports the current wrap mode.

func (*LogIndicator) ToggleAutoScroll

func (l *LogIndicator) ToggleAutoScroll()

ToggleAutoScroll toggles the scroll mode.

func (*LogIndicator) ToggleFullScreen

func (l *LogIndicator) ToggleFullScreen()

ToggleFullScreen toggles the screen mode.

func (*LogIndicator) ToggleTextWrap

func (l *LogIndicator) ToggleTextWrap()

ToggleTextWrap toggles the wrap mode.

type LogViewer

type LogViewer interface {
	ResourceViewer

	ShowLogs(prev bool)
}

LogViewer represents a log viewer.

type LogsExtender

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

LogsExtender adds log actions to a given viewer.

type MetaViewer

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

MetaViewer represents a registered meta viewer.

type MetaViewers

type MetaViewers map[client.GVR]MetaViewer

MetaViewers represents a collection of meta viewers.

type Namespace

type Namespace struct {
	ResourceViewer
}

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 Picker

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

Picker represents a container picker.

func NewPicker

func NewPicker() *Picker

NewPicker returns a new picker.

func (*Picker) Hints

func (v *Picker) Hints() model.MenuHints

Hints returns the view hints.

func (*Picker) Init

func (v *Picker) Init(ctx context.Context) error

Init initializes the view.

func (*Picker) Name

func (v *Picker) Name() string

Name returns the component name.

func (*Picker) Start

func (v *Picker) Start()

Start starts the view.

func (*Picker) Stop

func (v *Picker) Stop()

Stop stops the view.

type Pod

type Pod struct {
	ResourceViewer
}

Pod represents a pod viewer.

type Policy

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

Policy presents a RBAC rules viewer based on what a given user/group or sa can do.

func NewPolicy

func NewPolicy(app *App, subject, name string) *Policy

NewPolicy returns a new viewer.

type PortForward

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

PortForward presents active portforward viewer.

type Rbac

type Rbac struct {
	ResourceViewer
}

Rbac presents an RBAC policy viewer.

type ReplicaSet

type ReplicaSet struct {
	ResourceViewer
}

ReplicaSet presents a replicaset viewer.

type ResourceViewer

type ResourceViewer interface {
	TableViewer

	// SetEnvFn sets a function to pull viewer env vars for plugins.
	SetEnvFn(EnvFunc)

	// GVR returns a resource descriptor.
	GVR() string

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

	// SetBindKeys provision additional key bindings.
	SetBindKeysFn(BindKeysFunc)
	SetInstance(string)
}

ResourceViewer represents a generic resource viewer.

func NewAlias

func NewAlias(gvr client.GVR) ResourceViewer

NewAlias returns a new alias view.

func NewBenchmark

func NewBenchmark(gvr client.GVR) ResourceViewer

NewBenchmark returns a new viewer.

func NewBrowser

func NewBrowser(gvr client.GVR) ResourceViewer

NewBrowser returns a new browser.

func NewChart

func NewChart(gvr client.GVR) ResourceViewer

NewChart returns a new alias view.

func NewContainer

func NewContainer(gvr client.GVR) ResourceViewer

NewContainer returns a new container view.

func NewContext

func NewContext(gvr client.GVR) ResourceViewer

NewContext returns a new viewer.

func NewCronJob

func NewCronJob(gvr client.GVR) ResourceViewer

NewCronJob returns a new viewer.

func NewDaemonSet

func NewDaemonSet(gvr client.GVR) ResourceViewer

NewDaemonSet returns a new viewer.

func NewDeploy

func NewDeploy(gvr client.GVR) ResourceViewer

NewDeploy returns a new deployment view.

func NewEvent

func NewEvent(gvr client.GVR) ResourceViewer

NewEvent returns a new alias view.

func NewGroup

func NewGroup(gvr client.GVR) ResourceViewer

NewGroup returns a new subject viewer.

func NewJob

func NewJob(gvr client.GVR) ResourceViewer

NewJob returns a new viewer.

func NewLogsExtender

func NewLogsExtender(v ResourceViewer, f ContainerFunc) ResourceViewer

NewLogsExtender returns a new extender.

func NewNamespace

func NewNamespace(gvr client.GVR) ResourceViewer

NewNamespace returns a new viewer

func NewNode

func NewNode(gvr client.GVR) ResourceViewer

NewNode returns a new node view.

func NewPod

func NewPod(gvr client.GVR) ResourceViewer

NewPod returns a new viewer.

func NewPortForward

func NewPortForward(gvr client.GVR) ResourceViewer

NewPortForward returns a new viewer.

func NewRbac

func NewRbac(gvr client.GVR) ResourceViewer

NewRbac returns a new viewer.

func NewReplicaSet

func NewReplicaSet(gvr client.GVR) ResourceViewer

NewReplicaSet returns a new viewer.

func NewRestartExtender

func NewRestartExtender(v ResourceViewer) ResourceViewer

NewRestartExtender returns a new extender.

func NewScaleExtender

func NewScaleExtender(r ResourceViewer) ResourceViewer

NewScaleExtender returns a new extender.

func NewScreenDump

func NewScreenDump(gvr client.GVR) ResourceViewer

NewScreenDump returns a new viewer.

func NewSecret

func NewSecret(gvr client.GVR) ResourceViewer

NewSecret returns a new viewer.

func NewService

func NewService(gvr client.GVR) ResourceViewer

NewService returns a new viewer.

func NewStatefulSet

func NewStatefulSet(gvr client.GVR) ResourceViewer

NewStatefulSet returns a new viewer.

func NewUser

func NewUser(gvr client.GVR) ResourceViewer

NewUser returns a new subject viewer.

func NewXray

func NewXray(gvr client.GVR) ResourceViewer

NewXray returns a new view.

type RestartExtender

type RestartExtender struct {
	ResourceViewer
}

RestartExtender represents a restartable resource.

type RestartableViewer

type RestartableViewer interface {
	LogViewer
}

RestartableViewer represents a viewer with restartable resources.

type Runner

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

Runner represents a runnable action handler.

type ScalableViewer

type ScalableViewer interface {
	LogViewer
}

ScalableViewer represents a viewer with scalable resources.

type ScaleExtender

type ScaleExtender struct {
	ResourceViewer
}

ScaleExtender adds scaling extensions.

type ScreenDump

type ScreenDump struct {
	ResourceViewer
}

ScreenDump presents a directory listing viewer.

type Secret

type Secret struct {
	ResourceViewer
}

Secret presents a secret viewer.

type Service

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

Service represents a service viewer.

type StatefulSet

type StatefulSet struct {
	ResourceViewer
}

StatefulSet represents a statefulset viewer.

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(gvr client.GVR) *Table

NewTable returns a new viewer.

func (*Table) App

func (t *Table) App() *App

App returns the current app handle.

func (*Table) BufferActive

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

BufferActive indicates the buff activity changed.

func (*Table) BufferChanged

func (t *Table) BufferChanged(s string)

BufferChanged indicates the buffer was changed.

func (*Table) EnvFn

func (t *Table) EnvFn() EnvFunc

EnvFn returns an plugin env function if available.

func (*Table) GVR

func (t *Table) GVR() string

GVR returns a resource descriptor.

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

func (t *Table) SetBindKeysFn(f BindKeysFunc)

SetBindKeysFn adds additional key bindings.

func (*Table) SetEnterFn

func (t *Table) SetEnterFn(f EnterFunc)

SetEnterFn specifies the default enter behavior.

func (*Table) SetEnvFn

func (t *Table) SetEnvFn(f EnvFunc)

SetEnvFn sets a function to pull viewer env vars for plugins.

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

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

TableViewer represents a tabular viewer.

type User

type User struct {
	ResourceViewer
}

User presents a user 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(client.GVR) ResourceViewer

ViewerFunc returns a viewer matching a given gvr.

type Xray

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

Xray represents an xray tree view.

func (*Xray) Actions

func (x *Xray) Actions() ui.KeyActions

Actions returns active menu bindings.

func (*Xray) Aliases

func (x *Xray) Aliases() []string

Aliases returns all available aliases.

func (*Xray) App

func (x *Xray) App() *App

App returns the current app handle.

func (*Xray) BufferActive

func (x *Xray) BufferActive(state bool, k ui.BufferKind)

BufferActive indicates the buff activity changed.

func (*Xray) BufferChanged

func (x *Xray) BufferChanged(s string)

BufferChanged indicates the buffer was changed.

func (*Xray) ClearSelection

func (x *Xray) ClearSelection()

ClearSelection clears the currently selected node.

func (*Xray) EnvFn

func (x *Xray) EnvFn() EnvFunc

EnvFn returns an plugin env function if available.

func (*Xray) GVR

func (x *Xray) GVR() string

GVR returns a resource descriptor.

func (*Xray) GetSelectedItem

func (x *Xray) GetSelectedItem() string

func (*Xray) GetTable

func (x *Xray) GetTable() *Table

GetTable returns the underlying table.

func (*Xray) Hints

func (x *Xray) Hints() model.MenuHints

Hints returns the view hints.

func (*Xray) Init

func (x *Xray) Init(ctx context.Context) error

Init initializes the view

func (*Xray) Name

func (x *Xray) Name() string

Name returns the component name.

func (*Xray) Refresh

func (x *Xray) Refresh()

Refresh refresh the view

func (*Xray) SetBindKeysFn

func (x *Xray) SetBindKeysFn(BindKeysFunc)

SetBindKeysFn sets up extra key bindings.

func (*Xray) SetContextFn

func (x *Xray) SetContextFn(ContextFunc)

SetContextFn sets custom context.

func (*Xray) SetEnvFn

func (x *Xray) SetEnvFn(EnvFunc)

SetEnvFn sets the custom environment function.

func (*Xray) SetInstance

func (x *Xray) SetInstance(string)

SetInstance sets specific resource instance.

func (*Xray) Start

func (x *Xray) Start()

Start initializes resource watch loop.

func (*Xray) Stop

func (x *Xray) Stop()

Stop terminates watch loop.

func (*Xray) TreeChanged

func (x *Xray) TreeChanged(node *xray.TreeNode)

XrayDataChanged notifies the model data changed.

func (*Xray) TreeLoadFailed

func (x *Xray) TreeLoadFailed(err error)

XrayLoadFailed notifies the load failed.

func (*Xray) TreeNodeSelected

func (x *Xray) TreeNodeSelected()

TreeNodeSelected callback for node selection.

func (*Xray) UpdateTitle

func (x *Xray) UpdateTitle()

UpdateTitle updates the view title.

Jump to

Keyboard shortcuts

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