view

package
v1.6.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const RefreshDelay = 10 * time.Second

RefreshDelay is refresh delay

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),
}

ResourceViewMap is a map from resource name to resource view

Functions

func HighlightText

func HighlightText(yaml string) string

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

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

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

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

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

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

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

Refresh the base resource view

func (*CommonResourceView) Stop

func (v *CommonResourceView) Stop()

Stop the refresh goroutine and clear the table content

type HelpView

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

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

func NewHelpView

func NewHelpView(app *App) *HelpView

NewHelpView return a new help 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

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

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

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

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()
	BuildHeader()
	BuildBody()
}

ResourceView is the interface to abstract resource 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) 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