Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[24.0] Fix submitted value in workflow run form if data is constrained by tag filter #18193

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions client/src/components/Form/Elements/FormData/FormData.vue
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,10 @@ const matchedValues = computed(() => {
const options = props.options[entry.src] || [];
const option = options.find((v) => v.id === entry.id && v.src === entry.src);
if (option) {
values.push({ ...option, name: option.name || entry.id });
const accepted = !props.tag || option.tags?.includes(props.tag);
if (accepted) {
values.push({ ...option, name: option.name || entry.id });
}
}
}
});
Expand All @@ -426,7 +429,7 @@ const matchedValues = computed(() => {
});

onMounted(() => {
if (props.value) {
if (props.value && matchedValues.value.length > 0) {
$emit("input", createValue(matchedValues.value));
} else {
$emit("input", createValue(currentValue.value));
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Form/Elements/FormSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const props = defineProps({
default: "Select Value",
},
value: {
type: String as PropType<SelectValue | SelectValue[]>,
type: [String, Array] as PropType<SelectValue | SelectValue[]>,
default: null,
},
});
Expand Down
40 changes: 40 additions & 0 deletions lib/galaxy_test/base/workflow_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -1177,3 +1177,43 @@
format: txt
location: https://raw.githubusercontent.com/galaxyproject/galaxy/dev/test-data/1.bed
"""

WORKFLOW_WITH_DATA_TAG_FILTER = r"""{
"a_galaxy_workflow": "true",
"annotation": null,
"comments": [],
"format-version": "0.1",
"name": "Export WF4 Assembly HiC (imported from URL) (imported from uploaded file)",
"steps": {
"0": {
"annotation": "With dataset tag : genomescope_model ",
"content_id": null,
"errors": null,
"id": 0,
"input_connections": {},
"inputs": [
{
"description": "With dataset tag : genomescope_model ",
"name": "Genomescope Model"
}
],
"label": "Genomescope Model",
"name": "Input dataset",
"outputs": [],
"position": {
"left": 0,
"top": 0
},
"tool_id": null,
"tool_state": "{\"optional\": false, \"format\": [\"txt\"], \"tag\": \"genomescope_model\"}",
"tool_version": null,
"type": "data_input",
"uuid": "a165c531-371f-4073-9cdd-85ce3506586f",
"when": null,
"workflow_outputs": []
}
},
"tags": [],
"uuid": "03a95ebe-af1e-4628-ac2f-e7553babfb2f",
"version": 3
}"""
20 changes: 20 additions & 0 deletions lib/galaxy_test/selenium/test_workflow_run.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
from uuid import uuid4

import yaml
from selenium.webdriver.common.by import By
Expand All @@ -14,6 +15,7 @@
WORKFLOW_SIMPLE_CAT_TWICE,
WORKFLOW_WITH_CUSTOM_REPORT_1,
WORKFLOW_WITH_CUSTOM_REPORT_1_TEST_DATA,
WORKFLOW_WITH_DATA_TAG_FILTER,
WORKFLOW_WITH_DYNAMIC_OUTPUT_COLLECTION,
WORKFLOW_WITH_OLD_TOOL_VERSION,
WORKFLOW_WITH_RULES_1,
Expand Down Expand Up @@ -308,6 +310,24 @@ def test_workflow_run_button_disabled_when_required_input_missing(self):
input_element.clear()
workflow_run.run_workflow_disabled.wait_for_present()

@selenium_test
@managed_history
def test_workflow_run_tag_filter(self):
history_id = self.current_history_id()
dataset = self.dataset_populator.new_dataset(history_id, wait=True)
self.dataset_populator.tag_dataset(history_id, dataset["id"], tags=["genomescope_model"])
# Add another possible input that should not be selected
self.dataset_populator.new_dataset(history_id, wait=True)
wf = json.loads(WORKFLOW_WITH_DATA_TAG_FILTER)
wf["name"] = str(uuid4())
workflow_id = self.workflow_populator.create_workflow(wf)
self.workflow_run_with_name(wf["name"])
self.workflow_run_submit()
self.sleep_for(self.wait_types.HISTORY_POLL)
invocations = self.workflow_populator.workflow_invocations(workflow_id=workflow_id)
invocation = self.workflow_populator.get_invocation(invocations[-1]["id"])
assert invocation["inputs"]["0"]["id"] == dataset["id"]

def _assert_has_3_lines_after_run(self, hid):
self.workflow_run_wait_for_ok(hid=hid)
history_id = self.current_history_id()
Expand Down
Loading