tui

package
v0.75.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildRunsListFiltersForm

func BuildRunsListFiltersForm(filters *RunsListFilters, workflows []WorkflowOption) (*huh.Form, *[]rest.V1TaskStatus)

BuildRunsListFiltersForm builds a huh.Form for editing filters This form is meant to be embedded directly in the main tea.Program Returns the form and a pointer to the status slice that will be modified

func FormatEventType

func FormatEventType(eventType rest.V1TaskEventType) string

FormatEventType maps a V1TaskEventType enum to a human-readable string Mapping taken from frontend: frontend/app/src/pages/main/v1/workflow-runs-v1/$run/v2components/events-columns.tsx

func FormatV1TaskStatusForTable

func FormatV1TaskStatusForTable(status rest.V1TaskStatus) string

FormatV1TaskStatusForTable returns plain text with a status indicator icon Use this for table cells since bubbles table doesn't support per-cell colors

func GetTimeRangeFromWindow

func GetTimeRangeFromWindow(window string) time.Time

GetTimeRangeFromWindow converts time window string to time.Time

func HandleDebugKeyboard

func HandleDebugKeyboard(logger *DebugLogger, key string) (bool, tea.Cmd)

HandleDebugKeyboard handles keyboard input for debug views with file writing Returns true if the key was handled, along with any command to execute

func NewNavigateBackMsg

func NewNavigateBackMsg() tea.Cmd

NewNavigateBackMsg creates a navigation message to go back

func NewNavigateToRunMsg

func NewNavigateToRunMsg(workflowRunID string) tea.Cmd

NewNavigateToRunMsg creates a navigation message to a workflow run (deprecated)

func NewNavigateToRunWithDetectionMsg

func NewNavigateToRunWithDetectionMsg(runID string) tea.Cmd

NewNavigateToRunWithDetectionMsg creates a navigation message with run type detection

func NewNavigateToWorkerMsg

func NewNavigateToWorkerMsg(workerID string) tea.Cmd

NewNavigateToWorkerMsg creates a navigation message to a worker details view

func NewNavigateToWorkflowMsg

func NewNavigateToWorkflowMsg(workflowID string) tea.Cmd

NewNavigateToWorkflowMsg creates a navigation message to a workflow details view

func RenderDebugView

func RenderDebugView(logger *DebugLogger, width, height int, extraInfo string) string

RenderDebugView renders a debug log overlay with file writing support

func RenderError

func RenderError(message string, width int) string

RenderError renders an error message in error style with text wrapping

func RenderEventSeverityDot

func RenderEventSeverityDot(severity EventSeverity) string

RenderEventSeverityDot returns a colored dot indicator for the severity level

func RenderFooter

func RenderFooter(controls []string, width int) string

RenderFooter renders a consistent footer with controls/help text

func RenderHeader

func RenderHeader(title string, profileName string, width int) string

RenderHeader renders a consistent header with logo for all views

func RenderHeaderWithLogo(title string, width int) string

RenderHeaderWithLogo creates a header with the logo on the right side Returns the rendered header with proper spacing and borders

func RenderHeaderWithViewIndicator

func RenderHeaderWithViewIndicator(viewName string, profileName string, width int) string

RenderHeaderWithViewIndicator renders a header with just the view name in magenta viewName is highlighted in magenta to show which primary view is active

func RenderInstructions

func RenderInstructions(instructions string, width int) string

RenderInstructions renders instruction text in a consistent style

func RenderLogo() string

RenderLogo returns the Hatchet logo as styled text

func RenderV1TaskStatus

func RenderV1TaskStatus(status rest.V1TaskStatus) string

RenderV1TaskStatus renders a V1TaskStatus as a styled badge Matches the frontend Badge component styling

func SortEventsByTimestamp

func SortEventsByTimestamp(events []rest.V1TaskEvent) []rest.V1TaskEvent

SortEventsByTimestamp sorts events by timestamp in descending order (newest first)

Types

type BaseModel

type BaseModel struct {
	Ctx    ViewContext
	Width  int
	Height int
	Err    error
}

BaseModel contains common fields for all views

func (*BaseModel) ClearError

func (m *BaseModel) ClearError()

ClearError clears any error on the base model

func (*BaseModel) HandleError

func (m *BaseModel) HandleError(err error)

HandleError sets an error on the base model

func (*BaseModel) SetSize

func (m *BaseModel) SetSize(width, height int)

SetSize updates the base model dimensions

type ContentViewer

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

ContentViewer is a component for viewing long content with scrolling and file writing

func NewContentViewer

func NewContentViewer(content string, width, height int) *ContentViewer

NewContentViewer creates a new content viewer

func (*ContentViewer) Activate

func (v *ContentViewer) Activate()

Activate enters dive mode

func (*ContentViewer) Deactivate

func (v *ContentViewer) Deactivate()

Deactivate exits dive mode

func (*ContentViewer) HandleMouse

func (v *ContentViewer) HandleMouse(msg tea.MouseMsg)

HandleMouse handles mouse events even when not active (for preview mode scrolling)

func (*ContentViewer) IsActive

func (v *ContentViewer) IsActive() bool

IsActive returns whether the viewer is in dive mode

func (*ContentViewer) RenderPreview

func (v *ContentViewer) RenderPreview() string

RenderPreview renders a preview with dive hint (public method for external use)

func (*ContentViewer) ScrollDown

func (v *ContentViewer) ScrollDown()

ScrollDown scrolls down by one line

func (*ContentViewer) ScrollPageDown

func (v *ContentViewer) ScrollPageDown()

ScrollPageDown scrolls down by one page

func (*ContentViewer) ScrollPageUp

func (v *ContentViewer) ScrollPageUp()

ScrollPageUp scrolls up by one page

func (*ContentViewer) ScrollToBottom

func (v *ContentViewer) ScrollToBottom()

ScrollToBottom scrolls to the bottom

func (*ContentViewer) ScrollToTop

func (v *ContentViewer) ScrollToTop()

ScrollToTop scrolls to the top

func (*ContentViewer) ScrollUp

func (v *ContentViewer) ScrollUp()

ScrollUp scrolls up by one line

func (*ContentViewer) SetContent

func (v *ContentViewer) SetContent(content string)

SetContent updates the content

func (*ContentViewer) SetSize

func (v *ContentViewer) SetSize(width, height int)

SetSize updates the viewer dimensions

func (*ContentViewer) Update

func (v *ContentViewer) Update(msg tea.Msg) tea.Cmd

Update handles messages when viewer is active

func (*ContentViewer) View

func (v *ContentViewer) View() string

View renders the content viewer

type DAGTab

type DAGTab int

DAGTab represents different tabs in the DAG workflow run view

const (
	DAGTabDAG DAGTab = iota // DAG visualization tab (default)
	DAGTabEvents
	DAGTabTasks
	DAGTabInput
)

type DebugLog

type DebugLog struct {
	Timestamp time.Time
	Message   string
}

DebugLog represents a single debug log entry

type DebugLogger

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

DebugLogger is a fixed-size ring buffer for debug logs with file writing support

func NewDebugLogger

func NewDebugLogger(capacity int) *DebugLogger

NewDebugLogger creates a new debug logger with the specified capacity

func (*DebugLogger) CancelFilePrompt

func (d *DebugLogger) CancelFilePrompt()

CancelFilePrompt cancels the file writing prompt

func (*DebugLogger) Capacity

func (d *DebugLogger) Capacity() int

Capacity returns the maximum capacity

func (*DebugLogger) CheckAndWriteFile

func (d *DebugLogger) CheckAndWriteFile() tea.Cmd

CheckAndWriteFile checks if file exists and writes or prompts for confirmation

func (*DebugLogger) Clear

func (d *DebugLogger) Clear()

Clear removes all logs

func (*DebugLogger) ClearStatusMessage

func (d *DebugLogger) ClearStatusMessage()

ClearStatusMessage clears the status message

func (*DebugLogger) ConfirmOverwrite

func (d *DebugLogger) ConfirmOverwrite() tea.Cmd

ConfirmOverwrite confirms overwriting an existing file

func (*DebugLogger) GetFileInput

func (d *DebugLogger) GetFileInput() string

GetFileInput returns the current file input

func (*DebugLogger) GetLogs

func (d *DebugLogger) GetLogs() []DebugLog

GetLogs returns all logs in chronological order

func (*DebugLogger) GetLogsAsString

func (d *DebugLogger) GetLogsAsString() string

GetLogsAsString returns all logs formatted as a string

func (*DebugLogger) GetStatusMessage

func (d *DebugLogger) GetStatusMessage() string

GetStatusMessage returns the current status message

func (*DebugLogger) HandleFileInput

func (d *DebugLogger) HandleFileInput(key string)

HandleFileInput handles keyboard input for filename

func (*DebugLogger) IsConfirmingOverwrite

func (d *DebugLogger) IsConfirmingOverwrite() bool

IsConfirmingOverwrite returns whether confirming file overwrite

func (*DebugLogger) IsPromptingFile

func (d *DebugLogger) IsPromptingFile() bool

IsPromptingFile returns whether the logger is prompting for a filename

func (*DebugLogger) Log

func (d *DebugLogger) Log(format string, args ...interface{})

Log adds a new log entry to the ring buffer

func (*DebugLogger) Size

func (d *DebugLogger) Size() int

Size returns the current number of logs

func (*DebugLogger) StartFilePrompt

func (d *DebugLogger) StartFilePrompt()

StartFilePrompt initiates the file writing prompt

func (*DebugLogger) WriteToFile

func (d *DebugLogger) WriteToFile() tea.Cmd

WriteToFile writes the logs to the specified file

type EventSeverity

type EventSeverity int

EventSeverity represents the severity level of a task event

const (
	EventSeverityInfo EventSeverity = iota
	EventSeverityWarning
	EventSeverityCritical
)

func GetEventSeverity

func GetEventSeverity(eventType rest.V1TaskEventType) EventSeverity

GetEventSeverity returns the severity level for a given event type

type HelpView

type HelpView struct {
	BaseModel
	// contains filtered or unexported fields
}

HelpView displays a fullscreen help modal with ASCII art logo and command reference

func NewHelpView

func NewHelpView(ctx ViewContext) *HelpView

NewHelpView creates a new help view

func (*HelpView) Init

func (v *HelpView) Init() tea.Cmd

Init initializes the view

func (*HelpView) SetSize

func (v *HelpView) SetSize(width, height int)

SetSize updates the view dimensions and initializes the viewport

func (*HelpView) Update

func (v *HelpView) Update(msg tea.Msg) (View, tea.Cmd)

Update handles messages and updates the view state

func (*HelpView) View

func (v *HelpView) View() string

View renders the help view

type NavigateBackMsg struct{}

NavigateBackMsg is sent when navigating back to the tasks view

type NavigateToRunMsg struct {
	WorkflowRunID string
}

NavigateToRunMsg is sent when navigating to a workflow run details view (deprecated, use NavigateToRunWithDetectionMsg)

type NavigateToRunWithDetectionMsg struct {
	RunID string
}

NavigateToRunWithDetectionMsg requests detection of run type (task vs dag)

type NavigateToWorkerMsg struct {
	WorkerID string
}

NavigateToWorkerMsg is sent when navigating to a worker details view

type NavigateToWorkflowMsg struct {
	WorkflowID string
}

NavigateToWorkflowMsg is sent when navigating to a workflow details view

type RunDetailsView

type RunDetailsView struct {
	BaseModel
	// contains filtered or unexported fields
}

RunDetailsView displays details for a DAG workflow run (multiple tasks)

func NewRunDetailsView

func NewRunDetailsView(ctx ViewContext, workflowRunID string) *RunDetailsView

NewRunDetailsView creates a new DAG workflow run details view

func (*RunDetailsView) Init

func (v *RunDetailsView) Init() tea.Cmd

Init initializes the view

func (*RunDetailsView) SetSize

func (v *RunDetailsView) SetSize(width, height int)

SetSize updates the view dimensions and rebuilds the DAG

func (*RunDetailsView) Update

func (v *RunDetailsView) Update(msg tea.Msg) (View, tea.Cmd)

Update handles messages and updates the view state

func (*RunDetailsView) View

func (v *RunDetailsView) View() string

View renders the view to a string

type RunTypeDetectedMsg

type RunTypeDetectedMsg struct {
	Type     string // "task" or "dag"
	TaskData *rest.V1TaskSummary
	DAGData  *rest.V1WorkflowRunDetails
	Error    error
}

RunTypeDetectedMsg contains the detected run type and data

type RunsListFilters

type RunsListFilters struct {
	WorkflowIDs []string // Multiple workflow IDs
	Statuses    map[rest.V1TaskStatus]bool
	TimeWindow  string // "1h", "6h", "1d", "7d", "custom"
	Since       time.Time
	Until       *time.Time
}

RunsListFilters holds the current filter state

func NewDefaultRunsListFilters

func NewDefaultRunsListFilters() *RunsListFilters

NewDefaultRunsListFilters creates default filters matching frontend defaults

func RunFiltersFormProgram

func RunFiltersFormProgram(currentFilters *RunsListFilters, workflows []WorkflowOption) (*RunsListFilters, error)

RunFiltersFormProgram runs the filters form in a separate tea.Program This ensures it takes full control of the terminal without interference

func ShowFiltersForm

func ShowFiltersForm(currentFilters *RunsListFilters, workflows []WorkflowOption) (*RunsListFilters, error)

ShowFiltersForm displays a form to edit filters (deprecated, use RunFiltersFormProgram)

func (*RunsListFilters) GetActiveStatuses

func (f *RunsListFilters) GetActiveStatuses() []rest.V1TaskStatus

GetActiveStatuses returns a slice of enabled statuses

type RunsListView

type RunsListView struct {
	BaseModel
	// contains filtered or unexported fields
}

RunsListView displays a list of runs in a table

func NewRunsListView

func NewRunsListView(ctx ViewContext) *RunsListView

NewRunsListView creates a new runs list view

func (*RunsListView) Init

func (v *RunsListView) Init() tea.Cmd

Init initializes the view

func (*RunsListView) SetSize

func (v *RunsListView) SetSize(width, height int)

SetSize updates the view dimensions

func (*RunsListView) Update

func (v *RunsListView) Update(msg tea.Msg) (View, tea.Cmd)

Update handles messages and updates the view state

func (*RunsListView) View

func (v *RunsListView) View() string

View renders the view to a string

type SingleTaskTab

type SingleTaskTab int

SingleTaskTab represents different tabs in the single task view

const (
	SingleTaskTabOutput SingleTaskTab = iota
	SingleTaskTabInput
	SingleTaskTabEvents
	SingleTaskTabLogs
)

type SingleTaskView

type SingleTaskView struct {
	BaseModel
	// contains filtered or unexported fields
}

SingleTaskView displays details for a single task run

func NewSingleTaskView

func NewSingleTaskView(ctx ViewContext, taskID string) *SingleTaskView

NewSingleTaskView creates a new single task details view

func (*SingleTaskView) Init

func (v *SingleTaskView) Init() tea.Cmd

Init initializes the view

func (*SingleTaskView) Update

func (v *SingleTaskView) Update(msg tea.Msg) (View, tea.Cmd)

Update handles messages and updates the view state

func (*SingleTaskView) View

func (v *SingleTaskView) View() string

View renders the view to a string

type StatusStyle

type StatusStyle struct {
	Text       string
	Foreground lipgloss.AdaptiveColor
	Background lipgloss.AdaptiveColor
}

StatusStyle defines the styling for a status badge

func GetV1TaskStatusStyle

func GetV1TaskStatusStyle(status rest.V1TaskStatus) StatusStyle

GetV1TaskStatusStyle returns the appropriate style for a V1TaskStatus Matches frontend createV1RunStatusVariant from run-statuses.tsx

type TableWithStyleFunc

type TableWithStyleFunc struct {
	*table.Model
	// contains filtered or unexported fields
}

TableWithStyleFunc wraps bubbles table.Model and adds per-cell styling support

func NewTableWithStyleFunc

func NewTableWithStyleFunc(opts ...table.Option) *TableWithStyleFunc

NewTableWithStyleFunc creates a new table with StyleFunc support

func (*TableWithStyleFunc) Columns

func (t *TableWithStyleFunc) Columns() []table.Column

Columns returns the table columns

func (*TableWithStyleFunc) Cursor

func (t *TableWithStyleFunc) Cursor() int

Cursor returns the current cursor position

func (*TableWithStyleFunc) Height

func (t *TableWithStyleFunc) Height() int

Height returns the table height

func (*TableWithStyleFunc) Rows

func (t *TableWithStyleFunc) Rows() []table.Row

Rows returns the table rows

func (*TableWithStyleFunc) SetHeight

func (t *TableWithStyleFunc) SetHeight(height int)

SetHeight sets the table height

func (*TableWithStyleFunc) SetRows

func (t *TableWithStyleFunc) SetRows(rows []table.Row)

SetRows sets the table rows

func (*TableWithStyleFunc) SetStyleFunc

func (t *TableWithStyleFunc) SetStyleFunc(fn func(row, col int) lipgloss.Style)

SetStyleFunc sets the function that determines styling for each cell

func (*TableWithStyleFunc) SetStyles

func (t *TableWithStyleFunc) SetStyles(s table.Styles)

SetStyles sets the table styles

func (*TableWithStyleFunc) Update

func (t *TableWithStyleFunc) Update(msg interface{}) (table.Model, tea.Cmd)

Update delegates to the underlying table model and handles all events including mouse

func (*TableWithStyleFunc) View

func (t *TableWithStyleFunc) View() string

View renders the table with per-cell styling

type View

type View interface {
	// Init initializes the view and returns any initial commands
	Init() tea.Cmd

	// Update handles messages and updates the view state
	Update(msg tea.Msg) (View, tea.Cmd)

	// View renders the view to a string
	View() string

	// SetSize updates the view dimensions
	SetSize(width, height int)
}

View represents a TUI view component

type ViewContext

type ViewContext struct {
	// Profile name for display
	ProfileName string

	// Hatchet client for API calls
	Client client.Client

	// Terminal dimensions
	Width  int
	Height int
}

ViewContext contains the shared context passed to all views

type WorkerDetailsView

type WorkerDetailsView struct {
	BaseModel
	// contains filtered or unexported fields
}

WorkerDetailsView displays details about a specific worker

func NewWorkerDetailsView

func NewWorkerDetailsView(ctx ViewContext, workerID string) *WorkerDetailsView

NewWorkerDetailsView creates a new worker details view

func (*WorkerDetailsView) Init

func (v *WorkerDetailsView) Init() tea.Cmd

Init initializes the view

func (*WorkerDetailsView) SetSize

func (v *WorkerDetailsView) SetSize(width, height int)

SetSize updates the view dimensions

func (*WorkerDetailsView) Update

func (v *WorkerDetailsView) Update(msg tea.Msg) (View, tea.Cmd)

Update handles messages and updates the view state

func (*WorkerDetailsView) View

func (v *WorkerDetailsView) View() string

View renders the view to a string

type WorkersView

type WorkersView struct {
	BaseModel
	// contains filtered or unexported fields
}

WorkersView displays a list of workers in a table

func NewWorkersView

func NewWorkersView(ctx ViewContext) *WorkersView

NewWorkersView creates a new workers list view

func (*WorkersView) Init

func (v *WorkersView) Init() tea.Cmd

Init initializes the view

func (*WorkersView) SetSize

func (v *WorkersView) SetSize(width, height int)

SetSize updates the view dimensions

func (*WorkersView) Update

func (v *WorkersView) Update(msg tea.Msg) (View, tea.Cmd)

Update handles messages and updates the view state

func (*WorkersView) View

func (v *WorkersView) View() string

View renders the view to a string

type WorkflowDetailsView

type WorkflowDetailsView struct {
	BaseModel
	// contains filtered or unexported fields
}

WorkflowDetailsView displays details about a specific workflow and its recent runs

func NewWorkflowDetailsView

func NewWorkflowDetailsView(ctx ViewContext, workflowID string) *WorkflowDetailsView

NewWorkflowDetailsView creates a new workflow details view

func (*WorkflowDetailsView) Init

func (v *WorkflowDetailsView) Init() tea.Cmd

Init initializes the view

func (*WorkflowDetailsView) SetSize

func (v *WorkflowDetailsView) SetSize(width, height int)

SetSize updates the view dimensions

func (*WorkflowDetailsView) Update

func (v *WorkflowDetailsView) Update(msg tea.Msg) (View, tea.Cmd)

Update handles messages and updates the view state

func (*WorkflowDetailsView) View

func (v *WorkflowDetailsView) View() string

View renders the view to a string

type WorkflowOption

type WorkflowOption struct {
	ID          string
	DisplayName string
}

WorkflowOption represents a workflow for the selector

func FetchWorkflows

func FetchWorkflows(ctx context.Context, client rest.ClientWithResponsesInterface, tenantID string) ([]WorkflowOption, error)

FetchWorkflows fetches available workflows for filtering

type WorkflowsView

type WorkflowsView struct {
	BaseModel
	// contains filtered or unexported fields
}

WorkflowsView displays a list of workflows in a table

func NewWorkflowsView

func NewWorkflowsView(ctx ViewContext) *WorkflowsView

NewWorkflowsView creates a new workflows list view

func (*WorkflowsView) Init

func (v *WorkflowsView) Init() tea.Cmd

Init initializes the view

func (*WorkflowsView) SetSize

func (v *WorkflowsView) SetSize(width, height int)

SetSize updates the view dimensions

func (*WorkflowsView) Update

func (v *WorkflowsView) Update(msg tea.Msg) (View, tea.Cmd)

Update handles messages and updates the view state

func (*WorkflowsView) View

func (v *WorkflowsView) View() string

View renders the view to a string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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