historydetailview

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(m *Model, windowWidth, windowHeight int) string

Types

type Action

type Action int
const (
	ActionNone Action = iota
	ActionQuit
	ActionMoveUp
	ActionMoveDown
	ActionScanAllPorts
	ActionHelp
	ActionDelete
)

func HandleKey

func HandleKey(key string) Action

type Model

type Model struct {
	History         history.ScanHistory
	HistoryPath     string
	Cursor          int
	ShowHelp        bool
	ErrorMsg        string
	Viewport        viewport.Model
	DeleteDialog    *deletepkg.HistoryDeleteDialog
	WindowW         int
	WindowH         int
	NodePath        string
	NodeName        string
	NodeItemType    string
	HoveredHelpItem int // -1 means no hover, otherwise index of helpline item
	HelpLineY       int // Y row where the helpline starts, set during render

	// Rescan state
	Scanning         bool
	ScanningHostIdx  int // Index of host being scanned (-1 if none)
	ProgressChan     chan shared.ProgressUpdate
	Stopwatch        stopwatch.Model
	NewPortsByHost   map[string]map[int]bool // Track newly found ports per host IP
	ScannedCount     int
	TotalHosts       int
	ScannedHostStr   string // Last host string from scanner for the scanned host
	ScanPortsScanned []int  // Ports that were scanned in the current rescan
}

func (Model) HandleMouse

func (m Model) HandleMouse(msg tea.MouseMsg) UpdateResult

HandleMouse processes mouse events in the detail host list: scroll wheel scrolls the viewport; left-click selects or activates a host.

func (Model) ScrollToSelected

func (m Model) ScrollToSelected() Model

ScrollToSelected adjusts the viewport offset so the selected host is visible, showing as many of its ports as possible without pushing the host IP off-screen. During scanning it follows the scanning host, keeping new ports visible at the bottom.

func (Model) SetViewportSize

func (m Model) SetViewportSize(windowWidth, windowHeight int) Model

SetViewportSize initializes or updates the viewport with proper dimensions accounting for title, metadata, and help text that appear outside the viewport

func (Model) Update

func (m Model) Update(msg tea.Msg) UpdateResult

func (Model) UpdateViewportContent

func (m Model) UpdateViewportContent(content string, windowWidth, windowHeight, reservedLines int) Model

UpdateViewportContent updates the viewport with new content and ensures proper dimensions. reservedLines is the total number of non-viewport lines (title + help, accounting for wrapping).

type SavedMsg

type SavedMsg struct {
	Updated history.ScanHistory
}

SavedMsg is sent after the background save+reload finishes

type UpdateResult

type UpdateResult struct {
	Model           Model
	Quit            bool
	ScanAllPorts    bool
	SelectedHostIP  string
	ScanHistoryPath string
	Deleted         bool
	Cmd             tea.Cmd
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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