Skip to content

Commit

Permalink
Syntax for conditionally loading toolbox items.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Apr 16, 2024
1 parent 6f3e515 commit eb036e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions lib/galaxy/tool_util/toolbox/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,12 @@ def load_item(
panel_dict = self._tool_panel
if integrated_panel_dict is None:
integrated_panel_dict = self._integrated_tool_panel
load_if = item.get("if")
if load_if == "interactivetools_enable":
if not self.app.config.interactivetools_enable:
raise ValueError("Trying to load an InteractiveTool, but InteractiveTools are not enabled.")
elif load_if:
raise ValueError(f"Unknown conditional tool load condition '{load_if}'")
if item_type == "tool":
self._load_tool_tag_set(
item,
Expand Down
4 changes: 2 additions & 2 deletions test/functional/tools/sample_tool_conf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@
<tool file="multiple_versions_changes_v01.xml" />
<tool file="multiple_versions_changes_v02.xml" />

<tool file="interactivetool_simple.xml" />
<tool file="interactivetool_two_entry_points.xml" />
<tool file="interactivetool_simple.xml" if="interactivetools_enable" />
<tool file="interactivetool_two_entry_points.xml" if="interactivetools_enable" />
<tool file="converter_target_datatype.xml" />

<!-- Tools interesting only for building up test workflows. -->
Expand Down

0 comments on commit eb036e7

Please sign in to comment.