Documentation
¶
Overview ¶
Package modal provides modal dialogs for user interactions in the TUI application.
Index ¶
- func FormatStatusBar(runs []watcher.WatchedRun) string
- type BranchItem
- type BranchModal
- type BranchResultMsg
- type ChainConfirmModal
- type ChainConfirmResultMsg
- type ChainRerunModal
- type ChainRerunResultMsg
- type ChainSelectModal
- type ChainSelectResultMsg
- type ChainStatusModal
- func (m *ChainStatusModal) GetDetailedError() string
- func (m *ChainStatusModal) GetFailedStepRunURL() string
- func (m *ChainStatusModal) IsDone() bool
- func (*ChainStatusModal) Result() any
- func (m *ChainStatusModal) SetCommands(commands []string, branch string)
- func (m *ChainStatusModal) Update(msg tea.Msg) (Context, tea.Cmd)
- func (m *ChainStatusModal) UpdateState(state chain.ChainState)
- func (m *ChainStatusModal) View() string
- func (m *ChainStatusModal) WasStopped() bool
- type ChainStatusStopMsg
- type ChainStatusViewLogsMsg
- type ChainVariableModal
- type ChainVariableResultMsg
- type ClosedMsg
- type ConfirmModal
- type ConfirmResultMsg
- type Context
- type ErrorModal
- type FilterModal
- type FilterResultMsg
- type HelpModal
- type InputModal
- type InputResultMsg
- type LiveViewClearAllMsg
- type LiveViewClearMsg
- type LiveViewModal
- type LogsViewerModal
- func (m *LogsViewerModal) AppendStreamUpdate(update logs.StreamUpdate)
- func (m *LogsViewerModal) DisableStreaming()
- func (m *LogsViewerModal) EnableStreaming(runID int64, autoScroll bool)
- func (m *LogsViewerModal) IsDone() bool
- func (m *LogsViewerModal) IsStreaming() bool
- func (*LogsViewerModal) Result() any
- func (m *LogsViewerModal) StreamRunID() int64
- func (m *LogsViewerModal) Update(msg tea.Msg) (Context, tea.Cmd)
- func (m *LogsViewerModal) View() string
- type MatchLocation
- type RemapAction
- type RemapDecision
- type RemapModal
- type RemapResultMsg
- type ResetDiff
- type ResetModal
- type ResetResultMsg
- type RunConfirmModal
- type RunConfirmResultMsg
- type SelectModal
- type SelectResultMsg
- type SimpleBranchModal
- type Sizer
- type Stack
- func (s *Stack) Clear()
- func (s *Stack) Current() Context
- func (s *Stack) Find(match func(Context) bool) Context
- func (s *Stack) HasActive() bool
- func (s *Stack) Pop() Context
- func (s *Stack) Push(ctx Context)
- func (s *Stack) Render(background string) string
- func (s *Stack) SetSize(width, height int)
- func (s *Stack) Update(msg tea.Msg) tea.Cmd
- type ValidationErrorModal
- type ValidationErrorResultMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatStatusBar ¶
func FormatStatusBar(runs []watcher.WatchedRun) string
FormatStatusBar returns a formatted status bar string for watched runs.
Types ¶
type BranchItem ¶
type BranchItem struct {
// contains filtered or unexported fields
}
BranchItem represents a branch in the list.
func (BranchItem) Description ¶
func (BranchItem) Description() string
Description returns the list item description (unused for branches).
func (BranchItem) FilterValue ¶
func (i BranchItem) FilterValue() string
FilterValue returns the value used for fuzzy filtering.
func (BranchItem) Title ¶
func (i BranchItem) Title() string
Title returns the branch name for list display.
type BranchModal ¶
type BranchModal struct {
// contains filtered or unexported fields
}
BranchModal presents a filterable list of branches.
func NewBranchModal ¶
func NewBranchModal(title string, branches []string, current string) *BranchModal
NewBranchModal creates a new branch selection modal.
func NewBranchModalWithDefault ¶
func NewBranchModalWithDefault(title string, branches []string, current, defaultBranch string) *BranchModal
NewBranchModalWithDefault creates a new branch selection modal with default branch pinning.
func (*BranchModal) IsDone ¶
func (m *BranchModal) IsDone() bool
IsDone returns true if the modal is finished.
func (*BranchModal) SetSize ¶
func (m *BranchModal) SetSize(width, height int)
SetSize updates the modal dimensions based on terminal size.
type BranchResultMsg ¶
type BranchResultMsg struct {
Value string
}
BranchResultMsg is sent when a branch is selected.
type ChainConfirmModal ¶
type ChainConfirmModal struct {
// contains filtered or unexported fields
}
ChainConfirmModal shows the chain configuration and confirms execution.
func NewChainConfirmModal ¶
func NewChainConfirmModal( chainName string, chainDef *config.Chain, variables map[string]string, branch string, watch bool, ) *ChainConfirmModal
NewChainConfirmModal creates a chain confirmation modal.
func (*ChainConfirmModal) IsDone ¶
func (m *ChainConfirmModal) IsDone() bool
IsDone returns true if the modal is finished.
func (*ChainConfirmModal) Result ¶
func (m *ChainConfirmModal) Result() any
Result returns the confirmation result.
func (*ChainConfirmModal) SetSize ¶ added in v1.2.1
func (m *ChainConfirmModal) SetSize(width, _ int)
SetSize records the room the modal has, so a long command wraps rather than widening the modal past the terminal.
func (*ChainConfirmModal) View ¶
func (m *ChainConfirmModal) View() string
View renders the chain confirm modal.
type ChainConfirmResultMsg ¶
type ChainConfirmResultMsg struct {
Variables map[string]string
ChainName string
Branch string
Confirmed bool
Watch bool
}
ChainConfirmResultMsg is sent when chain execution is confirmed or canceled.
type ChainRerunModal ¶
type ChainRerunModal struct {
// contains filtered or unexported fields
}
ChainRerunModal presents options for re-running a chain from history.
func NewChainRerunModal ¶
func NewChainRerunModal(entry *frecency.HistoryEntry) *ChainRerunModal
NewChainRerunModal creates a chain re-run modal.
func (*ChainRerunModal) IsDone ¶
func (m *ChainRerunModal) IsDone() bool
IsDone returns true if the modal is finished.
func (*ChainRerunModal) Result ¶
func (m *ChainRerunModal) Result() any
Result returns the re-run selection result.
func (*ChainRerunModal) View ¶
func (m *ChainRerunModal) View() string
View renders the chain re-run modal.
type ChainRerunResultMsg ¶
type ChainRerunResultMsg struct {
HistoryEntry *frecency.HistoryEntry
Action string
ResumeFromStep int
}
ChainRerunResultMsg is sent when chain re-run options are selected.
type ChainSelectModal ¶
type ChainSelectModal struct {
// contains filtered or unexported fields
}
ChainSelectModal displays available chains for selection.
func NewChainSelectModal ¶
func NewChainSelectModal(cfg *config.WfdConfig) *ChainSelectModal
NewChainSelectModal creates a new chain selection modal.
func (*ChainSelectModal) IsDone ¶
func (m *ChainSelectModal) IsDone() bool
IsDone returns true if the modal is finished.
func (*ChainSelectModal) Result ¶
func (*ChainSelectModal) Result() any
Result returns nil for chain select modal.
func (*ChainSelectModal) View ¶
func (m *ChainSelectModal) View() string
View renders the chain select modal.
type ChainSelectResultMsg ¶
ChainSelectResultMsg is sent when a chain is selected.
type ChainStatusModal ¶
type ChainStatusModal struct {
// contains filtered or unexported fields
}
ChainStatusModal displays the current status of a chain execution.
func NewChainStatusModal ¶
func NewChainStatusModal(state chain.ChainState) *ChainStatusModal
NewChainStatusModal creates a new chain status modal.
func NewChainStatusModalWithCommands ¶
func NewChainStatusModalWithCommands(state chain.ChainState, commands []string, branch string) *ChainStatusModal
NewChainStatusModalWithCommands creates a chain status modal with command strings.
func (*ChainStatusModal) GetDetailedError ¶
func (m *ChainStatusModal) GetDetailedError() string
GetDetailedError returns a detailed error message with context.
func (*ChainStatusModal) GetFailedStepRunURL ¶
func (m *ChainStatusModal) GetFailedStepRunURL() string
GetFailedStepRunURL returns the URL of the failed step's run, if available.
func (*ChainStatusModal) IsDone ¶
func (m *ChainStatusModal) IsDone() bool
IsDone returns true if the modal is finished.
func (*ChainStatusModal) Result ¶
func (*ChainStatusModal) Result() any
Result returns nil for chain status modal.
func (*ChainStatusModal) SetCommands ¶
func (m *ChainStatusModal) SetCommands(commands []string, branch string)
SetCommands sets the command strings for each step.
func (*ChainStatusModal) UpdateState ¶
func (m *ChainStatusModal) UpdateState(state chain.ChainState)
UpdateState updates the chain state displayed in the modal.
func (*ChainStatusModal) View ¶
func (m *ChainStatusModal) View() string
View renders the chain status modal.
func (*ChainStatusModal) WasStopped ¶
func (m *ChainStatusModal) WasStopped() bool
WasStopped returns true if the user requested to stop the chain.
type ChainStatusStopMsg ¶
type ChainStatusStopMsg struct{}
ChainStatusStopMsg is sent when the user requests to stop the chain.
type ChainStatusViewLogsMsg ¶
type ChainStatusViewLogsMsg struct {
Branch string
State chain.ChainState
ErrorsOnly bool
}
ChainStatusViewLogsMsg is sent when the user requests to view logs.
type ChainVariableModal ¶
type ChainVariableModal struct {
// contains filtered or unexported fields
}
ChainVariableModal collects variable values for chain execution.
func NewChainVariableModal ¶
func NewChainVariableModal(chainName string, chainDef *config.Chain) *ChainVariableModal
NewChainVariableModal creates a chain variable input modal.
func (*ChainVariableModal) IsDone ¶
func (m *ChainVariableModal) IsDone() bool
IsDone returns true if the modal is finished.
func (*ChainVariableModal) Result ¶
func (m *ChainVariableModal) Result() any
Result returns the variable collection result.
func (*ChainVariableModal) View ¶
func (m *ChainVariableModal) View() string
View renders the chain variable modal.
type ChainVariableResultMsg ¶
ChainVariableResultMsg is sent when chain variable input is complete.
type ClosedMsg ¶ added in v1.0.1
type ClosedMsg struct {
Result any
}
ClosedMsg is sent when a modal is closed.
type ConfirmModal ¶
type ConfirmModal struct {
// contains filtered or unexported fields
}
ConfirmModal presents a yes/no choice.
func NewConfirmModal ¶
func NewConfirmModal(title, description string, current, defaultVal bool) *ConfirmModal
NewConfirmModal creates a new confirmation modal.
func (*ConfirmModal) IsDone ¶
func (m *ConfirmModal) IsDone() bool
IsDone returns true if the modal is finished.
func (*ConfirmModal) Result ¶
func (m *ConfirmModal) Result() any
Result returns the confirmed value.
type ConfirmResultMsg ¶
type ConfirmResultMsg struct {
Value bool
}
ConfirmResultMsg is sent when confirmation is made.
type Context ¶
type Context interface {
Update(msg tea.Msg) (Context, tea.Cmd)
View() string
IsDone() bool
Result() any
}
Context represents a modal that can be pushed onto the stack.
type ErrorModal ¶
type ErrorModal struct {
// contains filtered or unexported fields
}
ErrorModal displays an error message with a dismiss button.
func NewErrorModal ¶
func NewErrorModal(title, message string) *ErrorModal
NewErrorModal creates a new error modal with a title and message.
func (*ErrorModal) IsDone ¶
func (m *ErrorModal) IsDone() bool
IsDone returns true if the modal is finished.
type FilterModal ¶
type FilterModal struct {
// contains filtered or unexported fields
}
FilterModal presents a fuzzy filter input.
func NewFilterModal ¶
func NewFilterModal(title string, items []string, currentFilter string) *FilterModal
NewFilterModal creates a new filter modal.
func (*FilterModal) IsDone ¶
func (m *FilterModal) IsDone() bool
IsDone returns true if the modal is finished.
type FilterResultMsg ¶
FilterResultMsg is sent when filter is applied or canceled.
type HelpModal ¶
type HelpModal struct {
// contains filtered or unexported fields
}
HelpModal displays keyboard shortcuts and help.
func (*HelpModal) SetSize ¶ added in v1.2.0
SetSize records how many content lines the modal has room for.
type InputModal ¶
type InputModal struct {
// contains filtered or unexported fields
}
InputModal presents a text input field.
func NewInputModal ¶
func NewInputModal( title, description, defaultVal, inputType, current string, options []string, rules []rule.ValidationRule, ) *InputModal
NewInputModal creates a new text input modal.
func (*InputModal) IsDone ¶
func (m *InputModal) IsDone() bool
IsDone returns true if the modal is finished.
type InputResultMsg ¶
type InputResultMsg struct {
Value string
}
InputResultMsg is sent when input is confirmed.
type LiveViewClearAllMsg ¶
type LiveViewClearAllMsg struct{}
LiveViewClearAllMsg is sent when user wants to clear all completed runs.
type LiveViewClearMsg ¶
type LiveViewClearMsg struct {
RunID int64
}
LiveViewClearMsg is sent when user wants to clear a specific run.
type LiveViewModal ¶
type LiveViewModal struct {
// contains filtered or unexported fields
}
LiveViewModal displays the status of watched workflow runs.
func NewLiveViewModal ¶
func NewLiveViewModal(runs []watcher.WatchedRun) *LiveViewModal
NewLiveViewModal creates a new live view modal.
func (*LiveViewModal) IsDone ¶
func (m *LiveViewModal) IsDone() bool
IsDone returns true if the modal is finished.
func (*LiveViewModal) Result ¶
func (*LiveViewModal) Result() any
Result returns nil for live view modal.
func (*LiveViewModal) UpdateRuns ¶
func (m *LiveViewModal) UpdateRuns(runs []watcher.WatchedRun)
UpdateRuns updates the list of watched runs.
func (*LiveViewModal) View ¶
func (m *LiveViewModal) View() string
View renders the live view modal.
type LogsViewerModal ¶
type LogsViewerModal struct {
// contains filtered or unexported fields
}
LogsViewerModal displays workflow logs in a unified view with collapsible sections.
func NewLogsViewerModal ¶
func NewLogsViewerModal(runLogs *logs.RunLogs, width, height int) *LogsViewerModal
NewLogsViewerModal creates a new unified logs viewer modal.
func NewLogsViewerModalWithError ¶
func NewLogsViewerModalWithError(runLogs *logs.RunLogs, width, height int) *LogsViewerModal
NewLogsViewerModalWithError creates a logs viewer pre-filtered for errors.
func (*LogsViewerModal) AppendStreamUpdate ¶
func (m *LogsViewerModal) AppendStreamUpdate(update logs.StreamUpdate)
AppendStreamUpdate appends new log entries from streaming.
func (*LogsViewerModal) DisableStreaming ¶
func (m *LogsViewerModal) DisableStreaming()
DisableStreaming disables streaming mode.
func (*LogsViewerModal) EnableStreaming ¶
func (m *LogsViewerModal) EnableStreaming(runID int64, autoScroll bool)
EnableStreaming enables streaming mode for this viewer.
func (*LogsViewerModal) IsDone ¶
func (m *LogsViewerModal) IsDone() bool
IsDone returns true if the modal is finished.
func (*LogsViewerModal) IsStreaming ¶
func (m *LogsViewerModal) IsStreaming() bool
IsStreaming returns whether streaming is active.
func (*LogsViewerModal) StreamRunID ¶
func (m *LogsViewerModal) StreamRunID() int64
StreamRunID returns the run ID being streamed.
func (*LogsViewerModal) View ¶
func (m *LogsViewerModal) View() string
View renders the logs viewer modal.
type MatchLocation ¶
type MatchLocation struct {
StepIndex int // index in filtered.Steps
EntryIndex int // index in step.Entries
LineNumber int // line number in viewport content (0-based)
}
MatchLocation tracks the position of a search match in the rendered viewport.
type RemapAction ¶
type RemapAction int
RemapAction represents the action to take for a validation error.
const ( RemapActionDrop RemapAction = iota // Drop this input RemapActionKeep // Keep with original name (ignore error) RemapActionMap // Map to a different input name )
Remap action values.
type RemapDecision ¶
type RemapDecision struct {
OriginalName string
NewName string
Action RemapAction
}
RemapDecision represents a user decision for a validation error.
type RemapModal ¶
type RemapModal struct {
// contains filtered or unexported fields
}
RemapModal presents a wizard for remapping invalid configuration inputs.
func NewRemapModal ¶
func NewRemapModal( errors []validation.ConfigValidationError, currentInputs map[string]workflow.Input, ) *RemapModal
NewRemapModal creates a new remapping wizard modal.
func (*RemapModal) IsDone ¶
func (m *RemapModal) IsDone() bool
IsDone returns true if the modal is finished.
func (*RemapModal) Result ¶
func (m *RemapModal) Result() any
Result returns the remapping decisions.
type RemapResultMsg ¶
type RemapResultMsg struct {
Decisions []RemapDecision
}
RemapResultMsg is sent when remapping is complete.
type ResetModal ¶
type ResetModal struct {
// contains filtered or unexported fields
}
ResetModal shows values that will be reset and confirms.
func NewResetModal ¶
func NewResetModal(diffs []ResetDiff) *ResetModal
NewResetModal creates a reset confirmation modal.
func (*ResetModal) IsDone ¶
func (m *ResetModal) IsDone() bool
IsDone returns true if the modal is finished.
func (*ResetModal) Result ¶
func (m *ResetModal) Result() any
Result returns the confirmation result.
type ResetResultMsg ¶
type ResetResultMsg struct {
Confirmed bool
}
ResetResultMsg is sent when reset is confirmed or canceled.
type RunConfirmModal ¶
type RunConfirmModal struct {
// contains filtered or unexported fields
}
RunConfirmModal shows the command that will be executed and confirms.
func NewRunConfirmModal ¶
func NewRunConfirmModal(cfg runner.RunConfig) *RunConfirmModal
NewRunConfirmModal creates a run confirmation modal.
func (*RunConfirmModal) IsDone ¶
func (m *RunConfirmModal) IsDone() bool
IsDone returns true if the modal is finished.
func (*RunConfirmModal) Result ¶
func (m *RunConfirmModal) Result() any
Result returns the confirmation result.
func (*RunConfirmModal) View ¶
func (m *RunConfirmModal) View() string
View renders the run confirm modal.
type RunConfirmResultMsg ¶
RunConfirmResultMsg is sent when workflow execution is confirmed or canceled.
type SelectModal ¶
type SelectModal struct {
// contains filtered or unexported fields
}
SelectModal presents a list of options to choose from.
func NewSelectModal ¶
func NewSelectModal(title, description string, options []string, current, defaultVal string) *SelectModal
NewSelectModal creates a new selection modal.
func (*SelectModal) IsDone ¶
func (m *SelectModal) IsDone() bool
IsDone returns true if the modal is finished.
type SelectResultMsg ¶
type SelectResultMsg struct {
Value string
}
SelectResultMsg is sent when a selection is made.
type SimpleBranchModal ¶
type SimpleBranchModal struct {
// contains filtered or unexported fields
}
SimpleBranchModal is a branch selector without bubbles/list complexity.
func NewSimpleBranchModal ¶
func NewSimpleBranchModal(title string, branches []string, current, defaultBranch string) *SimpleBranchModal
NewSimpleBranchModal creates a simple branch modal with filtering.
func (*SimpleBranchModal) IsDone ¶
func (m *SimpleBranchModal) IsDone() bool
IsDone returns true if the modal is finished.
func (*SimpleBranchModal) Result ¶
func (m *SimpleBranchModal) Result() any
Result returns the selected branch.
func (*SimpleBranchModal) SetSize ¶
func (m *SimpleBranchModal) SetSize(_, height int)
SetSize updates the modal dimensions.
func (*SimpleBranchModal) View ¶
func (m *SimpleBranchModal) View() string
View renders the simple branch modal.
type Sizer ¶ added in v1.2.0
type Sizer interface {
SetSize(width, height int)
}
Sizer is implemented by modals that render themselves against the terminal dimensions. Stack hands those out on Push and on every resize, so a modal never has to guess how much room it has.
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
Stack manages a stack of modal contexts.
func (*Stack) Find ¶ added in v1.2.2
Find returns the first context on the stack that satisfies match, searching from the top down. A long-running operation uses it to reach the modal reporting on it, which need not be the modal the user is looking at.
type ValidationErrorModal ¶
type ValidationErrorModal struct {
// contains filtered or unexported fields
}
ValidationErrorModal displays validation errors and allows override or fixing.
func NewValidationErrorModal ¶
func NewValidationErrorModal(errors map[string][]string) *ValidationErrorModal
NewValidationErrorModal creates a new validation error modal.
func (*ValidationErrorModal) IsDone ¶
func (m *ValidationErrorModal) IsDone() bool
IsDone returns true if the modal is finished.
func (*ValidationErrorModal) Result ¶
func (m *ValidationErrorModal) Result() any
Result returns nil for validation error modal.
func (*ValidationErrorModal) View ¶
func (m *ValidationErrorModal) View() string
View renders the validation error modal.
type ValidationErrorResultMsg ¶
type ValidationErrorResultMsg struct {
Override bool
}
ValidationErrorResultMsg is returned when the modal closes.