From 7554e65456041ad24eed6514d031c7f7c36f3db0 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 31 Oct 2024 13:02:50 -0400 Subject: [PATCH] Improvements to workflow parameter validators. - Allow specifying a min/max for integer and float parameters. - Swap language from regex to "Regular Expression" and synchronize help with regular expression fields in rule builder. - Extend regular expression help. - Improve default message for in_range validator. Probably a reversion in some ways introduced with https://github.com/galaxyproject/galaxy/pull/19027. --- client/src/components/Form/FormElement.vue | 11 ++- .../Form/FormElementHelpMarkdown.vue | 56 ++++++++++++ client/src/components/Form/FormInputs.vue | 2 + client/src/components/Help/HelpPopover.vue | 2 +- client/src/components/Help/terms.yml | 5 ++ .../RuleBuilder/RegularExpressionInput.vue | 12 ++- .../tool_util/parser/parameter_validators.py | 6 +- lib/galaxy/tools/parameters/basic.py | 3 +- lib/galaxy/workflow/modules.py | 87 ++++++++++++++++--- 9 files changed, 158 insertions(+), 26 deletions(-) create mode 100644 client/src/components/Form/FormElementHelpMarkdown.vue diff --git a/client/src/components/Form/FormElement.vue b/client/src/components/Form/FormElement.vue index ed81622799e1..aa3507808661 100644 --- a/client/src/components/Form/FormElement.vue +++ b/client/src/components/Form/FormElement.vue @@ -27,6 +27,7 @@ import FormSelection from "./Elements/FormSelection.vue"; import FormTags from "./Elements/FormTags.vue"; import FormText from "./Elements/FormText.vue"; import FormUpload from "./Elements/FormUpload.vue"; +import FormElementHelpMarkdown from "./FormElementHelpMarkdown.vue"; interface FormElementProps { id?: string; @@ -35,6 +36,7 @@ interface FormElementProps { title?: string; refreshOnChange?: boolean; help?: string; + helpFormat?: string; error?: string; warning?: string; disabled?: boolean; @@ -63,6 +65,7 @@ const props = withDefaults(defineProps(), { connectedDisableText: "Add connection to module.", connectedEnableIcon: "fa fa-times", connectedDisableIcon: "fa fa-arrows-alt-h", + helpFormat: "html", workflowBuildingMode: false, }); @@ -337,7 +340,13 @@ function onAlert(value: string | undefined) {
{{ previewText }}
- + + diff --git a/client/src/components/Form/FormElementHelpMarkdown.vue b/client/src/components/Form/FormElementHelpMarkdown.vue new file mode 100644 index 000000000000..e6271c9a2124 --- /dev/null +++ b/client/src/components/Form/FormElementHelpMarkdown.vue @@ -0,0 +1,56 @@ + + + diff --git a/client/src/components/Form/FormInputs.vue b/client/src/components/Form/FormInputs.vue index 1421a4b79ea3..fafe1734b478 100644 --- a/client/src/components/Form/FormInputs.vue +++ b/client/src/components/Form/FormInputs.vue @@ -11,6 +11,7 @@ v-model="input.test_param.value" :type="input.test_param.type" :help="input.test_param.help" + :help-format="input.test_param.help_format" :refresh-on-change="false" :disabled="sustainConditionals" :attributes="input.test_param" @@ -51,6 +52,7 @@ :error="input.error" :warning="input.warning" :help="input.help" + :help-format="input.help_format" :refresh-on-change="input.refresh_on_change" :attributes="input.attributes || input" :collapsed-enable-text="collapsedEnableText" diff --git a/client/src/components/Help/HelpPopover.vue b/client/src/components/Help/HelpPopover.vue index 11ded1f423de..200f76706a2b 100644 --- a/client/src/components/Help/HelpPopover.vue +++ b/client/src/components/Help/HelpPopover.vue @@ -12,7 +12,7 @@ defineProps(); diff --git a/client/src/components/Help/terms.yml b/client/src/components/Help/terms.yml index 0ca9bd36bc72..536d08f3dee1 100644 --- a/client/src/components/Help/terms.yml +++ b/client/src/components/Help/terms.yml @@ -27,7 +27,12 @@ unix: debug what is wrong with the execution of an application. More information on stack traces can be found on [Wikipedia](https://en.wikipedia.org/wiki/Stack_trace). +programming: + python: + regex: | + Regular expressions are patterns used to match character combinations in strings. This input accepts Python-style regular expressions, find more information about these in [this Python for Biologists tutorial](https://pythonforbiologists.com/tutorial/regex.html). + The website [regex101](https://regex101.com/) is a useful playground to explore regular expressions (be sure to enable "Python" as your flavor) and language models such as ChatGPT can help interactively build up and explain regular expressions from natural language prompts or examples. galaxy: collections: flatList: | diff --git a/client/src/components/RuleBuilder/RegularExpressionInput.vue b/client/src/components/RuleBuilder/RegularExpressionInput.vue index 3f7c089adf80..b3788e423abe 100644 --- a/client/src/components/RuleBuilder/RegularExpressionInput.vue +++ b/client/src/components/RuleBuilder/RegularExpressionInput.vue @@ -1,7 +1,7 @@