model

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Keys = KeyMap{
	Up: key.NewBinding(
		key.WithKeys("up", "k"),
		key.WithHelp("↑/k", "up"),
	),
	Down: key.NewBinding(
		key.WithKeys("down", "j"),
		key.WithHelp("↓/j", "down"),
	),
	Left: key.NewBinding(
		key.WithKeys("left", "h"),
		key.WithHelp("←/h", "previous tab"),
	),
	Right: key.NewBinding(
		key.WithKeys("right", "l"),
		key.WithHelp("→/l", "next tab"),
	),
	Enter: key.NewBinding(
		key.WithKeys("enter"),
		key.WithHelp("enter", "select"),
	),
	Back: key.NewBinding(
		key.WithKeys("esc"),
		key.WithHelp("esc", "back"),
	),
	Quit: key.NewBinding(
		key.WithKeys("q", "ctrl+c"),
		key.WithHelp("q", "quit"),
	),
	Tab: key.NewBinding(
		key.WithKeys("tab"),
		key.WithHelp("tab", "switch tab"),
	),
	Refresh: key.NewBinding(
		key.WithKeys("r"),
		key.WithHelp("r", "refresh"),
	),
	AddSite: key.NewBinding(
		key.WithKeys("a"),
		key.WithHelp("a", "add site"),
	),
}

Keys is the default keymap

Functions

This section is empty.

Types

type ClearStatusMsg

type ClearStatusMsg struct{}

ClearStatusMsg is sent to clear the status message

type KeyMap

type KeyMap struct {
	Up      key.Binding
	Down    key.Binding
	Left    key.Binding
	Right   key.Binding
	Enter   key.Binding
	Back    key.Binding
	Quit    key.Binding
	Tab     key.Binding
	Refresh key.Binding
	AddSite key.Binding
}

KeyMap defines the keybindings for the application

func (KeyMap) FullHelp

func (k KeyMap) FullHelp() [][]key.Binding

FullHelp returns the full help text

func (KeyMap) ShortHelp

func (k KeyMap) ShortHelp() []key.Binding

ShortHelp returns a short help text

type Model

type Model struct {
	Sites          []Site
	Table          *table.Table
	Cursor         int
	Selected       int
	MenuMode       bool
	ActiveTab      TabType
	Quitting       bool
	Err            error
	StatusMsg      string
	ShowStatus     bool
	IsError        bool
	Spinner        spinner.Model
	Loading        bool
	Width          int
	Height         int
	Viewport       viewport.Model
	CPUHistory     []float64
	MemHistory     []float64
	NetHistory     []float64
	RequestHistory []float64
	Progress       progress.Model
	LastUpdate     time.Time
	MetricsHistory interface{} // Will store *nginx.MetricsHistory
	LastNetworkIn  float64     // Track last network in for rate calculation
	LastNetworkOut float64     // Track last network out for rate calculation

	// Form state
	ShowAddSiteForm bool
	AddSiteForm     interface{} // Will store *huh.Form
	AddSiteConfig   interface{} // Will store *forms.SiteConfig
}

Model represents the application state

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the Bubble Tea program

type Site

type Site struct {
	Name    string
	Enabled bool
	Port    string
	SSL     bool
	Uptime  string
}

Site represents an NGINX site configuration

type SiteCreatedMsg

type SiteCreatedMsg struct {
	SiteName string
	Sites    []Site
}

SiteCreatedMsg is sent when a new site is successfully created

type StatusMsg

type StatusMsg struct {
	Message string
	IsError bool
}

StatusMsg represents a status message to display to the user

type TabType

type TabType int

TabType represents the different tabs in the application

const (
	SitesTab TabType = iota
	LogsTab
	StatsTab
	MetricsTab
)

type TickMsg

type TickMsg time.Time

TickMsg is sent on each tick for animations and updates

Jump to

Keyboard shortcuts

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