Skip to content

Commit 237d27c

Browse files
committed
LazyToolBox: drop the broken to_panel_view override
The override I had ignored the ``view`` argument entirely and just flattened ``_tool_index.entries`` by ``panel_section_id``, so any caller hitting ``GET /api/tool_panels/<view>`` with a custom view got the whole tool registry's sections back instead of the requested view. ``test_panel_views::test_custom_label_order`` configures ``default_panel_view = "my-custom"`` whose definition is just labels + tools, asserts the response has zero sections, and got back the global ``test_section_multi`` and similar — because the override walked every index entry without consulting the named view. Remove the override entirely. The parent ``AbstractToolBox.to_panel_view`` calls ``tool_panel_contents(trans, view=view)`` which in turn invokes the registered ``ToolPanelView.apply_view`` for the named view; that's the correct behaviour for both ``default``, ``edam:*``, and the ``StaticToolPanelView`` instances built from ``panel_views`` / ``panel_views_dir``. With the prior commit that defers ``_load_tool_panel_views`` until after the index is populated, the parent path renders correctly under LazyToolBox. Local: ``test_panel_views::test_custom_label_order`` now PASSES.
1 parent bce63eb commit 237d27c

1 file changed

Lines changed: 0 additions & 43 deletions

File tree

lib/galaxy/tools/lazy_toolbox.py

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,46 +1515,3 @@ def _index_entry_to_api_dict(self, entry: ToolIndexEntry) -> dict[str, Any]:
15151515
"target": "galaxy_main",
15161516
}
15171517

1518-
def to_panel_view(self, trans, view="default_panel_view", **kwds) -> dict[str, dict]:
1519-
"""
1520-
Create a panel view representation of the toolbox.
1521-
1522-
For LazyToolBox, returns tools from index organized by section.
1523-
"""
1524-
if self._tool_index is None:
1525-
return {}
1526-
1527-
view_contents: dict[str, dict] = {}
1528-
1529-
# Group tools by section from index
1530-
sections: dict[str, dict[str, Any]] = {}
1531-
uncategorized_tools: list[dict[str, Any]] = []
1532-
1533-
for _tool_id, entry in self._tool_index.entries.items():
1534-
if entry.hidden and not kwds.get("include_hidden", False):
1535-
continue
1536-
1537-
tool_dict = self._index_entry_to_api_dict(entry)
1538-
1539-
section_id = entry.panel_section_id
1540-
if section_id:
1541-
if section_id not in sections:
1542-
sections[section_id] = {
1543-
"id": section_id,
1544-
"name": entry.panel_section_name or section_id,
1545-
"model_class": "ToolSection",
1546-
"elems": [],
1547-
}
1548-
sections[section_id]["elems"].append(tool_dict)
1549-
else:
1550-
uncategorized_tools.append(tool_dict)
1551-
1552-
# Add sections to view_contents
1553-
for section_id, section_dict in sections.items():
1554-
view_contents[section_id] = section_dict
1555-
1556-
# Add uncategorized tools directly
1557-
for tool_dict in uncategorized_tools:
1558-
view_contents[tool_dict["id"]] = tool_dict
1559-
1560-
return view_contents

0 commit comments

Comments
 (0)