Unverified Commit 18c68b06 authored by Marius van den Beek's avatar Marius van den Beek Committed by GitHub
Browse files

Merge pull request #20144 from mvdbeek/fix_param_value_restriction

[24.2] Skip ``param_value`` filter if ref value is runtime value
parents 4650f93f a53b4125
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -298,8 +298,11 @@ class ParamValueFilter(Filter):

    def filter_options(self, options: Sequence[ParameterOption], trans, other_values):
        ref = other_values.get(self.ref_name, None)
        if ref is None or is_runtime_value(ref):
        if ref is None:
            ref = []
        elif is_runtime_value(ref) and trans and trans.workflow_building_mode is workflow_building_modes.USE_HISTORY:
            # We're in the run form, can't possibly apply a param_value filter.
            return options

        # - for HDCAs the list of contained HDAs is extracted
        # - single values are transformed in a single element list
+24 −0
Original line number Diff line number Diff line
@@ -6862,6 +6862,30 @@ steps:
        options = run_workflow["steps"][0]["inputs"][0]["options"]
        assert len(options) >= 1

    @skip_without_tool("filter_param_value")
    def test_value_restriction_with_filter_param_value(self):
        workflow_id = self.workflow_populator.upload_yaml_workflow(
            """
class: GalaxyWorkflow
inputs:
  select_text:
     type: text
     restrictOnConnections: true
steps:
  select:
    tool_id: filter_param_value
    tool_state:
      select1: "hg19_value"
    in:
      select3: select_text
"""
        )
        with self.dataset_populator.test_history() as history_id:
            run_workflow = self._download_workflow(workflow_id, style="run", history_id=history_id)
        options = run_workflow["steps"][0]["inputs"][0]["options"]
        assert len(options) == 1
        assert options[0] == ["hg19", "hg19_value", False]

    def test_value_restriction_with_select_and_text_param(self):
        workflow_id = self.workflow_populator.upload_yaml_workflow(
            """
+10 −3
Original line number Diff line number Diff line
@@ -25,6 +25,13 @@
                <filter type="param_value" column="0" ref="select1" keep="false"/>
            </options>
        </param>
        <param name="select3" type="select" label="keeps only values selected in select1">
            <options from_data_table="test_fasta_indexes">
                <column name="value" index="0"/>
                <column name="name" index="1"/>
                <filter type="param_value" column="0" ref="select1" keep="true"/>
            </options>
        </param>
    </inputs>

    <outputs>