Skip to content

Commit

Permalink
Make default_panel_view a _by_host option
Browse files Browse the repository at this point in the history
  • Loading branch information
natefoo committed Jun 29, 2024
1 parent 9d601f8 commit f3f8928
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/galaxy/config/schemas/config_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2903,6 +2903,7 @@ mapping:
type: str
default: default
required: false
per_host: true
desc: |
Default tool panel view for the current Galaxy configuration. This should refer to an id of
a panel view defined using the panel_views or panel_views_dir configuration options or an
Expand Down
9 changes: 6 additions & 3 deletions lib/galaxy/tool_util/toolbox/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def __init__(
Create a toolbox from the config files named by `config_filenames`, using
`tool_root_dir` as the base directory for finding individual tool config files.
"""
self._default_panel_view = default_panel_view
self.__default_panel_view = default_panel_view
# The _dynamic_tool_confs list contains dictionaries storing
# information about the tools defined in each shed-related
# shed_tool_conf.xml file.
Expand Down Expand Up @@ -238,6 +238,9 @@ def to_model(self) -> ToolPanelViewModel:
if save_integrated_tool_panel:
self._save_integrated_tool_panel()

def _default_panel_view(self, trans):
return self.app.config.config_value_for_host("default_panel_view", trans.host) or self.__default_panel_view

def create_tool(self, config_file, tool_shed_repository=None, guid=None, **kwds):
raise NotImplementedError()

Expand Down Expand Up @@ -1275,7 +1278,7 @@ def find_section_id(self, tool_panel_section_id):
def tool_panel_contents(self, trans, view=None, **kwds):
"""Filter tool_panel contents for displaying for user."""
if view is None:
view = self._default_panel_view
view = self._default_panel_view(trans)
if view not in self._tool_panel_view_rendered:
raise RequestParameterInvalidException(f"No panel view {view} found.")
filter_method = self._build_filter_method(trans)
Expand Down Expand Up @@ -1338,7 +1341,7 @@ def to_panel_view(self, trans, view="default_panel_view", **kwds):
{section_id: { section but with .tools=List[all tool ids] }, ...}}
"""
if view == "default_panel_view":
view = self._default_panel_view
view = self._default_panel_view(trans)
view_contents: Dict[str, Dict] = {}
panel_elts = self.tool_panel_contents(trans, view=view, **kwds)
for elt in panel_elts:
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/webapps/galaxy/api/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def panel_views(self, trans: GalaxyWebTransaction, **kwds):
"""

rval = {}
rval["default_panel_view"] = self.app.toolbox._default_panel_view
rval["default_panel_view"] = self.app.toolbox._default_panel_view(trans)
rval["views"] = self.app.toolbox.panel_view_dicts()
return rval

Expand Down

0 comments on commit f3f8928

Please sign in to comment.