tui

package
v0.0.0-...-625aa4e Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LoadingState state = iota
	ReadyState
	ErrorState
)
View Source
const (
	COUNT_COL = 4
)

Variables

This section is empty.

Functions

func Decolorise

func Decolorise(str string) string

func RenderCell

func RenderCell(cluster entity.Cluster, col int) *tview.TableCell

func ToTitle

func ToTitle(str string) string

func TrimCell

func TrimCell(tv *SelectTable, row, col int) string

func WithPadding

func WithPadding(str string, padding int) string

Types

type ClusterTableContent

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

func NewTableContent

func NewTableContent(clusters []entity.Cluster) *ClusterTableContent

func NewTableContentWithFilter

func NewTableContentWithFilter(clusters []entity.Cluster, filter func(entity.Cluster) bool) *ClusterTableContent

func (*ClusterTableContent) Clear

func (tc *ClusterTableContent) Clear()

Clear does not do anything.

func (*ClusterTableContent) GetCell

func (tc *ClusterTableContent) GetCell(row, column int) *tview.TableCell

func (*ClusterTableContent) GetColumnCount

func (tc *ClusterTableContent) GetColumnCount() int

func (*ClusterTableContent) GetRowCount

func (tc *ClusterTableContent) GetRowCount() int

func (*ClusterTableContent) InsertColumn

func (tc *ClusterTableContent) InsertColumn(column int)

InsertColumn does not do anything.

func (*ClusterTableContent) InsertRow

func (tc *ClusterTableContent) InsertRow(row int)

InsertRow does not do anything.

func (*ClusterTableContent) RemoveColumn

func (tc *ClusterTableContent) RemoveColumn(column int)

RemoveColumn does not do anything.

func (*ClusterTableContent) RemoveRow

func (tc *ClusterTableContent) RemoveRow(row int)

RemoveRow does not do anything.

func (*ClusterTableContent) SetCell

func (tc *ClusterTableContent) SetCell(row, column int, cell *tview.TableCell)

SetCell does not do anything.

func (*ClusterTableContent) SetFilter

func (tc *ClusterTableContent) SetFilter(filter func(entity.Cluster) bool)

type ClusterView

type ClusterView struct {
	*tview.Box
	// contains filtered or unexported fields
}

func NewClusterView

func NewClusterView(name string) *ClusterView

func (*ClusterView) Draw

func (v *ClusterView) Draw(screen tcell.Screen)

func (*ClusterView) Focus

func (v *ClusterView) Focus(delegate func(p tview.Primitive))

Focus set the focus either on the menu is showMenu is true or on the textView.

func (*ClusterView) HandleEventKey

func (v *ClusterView) HandleEventKey(key *tcell.EventKey)

func (*ClusterView) Model

func (v *ClusterView) Model(model any)

func (*ClusterView) SetFocus

func (v *ClusterView) SetFocus()
type NavBar struct {
	*tview.TextView
}

NavBar displays the navigation bar at the bottom of the screen.

func NewNavBar

func NewNavBar() *NavBar
func (navBar *NavBar) AddPage(idx int, name string)

AddPage shows the names of the pages in the navBar.

func (navBar *NavBar) SelectPage(name string)

SelectPage highlight the page.

type SelectTable

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

SelectTable represents a table with selections.

func (*SelectTable) ClearMarks

func (s *SelectTable) ClearMarks()

ClearMarks delete all marked items.

func (*SelectTable) ClearSelection

func (s *SelectTable) ClearSelection()

ClearSelection reset selected row.

func (*SelectTable) DeleteMark

func (s *SelectTable) DeleteMark(k string)

DeleteMark delete a marked item.

func (*SelectTable) GetModel

func (s *SelectTable) GetModel() TableModel

GetModel returns the current model.

func (*SelectTable) GetRowID

func (s *SelectTable) GetRowID(index int) (string, bool)

GetRowID returns the row id at at given location.

func (*SelectTable) GetSelectedCell

func (s *SelectTable) GetSelectedCell(col int) string

GetSelectedCell returns the content of a cell for the currently selected row.

func (*SelectTable) GetSelectedItem

func (s *SelectTable) GetSelectedItem() string

GetSelectedItem returns the currently selected item name.

func (*SelectTable) GetSelectedItems

func (s *SelectTable) GetSelectedItems() []string

GetSelectedItems return currently marked or selected items names.

func (*SelectTable) GetSelectedRowIndex

func (s *SelectTable) GetSelectedRowIndex() int

GetSelectedRowIndex fetch the currently selected row index.

func (*SelectTable) SelectFirstRow

func (s *SelectTable) SelectFirstRow()

SelectFirstRow select first data row if any.

func (*SelectTable) SelectRow

func (s *SelectTable) SelectRow(r int, broadcast bool)

SelectRow select a given row by index.

func (*SelectTable) SetModel

func (s *SelectTable) SetModel(m TableModel)

SetModel sets the table model.

func (*SelectTable) SetSelectedFn

func (s *SelectTable) SetSelectedFn(f func(string) string)

SetSelectedFn defines a function that cleanse the current selection.

func (*SelectTable) SpanMark

func (s *SelectTable) SpanMark()

SpanMark toggles marked row.

func (*SelectTable) ToggleMark

func (s *SelectTable) ToggleMark()

ToggleMark toggles marked row.

type TableModel

type TableModel interface {
	Empty() bool
	Count() int
}

type Tui

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

func New

func New(app *tview.Application, fmReader service.FleetManagerReader) *Tui

func (*Tui) HandleEventKey

func (t *Tui) HandleEventKey(key *tcell.EventKey)

func (*Tui) Layout

func (t *Tui) Layout() tview.Primitive

Layout returns the root flex

func (*Tui) Start

func (t *Tui) Start()

Start starts a go routin which draws app every 0.5s. In this way, we avoid to pass app pointer to every primitive which needs to be redrawn

func (*Tui) Stop

func (t *Tui) Stop()

type ViewState

type ViewState struct {
	State state
	Err   error
}

Jump to

Keyboard shortcuts

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