mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-25 10:24:38 +08:00
Merge branch 'release_24.1' into dev
This commit is contained in:
@@ -2,6 +2,6 @@
|
||||
<display id="biom_simple" version="1.0.0" name="view biom at">
|
||||
<dynamic_links from_data_table="biom_simple_display" skip_startswith="#" id="value" name="name">
|
||||
<url>${ url % { 'biom_file_url_qp': $biom_file.qp } }</url>
|
||||
<param type="data" name="biom_file" url="galaxy_${DATASET_HASH}.biom" />
|
||||
<param type="data" name="biom_file" url="galaxy_${DATASET_HASH}.biom" allow_cors="true" />
|
||||
</dynamic_links>
|
||||
</display>
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
<display id="q2view" version="1.0.0" name="view at">
|
||||
<dynamic_links from_data_table="q2view_display" skip_startswith="#" id="value" name="name">
|
||||
<url>${ url % { 'q2view_file_url_qp': $q2view_file.qp } }</url>
|
||||
<param type="data" name="q2view_file" url="galaxy_${DATASET_HASH}.${dataset.ext}" />
|
||||
<param type="data" name="q2view_file" url="galaxy_${DATASET_HASH}.${dataset.ext}" allow_cors="true"/>
|
||||
</dynamic_links>
|
||||
</display>
|
||||
|
||||
@@ -39,10 +39,13 @@ import abc
|
||||
import string
|
||||
from json import dumps
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
cast,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
)
|
||||
|
||||
from sqlalchemy import select
|
||||
@@ -206,6 +209,13 @@ class ProvidesUserContext(ProvidesAppContext):
|
||||
|
||||
galaxy_session: Optional[GalaxySession] = None
|
||||
_tag_handler: Optional[GalaxyTagHandlerSession] = None
|
||||
_short_term_cache: Dict[Tuple[str, ...], Any]
|
||||
|
||||
def set_cache_value(self, args: Tuple[str, ...], value: Any):
|
||||
self._short_term_cache[args] = value
|
||||
|
||||
def get_cache_value(self, args: Tuple[str, ...], default: Any = None) -> Any:
|
||||
return self._short_term_cache.get(args, default)
|
||||
|
||||
@property
|
||||
def tag_handler(self):
|
||||
|
||||
@@ -3790,6 +3790,17 @@ class FilterEmptyDatasetsTool(FilterDatasetsTool):
|
||||
return False
|
||||
|
||||
|
||||
class FilterNullTool(FilterDatasetsTool):
|
||||
tool_type = "filter_null"
|
||||
require_dataset_ok = True
|
||||
|
||||
@staticmethod
|
||||
def element_is_valid(element: model.DatasetCollectionElement):
|
||||
element_object = element.element_object
|
||||
assert isinstance(element_object, model.DatasetInstance)
|
||||
return element_object.extension == "expression.json" and element_object.blurb == "skipped"
|
||||
|
||||
|
||||
class FlattenTool(DatabaseOperationTool):
|
||||
tool_type = "flatten_collection"
|
||||
require_terminal_states = False
|
||||
|
||||
@@ -286,14 +286,12 @@ class ParamValueFilter(Filter):
|
||||
return self.ref_name
|
||||
|
||||
def filter_options(self, options, trans, other_values):
|
||||
if trans is not None and trans.workflow_building_mode:
|
||||
return []
|
||||
ref = other_values.get(self.ref_name, None)
|
||||
if ref is None:
|
||||
if ref is None or is_runtime_value(ref):
|
||||
ref = []
|
||||
|
||||
# - for HDCAs the list of contained HDAs is extracted
|
||||
# - single values are transformed in a single eleent list
|
||||
# - single values are transformed in a single element list
|
||||
# - remaining cases are already lists (select and data parameters with multiple=true)
|
||||
if isinstance(ref, HistoryDatasetCollectionAssociation):
|
||||
ref = ref.to_hda_representative(multiple=True)
|
||||
@@ -835,6 +833,9 @@ class DynamicOptions:
|
||||
return rval
|
||||
|
||||
def get_options(self, trans, other_values):
|
||||
|
||||
rval = []
|
||||
|
||||
def to_triple(values):
|
||||
if len(values) == 2:
|
||||
return [str(values[0]), str(values[1]), False]
|
||||
@@ -877,8 +878,7 @@ class DynamicOptions:
|
||||
data = []
|
||||
|
||||
# We only support the very specific ["name", "value", "selected"] format for now.
|
||||
return [to_triple(d) for d in data]
|
||||
rval = []
|
||||
rval = [to_triple(d) for d in data]
|
||||
if (
|
||||
self.file_fields is not None
|
||||
or self.tool_data_table is not None
|
||||
|
||||
@@ -14,6 +14,7 @@ from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
Optional,
|
||||
Tuple,
|
||||
)
|
||||
from urllib.parse import urlparse
|
||||
|
||||
@@ -325,6 +326,7 @@ class GalaxyWebTransaction(base.DefaultWebTransaction, context.ProvidesHistoryCo
|
||||
self.galaxy_session = None
|
||||
self.error_message = None
|
||||
self.host = self.request.host
|
||||
self._short_term_cache: Dict[Tuple[str, ...], Any] = {}
|
||||
|
||||
# set any cross origin resource sharing headers if configured to do so
|
||||
self.set_cors_headers()
|
||||
|
||||
@@ -49,12 +49,6 @@ class WorkRequestContext(ProvidesHistoryContext):
|
||||
self.workflow_building_mode = workflow_building_mode
|
||||
self.galaxy_session = galaxy_session
|
||||
|
||||
def set_cache_value(self, args: Tuple[str, ...], value: Any):
|
||||
self._short_term_cache[args] = value
|
||||
|
||||
def get_cache_value(self, args: Tuple[str, ...], default: Any = None) -> Any:
|
||||
return self._short_term_cache.get(args, default)
|
||||
|
||||
@property
|
||||
def app(self):
|
||||
return self._app
|
||||
|
||||
@@ -1423,7 +1423,7 @@ class InputParameterModule(WorkflowModule):
|
||||
|
||||
def callback(input, prefixed_name, context, **kwargs):
|
||||
if prefixed_name == connection.input_name and hasattr(input, "get_options"): # noqa: B023
|
||||
static_options.append(input.get_options(self.trans, {}))
|
||||
static_options.append(input.get_options(self.trans, context))
|
||||
|
||||
visit_input_values(tool_inputs, module.state.inputs, callback)
|
||||
elif isinstance(module, SubWorkflowModule):
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
from galaxy_test.base.populators import (
|
||||
skip_without_tool,
|
||||
WorkflowPopulator,
|
||||
)
|
||||
from ._framework import ApiTestCase
|
||||
|
||||
|
||||
class TestBuildWorkflowModule(ApiTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.workflow_populator = WorkflowPopulator(self.galaxy_interactor)
|
||||
|
||||
@skip_without_tool("select_from_url")
|
||||
def test_build_module_filter_dynamic_select(self):
|
||||
# Verify that filtering on parameters that depend on parameter and validators works
|
||||
# fine in workflow building mode.
|
||||
module = self.workflow_populator.build_module(step_type="tool", content_id="select_from_url")
|
||||
assert not module["errors"], module["errors"]
|
||||
@@ -2298,6 +2298,12 @@ class WorkflowPopulator(GalaxyInteractorHttpMixin, BaseWorkflowPopulator, Import
|
||||
assert upload_response.status_code == 200, upload_response
|
||||
return upload_response.json()
|
||||
|
||||
def build_module(self, step_type: str, content_id: Optional[str] = None, inputs: Optional[Dict[str, Any]] = None):
|
||||
payload = {"inputs": inputs or {}, "type": step_type, "content_id": content_id}
|
||||
response = self._post("workflows/build_module", data=payload, json=True)
|
||||
assert response.status_code == 200, response
|
||||
return response.json()
|
||||
|
||||
def _import_tool_response(self, tool) -> Response:
|
||||
using_requirement("admin")
|
||||
tool_str = json.dumps(tool, indent=4)
|
||||
|
||||
@@ -10,6 +10,13 @@ echo '$url_param_value_header_and_body' > '$param_value_header_and_body'
|
||||
<options from_url="https://usegalaxy.org/api/genomes">
|
||||
</options>
|
||||
</param>
|
||||
<param name="dynamic_param_filtered_with_validator" type="select">
|
||||
<!-- tested in test_build_module_filter_dynamic_select -->
|
||||
<options from_url="https://usegalaxy.org/api/genomes">
|
||||
<filter type="param_value" ref="url_param_value" column="1" />
|
||||
</options>
|
||||
<validator type="no_options" message="Need at least one option here" />
|
||||
</param>
|
||||
<!--
|
||||
<param name="url_param_value_templated" type="select">
|
||||
<options from_url="http://localhost:8000/data?user=$__user_id__">
|
||||
|
||||
Reference in New Issue
Block a user