🆕JSON-Based input forms
Introduction
Pipelines defined using the "Code" mode require an XML or JSON-based input form to define the fields shown on the launch view in the user interface (UI).
To create a JSON-based Nexflow (or CWL) pipeline, go to Projects > your_project > flow>pipelines>create pipeline>Nextflow (or CWL) > JSON-based.
Three files, located on the inputform files tab, work together for evaluating and presenting JSON-based input.
inoutForm.json contains the actual input form which is rendered when staring the pipeline run.
onRender.js is triggered when a value is changed.
onSubmit.js is triggered when submitting a new pipeline execution request via the GUI or API.
Use + Create file to add additional files and Simulate to test your inputForms.
Scripting execution supports crossfield validation of the values, hiding fields, making them required, .... based on value changes.
inputForm.json
The json schema allowing you to define the input parameters. See the inputForm.json page for syntax details.
Parameter types
Type | Usage |
---|---|
text | To display informational messages. No values are to be assigned to these fields. |
section | For splitting up fields, to give structure. Rendered as subtitles. No values are to be assigned to these fields. |
number | The value is of Number type in javascript and Double type in java. (corresponds to doubleType in xml). |
integer | Corresponds to java Integer. |
textbox | Corresponds to stringType in xml. |
checkbox | A checkbox that supports the option of being required, so can serve as an active consent feature. (corresponds to the booleanType in xml). |
select | A dropdown selection to select one from a list of choices. |
radio | A radio button group to select one from a list of choices. |
data | Data such as files. |
fieldgroup | Can contain parameters or other groups. Allows to have repeating sets of parameters, for instance when a father|mother|child choice needs to be linked to each file input. So if you want to have the same elements multiple times in your form, combine them into a fieldgroup. |
Parameter Attributes
These attributes can be used to configure all parameter types.
Attribute | Purpose |
---|---|
label | The display label for this parameter. Optional but recommended, id will be used if missing. |
minValues | The minimal amount of values that needs to be present. Default when not set is 0. Set to >=1 to make the field required. |
maxValues | The maximal amount of values that need to be present. Default when not set is 1. |
minMaxValuesMessage | The error message displayed when minValues or maxValues is not adhered to. When not set, a default message is generated. |
helpText | A helper text about the parameter. Will be displayed in smaller font with the parameter. |
placeHolderText | An optional short hint ( a word or short phrase) to aid the user when the field has no value. |
value | The value of the parameter. Can be considered default value. |
minLength | Only applied on type="textbox". Value is a positive integer. |
maxLength | Only applied on type="textbox". Value is a positive integer. |
min | Applied on type="number" and type="integer". Value must correspond to the primitive type. |
max | Applied on type="number" and type="integer". Value must correspond to the primitive type. |
choices | A list of choices with for each a "value", "text" (is label), "selected" (only 1 true supported), "disabled". "parent" can be used to build hierarchical choicetrees. "availableWhen" can be used for conditional presence of the choice based on values of other fields. |
fields | The list of sub fields for type fieldgroup. |
dataFilter | For defining the filtering when type is 'data'. nameFilter, dataFormat and dataType are additional properties. |
regex | The regex pattern the value must adhere to. Only applied on type="textbox". |
regexErrorMessage | The optional error message when the value does not adhere to the "regex". A default message will be used if this parameter is not present. It is highly recommended to set this as the default message will show the regex which is typically very technical. |
hidden | Makes this parameter hidden. Can be made visible later in onRender.js or can be used to set hardcoded values of which the user should be aware. |
disabled | Shows the parameter but makes editing it impossible. The value can still be altered by onRender.js. |
emptyValuesAllowed | When maxValues is 1 or not set and emptyValuesAllowed is true, the values may contain null entries. Default is false. |
updateRenderOnChange | When true, the onRender javascript function is triggered each time the user changes the value of this field. Default is false. |
onSubmit.js
The onSubmit.js javascript function receives an input object which holds information about the chosen values of the input form and the pipeline and pipeline execution request parameters. This javascript function is not only triggered when submitting a new pipeline execution request in the user interface, but also when submitting one through the rest API..
Input parameters
Value | Meaning |
---|---|
settings | The value of the setting fields. Corresponds to |
settingValues | To maximize the opportunity for reusing code between onRender and onSubmit, the 'settings' are also exposed as |
pipeline | Info about the pipeline: code, tenant, version, and description are all available in the pipeline object as string. |
analysis | Info about this run: userReference, userName, and userTenant are all available in the analysis object as string. |
storageSize | The storage size as chosen by the user. This will initially be null. StorageSize is an object containing an 'id' and 'name' property. |
storageSizeOptions | The list of storage sizes available to the user when creating an analysis. Is a list of StorageSize objects containing an 'id' and 'name' property. |
Return values (taken from the response object)
Value | Meaning |
---|---|
settings | The value of the setting fields. This allows modifying the values or applying defaults and such. Or taking info of the pipeline or analysis input object. When settings are not present in the onSubmit return value object, they are assumed to be not modified. |
validationErrors | A list of AnalysisError essages representing validation errors. Submitting a pipeline execution request is not possible while there are still validation errors. |
AnalysisError
Value | Meaning |
---|---|
fieldId / FieldId | The field which has an erroneous value. When not present, a general error/warning is displayed. To display an error on the storage size, use the |
index / Index | The 0-starting index of the value which is incorrect. Use this when a particular value of a multivalue field is not correct. When not present, the entire field is marked as erroneous. The value can also be an array of indexes for use with fieldgroups. For instance, when the 3rd field of the 2nd instance of a fieldgroup is erroneous, a value of [ 1 , 2 ] is used. |
message / Message | The error/warning message to display. |
onRender.js
Receives an input object which contains information about the current state of the input form, the chosen values and the field value change that triggered the onrender call. It also contains pipeline information. Changed objects are present in the onRender return value object. Any object not present is considered to be unmodified. Changing the storage size in the start analysis screen triggers an onRender execution with storageSize as changed field.
Input Parameters
context | "Initial"/"FieldChanged"/"Edited".
|
changedFieldId | The id of the field that changed and which triggered this onRender call. context will be |
analysisSettings | The input form json as saved in the pipeline. This is the original json, without changes. |
currentAnalysisSettings | The current input form json as rendered to the user. This can contain already applied changes form earlier onRender passes. Null in the first call, when context is |
settingValues | The current value of all settings fields. This is a map with field id as key and an array of field values as value for multivalue fields. For convenience, values of single-value fields are present as the individual value and not as an array of length 1. In case of fieldGroups, the value can be multiple levels of arrays. |
pipeline | Information about the pipeline: code, tenant, version, and description are all available in the pipeline object as string. |
analysis | Information about this run: userReference, userName, and userTenant are all available in the analysis object as string. |
storageSize | The storage size as chosen by the user. This will initially be null. StorageSize is an object containing an 'id' and 'name' property. |
storageSizeOptions | The list of storage sizes available to the user when creating an analysis. Is a list of StorageSize objects containing an 'id' and 'name' property. |
Return values (taken from the response object)
Value | Meaning |
---|---|
analysisSettings | The input form json with potential applied changes. The discovered changes will be applied in the UI. |
settingValues | The current, potentially altered map of all setting values. These will be updated in the UI. |
validationErrors | A list of RenderMessages representing validation errors. Submitting a pipeline execution request is not possible while there are still validation errors. |
validationWarnings | A list of RenderMessages representing validation warnings. A user may choose to ignore these validation warnings and start the pipeline execution request. |
storageSize | The suitable value for storageSize. Must be one of the options of input.storageSizeOptions. When absent or null, it is ignored. |
RenderMessage
This is the object used for representing validation errors and warnings. The attributes can be used with first letter lowercase (consistent with the input object attributes) or uppercase.
Value | Meaning |
---|---|
fieldId / FieldId | The field which has an erroneous value. When not present, a general error/warning is displayed. To display an error on the storage size, use the |
index / Index | The 0-starting index of the value which is incorrect. Use this when a particular value of a multivalue field is not correct. When not present, the entire field is marked as erroneous. The value can also be an array of indexes for use with fieldgroups. For instance, when the 3rd field of the 2nd instance of a fieldgroup is erroneous, a value of [ 1 , 2 ] is used. |
message / Message | The error/warning message to display. |
Last updated