Skip to content

Commit

Permalink
Fix submitted value in workflow run form if data is constrained by ta…
Browse files Browse the repository at this point in the history
…g filter
  • Loading branch information
mvdbeek committed May 21, 2024
1 parent 37551f5 commit 9a830db
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 24 deletions.
25 changes: 1 addition & 24 deletions client/src/components/Form/Elements/FormData/FormData.vue
Original file line number Diff line number Diff line change
Expand Up @@ -406,31 +406,8 @@ function onDrop() {
}
}
/**
* Matches an array of values to available options
*/
const matchedValues = computed(() => {
const values: Array<DataOption> = [];
if (props.value && props.value.values.length > 0) {
props.value.values.forEach((entry) => {
if ("src" in entry && entry.src) {
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 });
}
}
});
}
return values;
});
onMounted(() => {
if (props.value) {
$emit("input", createValue(matchedValues.value));
} else {
$emit("input", createValue(currentValue.value));
}
$emit("input", createValue(currentValue.value));
});
/**
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_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

Check failure on line 1 in lib/galaxy_test/selenium/test_workflow_run.py

View workflow job for this annotation

GitHub Actions / Test (3.8)

Imports are incorrectly sorted and/or formatted.

Check failure on line 1 in lib/galaxy_test/selenium/test_workflow_run.py

View workflow job for this annotation

GitHub Actions / Test (3.12)

Imports are incorrectly sorted and/or formatted.
from uuid import uuid4

import yaml
from selenium.webdriver.common.by import By
Expand All @@ -17,6 +18,7 @@
WORKFLOW_WITH_DYNAMIC_OUTPUT_COLLECTION,
WORKFLOW_WITH_OLD_TOOL_VERSION,
WORKFLOW_WITH_RULES_1,
WORKFLOW_WITH_DATA_FILTER,
)
from .framework import (
managed_history,
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_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

0 comments on commit 9a830db

Please sign in to comment.