tui

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ColorBlue     = lipgloss.Color("#0f93fc")
	ColorGreen    = lipgloss.Color("#49E209")
	ColorNavy     = lipgloss.Color("#081C39")
	ColorGray     = lipgloss.Color("#BCBEC0")
	ColorDarkGray = lipgloss.Color("#2D2D2D") // Dark gray for modal backgrounds
	ColorBlack    = lipgloss.Color("#000000")
	ColorWhite    = lipgloss.Color("#FFFFFF")
	ColorRed      = lipgloss.Color("#FF6B6B")
	ColorYellow   = lipgloss.Color("#FFD93D")
	ColorOrange   = lipgloss.Color("#FF8C42")
	ColorPink     = lipgloss.Color("#FF69B4")
)

Color palette - these will be updated by the skin system

Functions

func GetSeverityColor added in v0.2.0

func GetSeverityColor(severity string) lipgloss.Color

GetSeverityColor returns the color for a given severity level This uses semantic colors if defined, otherwise falls back to defaults

func InitializeSkin added in v0.2.0

func InitializeSkin(skinName string, configDir string) error

InitializeSkin sets up the skin system with the specified skin

Types

type AIAnalysisMsg

type AIAnalysisMsg struct {
	Result string
	Error  error
	IsChat bool // true for chat responses, false for initial analysis
}

AIAnalysisMsg represents the result of AI log analysis

type AttributeStatFormatted

type AttributeStatFormatted struct {
	Key        string
	Value      string
	Count      int
	Percentage float64
}

AttributeStatFormatted represents a formatted attribute statistic

type DashboardModel

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

DashboardModel represents the main TUI model

func NewDashboardModel

func NewDashboardModel(maxLogBuffer int, updateInterval time.Duration, aiModel string, stopWords map[string]bool, reverseScrollWheel bool) *DashboardModel

NewDashboardModel creates a new dashboard model with stop words

func (*DashboardModel) GetCountsHistory

func (m *DashboardModel) GetCountsHistory() []SeverityCounts

GetCountsHistory returns the current counts history for debugging

func (*DashboardModel) Init

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

Init initializes the model

func (*DashboardModel) SetK8sSource added in v0.3.0

func (m *DashboardModel) SetK8sSource(source K8sSourceInterface)

SetK8sSource sets the Kubernetes log source for the dashboard

func (*DashboardModel) SetVersionChecker added in v0.2.0

func (m *DashboardModel) SetVersionChecker(checker *versioncheck.Checker)

SetVersionChecker sets the version checker for update notifications

func (*DashboardModel) Update

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

Update handles messages

func (*DashboardModel) View

func (m *DashboardModel) View() string

View renders the dashboard

type Drain3Manager

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

Drain3Manager manages the drain3 instance for pattern extraction

func NewDrain3Manager

func NewDrain3Manager() *Drain3Manager

NewDrain3Manager creates a new drain3 manager with optimized settings for log pattern extraction

func (*Drain3Manager) AddLogMessage

func (dm *Drain3Manager) AddLogMessage(message string)

AddLogMessage processes a log message and extracts its pattern

func (*Drain3Manager) GetStats

func (dm *Drain3Manager) GetStats() (patternCount int, totalLogs int)

GetStats returns statistics about the current patterns

func (*Drain3Manager) GetTopPatterns

func (dm *Drain3Manager) GetTopPatterns(limit int) []PatternInfo

GetTopPatterns returns the top N patterns by frequency

func (*Drain3Manager) Reset

func (dm *Drain3Manager) Reset()

Reset clears the drain3 instance and starts fresh

func (*Drain3Manager) ShouldReset

func (dm *Drain3Manager) ShouldReset(resetInterval time.Duration) bool

ShouldReset checks if it's time to reset based on a duration

type HeatmapMinute

type HeatmapMinute struct {
	Timestamp time.Time
	Counts    SeverityCounts
}

HeatmapMinute represents severity counts for one minute in the heatmap

type K8sSourceInterface added in v0.3.0

type K8sSourceInterface interface {
	ListNamespaces() (map[string]bool, error)
	ListPods(selectedNamespaces map[string]bool) (map[string]bool, error)
	UpdateFilter(namespaces []string, selector string, podNames []string) error
}

K8sSourceInterface defines the interface for Kubernetes log source This allows the TUI to query available namespaces and pods

type LogEntry

type LogEntry struct {
	Timestamp     time.Time // Receive time - when we processed this log
	OrigTimestamp time.Time // Original timestamp from the log (if available)
	Severity      string
	Message       string
	RawLine       string
	Attributes    map[string]string
}

LogEntry represents a formatted log entry

type ManualResetMsg

type ManualResetMsg struct{}

ManualResetMsg represents a manual reset request triggered by user

type PatternCount

type PatternCount struct {
	Pattern string
	Count   int
}

PatternCount represents a pattern and its count for a specific severity

type PatternInfo

type PatternInfo struct {
	Template   string
	Count      int
	Percentage float64
}

PatternInfo represents a log pattern with its statistics

type Section

type Section int

Section represents different dashboard sections

const (
	SectionWords Section = iota
	SectionAttributes
	SectionDistribution
	SectionCounts
	SectionFilter
	SectionLogs
)

type ServiceCount

type ServiceCount struct {
	Service string
	Count   int
}

ServiceCount represents a service and its count for a specific severity

type SeverityCounts

type SeverityCounts struct {
	Trace    int
	Debug    int
	Info     int
	Warn     int
	Error    int
	Fatal    int
	Critical int
	Unknown  int
	Total    int
}

SeverityCounts tracks log counts by severity level for a time interval

func NewSeverityCountsFromEntries

func NewSeverityCountsFromEntries(entries []LogEntry) *SeverityCounts

NewSeverityCountsFromEntries creates SeverityCounts from a slice of log entries

func (*SeverityCounts) AddCount

func (sc *SeverityCounts) AddCount(severity string)

AddCount adds a count for the given severity level

type Skin added in v0.2.0

type Skin struct {
	Name        string     `yaml:"name"`
	Description string     `yaml:"description,omitempty"`
	Author      string     `yaml:"author,omitempty"`
	Colors      SkinColors `yaml:"colors"`
}

Skin represents a complete color scheme

var CurrentSkin *Skin

CurrentSkin holds the active skin

func DefaultSkin added in v0.2.0

func DefaultSkin() *Skin

DefaultSkin returns the default color scheme

func LoadSkin added in v0.2.0

func LoadSkin(path string) (*Skin, error)

LoadSkin loads a skin from a YAML file

func LoadSkinByName added in v0.2.0

func LoadSkinByName(name string, configDir string) (*Skin, error)

LoadSkinByName loads a skin by name from the skins directory

type SkinColors added in v0.2.0

type SkinColors struct {
	// UI Component Colors
	Primary       string `yaml:"primary"`        // Main accent color (section borders, highlights)
	Secondary     string `yaml:"secondary"`      // Secondary accent color
	Background    string `yaml:"background"`     // Main background
	Surface       string `yaml:"surface"`        // Secondary background (modals, panels)
	Border        string `yaml:"border"`         // Default border color
	BorderActive  string `yaml:"border_active"`  // Active section border
	Text          string `yaml:"text"`           // Primary text color
	TextSecondary string `yaml:"text_secondary"` // Secondary/muted text
	TextInverse   string `yaml:"text_inverse"`   // Text on colored backgrounds

	// Chart and Data Colors
	ChartTitle  string `yaml:"chart_title"`  // Chart titles
	ChartBar    string `yaml:"chart_bar"`    // Bar chart bars
	ChartAccent string `yaml:"chart_accent"` // Chart accent elements

	// Log Entry Colors
	LogTimestamp  string `yaml:"log_timestamp"`  // Log timestamps
	LogMessage    string `yaml:"log_message"`    // Log message text
	LogBackground string `yaml:"log_background"` // Log entry background
	LogSelected   string `yaml:"log_selected"`   // Selected log entry

	// Severity Level Colors
	SeverityTrace string `yaml:"severity_trace"` // TRACE level logs
	SeverityDebug string `yaml:"severity_debug"` // DEBUG level logs
	SeverityInfo  string `yaml:"severity_info"`  // INFO level logs
	SeverityWarn  string `yaml:"severity_warn"`  // WARN level logs
	SeverityError string `yaml:"severity_error"` // ERROR level logs
	SeverityFatal string `yaml:"severity_fatal"` // FATAL/CRITICAL level logs

	// Status Colors
	Success string `yaml:"success"` // Success states
	Warning string `yaml:"warning"` // Warning states
	Error   string `yaml:"error"`   // Error states
	Info    string `yaml:"info"`    // Info states

	// Special Elements
	Help      string `yaml:"help"`      // Help text
	Highlight string `yaml:"highlight"` // Search highlights, emphasis
	Disabled  string `yaml:"disabled"`  // Disabled elements
}

SkinColors defines the color scheme for the TUI with semantic naming

type StatItem

type StatItem struct {
	Key   string
	Value string
}

StatItem represents a statistics key-value pair

type TickMsg

type TickMsg time.Time

TickMsg represents periodic updates

type UpdateIntervalMsg

type UpdateIntervalMsg time.Duration

UpdateIntervalMsg represents a request to change update interval

type UpdateMsg

type UpdateMsg struct {
	Snapshot         *memory.FrequencySnapshot
	NewLogEntry      *LogEntry
	NewLogBatch      []*LogEntry     // Support for batch updates
	LineCount        int             // Deprecated - use SeverityCount
	SeverityCount    *SeverityCounts // Counts by severity level
	ForceCountUpdate bool            // Force update count history even with 0
	ResetDrain3      bool            // Signal to reset drain3 pattern extraction
}

UpdateMsg contains data updates for the dashboard

Jump to

Keyboard shortcuts

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