How a step editor shows a setting a Configuration step may fill
(Alternera.Plugin.configurable?/2, "Settings by match" in the
plugin contract): a step that leaves it empty runs with the value of the
last Configuration step before it, so the empty field says so.
- A text or number input takes
placeholder/3: "From Configuration" with the value the step runs with in brackets ("From Configuration (60)"), and an example where it has neither. - A select or a segmented control gets a first choice
(
choice_label/5, "From Configuration (GET)") that stores the key left out; picking the default itself stores it, and the step's own value then wins over any Configuration step. - Both name the effective value: the values the Configuration steps
that may run before the step set (the editor's
configuredprop, passed as theconfigured:option), and the plugin's default when none of them is certain to ("From Configuration (5000 or 30000, else 60000)"). Which one applies depends on the request, sotitle/3says where each comes from, for the field's hover, while the step leaves the field empty. - An editor builds one
context/3per render (its plugin, itsconfiguredprop and its stored settings) and passes it in place of the plugin: an input then takesfield/3, its placeholder and hover as attributes to spread (<input {ByMatch.field(@by_match, "ttl", default: "60")} />), a select its first choice fromchoice_label/5and its hover fromtitle/3. - A required field that is configurable may be left empty:
note/1says a Configuration step must set it, or the step failsnot_configuredwhen it runs. - A list with no entries says a Configuration step may set it
(
empty_hint/1); it is set whole, never merged.
A field that is not configurable keeps the editor's own placeholder and choices: every function here falls back to them.
Summary
Types
The editor's configured prop: by key, the steps that may set it.
A Configuration step that may set a key before the step: the value it
sets, from where it is (pipeline, host, conditions, step), and
certain? whether it runs on every request the step runs on.
Functions
The label of the choice that leaves key out: "From Configuration
(GET)" with the plugin's default, "From Configuration" without one and
nothing that sets it, and fallback (the editor's own empty choice, or
nil for none) when the field is not configurable. Options as
placeholder/3's configured: and labels:.
Whether a Configuration step may set key of plugin's settings.
The t/0 an editor passes to this module's functions in place of the
plugin: configured the editor's prop (nil reads as none), settings
the step's stored settings, so a field the step sets itself shows no
hover.
Under a list or map a configurable field holds none of: a Configuration step may set it whole. Nothing when it holds entries or is not configurable.
The placeholder and hover of key's input as attributes to spread on
it: placeholder/3 and title/3 with the same options.
Under a required, configurable field left empty: a Configuration step for
these requests must set it, or the step fails not_configured. Nothing
for a field that holds a value, is not required or is not configurable.
The placeholder of key's input. Options: default: the value the
plugin uses when nothing sets it ("From Configuration (60)"),
example: a value to show the shape of, when nothing sets it and there
is no default ("From Configuration, e.g. orders-service"), fallback:
the placeholder when the field is not configurable (the default or the
example otherwise), configured: the editor's configured prop and
labels: the words for stored values (value_text/2).
Whether key is required, configurable and empty in value (note/1 shows).
The hover of key's field while it is left to a Configuration step:
each value a Configuration step that may run before the step sets, with
where it is, and the default when none is certain to. Nil when the field
is not configurable, and, given a t/0, when the step sets key
itself: its own value wins, whatever a Configuration step sets. Options
as placeholder/3's default:, configured: and labels:.
A stored value as a field shows it: labels first (a map from the
stored value as text to its words, such as a select's choices), on and
off for a boolean, a list joined with commas, cut at 40 characters.
Types
The editor's configured prop: by key, the steps that may set it.
A Configuration step that may set a key before the step: the value it
sets, from where it is (pipeline, host, conditions, step), and
certain? whether it runs on every request the step runs on.
@type t() :: %Alternera.Plugin.Editor.ByMatch{ configured: configured(), plugin: module(), settings: map() }
What every field of one editor shares (context/3): the plugin, the
editor's configured prop and the step's stored settings.
Functions
@spec choice_label( module() | t(), String.t(), String.t() | nil, String.t() | nil, keyword() ) :: String.t() | nil
The label of the choice that leaves key out: "From Configuration
(GET)" with the plugin's default, "From Configuration" without one and
nothing that sets it, and fallback (the editor's own empty choice, or
nil for none) when the field is not configurable. Options as
placeholder/3's configured: and labels:.
Whether a Configuration step may set key of plugin's settings.
@spec context(module(), configured() | nil, map() | nil) :: t()
The t/0 an editor passes to this module's functions in place of the
plugin: configured the editor's prop (nil reads as none), settings
the step's stored settings, so a field the step sets itself shows no
hover.
Under a list or map a configurable field holds none of: a Configuration step may set it whole. Nothing when it holds entries or is not configurable.
Attributes
id(:string) (required)plugin(:atom) (required)key(:string) (required)value(:any) (required) - the step's stored value.class(:any) - Defaults to"mt-1 text-xs text-gray-500 dark:text-gray-300".
@spec field(t(), String.t(), keyword()) :: %{ placeholder: String.t() | nil, title: String.t() | nil }
The placeholder and hover of key's input as attributes to spread on
it: placeholder/3 and title/3 with the same options.
Under a required, configurable field left empty: a Configuration step for
these requests must set it, or the step fails not_configured. Nothing
for a field that holds a value, is not required or is not configurable.
Attributes
id(:string) (required)plugin(:atom) (required)key(:string) (required)value(:any) (required) - the step's stored value.class(:any) - Defaults to"mt-1 text-xs text-gray-500 dark:text-gray-300".
The placeholder of key's input. Options: default: the value the
plugin uses when nothing sets it ("From Configuration (60)"),
example: a value to show the shape of, when nothing sets it and there
is no default ("From Configuration, e.g. orders-service"), fallback:
the placeholder when the field is not configurable (the default or the
example otherwise), configured: the editor's configured prop and
labels: the words for stored values (value_text/2).
Whether key is required, configurable and empty in value (note/1 shows).
The hover of key's field while it is left to a Configuration step:
each value a Configuration step that may run before the step sets, with
where it is, and the default when none is certain to. Nil when the field
is not configurable, and, given a t/0, when the step sets key
itself: its own value wins, whatever a Configuration step sets. Options
as placeholder/3's default:, configured: and labels:.
A stored value as a field shows it: labels first (a map from the
stored value as text to its words, such as a select's choices), on and
off for a boolean, a list joined with commas, cut at 40 characters.