tui

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ColorPrimary   = lipgloss.Color("86")  // Green
	ColorSecondary = lipgloss.Color("244") // Gray
	ColorError     = lipgloss.Color("196") // Red
	ColorWarning   = lipgloss.Color("214") // Orange
	ColorSuccess   = lipgloss.Color("46")  // Bright green
	ColorInfo      = lipgloss.Color("39")  // Blue
	ColorHighlight = lipgloss.Color("57")  // Dark blue
)

Color constants for consistency

View Source
const (
	DefaultPadding = 2
	DefaultMargin  = 1
	DefaultWidth   = 80
	DefaultHeight  = 24
)

Common layout constants

Variables

View Source
var (

	// Exported style variables for use in other components
	TitleStyle      = titleStyle
	HeaderStyle     = headerStyle
	ContentStyle    = contentStyle
	ErrorStyle      = errorStyle
	BreadcrumbStyle = breadcrumbStyle
	FooterStyle     = footerStyle

	// Exported info style
	InfoStyle = lipgloss.NewStyle().
				Foreground(lipgloss.Color("39")).
				Italic(true)
)

Common styles used across TUI components

Functions

func FormatDuration

func FormatDuration(d time.Duration) string

Format duration

func FormatFileSize

func FormatFileSize(bytes int64) string

Format file size

func RenderBox

func RenderBox(title, content string, width int) string

Common UI elements

func RenderKeyHelp

func RenderKeyHelp(keys []string) string

func RenderProgress

func RenderProgress(current, total int) string

Progress indicators

func StatusActive

func StatusActive() string

Status indicators

func StatusInactive

func StatusInactive() string

func StatusUnknown

func StatusUnknown() string

func TruncateText

func TruncateText(text string, maxLength int) string

Truncate text with ellipsis

Types

type AnalyticsBrowserModel

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

Analytics Browser Model

func NewAnalyticsBrowser

func NewAnalyticsBrowser(client *servicenow.Client) *AnalyticsBrowserModel

NewAnalyticsBrowser creates a new analytics browser

func (*AnalyticsBrowserModel) Init

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

Init initializes the analytics browser

func (*AnalyticsBrowserModel) Update

Update handles messages

func (*AnalyticsBrowserModel) View

func (m *AnalyticsBrowserModel) View() string

View renders the analytics browser

type AnalyticsMetric

type AnalyticsMetric struct {
	Name        string
	Description string
	Type        string // count, sum, avg, max, min, group_by
	Field       string
	GroupBy     string
}

Analytics Metric represents a metric that can be computed

type AnalyticsResult

type AnalyticsResult struct {
	Label string
	Value interface{}
	Count int
}

Analytics Result represents the result of an analytics query

type CMDBBrowserModel

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

CMDB Browser Model

func NewCMDBBrowser

func NewCMDBBrowser(client *servicenow.Client) *CMDBBrowserModel

NewCMDBBrowser creates a new CMDB browser

func (*CMDBBrowserModel) Init

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

Init initializes the CMDB browser

func (*CMDBBrowserModel) Update

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

Update handles messages

func (*CMDBBrowserModel) View

func (m *CMDBBrowserModel) View() string

View renders the CMDB browser

type CMDBClass

type CMDBClass struct {
	Name        string
	Label       string
	Table       string
	Description string
	Count       int
}

CMDB Class represents a CI class

type CMDBRelationship

type CMDBRelationship struct {
	Type        string
	Direction   string
	TargetClass string
	TargetName  string
	TargetSysID string
}

CMDB Relationship represents a CI relationship

type CartItem

type CartItem struct {
	Item      CatalogItem
	Quantity  int
	Variables map[string]string
}

Cart Item represents an item in the shopping cart

type CatalogBrowserModel

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

Catalog Browser Model

func NewCatalogBrowser

func NewCatalogBrowser(client *servicenow.Client) *CatalogBrowserModel

NewCatalogBrowser creates a new catalog browser

func (*CatalogBrowserModel) Init

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

Init initializes the catalog browser

func (*CatalogBrowserModel) Update

Update handles messages

func (*CatalogBrowserModel) View

func (m *CatalogBrowserModel) View() string

View renders the catalog browser

type CatalogInfo

type CatalogInfo struct {
	SysID       string
	Title       string
	Description string
	Active      bool
	ItemCount   int
}

Catalog Info represents a service catalog

type CatalogItem

type CatalogItem struct {
	SysID       string
	Name        string
	ShortDesc   string
	Description string
	Price       string
	Category    string
	Available   bool
	Icon        string
	Variables   []CatalogVariable
}

Catalog Item represents a catalog item

type CatalogVariable

type CatalogVariable struct {
	Name         string
	Label        string
	Type         string
	Mandatory    bool
	DefaultValue string
	Options      []string
}

Catalog Variable represents an item variable

type IdentityBrowserModel

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

Identity browser model

func NewIdentityBrowser

func NewIdentityBrowser(client *servicenow.Client) *IdentityBrowserModel

Create new identity browser

func (*IdentityBrowserModel) Init

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

Initialize identity browser

func (*IdentityBrowserModel) Update

Update identity browser

func (*IdentityBrowserModel) View

func (m *IdentityBrowserModel) View() string

View identity browser

type TableBrowserModel

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

Table browser model

func NewTableBrowser

func NewTableBrowser(client *servicenow.Client) *TableBrowserModel

Create new table browser

func (*TableBrowserModel) Init

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

Initialize table browser

func (*TableBrowserModel) Update

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

Update table browser

func (*TableBrowserModel) View

func (m *TableBrowserModel) View() string

View table browser

type TableInfo

type TableInfo struct {
	Name        string
	Label       string
	Desc        string
	RecordCount int
}

Table information

func (TableInfo) Description

func (t TableInfo) Description() string

func (TableInfo) FilterValue

func (t TableInfo) FilterValue() string

func (TableInfo) Title

func (t TableInfo) Title() string

Jump to

Keyboard shortcuts

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