Documentation
¶
Overview ¶
Package action provides a single controller that collects input for the Jira verbs (transition, comment, assign, labels, worklog, edit) through one Mode-dispatched component, instead of a bespoke flow per action. The controller is pure state: it gathers input and produces a Request; the caller turns the Request into a Jira mutation and applies it optimistically.
Index ¶
- type Controller
- func (c *Controller) Active() bool
- func (c *Controller) Cancel()
- func (c *Controller) Mode() Mode
- func (c *Controller) Multiline() bool
- func (c *Controller) OpenBulkTransition(transitions []*jira.Transition)
- func (c *Controller) OpenPreset(items []picker.Item)
- func (c *Controller) OpenText(mode Mode, issueKey, initial string)
- func (c *Controller) OpenTransition(issueKey string, transitions []*jira.Transition)
- func (c *Controller) Submit() (Request, bool)
- func (c *Controller) Text() string
- func (c *Controller) Update(msg tea.Msg) tea.Cmd
- func (c *Controller) View() string
- type Mode
- type Request
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller collects input for one action against one issue. Text entry rides the shared input substrate: a real single-line input for the quick verbs and a textarea for comments when no external editor is configured.
func (*Controller) Active ¶
func (c *Controller) Active() bool
Active reports whether an action is open.
func (*Controller) Cancel ¶
func (c *Controller) Cancel()
Cancel closes the controller without producing a request.
func (*Controller) Multiline ¶
func (c *Controller) Multiline() bool
Multiline reports that the open action collects multiline text, so enter inserts a newline rather than submitting.
func (*Controller) OpenBulkTransition ¶
func (c *Controller) OpenBulkTransition(transitions []*jira.Transition)
OpenBulkTransition opens the same picker for a multi-selection. The choices come from one representative marked issue; issues whose workflow doesn't offer the picked name report a per-issue failure at apply time.
func (*Controller) OpenPreset ¶
func (c *Controller) OpenPreset(items []picker.Item)
OpenPreset opens a choice list of saved queries. Item values carry the JQL and come back whole in Request.Text on submit.
func (*Controller) OpenText ¶
func (c *Controller) OpenText(mode Mode, issueKey, initial string)
OpenText opens a free-text action with an optional initial value (e.g. the current summary for an edit). Comments get a multiline area; everything else a single-line input.
func (*Controller) OpenTransition ¶
func (c *Controller) OpenTransition(issueKey string, transitions []*jira.Transition)
OpenTransition opens the transition picker for an issue with its valid transitions. Only the transitions Jira allows for this issue are passed in, so the user can never pick an invalid one.
func (*Controller) Submit ¶
func (c *Controller) Submit() (Request, bool)
Submit produces the Request and closes the controller. It reports false when the action is incomplete (no transitions, or empty required text), leaving the controller open so the user can finish.
func (*Controller) Text ¶
func (c *Controller) Text() string
Text returns the current text-mode content.
func (*Controller) Update ¶
func (c *Controller) Update(msg tea.Msg) tea.Cmd
Update routes a message into the active control: the transition picker (up/down navigate, typing filters) or the text input (cursor movement, editing, paste).
func (*Controller) View ¶
func (c *Controller) View() string
View renders the open action as overlay content: a choice list for a transition, or a labeled text prompt otherwise. Empty when no action is open.
type Mode ¶
type Mode int
Mode is the verb the controller is collecting input for.
const ( // ModeNone means no action is open. ModeNone Mode = iota // ModeTransition picks a workflow transition from a choice list. ModeTransition // ModeComment captures comment text. ModeComment // ModeAssign captures an assignee query. ModeAssign // ModeLabels captures a comma-separated label list. ModeLabels // ModeWorklog captures a time string. ModeWorklog // ModeEdit captures a new summary. ModeEdit // ModeBulkTransition picks a workflow transition to apply across a // multi-selection. The choices come from one representative issue; the // match is by name, with the per-issue id resolved at apply time. ModeBulkTransition // ModeBulkAssign captures an assignee query to apply across a // multi-selection (resolved to one account id at apply time). ModeBulkAssign // ModeBulkComment captures comment text to post on every selected issue. ModeBulkComment // ModePreset picks a saved query from a choice list; the selection's // value (the JQL) comes back in Request.Text. The owning section drives // this mode itself — results.submitAction never sees it. ModePreset )
type Request ¶
type Request struct {
Mode Mode
IssueKey string
// TransitionID/TransitionName are set for ModeTransition. The ID is what
// Jira needs; the name is what the user saw, for optimistic display.
TransitionID string
TransitionName string
// Text is the free-text payload for the text modes.
Text string
}
Request is the result of a completed action, handed to the caller to execute.