widgets

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventDetailsWidget added in v1.1.0

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

EventDetailsWidget represents the ui widget component for the details view of an event.

func NewEventDetailsWidget added in v1.1.0

func NewEventDetailsWidget(name, namespace string, apiClient *api.Client, filter api.Filter, sortorder api.Sort, termWidth, termHeight int) *EventDetailsWidget

NewEventDetailsWidget returns an new event details widget.

func (*EventDetailsWidget) Draw added in v1.1.0

func (e *EventDetailsWidget) Draw(buf *ui.Buffer)

Draw renders our statusbar.

func (*EventDetailsWidget) Filter added in v1.1.0

func (e *EventDetailsWidget) Filter() api.Filter

Filter returns the setted filter.

func (*EventDetailsWidget) Pause added in v1.1.0

func (e *EventDetailsWidget) Pause() bool

Pause returns if updates are paused or not.

func (*EventDetailsWidget) SelectBottom added in v1.1.0

func (e *EventDetailsWidget) SelectBottom()

SelectBottom selects the bottom item in the table.

func (*EventDetailsWidget) SelectHalfPageDown added in v1.1.0

func (e *EventDetailsWidget) SelectHalfPageDown()

SelectHalfPageDown selects the item a half page down.

func (*EventDetailsWidget) SelectHalfPageUp added in v1.1.0

func (e *EventDetailsWidget) SelectHalfPageUp()

SelectHalfPageUp selects the item a half page up.

func (*EventDetailsWidget) SelectNext added in v1.1.0

func (e *EventDetailsWidget) SelectNext()

SelectNext selects the next log line.

func (*EventDetailsWidget) SelectPageDown added in v1.1.0

func (e *EventDetailsWidget) SelectPageDown()

SelectPageDown selects the item on the next page.

func (*EventDetailsWidget) SelectPageUp added in v1.1.0

func (e *EventDetailsWidget) SelectPageUp()

SelectPageUp selects the item on the previous page.

func (*EventDetailsWidget) SelectPrev added in v1.1.0

func (e *EventDetailsWidget) SelectPrev()

SelectPrev selects the previous log line.

func (*EventDetailsWidget) SelectTop added in v1.1.0

func (e *EventDetailsWidget) SelectTop()

SelectTop selects the top item in the table.

func (*EventDetailsWidget) SelectedValues added in v1.1.0

func (e *EventDetailsWidget) SelectedValues() []string

SelectedValues returns the name of the selected pod.

func (*EventDetailsWidget) SetSortAndFilter added in v1.1.0

func (e *EventDetailsWidget) SetSortAndFilter(sortorder api.Sort, filter api.Filter)

SetSortAndFilter sets a new value for the sortorder and filter.

func (*EventDetailsWidget) Sortorder added in v1.1.0

func (e *EventDetailsWidget) Sortorder() api.Sort

Sortorder returns the setted sortorder.

func (*EventDetailsWidget) TogglePause added in v1.1.0

func (e *EventDetailsWidget) TogglePause()

TogglePause sets toggle pause.

func (*EventDetailsWidget) Update added in v1.1.0

func (e *EventDetailsWidget) Update() error

Update updates the data for the details view of a pod.

type EventsWidget added in v1.1.0

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

EventsWidget represents the ui widget component for the events view.

func NewEventsWidget added in v1.1.0

func NewEventsWidget(apiClient *api.Client, filter api.Filter, sortorder api.Sort, termWidth, termHeight int) *EventsWidget

NewEventsWidget returns a new events widget. We create the table for the events widget with all the basic layout settings.

func (*EventsWidget) Filter added in v1.1.0

func (e *EventsWidget) Filter() api.Filter

Filter returns the setted filter.

func (*EventsWidget) Pause added in v1.1.0

func (e *EventsWidget) Pause() bool

Pause returns if updates are paused or not.

func (*EventsWidget) SelectBottom added in v1.1.0

func (e *EventsWidget) SelectBottom()

SelectBottom selects the bottom item in the table.

func (*EventsWidget) SelectHalfPageDown added in v1.1.0

func (e *EventsWidget) SelectHalfPageDown()

SelectHalfPageDown selects the item a half page down.

func (*EventsWidget) SelectHalfPageUp added in v1.1.0

func (e *EventsWidget) SelectHalfPageUp()

SelectHalfPageUp selects the item a half page up.

func (*EventsWidget) SelectNext added in v1.1.0

func (e *EventsWidget) SelectNext()

SelectNext selects the next item in the table.

func (*EventsWidget) SelectPageDown added in v1.1.0

func (e *EventsWidget) SelectPageDown()

SelectPageDown selects the item on the next page.

func (*EventsWidget) SelectPageUp added in v1.1.0

func (e *EventsWidget) SelectPageUp()

SelectPageUp selects the item on the previous page.

func (*EventsWidget) SelectPrev added in v1.1.0

func (e *EventsWidget) SelectPrev()

SelectPrev selects the previous item in the table.

func (*EventsWidget) SelectTop added in v1.1.0

func (e *EventsWidget) SelectTop()

SelectTop selects the top item in the table.

func (*EventsWidget) SelectedValues added in v1.1.0

func (e *EventsWidget) SelectedValues() []string

SelectedValues returns the selected event.

func (*EventsWidget) SetSortAndFilter added in v1.1.0

func (e *EventsWidget) SetSortAndFilter(sortorder api.Sort, filter api.Filter)

SetSortAndFilter sets a new value for the sortorder and filter.

func (*EventsWidget) Sortorder added in v1.1.0

func (e *EventsWidget) Sortorder() api.Sort

Sortorder returns the setted sortorder.

func (*EventsWidget) TogglePause added in v1.1.0

func (e *EventsWidget) TogglePause()

TogglePause sets toggle pause.

func (*EventsWidget) Update added in v1.1.0

func (e *EventsWidget) Update() error

Update updates the table data of the pod view. Get the data for the pods widget and add each pod as seperate row to the table.

type ListType

type ListType string

ListType is our custom type for the different list types (e.g. sort and filter)

const (
	// ListTypeSort represents the the sorting list.
	ListTypeSort ListType = "Sort by ..."
	// ListTypeFilterNamespace represents the namespace filter.
	ListTypeFilterNamespace ListType = "Filter by Namespace ..."
	// ListTypeFilterNode represents the node filter.
	ListTypeFilterNode ListType = "Filter by Node ..."
	// ListTypeFilterStatus represents the status filter.
	ListTypeFilterStatus ListType = "Filter by Status ..."
	// ListTypeFilterEventType represents the event type filter.
	ListTypeFilterEventType ListType = "Filter by Event Type ..."
	// ListTypeView represents the list for switching to an other view.
	ListTypeView = "Select View ..."
)

type ListWidget

type ListWidget struct {
	*w.List
	// contains filtered or unexported fields
}

ListWidget represents the ui widget component for a list.

func NewListWidget

func NewListWidget(apiClient *api.Client) *ListWidget

NewListWidget returns a new list widget.

func (*ListWidget) Hide

func (l *ListWidget) Hide()

Hide hides the list.

func (*ListWidget) Selected

func (l *ListWidget) Selected(viewType ViewType, listType ListType, sortorder api.Sort, filter api.Filter) (ViewType, api.Sort, api.Filter)

Selected determines the selected sortorder or filter.

func (*ListWidget) Show

func (l *ListWidget) Show(viewType ViewType, listType ListType, termWidth, termHeight int) bool

Show shows a list with the specified sort options or filters.

type NodesWidget

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

NodesWidget represents the ui widget component for the nodes view.

func NewNodesWidget

func NewNodesWidget(apiClient *api.Client, filter api.Filter, sortorder api.Sort, termWidth, termHeight int) *NodesWidget

NewNodesWidget returns a new nodes widget. We create the table for the nodes widget with all the basic layout settings.

func (*NodesWidget) Filter

func (n *NodesWidget) Filter() api.Filter

Filter returns the setted filter.

func (*NodesWidget) Pause

func (n *NodesWidget) Pause() bool

Pause returns if updates are paused or not.

func (*NodesWidget) SelectBottom added in v1.1.0

func (n *NodesWidget) SelectBottom()

SelectBottom selects the bottom item in the table.

func (*NodesWidget) SelectHalfPageDown added in v1.1.0

func (n *NodesWidget) SelectHalfPageDown()

SelectHalfPageDown selects the item a half page down.

func (*NodesWidget) SelectHalfPageUp added in v1.1.0

func (n *NodesWidget) SelectHalfPageUp()

SelectHalfPageUp selects the item a half page up.

func (*NodesWidget) SelectNext

func (n *NodesWidget) SelectNext()

SelectNext selects the next item in the table.

func (*NodesWidget) SelectPageDown added in v1.1.0

func (n *NodesWidget) SelectPageDown()

SelectPageDown selects the item on the next page.

func (*NodesWidget) SelectPageUp added in v1.1.0

func (n *NodesWidget) SelectPageUp()

SelectPageUp selects the item on the previous page.

func (*NodesWidget) SelectPrev

func (n *NodesWidget) SelectPrev()

SelectPrev selects the previous item in the table.

func (*NodesWidget) SelectTop added in v1.1.0

func (n *NodesWidget) SelectTop()

SelectTop selects the top item in the table.

func (*NodesWidget) SelectedValues

func (n *NodesWidget) SelectedValues() []string

SelectedValues returns the name of the selected row.

func (*NodesWidget) SetSortAndFilter

func (n *NodesWidget) SetSortAndFilter(sortorder api.Sort, filter api.Filter)

SetSortAndFilter sets a new value for the sortorder and filter.

func (*NodesWidget) Sortorder

func (n *NodesWidget) Sortorder() api.Sort

Sortorder returns the setted sortorder.

func (*NodesWidget) TogglePause

func (n *NodesWidget) TogglePause()

TogglePause sets toggle pause.

func (*NodesWidget) Update

func (n *NodesWidget) Update() error

Update updates the table data of the node view. Get the data for the nodes widget and add each node as seperate row to the table.

type PodDetailsWidget

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

PodDetailsWidget represents the ui widget component for the details view of a pod.

func NewPodDetailsWidget

func NewPodDetailsWidget(name, namespace string, apiClient *api.Client, filter api.Filter, sortorder api.Sort, termWidth, termHeight int) *PodDetailsWidget

NewPodDetailsWidget returns a new pods widget. We create the table for the pods widget with all the basic layout settings.

func (*PodDetailsWidget) Draw

func (p *PodDetailsWidget) Draw(buf *ui.Buffer)

Draw renders our statusbar.

func (*PodDetailsWidget) Filter

func (p *PodDetailsWidget) Filter() api.Filter

Filter returns the setted filter.

func (*PodDetailsWidget) Pause

func (p *PodDetailsWidget) Pause() bool

Pause returns if updates are paused or not.

func (*PodDetailsWidget) SelectBottom added in v1.1.0

func (p *PodDetailsWidget) SelectBottom()

SelectBottom selects the bottom item in the table.

func (*PodDetailsWidget) SelectHalfPageDown added in v1.1.0

func (p *PodDetailsWidget) SelectHalfPageDown()

SelectHalfPageDown selects the item a half page down.

func (*PodDetailsWidget) SelectHalfPageUp added in v1.1.0

func (p *PodDetailsWidget) SelectHalfPageUp()

SelectHalfPageUp selects the item a half page up.

func (*PodDetailsWidget) SelectNext

func (p *PodDetailsWidget) SelectNext()

SelectNext selects the next log line.

func (*PodDetailsWidget) SelectPageDown added in v1.1.0

func (p *PodDetailsWidget) SelectPageDown()

SelectPageDown selects the item on the next page.

func (*PodDetailsWidget) SelectPageUp added in v1.1.0

func (p *PodDetailsWidget) SelectPageUp()

SelectPageUp selects the item on the previous page.

func (*PodDetailsWidget) SelectPrev

func (p *PodDetailsWidget) SelectPrev()

SelectPrev selects the previous log line.

func (*PodDetailsWidget) SelectTop added in v1.1.0

func (p *PodDetailsWidget) SelectTop()

SelectTop selects the top item in the table.

func (*PodDetailsWidget) SelectedValues

func (p *PodDetailsWidget) SelectedValues() []string

SelectedValues returns the name of the selected pod.

func (*PodDetailsWidget) SetSortAndFilter

func (p *PodDetailsWidget) SetSortAndFilter(sortorder api.Sort, filter api.Filter)

SetSortAndFilter sets a new value for the sortorder and filter.

func (*PodDetailsWidget) Sortorder

func (p *PodDetailsWidget) Sortorder() api.Sort

Sortorder returns the setted sortorder.

func (*PodDetailsWidget) TogglePause

func (p *PodDetailsWidget) TogglePause()

TogglePause sets toggle pause.

func (*PodDetailsWidget) Update

func (p *PodDetailsWidget) Update() error

Update updates the data for the details view of a pod.

type PodsWidget

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

PodsWidget represents the ui widget component for the pods view.

func NewPodsWidget

func NewPodsWidget(apiClient *api.Client, filter api.Filter, sortorder api.Sort, termWidth, termHeight int) *PodsWidget

NewPodsWidget returns a new pods widget. We create the table for the pods widget with all the basic layout settings.

func (*PodsWidget) Filter

func (p *PodsWidget) Filter() api.Filter

Filter returns the setted filter.

func (*PodsWidget) Pause

func (p *PodsWidget) Pause() bool

Pause returns if updates are paused or not.

func (*PodsWidget) SelectBottom added in v1.1.0

func (p *PodsWidget) SelectBottom()

SelectBottom selects the bottom item in the table.

func (*PodsWidget) SelectHalfPageDown added in v1.1.0

func (p *PodsWidget) SelectHalfPageDown()

SelectHalfPageDown selects the item a half page down.

func (*PodsWidget) SelectHalfPageUp added in v1.1.0

func (p *PodsWidget) SelectHalfPageUp()

SelectHalfPageUp selects the item a half page up.

func (*PodsWidget) SelectNext

func (p *PodsWidget) SelectNext()

SelectNext selects the next item in the table.

func (*PodsWidget) SelectPageDown added in v1.1.0

func (p *PodsWidget) SelectPageDown()

SelectPageDown selects the item on the next page.

func (*PodsWidget) SelectPageUp added in v1.1.0

func (p *PodsWidget) SelectPageUp()

SelectPageUp selects the item on the previous page.

func (*PodsWidget) SelectPrev

func (p *PodsWidget) SelectPrev()

SelectPrev selects the previous item in the table.

func (*PodsWidget) SelectTop added in v1.1.0

func (p *PodsWidget) SelectTop()

SelectTop selects the top item in the table.

func (*PodsWidget) SelectedValues

func (p *PodsWidget) SelectedValues() []string

SelectedValues returns the name of the selected pod.

func (*PodsWidget) SetSortAndFilter

func (p *PodsWidget) SetSortAndFilter(sortorder api.Sort, filter api.Filter)

SetSortAndFilter sets a new value for the sortorder and filter.

func (*PodsWidget) Sortorder

func (p *PodsWidget) Sortorder() api.Sort

Sortorder returns the setted sortorder.

func (*PodsWidget) TogglePause

func (p *PodsWidget) TogglePause()

TogglePause sets toggle pause.

func (*PodsWidget) Update

func (p *PodsWidget) Update() error

Update updates the table data of the pod view. Get the data for the pods widget and add each pod as seperate row to the table.

type StatusbarWidget

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

StatusbarWidget represents the ui widget component for the statusbar.

func NewStatusbarWidget

func NewStatusbarWidget(apiClient *api.Client, filter api.Filter, pause bool, sortorder api.Sort, viewType ViewType, termWidth, termHeight int) *StatusbarWidget

NewStatusbarWidget returns a new statusbar widget.

func (*StatusbarWidget) Draw

func (s *StatusbarWidget) Draw(buf *ui.Buffer)

Draw renders our statusbar.

func (*StatusbarWidget) SetPause

func (s *StatusbarWidget) SetPause(pause bool)

SetPause sets a new value for pause.

func (*StatusbarWidget) SetSortAndFilter

func (s *StatusbarWidget) SetSortAndFilter(sortorder api.Sort, filter api.Filter)

SetSortAndFilter sets a new value for the sortorder and filter.

func (*StatusbarWidget) SetViewType

func (s *StatusbarWidget) SetViewType(viewType ViewType)

SetViewType sets current view type.

type Table

type Table struct {
	*ui.Block

	Header []string
	Rows   [][]string

	ColWidths []int
	ColGap    int
	PadLeft   int

	ShowCursor  bool
	CursorColor ui.Color

	ShowLocation bool

	UniqueCol    int
	SelectedItem string
	SelectedRow  int
	TopRow       int

	ColResizer func()
}

Table represents our table instance. We use the table component from gotop (https://github.com/cjbassi/gotop/blob/master/src/termui/table.go). We do not use the standard table component from termui, because the component does not support scrolling.

func NewTable

func NewTable() *Table

NewTable returns a new table instance

func (*Table) Draw

func (t *Table) Draw(buf *ui.Buffer)

Draw renders our table component.

func (*Table) HandleClick

func (t *Table) HandleClick(x, y int)

HandleClick handles a click.

func (*Table) ScrollBottom

func (t *Table) ScrollBottom()

ScrollBottom implements scroll to bottom.

func (*Table) ScrollDown

func (t *Table) ScrollDown()

ScrollDown implements scroll down.

func (*Table) ScrollHalfPageDown

func (t *Table) ScrollHalfPageDown()

ScrollHalfPageDown implements scroll down a half page.

func (*Table) ScrollHalfPageUp

func (t *Table) ScrollHalfPageUp()

ScrollHalfPageUp implements scroll up a half page.

func (*Table) ScrollPageDown

func (t *Table) ScrollPageDown()

ScrollPageDown implements scroll down a page.

func (*Table) ScrollPageUp

func (t *Table) ScrollPageUp()

ScrollPageUp implements scroll up a page.

func (*Table) ScrollTop

func (t *Table) ScrollTop()

ScrollTop implements scroll to top.

func (*Table) ScrollUp

func (t *Table) ScrollUp()

ScrollUp implements scroll up.

type View

type View interface {
	ui.Drawable

	Filter() api.Filter
	Pause() bool
	SelectedValues() []string
	SelectNext()
	SelectPrev()
	SelectTop()
	SelectBottom()
	SelectHalfPageDown()
	SelectHalfPageUp()
	SelectPageDown()
	SelectPageUp()
	SetSortAndFilter(sortorder api.Sort, filter api.Filter)
	Sortorder() api.Sort
	TogglePause()
	Update() error
}

View represents all widgets which can be rendered as seperate view.

type ViewType

type ViewType string

ViewType implements all possible views for kubetop.

const (
	// ViewTypeNodes represents the nodes view.
	// The nodes view is represented by the NodesWidget.
	ViewTypeNodes ViewType = "Nodes View"
	// ViewTypePodDetails represents the detail view for a pod.
	// The pod details view is represented by the PodDetailsWidget.
	ViewTypePodDetails ViewType = "Pod Details View"
	// ViewTypePods represents the pods view.
	// The pods view is represented by the PodsWidget.
	ViewTypePods ViewType = "Pods View"
	// ViewTypeEvents represents the events view.
	// The events view is represented by the EventsWidget.
	ViewTypeEvents ViewType = "Events View"
	// ViewTypeEventDetails represents the event details view.
	// The event details view is represented by the EventDetailsWidget.
	ViewTypeEventDetails ViewType = "Event Details View"
)

Jump to

Keyboard shortcuts

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