Documentation
¶
Overview ¶
Package app implements the main Bubbletea application for the interactive workflow dispatcher TUI.
Index ¶
- Constants
- Variables
- type Candidate
- type ChainStepAdoptedMsg
- type ChainUpdateMsg
- type Command
- type EnvironmentsFetchedMsg
- type FetchFlakyMsg
- type FetchLogsMsg
- type FetchRunsMsg
- type FetchTimelineMsg
- type FlakyFetchedMsg
- type FocusedPane
- type KeyMap
- type LogStreamUpdateMsg
- type LogsFetchedMsg
- type Model
- type Option
- type Registry
- type RunMutationDoneMsg
- type RunUpdateMsg
- type RunsFetchedMsg
- type ShowLogsViewerMsg
- type StartLogStreamMsg
- type StatusMsg
- type StopLogStreamMsg
- type TimelineFetchedMsg
- type TimelineTickMsg
- type ViewMode
Constants ¶
const ( MaxHistoryEntries = 10 MinTerminalHeight = 20 MinTerminalWidth = 80 )
UI layout and history limits.
Variables ¶
var ErrLogManagerNotInitialized = errors.New("log manager not initialized")
ErrLogManagerNotInitialized indicates logs were requested before the log manager was set up.
var ErrNoChainStateOrRunID = errors.New("no chain state or run ID provided")
ErrNoChainStateOrRunID indicates a log fetch request lacked both chain state and a run ID.
Functions ¶
This section is empty.
Types ¶
type Candidate ¶ added in v1.4.0
Candidate is one completion paired with the line explaining it, so the command bar shows both without a second lookup.
type ChainStepAdoptedMsg ¶ added in v1.12.0
type ChainStepAdoptedMsg struct {
Err error
Run *github.WorkflowRun
ChainName string
StepIndex int
}
ChainStepAdoptedMsg carries what a source: existing step would adopt, or the reason it found nothing.
type ChainUpdateMsg ¶
type ChainUpdateMsg struct {
Update chain.ChainUpdate
}
ChainUpdateMsg is sent when a chain execution state changes.
type Command ¶ added in v1.4.0
type Command struct {
// Run applies the command. Args are the whitespace-separated words after
// the command's own name.
Run func(Model, []string) (Model, tea.Cmd)
// Complete offers the candidates for the argument being typed, which is
// the last element of args and may be empty. A nil Complete means the
// command takes no arguments worth completing.
Complete func(Model, []string) []Candidate
Name string
Description string
}
Command is one named `:command` the command bar can run. A command exists so an action has a name a reader can guess, which is what a key cannot offer once the letters run out.
type EnvironmentsFetchedMsg ¶ added in v1.10.0
EnvironmentsFetchedMsg carries the repository's deployment environments, or the reason they could not be read.
type FetchFlakyMsg ¶ added in v1.10.0
type FetchFlakyMsg struct{}
FetchFlakyMsg asks for the run history a pass rate is measured over.
type FetchLogsMsg ¶
type FetchLogsMsg struct {
ChainState *chain.ChainState
Workflow string
Branch string
Step string
RunID int64
ErrorsOnly bool
}
FetchLogsMsg requests fetching logs for a chain or run. Step names the step the viewer should open on, empty when the whole run's log was asked for.
type FetchRunsMsg ¶ added in v1.7.0
FetchRunsMsg asks for the current state of a scope's workflows.
type FetchTimelineMsg ¶ added in v1.5.0
FetchTimelineMsg asks for a run's jobs so the panel can draw them.
type FlakyFetchedMsg ¶ added in v1.10.0
type FlakyFetchedMsg struct {
Error error
Runs []github.WorkflowRun
}
FlakyFetchedMsg carries the listing, or why it could not be read.
type FocusedPane ¶
type FocusedPane int
FocusedPane represents which pane currently has focus.
const ( PaneWorkflows FocusedPane = iota PaneChains PaneConfig PaneRight )
Panes available in the TUI, in tab order: the left column top to bottom, then the right panel.
type KeyMap ¶
type KeyMap struct {
Actions key.Binding
Branch key.Binding
Command key.Binding
Chain key.Binding
Clear key.Binding
ClearAll key.Binding
Copy key.Binding
Down key.Binding
Edit key.Binding
Enter key.Binding
Escape key.Binding
Filter key.Binding
Help key.Binding
LiveView key.Binding
Quit key.Binding
Reload key.Binding
Reset key.Binding
Scope key.Binding
PaneLeft key.Binding
PaneRight key.Binding
ShiftTab key.Binding
Space key.Binding
Tab key.Binding
TabNext key.Binding
TabPrev key.Binding
Up key.Binding
ViewLogs key.Binding
Watch key.Binding
Input0 key.Binding
Input1 key.Binding
Input2 key.Binding
Input3 key.Binding
Input4 key.Binding
Input5 key.Binding
Input6 key.Binding
Input7 key.Binding
Input8 key.Binding
Input9 key.Binding
Workflow0 key.Binding
Workflow1 key.Binding
Workflow2 key.Binding
Workflow3 key.Binding
Workflow4 key.Binding
Workflow5 key.Binding
Workflow6 key.Binding
Workflow7 key.Binding
Workflow8 key.Binding
Workflow9 key.Binding
}
KeyMap defines all keyboard shortcuts for the application.
func DefaultKeyMap ¶
func DefaultKeyMap() KeyMap
DefaultKeyMap returns the default keyboard shortcuts.
func (KeyMap) InputKeys ¶
InputKeys returns the input key bindings in row order, so the returned index is the input's own index and `0` reaches the tenth row.
func (KeyMap) WorkflowKeys ¶
WorkflowKeys returns all workflow key bindings as a slice indexed 0-9.
type LogStreamUpdateMsg ¶
type LogStreamUpdateMsg struct {
Update logs.StreamUpdate
}
LogStreamUpdateMsg contains new log content from streaming.
type LogsFetchedMsg ¶
type LogsFetchedMsg struct {
Error error
Logs *logs.RunLogs
Workflow string
Step string
RunID int64
ErrorsOnly bool
}
LogsFetchedMsg contains fetched logs or an error.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the root bubbletea model for the application.
func (Model) Init ¶
Init implements tea.Model. Init loads the tab the panel opens on. The question a reader starts with is whether their branch is green, so that answer is fetched rather than waiting for them to find the tab holding it.
func (Model) SelectedWorkflow ¶
SelectedWorkflow returns the currently selected workflow.
type Option ¶ added in v1.11.0
type Option func(*options)
Option configures an optional part of the model.
func WithRepoRoot ¶ added in v1.11.0
WithRepoRoot reads the chain config from root rather than the working directory, which is what lets the TUI start in a subdirectory.
type Registry ¶ added in v1.4.0
type Registry struct {
// contains filtered or unexported fields
}
Registry holds the commands the bar knows, sorted by name.
func DefaultRegistry ¶ added in v1.4.0
func DefaultRegistry() Registry
DefaultRegistry builds the commands the `:` bar offers. Every one of them is reachable by a key as well; the bar exists so an action has a name to guess at when its key is not the one you remember.
func NewRegistry ¶ added in v1.4.0
NewRegistry builds a Registry, sorting by name so every listing and completion comes back in one order.
func (Registry) Candidates ¶ added in v1.4.0
Candidates returns the commands whose names start with prefix.
func (Registry) Listing ¶ added in v1.4.0
Listing renders every command as "name<tab>description", one per line, for a caller with no help modal to open.
type RunMutationDoneMsg ¶ added in v1.10.0
type RunMutationDoneMsg struct {
Error error
Kind modal.RunActionKind
RunID int64
}
RunMutationDoneMsg reports what a re-run or a cancel did.
type RunUpdateMsg ¶
RunUpdateMsg is sent when a watched run is updated.
type RunsFetchedMsg ¶ added in v1.7.0
type RunsFetchedMsg struct {
Error error
Branch string
Runs []github.WorkflowRun
PRs []github.PullRequest
Scope panes.RunsScope
}
RunsFetchedMsg carries what GitHub said, or why it could not say. A branch scope answers with runs and a pull request scope with rollups, so only one of the two is ever set.
type ShowLogsViewerMsg ¶
type ShowLogsViewerMsg struct {
Logs *logs.RunLogs
Workflow string
Step string
RunID int64
ErrorsOnly bool
}
ShowLogsViewerMsg opens the logs viewer modal.
type StartLogStreamMsg ¶
StartLogStreamMsg begins streaming logs for an active run.
type StatusMsg ¶ added in v1.4.0
type StatusMsg struct {
Text string
}
StatusMsg carries a one-line result to the footer. A command that answers with text rather than a new view says so here.
type StopLogStreamMsg ¶
type StopLogStreamMsg struct {
RunID int64
}
StopLogStreamMsg stops streaming logs for a run.
type TimelineFetchedMsg ¶ added in v1.5.0
TimelineFetchedMsg carries the jobs, or why they could not be read.
type TimelineTickMsg ¶ added in v1.10.0
type TimelineTickMsg struct{}
TimelineTickMsg asks for a frame so an open bar is drawn against a clock that has moved.