{# Run-configuration fields, from presenters.params_view(). Rendered both into the page and, on a pipeline switch, straight into #params-area by /set_pipeline — so this file is the only place the form exists. Field ids are prefixed: a parameter is free to be called "terminal" or "run-btn", and an unprefixed id would then collide with the app's own. A field the run does not use is hidden rather than dropped: it keeps submitting the value it held, so ticking "skip QC" back off restores the thresholds instead of resetting them, and the server ignores whatever a hidden field sends (see model.params.inactive_ids). "active" is only the first paint — data-active-when carries the same condition to the page, which re-evaluates it as the form is filled in. #} {% macro field_state(p) -%} data-param="{{ p.id }}" {%- if p.active_when %} data-active-when='{{ p.active_when | tojson }}'{% endif %} {%- if not p.active %} hidden{% endif %} {%- endmacro %} {# What "reset" puts back. JSON, so a number the pipeline leaves unset stays null rather than becoming the string "None", and a flag stays a boolean. #} {% macro default_of(p) -%} data-default="{{ p.default | tojson | forceescape }}" {%- endmacro %} {# Per section, not per form: a run customises a group or two, and putting one of them back should not throw away what was chosen in the others. #} {% macro reset_button(section) -%} {%- endmacro %} {% macro section_body(section, values) %} {% set live_fields = section.fields | selectattr('active') | list %} {% if section.fields %}
{% for p in section.fields %}
{% if p.type == 'select' %} {% set current = values.get(p.id, p.default) | string %} {% elif p.type == 'number' %} {# None is a number the pipeline leaves unset: an empty field, never "None". #} {# Text, not type="number": a number field is drawn in the browser's locale, so a French one shows 0.5 as "0,5" and hands a phone the comma keypad, and it reports a half-typed value as empty. timon reads "." and nothing else (params.parse_number), so the field shows exactly what will be sent. The bounds ride along for the page to enforce as the value is typed; model.validation refuses the same things on save, and that is the answer that counts. #} {% set whole = (p.step | default(1)) == 1 %} {% elif p.path %} {# A path is found, not remembered: the same browse button the sample sheet's path columns have, told through data-pick what this parameter can take. #}
{% else %} {% endif %} {# Label, control and everything under the control are three rows of the grid's own (subgrid), so a label that wraps to two lines cannot push its input below its neighbours'. #}
{% if p.type == 'number' %} {% endif %} {% if p.options_note %} {{ p.options_note }} {% endif %} {% if p.description %} {{ p.description }} {% endif %} {# help_text is the part that actually decides a value (which medaka model to use, say). A title tooltip would hide it from every touch screen, so it is disclosed instead. #} {% if p.help_text %}
more {{ p.help_text }}
{% endif %}
{% endfor %}
{% endif %} {% set live_flags = section.flags | selectattr('active') | list %} {% if section.flags %}
{% for p in section.flags %} {% endfor %}
{% endif %} {% endmacro %} {% set multi = param_sections | length > 1 %} {% for section in param_sections %} {% set values = param_values %} {% if multi and section.title %} {# A pipeline that declares several groups folds them away: a run touches a couple of them, and every group open at once pushes the sample sheet a screen of defaults down. Folding is
rather than JS, so a folded section keeps its fields in the DOM and submits them all the same. #}
{{ section.title }} {{ reset_button(section) }} {% if section.description %}

{{ section.description }}

{% endif %} {{ section_body(section, values) }}
{% else %} {# A single unnamed group — there is nothing to fold it away from. #}
{{ reset_button(section) }}
{{ section_body(section, values) }}
{% endif %} {% else %}

This pipeline exposes no configurable parameters.

{% endfor %}