page

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchedNewRowsMsg

type BatchedNewRowsMsg struct {
	Msgs []NewRowsMsg
}

type ChangePageMsg

type ChangePageMsg struct {
	NewPage     string // Id of page to switch to
	FetchData   bool   // If true, clears and (re)fetches data on new page
	PageContext interface{}

	InspectedRow map[string]string
}

type Model

type Model struct {
	Spec    PageSpec
	Context interface{}
	Tabs    tabs.Model
	Panes   []pane.Pane
	// contains filtered or unexported fields
}

Logical section with a set of tables/tabs

func New

func New(ctx *context.ProgramContext, spec PageSpec) Model

func (*Model) AppendRows

func (m *Model) AppendRows(tabId int, rows []table.Row)

func (*Model) ClearData

func (m *Model) ClearData()

func (*Model) ClearRows

func (m *Model) ClearRows(tabId int)

func (*Model) CurrentPane

func (m *Model) CurrentPane() pane.Pane

func (*Model) FetchData

func (m *Model) FetchData(client data.Client) tea.Cmd

func (*Model) GetCurrentPaneId

func (m *Model) GetCurrentPaneId() int

func (*Model) GetPageContext

func (m *Model) GetPageContext() interface{}

func (*Model) GetPaneId

func (m *Model) GetPaneId(paneName string) int

func (*Model) GetSpec

func (m *Model) GetSpec() PageSpec

func (*Model) Hide

func (m *Model) Hide()

func (*Model) Init

func (m *Model) Init() tea.Cmd

func (*Model) Inspect

func (m *Model) Inspect(client data.Client) tea.Cmd

func (*Model) NextTab

func (m *Model) NextTab() int

func (*Model) PrevTab

func (m *Model) PrevTab() int

func (*Model) SetPageContext

func (m *Model) SetPageContext(context interface{})

func (*Model) SetSize

func (m *Model) SetSize(width int, height int)

func (*Model) Update

func (m *Model) Update(client data.Client, msg tea.Msg) (tea.Cmd, bool)

func (*Model) View

func (m *Model) View() string

type NewRowsMsg

type NewRowsMsg struct {
	Page      string
	PaneId    int
	Rows      []table.Row
	NextCmd   tea.Cmd
	Overwrite bool
}

type Page

type Page interface {
	Init() tea.Cmd
	View() string
	NextTab() int
	PrevTab() int
	FetchData(client data.Client) tea.Cmd
	ClearData()
	AppendRows(tabId int, rows []table.Row)
	ClearRows(tabId int)
	GetPageContext() interface{}
	SetPageContext(context interface{})
	GetSpec() PageSpec

	GetCurrentPaneId() int

	Inspect(client data.Client) tea.Cmd

	Update(data.Client, tea.Msg) (cmd tea.Cmd, consumed bool)

	Hide() // Called when the page is no longer visible
	SetSize(width int, height int)
}

type PageSpec

type PageSpec struct {
	Name      string
	PaneSpecs []pane.PaneSpec
}

Jump to

Keyboard shortcuts

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