Skip to main content

Module form

Module form 

Source
Expand description

Modal forms — reusable scaffolding for multi-field option-settings editors. The first concrete consumer is :capacity (MinSize / MaxSize / InstanceType / Cooldown); the Network / Security pickers will follow once we add a multi-select field kind.

Each Form carries its own field list, cursor position, and lifecycle state. Field values are always stored as String regardless of kind — FieldKind tells the renderer + input handler how to interpret them. Submission converts the field values into (namespace, option_name, value) triples and dispatches via the shared spawn_option_settings_update helper.

Structs§

Form
One modal-form session. Owned by the [App] while crate::app::Mode::Form is active; replaced wholesale on a new :command that opens a form.
FormField

Enums§

FieldKind
FormState
FormSubmit
What the form does on submit.

Functions§

is_multi_selected
Pure: is opt currently selected in a comma-separated multi-select value? Trims options on both sides so whitespace variations don’t produce a false negative.
parse_multi_value
Pure: parse a comma-separated multi-select value into a vec of trimmed, non-empty option strings. Round-trip with join(",").
toggle_multi
Pure: toggle opt in a comma-separated multi-select value. Returns the new comma-joined string. Preserves the original order of options that were already selected and appends a newly-added one at the end.
validate_field
Pure: returns Ok(()) if value is acceptable for kind, else the human-readable error to render below the field.