view

package
v1.9.11 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// RefreshDelay is refresh delay
	RefreshDelay = 10
)

Variables

View Source
var ResourceViewMap = map[string]ResourceView{
	"app":       new(ApplicationView),
	"cluster":   new(ClusterView),
	"resource":  new(ManagedResourceView),
	"ns":        new(NamespaceView),
	"cns":       new(ClusterNamespaceView),
	"pod":       new(PodView),
	"container": new(ContainerView),
}

ResourceViewMap is a map from resource name to resource view

Functions

func NewHelpView

func NewHelpView(app *App) model.View

NewHelpView return a new help view

func NewLogView

func NewLogView(ctx context.Context, app *App) model.View

NewLogView return a new log view

func NewTopologyView

func NewTopologyView(ctx context.Context, app *App) model.View

NewTopologyView return a new topology view

func NewYamlView

func NewYamlView(ctx context.Context, app *App) model.View

NewYamlView return a new yaml view

Types

type App

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

App application object

func NewApp

func NewApp(c client.Client, restConfig *rest.Config, namespace string) *App

NewApp return a new app object

func (*App) Back

func (a *App) Back(_ *tcell.EventKey) *tcell.EventKey

Back to return before view corresponding to the ESC key

func (*App) Exist

func (a *App) Exist(_ *tcell.EventKey) *tcell.EventKey

Exist the app

func (*App) Init

func (a *App) Init()

Init the app

func (*App) Refresh

func (a *App) Refresh()

Refresh will refresh the ui after the delay time

func (*App) Run

func (a *App) Run() error

Run is the application running entrance

func (*App) SwitchTheme added in v1.7.0

func (a *App) SwitchTheme(_ *tcell.EventKey) *tcell.EventKey

SwitchTheme switch page to the theme switch page

type ApplicationView

type ApplicationView struct {
	*CommonResourceView
	// contains filtered or unexported fields
}

ApplicationView is the application view, this view display info of application of KubeVela

func (*ApplicationView) BuildBody

func (v *ApplicationView) BuildBody()

BuildBody render the body of table

func (*ApplicationView) BuildHeader

func (v *ApplicationView) BuildHeader()

BuildHeader render the header of table

func (*ApplicationView) ColorizeStatusText

func (v *ApplicationView) ColorizeStatusText(rowNum int)

ColorizeStatusText colorize the status column text

func (*ApplicationView) Hint

func (v *ApplicationView) Hint() []model.MenuHint

Hint return key action menu hints of the application view

func (*ApplicationView) Init

func (v *ApplicationView) Init()

Init the application view

func (*ApplicationView) InitView

func (v *ApplicationView) InitView(ctx context.Context, app *App)

InitView return a new application view

func (*ApplicationView) Name

func (v *ApplicationView) Name() string

Name return application view name

func (*ApplicationView) Refresh

func (v *ApplicationView) Refresh(_ *tcell.EventKey) *tcell.EventKey

Refresh the view content

func (*ApplicationView) Start

func (v *ApplicationView) Start()

Start the application view

func (*ApplicationView) Stop

func (v *ApplicationView) Stop()

Stop the application view

func (*ApplicationView) Title

func (v *ApplicationView) Title() string

Title return table title of application view

func (*ApplicationView) Update

func (v *ApplicationView) Update(timeoutCancel func())

Update refresh the content of body of view

type ClusterNamespaceView

type ClusterNamespaceView struct {
	*CommonResourceView
	// contains filtered or unexported fields
}

ClusterNamespaceView is the cluster namespace, which display the namespace info of application's resource

func (*ClusterNamespaceView) BuildBody

func (v *ClusterNamespaceView) BuildBody()

BuildBody render the body of table

func (*ClusterNamespaceView) BuildHeader

func (v *ClusterNamespaceView) BuildHeader()

BuildHeader render the header of table

func (*ClusterNamespaceView) ColorizeStatusText

func (v *ClusterNamespaceView) ColorizeStatusText(rowNum int)

ColorizeStatusText colorize the status column text

func (*ClusterNamespaceView) Hint

func (v *ClusterNamespaceView) Hint() []model.MenuHint

Hint return key action menu hints of the cluster namespace view

func (*ClusterNamespaceView) Init

func (v *ClusterNamespaceView) Init()

Init the cluster namespace view

func (*ClusterNamespaceView) InitView

func (v *ClusterNamespaceView) InitView(ctx context.Context, app *App)

InitView init a new cluster namespace view

func (*ClusterNamespaceView) Name

func (v *ClusterNamespaceView) Name() string

Name return cluster namespace view name

func (*ClusterNamespaceView) Refresh

func (v *ClusterNamespaceView) Refresh(_ *tcell.EventKey) *tcell.EventKey

Refresh the view content

func (*ClusterNamespaceView) Start

func (v *ClusterNamespaceView) Start()

Start the cluster namespace view

func (*ClusterNamespaceView) Stop

func (v *ClusterNamespaceView) Stop()

Stop the cluster namespace view

func (*ClusterNamespaceView) Update

func (v *ClusterNamespaceView) Update(timeoutCancel func())

Update refresh the content of body of view

type ClusterView

type ClusterView struct {
	*CommonResourceView
	// contains filtered or unexported fields
}

ClusterView is the cluster view, this view display info of cluster where selected application deployed

func (*ClusterView) BuildBody

func (v *ClusterView) BuildBody()

BuildBody render the body of table

func (*ClusterView) BuildHeader

func (v *ClusterView) BuildHeader()

BuildHeader render the header of table

func (*ClusterView) Hint

func (v *ClusterView) Hint() []model.MenuHint

Hint return key action menu hints of the cluster view

func (*ClusterView) Init

func (v *ClusterView) Init()

Init cluster view init

func (*ClusterView) InitView

func (v *ClusterView) InitView(ctx context.Context, app *App)

InitView init a new cluster view

func (*ClusterView) Name

func (v *ClusterView) Name() string

Name return cluster view name

func (*ClusterView) Refresh

func (v *ClusterView) Refresh(_ *tcell.EventKey) *tcell.EventKey

Refresh the view content

func (*ClusterView) Start

func (v *ClusterView) Start()

Start the cluster view

func (*ClusterView) Stop

func (v *ClusterView) Stop()

Stop the cluster view

func (*ClusterView) Update

func (v *ClusterView) Update(timeoutCancel func())

Update refresh the content of body of view

type Command

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

Command is a kind of abstract of user UI operation

func NewCommand

func NewCommand(app *App) *Command

NewCommand return app's command instance

func (*Command) Init

func (c *Command) Init()

Init command instance

type CommonResourceView

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

CommonResourceView is an abstract of resource view

func NewCommonView

func NewCommonView(app *App) *CommonResourceView

NewCommonView return a new common view

func (*CommonResourceView) AutoRefresh

func (v *CommonResourceView) AutoRefresh(update func(timeoutCancel func()))

AutoRefresh will refresh the view in every RefreshDelay delay

func (*CommonResourceView) BuildBody

func (v *CommonResourceView) BuildBody(body [][]string)

BuildBody render the body of table

func (*CommonResourceView) BuildHeader

func (v *CommonResourceView) BuildHeader(header []string)

BuildHeader render the header of table

func (*CommonResourceView) Init

func (v *CommonResourceView) Init()

Init the common resource view

func (*CommonResourceView) Name

func (v *CommonResourceView) Name() string

Name return the name of common view

func (*CommonResourceView) Refresh

func (v *CommonResourceView) Refresh(clear bool, update func(timeoutCancel func()))

Refresh the base resource view

func (*CommonResourceView) Stop

func (v *CommonResourceView) Stop()

Stop the refresh goroutine and clear the table content

type ContainerView

type ContainerView struct {
	*CommonResourceView
	// contains filtered or unexported fields
}

ContainerView is a view which displays info of container of aime pod

func (*ContainerView) BuildBody

func (v *ContainerView) BuildBody()

BuildBody render the body of table

func (*ContainerView) BuildHeader

func (v *ContainerView) BuildHeader()

BuildHeader render the header of table

func (*ContainerView) ColorizePhaseText

func (v *ContainerView) ColorizePhaseText(rowNum int)

ColorizePhaseText colorize the state column text

func (*ContainerView) Hint

func (v *ContainerView) Hint() []model.MenuHint

Hint return key action menu hints of the container view

func (*ContainerView) Init

func (v *ContainerView) Init()

Init container view

func (*ContainerView) InitView

func (v *ContainerView) InitView(ctx context.Context, app *App)

InitView init a new container view

func (*ContainerView) Name

func (v *ContainerView) Name() string

Name return pod container name

func (*ContainerView) Refresh

func (v *ContainerView) Refresh(_ *tcell.EventKey) *tcell.EventKey

Refresh the view content

func (*ContainerView) Start

func (v *ContainerView) Start()

Start the container view

func (*ContainerView) Stop

func (v *ContainerView) Stop()

Stop the container view

func (*ContainerView) Update

func (v *ContainerView) Update(timeoutCancel func())

Update refresh the content of body of view

type HelpView

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

HelpView is the view which display help tips about how to use app

func (*HelpView) Hint

func (v *HelpView) Hint() []model.MenuHint

Hint return the menu hints of yaml view

func (*HelpView) Init

func (v *HelpView) Init()

Init help view init

func (*HelpView) Name

func (v *HelpView) Name() string

Name return help view name

func (*HelpView) Start

func (v *HelpView) Start()

Start the help view

func (*HelpView) Stop

func (v *HelpView) Stop()

Stop the help view

type LogView

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

LogView is the log view, this view display log of pod

func (*LogView) Hint

func (v *LogView) Hint() []model.MenuHint

Hint return the menu hints of log view

func (*LogView) Init

func (v *LogView) Init()

Init the log view

func (*LogView) Name

func (v *LogView) Name() string

Name return the name of log view

func (*LogView) Start

func (v *LogView) Start()

Start the log view

func (*LogView) Stop

func (v *LogView) Stop()

Stop the log view

type ManagedResourceView

type ManagedResourceView struct {
	*CommonResourceView
	// contains filtered or unexported fields
}

ManagedResourceView is a view which displays info of application's managed resource including CRDs and k8s objects

func (*ManagedResourceView) BuildBody

func (v *ManagedResourceView) BuildBody()

BuildBody render the body of table

func (*ManagedResourceView) BuildHeader

func (v *ManagedResourceView) BuildHeader()

BuildHeader render the header of table

func (*ManagedResourceView) ColorizeStatusText

func (v *ManagedResourceView) ColorizeStatusText(rowNum int)

ColorizeStatusText colorize the status column text

func (*ManagedResourceView) Hint

func (v *ManagedResourceView) Hint() []model.MenuHint

Hint return key action menu hints of the managed resource view

func (*ManagedResourceView) Init

func (v *ManagedResourceView) Init()

Init managed resource view

func (*ManagedResourceView) InitView

func (v *ManagedResourceView) InitView(ctx context.Context, app *App)

InitView init a new managed resource view

func (*ManagedResourceView) Name

func (v *ManagedResourceView) Name() string

Name return managed resource view name

func (*ManagedResourceView) Refresh

func (v *ManagedResourceView) Refresh(_ *tcell.EventKey) *tcell.EventKey

Refresh the view content

func (*ManagedResourceView) Start

func (v *ManagedResourceView) Start()

Start the managed resource view

func (*ManagedResourceView) Stop

func (v *ManagedResourceView) Stop()

Stop the managed resource view

func (*ManagedResourceView) Title

func (v *ManagedResourceView) Title() string

Title return the table title of managed resource view

func (*ManagedResourceView) Update

func (v *ManagedResourceView) Update(timeoutCancel func())

Update refresh the content of body of view

type NamespaceView

type NamespaceView struct {
	*CommonResourceView
	// contains filtered or unexported fields
}

NamespaceView is namespace view struct

func (*NamespaceView) BuildBody

func (v *NamespaceView) BuildBody()

BuildBody render the body of table

func (*NamespaceView) BuildHeader

func (v *NamespaceView) BuildHeader()

BuildHeader render the header of table

func (*NamespaceView) ColorizeStatusText

func (v *NamespaceView) ColorizeStatusText(rowNum int)

ColorizeStatusText colorize the status column text

func (*NamespaceView) Hint

func (v *NamespaceView) Hint() []model.MenuHint

Hint return key action menu hints of the k8s view

func (*NamespaceView) Init

func (v *NamespaceView) Init()

Init a namespace view

func (*NamespaceView) InitView

func (v *NamespaceView) InitView(ctx context.Context, app *App)

InitView init a new namespace view

func (*NamespaceView) Name

func (v *NamespaceView) Name() string

Name return k8s view name

func (*NamespaceView) Refresh

func (v *NamespaceView) Refresh(_ *tcell.EventKey) *tcell.EventKey

Refresh the view content

func (*NamespaceView) Start

func (v *NamespaceView) Start()

Start the managed namespace view

func (*NamespaceView) Stop

func (v *NamespaceView) Stop()

Stop the managed namespace view

func (*NamespaceView) Update

func (v *NamespaceView) Update(timeoutCancel func())

Update refresh the content of body of view

type PageStack

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

PageStack store views of app's main view, and it's a high level packing of "component.Pages"

func NewPageStack

func NewPageStack(app *App) *PageStack

NewPageStack returns a new page stack.

func (*PageStack) Init

func (ps *PageStack) Init()

Init the pageStack

func (*PageStack) StackPop

func (ps *PageStack) StackPop(old, new model.View)

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

func (*PageStack) StackPush

func (ps *PageStack) StackPush(old, new model.View)

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

type PodView

type PodView struct {
	*CommonResourceView
	// contains filtered or unexported fields
}

PodView is the pod view, this view display info of pod belonging to component

func (*PodView) BuildBody

func (v *PodView) BuildBody()

BuildBody render the body of table

func (*PodView) BuildHeader

func (v *PodView) BuildHeader()

BuildHeader render the header of table

func (*PodView) ColorizePhaseText

func (v *PodView) ColorizePhaseText(rowNum int)

ColorizePhaseText colorize the phase column text

func (*PodView) Hint

func (v *PodView) Hint() []model.MenuHint

Hint return key action menu hints of the pod view

func (*PodView) Init

func (v *PodView) Init()

Init cluster view init

func (*PodView) InitView

func (v *PodView) InitView(ctx context.Context, app *App)

InitView init a new pod view

func (*PodView) Name

func (v *PodView) Name() string

Name return pod view name

func (*PodView) Refresh

func (v *PodView) Refresh(_ *tcell.EventKey) *tcell.EventKey

Refresh the view content

func (*PodView) Start

func (v *PodView) Start()

Start the pod view

func (*PodView) Stop

func (v *PodView) Stop()

Stop the pod view

func (*PodView) Update

func (v *PodView) Update(timeoutCancel func())

Update refresh the content of body of view

type ResourceView

type ResourceView interface {
	model.View
	InitView(ctx context.Context, app *App)
	Refresh(event *tcell.EventKey) *tcell.EventKey
	Update(timeoutCancel func())
	BuildHeader()
	BuildBody()
}

ResourceView is the interface to abstract resource view

type TopologyTree added in v1.6.1

type TopologyTree struct {
	*tview.TreeView
}

TopologyTree is the abstract of topology tree

type TopologyView

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

TopologyView display the resource topology of application

func (*TopologyView) AutoRefresh added in v1.6.4

func (v *TopologyView) AutoRefresh(update func(timeoutCancel func()))

AutoRefresh will refresh the view in every RefreshDelay delay

func (*TopologyView) Hint

func (v *TopologyView) Hint() []model.MenuHint

Hint return the menu hints of topology view

func (*TopologyView) Init

func (v *TopologyView) Init()

Init the topology view

func (*TopologyView) Name

func (v *TopologyView) Name() string

Name return the name of topology view

func (*TopologyView) NewAppTopologyView

func (v *TopologyView) NewAppTopologyView() *TopologyTree

NewAppTopologyView return a new app topology view

func (*TopologyView) NewResourceTopologyView

func (v *TopologyView) NewResourceTopologyView() *TopologyTree

NewResourceTopologyView return a new resource topology view

func (*TopologyView) Refresh added in v1.6.4

func (v *TopologyView) Refresh(clear bool, update func(timeoutCancel func()))

Refresh the topology view

func (*TopologyView) Start

func (v *TopologyView) Start()

Start the topology view

func (*TopologyView) Stop

func (v *TopologyView) Stop()

Stop the topology view

func (*TopologyView) Update added in v1.6.4

func (v *TopologyView) Update(timeoutCancel func())

Update the topology view

type YamlView

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

YamlView is the resource yaml view, this view display info of yaml text of the resource

func (*YamlView) HighlightText added in v1.7.0

func (v *YamlView) HighlightText(yaml string) string

HighlightText highlight the key, colon, value text of the yaml text

func (*YamlView) Hint

func (v *YamlView) Hint() []model.MenuHint

Hint return the menu hints of yaml view

func (*YamlView) Init

func (v *YamlView) Init()

Init the yaml view

func (*YamlView) Name

func (v *YamlView) Name() string

Name return the name of yaml view

func (*YamlView) Start

func (v *YamlView) Start()

Start the yaml view

func (*YamlView) Stop

func (v *YamlView) Stop()

Stop the yaml view

Jump to

Keyboard shortcuts

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