tui

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PrimaryColor string = "#3F51B5"
	PrimaryLight string = "#C5CAE9"
	PrimaryDark  string = "#001F5F"
	AccentColor  string = "#00796B"
	ErrorColor   string = "#8A0B29"
)
View Source
const (

)

Variables

View Source
var (

	// The hostname passed into the application as a command line argument flag
	Hostname string
	// The API token generated from the VC4 webpage, this is required to control an external appliance
	Token string
	// Program file path passed into the application used to create a new program entry
	ProgramFile string
	// The programs and room name used to whip up a new room with a simply command line arg
	ProgramName string
	// The room id passed into the application. providing a room id creates additional options that can be leveraged to process room actions
	RoomID string
	// Actions include GET PUT DEL and can be used with a combination of the Room ID and program file flags
	Action string
	// When the -o flag is provided the application will override the provided room.
	OverrideFile bool
)
View Source
var BaseStyle = lipgloss.NewStyle().
	BorderStyle(lipgloss.NormalBorder()).
	BorderForeground(lipgloss.Color("240"))
View Source
var GreyedOutText = lipgloss.NewStyle().
	Foreground(lipgloss.Color("#555555")).
	Bold(false)
View Source
var HighlightedText = lipgloss.NewStyle().
	Foreground(lipgloss.Color("#FF75B7")).
	Bold(true)
View Source
var Keys = keyMap{
	Up: key.NewBinding(
		key.WithKeys("up", "k"),
		key.WithHelp("↑/k", "move up"),
	),
	Down: key.NewBinding(
		key.WithKeys("down", "j"),
		key.WithHelp("↓/j", "move down"),
	),
	Left: key.NewBinding(
		key.WithKeys("left", "h"),
		key.WithHelp("←/h", "move left"),
	),
	Right: key.NewBinding(
		key.WithKeys("right", "l"),
		key.WithHelp("→/l", "move right"),
	),
	Help: key.NewBinding(
		key.WithKeys("?"),
		key.WithHelp("?", "toggle help"),
	),
	GoHelp: key.NewBinding(
		key.WithKeys("?"),
		key.WithHelp("?", "Show help"),
	),
	Quit: key.NewBinding(
		key.WithKeys("q", "ctrl+q", "esc", "ctrl+c"),
		key.WithHelp("ctrl+q", "return"),
	),
	Programs: key.NewBinding(
		key.WithKeys("ctrl+p"),
		key.WithHelp("ctrl+p", "programs"),
	),
	Rooms: key.NewBinding(
		key.WithKeys("ctrl+r"),
		key.WithHelp("ctrl+r", "rooms"),
	),
	Devices: key.NewBinding(
		key.WithKeys("ctrl+d"),
		key.WithHelp("ctrl+d", "devices"),
	),
	Auth: key.NewBinding(
		key.WithKeys("ctrl+a"),
		key.WithHelp("ctrl+a", "auth"),
	),
	Info: key.NewBinding(
		key.WithKeys("ctrl+i"),
		key.WithHelp("ctrl+i", "info"),
	),
}
View Source
var SelectText = lipgloss.NewStyle().
	Bold(true).
	Foreground(lipgloss.Color("#FAFAFA")).
	Background(lipgloss.Color("#7D56F4")).
	PaddingTop(1).
	PaddingLeft(1).
	MarginBottom(1).
	Width(76).Align(lipgloss.Top).
	Height(3)

Functions

func CheckMark

func CheckMark(status bool) string

func CreateAndRunProgram added in v0.0.5

func CreateAndRunProgram(progOps *vc.ProgramOptions, roomOps *vc.RoomOptions) tea.Msg

func CreateAndRunRoomAction added in v0.0.5

func CreateAndRunRoomAction(progOps *vc.ProgramOptions, roomOps *vc.RoomOptions) tea.Cmd

func CreateErrorAction added in v0.0.5

func CreateErrorAction() tea.Msg

func CreateNewProgram

func CreateNewProgram(options vc.ProgramOptions) tea.Msg

func CreateProgramAction added in v0.0.4

func CreateProgramAction(options *vc.ProgramOptions) tea.Cmd

func CreateRoom added in v0.0.3

func CreateRoom(options vc.RoomOptions) tea.Cmd

func CreateRoomAction added in v0.0.4

func CreateRoomAction(options *vc.RoomOptions) tea.Cmd

func CreateToken added in v0.1.0

func CreateToken(description string, readonly bool) tea.Cmd

func DefaultStyles

func DefaultStyles() table.Styles

func DeleteProgram

func DeleteProgram(id int) tea.Cmd

func DeleteRoom added in v0.0.3

func DeleteRoom(id string) tea.Cmd

func DeleteToken added in v0.1.0

func DeleteToken(token string) tea.Cmd

func DeviceInfoCommand

func DeviceInfoCommand() tea.Msg
func DisplayLogo(width int) string

func EditProgram added in v0.0.3

func EditProgram(options vc.ProgramOptions) tea.Msg

func EditRoom added in v0.0.3

func EditRoom(options vc.RoomOptions) tea.Cmd

func EditToken added in v0.1.0

func EditToken(description string, readonly bool, token string) tea.Cmd

func GetIcons

func GetIcons() string

func GetOnlineIcon added in v0.0.8

func GetOnlineIcon(status string) string

func GetReadonlyIcon added in v0.1.0

func GetReadonlyIcon(status vc.TokenStatus) string

func GetStatus

func GetStatus(status string) string

func HideBusyMessage

func HideBusyMessage() tea.Msg

func InitFlags

func InitFlags()

func IpTableQuery added in v0.0.8

func IpTableQuery(id string) tea.Cmd

func NewProgramsHelpModel

func NewProgramsHelpModel() programsHelpModel

func ProgramsQuery

func ProgramsQuery() tea.Msg

func QueryTokens added in v0.1.0

func QueryTokens() tea.Msg

func RenderErrorBox

func RenderErrorBox(header string, err error) string

func RenderMessageBox

func RenderMessageBox(width int) lipgloss.Style

func RoomDebug

func RoomDebug(id string, enable bool) tea.Msg

func RoomRestart

func RoomRestart(id string) tea.Msg

func RoomStart

func RoomStart(id string) tea.Msg

func RoomStop

func RoomStop(id string) tea.Msg

func RoomsQuery added in v0.0.3

func RoomsQuery() tea.Msg

func Run

func Run()

func ShowBusyMessage

func ShowBusyMessage(message string) tea.Cmd

func SumbitDeleteProgramForm

func SumbitDeleteProgramForm(m *DeleteProgramForm) tea.Cmd

func SumbitDeleteTokenForm added in v0.1.0

func SumbitDeleteTokenForm(m *DeleteTokenForm) tea.Cmd

func SumbitNewProgramForm

func SumbitNewProgramForm(m *NewProgramForm) tea.Cmd

Types

type ActionsModel added in v0.0.4

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

func InitialActionModel added in v0.0.4

func InitialActionModel(message string, action initialAction) *ActionsModel

func (ActionsModel) Init added in v0.0.4

func (m ActionsModel) Init() tea.Cmd

func (ActionsModel) Update added in v0.0.4

func (m ActionsModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (ActionsModel) View added in v0.0.4

func (m ActionsModel) View() string

type BannerModel added in v0.0.6

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

func NewBanner added in v0.0.6

func NewBanner(message string, state BannerState, width int) *BannerModel

func (BannerModel) Init added in v0.0.6

func (m BannerModel) Init() tea.Cmd

func (BannerModel) Update added in v0.0.6

func (m BannerModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (BannerModel) View added in v0.0.6

func (m BannerModel) View() string

type BannerState added in v0.0.6

type BannerState int
const (
	BannerNormalState BannerState = iota
	BannerErrorState  BannerState = 1
)

type DeleteProgramForm

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

func DeleteProgramFormModel

func DeleteProgramFormModel(program *vc.ProgramEntry) DeleteProgramForm

func (DeleteProgramForm) Init

func (m DeleteProgramForm) Init() tea.Cmd

func (DeleteProgramForm) Update

func (m DeleteProgramForm) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (DeleteProgramForm) View

func (m DeleteProgramForm) View() string

type DeleteRoomForm added in v0.0.3

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

func DeleteRoomFormModel added in v0.0.3

func DeleteRoomFormModel(room *vc.Room) DeleteRoomForm

func (DeleteRoomForm) Init added in v0.0.3

func (m DeleteRoomForm) Init() tea.Cmd

func (DeleteRoomForm) Update added in v0.0.3

func (m DeleteRoomForm) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (DeleteRoomForm) View added in v0.0.3

func (m DeleteRoomForm) View() string

type DeleteTokenForm added in v0.1.0

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

func DeleteTokenFormModel added in v0.1.0

func DeleteTokenFormModel(token *vc.ApiToken) DeleteTokenForm

func (DeleteTokenForm) Init added in v0.1.0

func (m DeleteTokenForm) Init() tea.Cmd

func (DeleteTokenForm) Update added in v0.1.0

func (m DeleteTokenForm) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (DeleteTokenForm) View added in v0.1.0

func (m DeleteTokenForm) View() string

type DeviceTableModel

type DeviceTableModel struct {
	Table table.Model
	Help  HelpModel
	// contains filtered or unexported fields
}

func HomeDeviceInfo

func HomeDeviceInfo(info vc.DeviceInfo, width int) DeviceTableModel

func NewDeviceErrorTable

func NewDeviceErrorTable(msg vc.VirtualControlError, width int) DeviceTableModel

func NewDeviceInfo

func NewDeviceInfo(width, height int) DeviceTableModel

func NewDeviceTable

func NewDeviceTable(info vc.DeviceInfo, width int) DeviceTableModel

func (DeviceTableModel) Init

func (m DeviceTableModel) Init() tea.Cmd

func (DeviceTableModel) Update

func (m DeviceTableModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (DeviceTableModel) View

func (m DeviceTableModel) View() string

type HelpModel

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

func NewHelpModel

func NewHelpModel() HelpModel

func (HelpModel) Init

func (m HelpModel) Init() tea.Cmd

func (HelpModel) Update

func (m HelpModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (HelpModel) View

func (m HelpModel) View() string

type IpTableModel added in v0.0.8

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

func InitialIpTableModel added in v0.0.8

func InitialIpTableModel(width, height int, roomid string) *IpTableModel

func (IpTableModel) Init added in v0.0.8

func (m IpTableModel) Init() tea.Cmd

func (IpTableModel) Update added in v0.0.8

func (m IpTableModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (IpTableModel) View added in v0.0.8

func (m IpTableModel) View() string

type MainModel

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

func InitialModel

func InitialModel() MainModel

func ReturnToHomeModel

func ReturnToHomeModel(state appState) MainModel

func (MainModel) Init

func (m MainModel) Init() tea.Cmd

func (MainModel) Update

func (m MainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (MainModel) View

func (m MainModel) View() string

type NewProgramForm

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

func EditProgramFormModel added in v0.0.3

func EditProgramFormModel(programEntry *vc.ProgramEntry) NewProgramForm

func NewProgramFormModel

func NewProgramFormModel() NewProgramForm

func (NewProgramForm) Init

func (m NewProgramForm) Init() tea.Cmd

func (NewProgramForm) Update

func (m NewProgramForm) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (NewProgramForm) View

func (m NewProgramForm) View() string

type NewRoomForm added in v0.0.3

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

func EditRoomFormModel added in v0.0.3

func EditRoomFormModel(room *vc.Room) NewRoomForm

func NewRoomFormModel added in v0.0.3

func NewRoomFormModel() NewRoomForm

func NewRoomFormModelWithPrograms added in v0.0.3

func NewRoomFormModelWithPrograms(programs vc.Programs) NewRoomForm

func NewRoomFromProgramFormModel added in v0.0.3

func NewRoomFromProgramFormModel(programEntry *vc.ProgramEntry) NewRoomForm

func (NewRoomForm) Init added in v0.0.3

func (m NewRoomForm) Init() tea.Cmd

func (NewRoomForm) Update added in v0.0.3

func (m NewRoomForm) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (NewRoomForm) View added in v0.0.3

func (m NewRoomForm) View() string

type NewTokenForm added in v0.1.0

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

func EditTokenFormModel added in v0.1.0

func EditTokenFormModel(token *vc.ApiToken) NewTokenForm

func NewTokenFormModel added in v0.1.0

func NewTokenFormModel() NewTokenForm

func (NewTokenForm) Init added in v0.1.0

func (m NewTokenForm) Init() tea.Cmd

func (NewTokenForm) Update added in v0.1.0

func (m NewTokenForm) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (NewTokenForm) View added in v0.1.0

func (m NewTokenForm) View() string

type ProgramsModel

type ProgramsModel struct {
	Programs vc.Programs
	// contains filtered or unexported fields
}

func BusyProgramsModel

func BusyProgramsModel(b busy, Programs vc.Programs) *ProgramsModel

func InitialProgramsModel

func InitialProgramsModel(width, height int) *ProgramsModel

func NewProgramsErrorTable

func NewProgramsErrorTable(msg vc.VirtualControlError) ProgramsModel

func ReturnToPrograms

func ReturnToPrograms() ProgramsModel

func (ProgramsModel) Init

func (m ProgramsModel) Init() tea.Cmd

func (ProgramsModel) Update

func (m ProgramsModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (ProgramsModel) View

func (m ProgramsModel) View() string

type RoomsHelpModel

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

func NewRoomsHelpModel

func NewRoomsHelpModel() RoomsHelpModel

func (RoomsHelpModel) Init

func (m RoomsHelpModel) Init() tea.Cmd

func (RoomsHelpModel) Update

func (m RoomsHelpModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (RoomsHelpModel) View

func (m RoomsHelpModel) View() string

type RoomsTableModel

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

func BusyRoomsModel

func BusyRoomsModel(b busy, rooms vc.Rooms) *RoomsTableModel

func InitialRoomsModel

func InitialRoomsModel(width, height int) *RoomsTableModel

func NewRoomsErrorTable

func NewRoomsErrorTable(msg vc.VirtualControlError) *RoomsTableModel

func ReturnRoomsModel added in v0.0.3

func ReturnRoomsModel() *RoomsTableModel

func (RoomsTableModel) Init

func (m RoomsTableModel) Init() tea.Cmd

func (RoomsTableModel) Update

func (m RoomsTableModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (RoomsTableModel) View

func (m RoomsTableModel) View() string

type SystemsHelpModel added in v0.0.5

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

func NewSystensHelpModel added in v0.0.5

func NewSystensHelpModel() SystemsHelpModel

func (SystemsHelpModel) Init added in v0.0.5

func (m SystemsHelpModel) Init() tea.Cmd

func (SystemsHelpModel) Update added in v0.0.5

func (m SystemsHelpModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SystemsHelpModel) View added in v0.0.5

func (m SystemsHelpModel) View() string

type TokenModel added in v0.1.0

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

func InitialTokensModel added in v0.1.0

func InitialTokensModel(width, height int) *TokenModel

func (TokenModel) Init added in v0.1.0

func (m TokenModel) Init() tea.Cmd

func (TokenModel) Update added in v0.1.0

func (m TokenModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (TokenModel) View added in v0.1.0

func (m TokenModel) View() string

type TokensHelpModel added in v0.1.0

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

func NewtokensHelpModel added in v0.1.0

func NewtokensHelpModel() TokensHelpModel

func (TokensHelpModel) Init added in v0.1.0

func (m TokensHelpModel) Init() tea.Cmd

func (TokensHelpModel) Update added in v0.1.0

func (m TokensHelpModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (TokensHelpModel) View added in v0.1.0

func (m TokensHelpModel) View() string

type VirtualControlServiceModel added in v0.0.5

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

func InitialSystemModel added in v0.0.5

func InitialSystemModel() VirtualControlServiceModel

func (VirtualControlServiceModel) Init added in v0.0.5

func (VirtualControlServiceModel) Update added in v0.0.5

func (m VirtualControlServiceModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (VirtualControlServiceModel) View added in v0.0.5

Jump to

Keyboard shortcuts

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