servicefieldsstep

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package servicefieldsstep is the two-field step every "make a service" flow needs: a name and an image, then out to the existing YAML editor rather than a form with a field for every compose key - docs/DESIGN.md §Editing services rejects that outright.

It is shared, not copied, between createcomposefilemodal (the bootstrap flow's optional first service) and addservicemodal (`n` on the Services page) precisely so a later feature added here - Docker Hub search, a tag picker - lands in both flows at once instead of leaving the bootstrap flow behind. See D2 in docs/plans/image-search.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

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

Model is not a tea.Model in its own right - it has no Init and its Update/View take and return the concrete type, not the interface - because it is always embedded inside a modal that owns the surrounding chrome (title text, what else the modal shows before or after this step) rather than run standalone.

func New

func New(title string, onSubmit func(name, image string) tea.Cmd) (Model, tea.Cmd)

New builds the step. title is shown as the step's heading; onSubmit turns the validated (name, image) pair into the command the embedding modal should run once it closes - cmds.CreateComposeFile for the bootstrap flow, cmds.AddService for the Services page. That is deliberately the whole contract: a third parameter is the signal to stop sharing this component and copy the step instead (D2).

The returned command focuses the service-name field; embed it in whatever command the caller already returns from the keypress that opens this step.

func (Model) Update

func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)

func (Model) View

func (m Model) View() string

View renders the step's body - title, both fields, an error line when one of the validations above tripped, and its own hint line, since the modal embedding it is not expected to know this step's keys beyond Cancel. The caller wraps the result in chrome.ModalSurface.

Jump to

Keyboard shortcuts

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