Documentation
¶
Index ¶
- Constants
- Variables
- func NewGCPSpinner() spinner.Model
- func ParseMetadata(text string) (map[string]string, error)
- func RenderError(err error) string
- func RenderInlineError(err error) string
- func RenderMetricBar(label string, currentValue, avgValue, peakValue float64, peakTime time.Time, ...) string
- func RenderMetricBarWithLabel(label string, currentValue, avgValue, peakValue float64, peakTime time.Time, ...) string
- func RenderSparkline(data []float64, width int) string
- func RenderSparklineWithLabel(label string, data []float64, width int) string
- func RenderTimeRangeSelector(activeRange time.Duration, autoRefresh bool, lastUpdated time.Time) string
- func SerializeMetadata(metadata map[string]string) string
- func Validate(metadata map[string]string) []string
- type Clickable
- type Footer
- func (f *Footer) ClearCenter()
- func (f *Footer) ClearLeft1()
- func (f *Footer) ClearLeft2()
- func (f *Footer) ClearLeft3()
- func (f *Footer) ClearRight1()
- func (f *Footer) ClearRight1Styled()
- func (f *Footer) ClearRight2()
- func (f *Footer) ClearRight2Styled()
- func (f *Footer) ClearRight3()
- func (f *Footer) ClearRight3Styled()
- func (f *Footer) GetRegions() []mouse.Region
- func (f *Footer) HandleRegionClick(regionID string) tea.Cmd
- func (f *Footer) SetCenter1(s string)
- func (f *Footer) SetCenter2(s string)
- func (f *Footer) SetCenter3(s string)
- func (f *Footer) SetCenterStyled(rendered string, bg lipgloss.Color)
- func (f *Footer) SetLeft1(s string)
- func (f *Footer) SetLeft2(s string)
- func (f *Footer) SetLeft3(s string)
- func (f *Footer) SetRight1(s string)
- func (f *Footer) SetRight1Styled(rendered string, bg lipgloss.Color)
- func (f *Footer) SetRight2(s string)
- func (f *Footer) SetRight2Styled(rendered string, bg lipgloss.Color)
- func (f *Footer) SetRight3(s string)
- func (f *Footer) SetRight3Styled(rendered string, bg lipgloss.Color)
- func (f *Footer) SetStyles(styles FooterStyles)
- func (f *Footer) SetWidth(width int)
- func (f *Footer) UpdateRegions(offsetX, offsetY int)
- func (f *Footer) View() string
- type FooterProjectClickedMsg
- type FooterStyles
- type GoogleColors
- type Header
- type HeaderStyles
- type LoadingSpinner
- type MetadataEditor
- func (m *MetadataEditor) Blur()
- func (m *MetadataEditor) Focus() tea.Cmd
- func (m *MetadataEditor) GetContent() string
- func (m MetadataEditor) Init() tea.Cmd
- func (m *MetadataEditor) IsDirty() bool
- func (m *MetadataEditor) SetContent(content string)
- func (m *MetadataEditor) SetSize(width, height int)
- func (m MetadataEditor) Update(msg tea.Msg) (MetadataEditor, tea.Cmd)
- func (m MetadataEditor) View() string
- type StatusBar
- type TimeRange
Constants ¶
const ( SepRight = "\ue0b0" // Powerline right arrow (solid) SepRightThin = "\ue0b1" // Powerline right arrow (thin) SepLeft = "\ue0b2" // Powerline left arrow (solid) SepLeftThin = "\ue0b3" // Powerline left arrow (thin) SepDiagonalRight = "\ue0bc" // Powerline diagonal right (bottom-left to top-right) SepDiagonalLeft = "\ue0ba" // Powerline diagonal left (top-left to bottom-right) SepDiagonalRightR = "\ue0be" // Powerline diagonal right reverse SepDiagonalLeftR = "\ue0b8" // Powerline diagonal left reverse )
Powerline separator characters (Unicode code points for powerline fonts)
Variables ¶
var ( // HintStyle is exported for consistent hint styling across views HintStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#9AA0A6")). Italic(true) )
var PredefinedTimeRanges = []TimeRange{ {Label: "1h", Duration: 1 * time.Hour, Key: "1"}, {Label: "6h", Duration: 6 * time.Hour, Key: "2"}, {Label: "24h", Duration: 24 * time.Hour, Key: "3"}, {Label: "7d", Duration: 7 * 24 * time.Hour, Key: "4"}, {Label: "30d", Duration: 30 * 24 * time.Hour, Key: "5"}, }
PredefinedTimeRanges are the standard time ranges available
Functions ¶
func NewGCPSpinner ¶
NewGCPSpinner creates a spinner.Model with standard GCP blue styling.
func ParseMetadata ¶
ParseMetadata parses the editor text into a metadata map Supports formats:
- key=value
- key: value
- key="multi-line\nvalue"
- key: | indented multi-line value
func RenderError ¶
RenderError formats an error for display in the TUI with user-friendly messages
func RenderInlineError ¶
RenderInlineError formats an error as a simple styled message for form/creation views. Unlike RenderError, it omits retry hints since forms have their own navigation.
func RenderMetricBar ¶
func RenderMetricBar(label string, currentValue, avgValue, peakValue float64, peakTime time.Time, width int) string
RenderMetricBar renders a horizontal bar chart for a metric Returns a multi-line string with the bar and stats
func RenderMetricBarWithLabel ¶
func RenderMetricBarWithLabel(label string, currentValue, avgValue, peakValue float64, peakTime time.Time, width int) string
RenderMetricBarWithLabel renders a metric bar with a header label
func RenderSparkline ¶
RenderSparkline converts a slice of data points to a Unicode sparkline Example: []float64{1, 3, 5, 7, 5, 3, 1} → "▁▃▅▇▅▃▁"
func RenderSparklineWithLabel ¶
RenderSparklineWithLabel renders sparkline with label Example: "CPU (6h): ▁▂▃▄▅▆▇█▇▆▅▄▃▂▁"
func RenderTimeRangeSelector ¶
func RenderTimeRangeSelector(activeRange time.Duration, autoRefresh bool, lastUpdated time.Time) string
RenderTimeRangeSelector renders a time range selector with highlighted active range
func SerializeMetadata ¶
SerializeMetadata converts a metadata map to editable text format
Types ¶
type Clickable ¶
type Clickable interface {
// UpdateRegions recalculates clickable regions based on current state
// offsetX, offsetY are the component's top-left corner in screen coordinates
// Called after View() but before mouse event processing
UpdateRegions(offsetX, offsetY int)
// GetRegions returns current clickable regions
GetRegions() []mouse.Region
// HandleRegionClick processes a click on a specific region
// regionID identifies which region was clicked
// Returns a tea.Cmd to execute in response to the click
HandleRegionClick(regionID string) tea.Cmd
}
Clickable interface for components that handle mouse clicks
type Footer ¶
type Footer struct {
// Fixed slots - nil means slot is hidden, empty string shows just separator
// Pre-rendered sections (already styled, for custom styling)
// contains filtered or unexported fields
}
Footer displays a multi-section status bar with powerline separators
func (*Footer) ClearRight1Styled ¶
func (f *Footer) ClearRight1Styled()
ClearRight1Styled clears the pre-rendered right1 content
func (*Footer) ClearRight2Styled ¶
func (f *Footer) ClearRight2Styled()
ClearRight2Styled clears the pre-rendered right2 content
func (*Footer) ClearRight3Styled ¶
func (f *Footer) ClearRight3Styled()
ClearRight3Styled clears the pre-rendered right3 content
func (*Footer) GetRegions ¶
GetRegions returns current clickable regions
func (*Footer) HandleRegionClick ¶
HandleRegionClick processes a click on a footer region
func (*Footer) SetCenter1 ¶
SetCenter1 sets the first center slot
func (*Footer) SetCenter2 ¶
SetCenter2 sets the second center slot
func (*Footer) SetCenter3 ¶
SetCenter3 sets the third center slot
func (*Footer) SetCenterStyled ¶
SetCenterStyled sets pre-rendered content for center (bypasses default styling) The bg color is used for powerline separator styling
func (*Footer) SetRight1Styled ¶
SetRight1Styled sets pre-rendered content for right1 (bypasses default styling) The bg color is used for powerline separator styling
func (*Footer) SetRight2Styled ¶
SetRight2Styled sets pre-rendered content for right2 (bypasses default styling) The bg color is used for powerline separator styling
func (*Footer) SetRight3Styled ¶
SetRight3Styled sets pre-rendered content for right3 (bypasses default styling) The bg color is used for powerline separator styling
func (*Footer) SetStyles ¶
func (f *Footer) SetStyles(styles FooterStyles)
SetStyles sets custom footer styles
func (*Footer) UpdateRegions ¶
UpdateRegions recalculates clickable regions based on footer state
type FooterProjectClickedMsg ¶
type FooterProjectClickedMsg struct{}
FooterProjectClickedMsg is sent when the project section is clicked
type FooterStyles ¶
type FooterStyles struct {
// Left group styles
// Center group styles
// Right group styles
SpacerBg lipgloss.Color
}
FooterStyles defines colors for each section slot
func DefaultFooterStyles ¶
func DefaultFooterStyles() FooterStyles
DefaultFooterStyles returns GCP-inspired footer colors
type GoogleColors ¶
type GoogleColors struct {
G lipgloss.Style // Blue #4285F4
O1 lipgloss.Style // Red #EA4335
O2 lipgloss.Style // Yellow #FBBC05
G2 lipgloss.Style // Blue #4285F4
L lipgloss.Style // Green #34A853
E lipgloss.Style // Red #EA4335
}
GoogleColors holds styles for rainbow-colored "Google" text
type Header ¶
type Header struct {
// contains filtered or unexported fields
}
Header displays the app title with rainbow Google and powerline breadcrumbs
func (*Header) SetCategory ¶
SetCategory sets the current category (e.g., "Compute Engine") for breadcrumbs
func (*Header) SetProject ¶
SetProject sets the current project ID for breadcrumbs
func (*Header) SetResources ¶
SetResources sets the resource path for breadcrumbs (e.g., ["my-instance"])
type HeaderStyles ¶
type HeaderStyles struct {
Title lipgloss.Style
Muted lipgloss.Style
GoogleColors GoogleColors
BreadcrumbProject lipgloss.Style
BreadcrumbCategory lipgloss.Style
BreadcrumbResource lipgloss.Style
BreadcrumbSeparator lipgloss.Style
}
HeaderStyles defines colors for header rendering
func DefaultHeaderStyles ¶
func DefaultHeaderStyles() HeaderStyles
DefaultHeaderStyles returns the default header styles with GCP colors
type LoadingSpinner ¶
type LoadingSpinner struct {
// contains filtered or unexported fields
}
LoadingSpinner wraps the bubbles spinner with custom styling
func NewLoadingSpinner ¶
func NewLoadingSpinner(message string) LoadingSpinner
NewLoadingSpinner creates a new loading spinner with a message
func (LoadingSpinner) Init ¶
func (l LoadingSpinner) Init() tea.Cmd
Init starts the spinner animation
func (*LoadingSpinner) SetMessage ¶
func (l *LoadingSpinner) SetMessage(message string)
SetMessage updates the loading message
func (LoadingSpinner) Tick ¶
func (l LoadingSpinner) Tick() tea.Cmd
Tick returns a command to continue spinner animation
func (LoadingSpinner) Update ¶
func (l LoadingSpinner) Update(msg tea.Msg) (LoadingSpinner, tea.Cmd)
Update handles spinner tick messages
func (LoadingSpinner) View ¶
func (l LoadingSpinner) View() string
View renders the spinner with message
type MetadataEditor ¶
type MetadataEditor struct {
// contains filtered or unexported fields
}
MetadataEditor wraps a textarea for editing instance metadata
func NewMetadataEditor ¶
func NewMetadataEditor() MetadataEditor
NewMetadataEditor creates a new metadata editor with optional initial content
func (*MetadataEditor) GetContent ¶
func (m *MetadataEditor) GetContent() string
GetContent returns the current editor content
func (*MetadataEditor) IsDirty ¶
func (m *MetadataEditor) IsDirty() bool
IsDirty returns true if content has changed
func (*MetadataEditor) SetContent ¶
func (m *MetadataEditor) SetContent(content string)
SetContent sets the editor content and stores it as original
func (*MetadataEditor) SetSize ¶
func (m *MetadataEditor) SetSize(width, height int)
SetSize sets the editor dimensions
func (MetadataEditor) Update ¶
func (m MetadataEditor) Update(msg tea.Msg) (MetadataEditor, tea.Cmd)
Update handles textarea messages
type StatusBar ¶
type StatusBar struct {
// contains filtered or unexported fields
}
StatusBar displays contextual information at the bottom of the screen
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package actionmenu provides a popup action menu component for views.
|
Package actionmenu provides a popup action menu component for views. |
|
Package confirm provides confirmation dialogs for destructive actions.
|
Package confirm provides confirmation dialogs for destructive actions. |
|
Package diff provides a component for displaying before/after comparisons with confirmation dialog for changes.
|
Package diff provides a component for displaying before/after comparisons with confirmation dialog for changes. |
|
Package footer provides an enhanced footer component with dynamic content.
|
Package footer provides an enhanced footer component with dynamic content. |
|
Package forms provides reusable form components for editing GCP resources.
|
Package forms provides reusable form components for editing GCP resources. |
|
Package inputdialog provides a simple modal input dialog for capturing text input.
|
Package inputdialog provides a simple modal input dialog for capturing text input. |
|
Package labeledit provides a component for editing key-value label pairs used in GCP resources like VM instances.
|
Package labeledit provides a component for editing key-value label pairs used in GCP resources like VM instances. |
|
Package links provides a component for navigable links within detail views.
|
Package links provides a component for navigable links within detail views. |
|
Package sortmenu provides a popup sort column selector for table views.
|
Package sortmenu provides a popup sort column selector for table views. |
|
Package table provides a reusable table component with GCP styling and filtering support.
|
Package table provides a reusable table component with GCP styling and filtering support. |
|
Package tabs provides a reusable tab bar component for detail views.
|
Package tabs provides a reusable tab bar component for detail views. |
|
Package textarea provides a multi-line text editor with GCP styling.
|
Package textarea provides a multi-line text editor with GCP styling. |
|
Package timer provides countdown and elapsed time components with GCP styling.
|
Package timer provides countdown and elapsed time components with GCP styling. |
|
Package viewport provides a scrollable content container with GCP styling.
|
Package viewport provides a scrollable content container with GCP styling. |