wottui

package
v0.0.0-...-a589b52 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PageLanding     = "landing"
	PageThings      = "things"
	PageDirectories = "directories"
	PageDiscovery   = "discovery"
	PageTD          = "td"
)
View Source
const (
	MenuEvClose           = "close"
	MenuEvDiscover        = "discover"
	MenuEvListTDs         = "listTDs"
	MenuEvNextPage        = "nextPage"
	MenuEvSelectTD        = "selectTD"
	MenuEvShowDiscovered  = "showDiscovered"
	MenuEvShowDirectory   = "showDirectory"
	MenuEvShowDirectories = "showDirectories"
	MenuEvShowTD          = "showTD"
	MenuEvShowThings      = "showThings"
	MenuEvQuit            = "quit"
)

menu events

Variables

This section is empty.

Functions

This section is empty.

Types

type AppFooter

type AppFooter struct {
	View *tview.Flex
	// contains filtered or unexported fields
}

The application footer are that shows the current activity and ?

func NewAppFooter

func NewAppFooter(model *wotco.WotConsumer) *AppFooter

Create a new instance of the application view

func (*AppFooter) Refresh

func (footer *AppFooter) Refresh()

Reload the text being shown using updated values

func (*AppFooter) SetHandler

func (footer *AppFooter) SetHandler(h func(ev ...string))

type AppHeader

type AppHeader struct {
	View *tview.Flex
	// contains filtered or unexported fields
}

The application header are that shows the connect connection and loaded status

func NewAppHeader

func NewAppHeader(model *wotco.WotConsumer) *AppHeader

Create a new instance of the application view

func (*AppHeader) Refresh

func (header *AppHeader) Refresh()

Reload the text being shown using updated values

type DirectoriesPage

type DirectoriesPage struct {
	TuiTable
	// contains filtered or unexported fields
}

Show the loaded directories in the main view

func NewDirectoriesPage

func NewDirectoriesPage(model *wotco.WotConsumer) *DirectoriesPage

Return a new page with a table of known thing TDs

func (*DirectoriesPage) GetDirectoryID

func (v *DirectoriesPage) GetDirectoryID(row int) string

Return the directoryID of the selected row, or empty string if not found

func (*DirectoriesPage) Refresh

func (v *DirectoriesPage) Refresh()

Show the loaded directories in the main view this rotates through different tables

func (*DirectoriesPage) SetHandler

func (footer *DirectoriesPage) SetHandler(h func(ev ...string))

type DiscoPage

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

Page with discovery records

func NewDiscoPage

func NewDiscoPage(model *wotco.WotConsumer) *DiscoPage

Create a new discovery table page

func (*DiscoPage) Refresh

func (v *DiscoPage) Refresh()

Show the discovered records in the main view

type TDPage

type TDPage struct {
	tview.Flex
	// contains filtered or unexported fields
}

Page for showing details of a TD document This consists of a header section with 3 tables for affordances and their value Including a button to subscribe and download the TD document as JSON.

func NewTDPage

func NewTDPage(model *wotco.WotConsumer) *TDPage

func (*TDPage) Refresh

func (page *TDPage) Refresh(thingID string)

func (*TDPage) SetHandler

func (page *TDPage) SetHandler(h func(ev ...string))

type ThingsPage

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

Show the loaded things in the main view this rotates through different tabl

func NewThingsPage

func NewThingsPage(model *wotco.WotConsumer) *ThingsPage

Return a new page with a table of known thing TDs

func (*ThingsPage) GetThingID

func (v *ThingsPage) GetThingID(row int) string

Return the thingID of the selected row, or empty string if not found

func (*ThingsPage) Refresh

func (v *ThingsPage) Refresh()

Show the loaded things in the main view this rotates through different tables

func (*ThingsPage) SetHandler

func (footer *ThingsPage) SetHandler(h func(ev ...string))

type TreeMenu

type TreeMenu struct {
	tview.TreeView
	// contains filtered or unexported fields
}

func NewTreeMenu

func NewTreeMenu(model *wotco.WotConsumer) *TreeMenu

func (*TreeMenu) HandleSelection

func (m *TreeMenu) HandleSelection(node *tview.TreeNode)

func (*TreeMenu) Refresh

func (m *TreeMenu) Refresh()

Refresh the menu with the latest discovered things and directories

func (*TreeMenu) SelectThing

func (m *TreeMenu) SelectThing(thingID string)

Select the Thing in the tree view

func (*TreeMenu) SetHandler

func (m *TreeMenu) SetHandler(h func(ev ...string))

type TuiApp

type TuiApp struct {
	tview.Application
	// contains filtered or unexported fields
}

The main application view with panels for header, menu main view and footer - header shows the current status - menu shows quick actions for discovery and viewing TDs - main shows details - footer shows last action

func NewTuiApp

func NewTuiApp(co *wotco.WotConsumer) *TuiApp

Create a new instance of the tui app

func (*TuiApp) NextPage

func (tui *TuiApp) NextPage()

func (*TuiApp) Run

func (tui *TuiApp) Run()

Start the application

func (*TuiApp) SelectTD

func (tui *TuiApp) SelectTD(thingID string)

Select a TD in the menu. This is called by the ThingList to select a thing in the menu which in turn updates the TD view.

func (*TuiApp) ShowDirectories

func (tui *TuiApp) ShowDirectories()

func (*TuiApp) ShowDiscovery

func (tui *TuiApp) ShowDiscovery()

Show the discovery records

func (*TuiApp) ShowTD

func (tui *TuiApp) ShowTD(thingID string)

Show the TD page with the thingID details

func (*TuiApp) ShowThings

func (tui *TuiApp) ShowThings()

Show the loaded things in the main view

func (*TuiApp) StartDiscovery

func (tui *TuiApp) StartDiscovery()

Start a discovery and refresh the header and main view.

type TuiTable

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

A simple table with boilerplate code for adding titles and data rows.

func NewTuiTable

func NewTuiTable(titleColor tcell.Color) *TuiTable

func (*TuiTable) SetDataCell

func (tbl *TuiTable) SetDataCell(row int, col int, content string) int

Add row data to the table, and return the increased column number Row should start at 1, as row 0 is for the titles

func (*TuiTable) SetDataRow

func (tbl *TuiTable) SetDataRow(row int, colData ...string)

Add a data row to the table Row should start at 1, as row 0 is for the titles

func (*TuiTable) SetTitleRow

func (tbl *TuiTable) SetTitleRow(row int, titles ...string)

Add the column titles to the table These use the titleColor and are not selectable

Jump to

Keyboard shortcuts

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