Bugfix: Apply tool panel filtering in workflow editor.

Bug originally reported by Eric here - http://dev.list.galaxyproject.org/Bug-Toolbox-filters-not-applied-in-workflows-td4662879.html (though this only fixes the superficial bug of them showing up in the workflow editor - and does not yet implement "strong" toolbox filters as requested).

This is actually a broader change that centralizes logic for listing out tool panel contents when displaying components to the user and the added filtering comes about from that. It also eliminates the last places Galaxy was accessing toolbox.tool_panel directly (in those mako templates).
This commit is contained in:
John Chilton
2014-12-29 11:48:38 -05:00
parent 0e17abd7ea
commit 8edced2685
4 changed files with 14 additions and 16 deletions
+11 -13
View File
@@ -1147,24 +1147,22 @@ class ToolBox( object, Dictifiable ):
"""
return self.app.model.context
def tool_panel_contents( self, trans, **kwds ):
""" Filter tool_panel contents for displaying for user.
"""
context = Bunch( toolbox=self, trans=trans )
filters = self.filter_factory.build_filters( trans )
for elt in self.tool_panel.itervalues():
elt = _filter_for_panel( elt, filters, context )
if elt:
yield elt
def to_dict( self, trans, in_panel=True, **kwds ):
"""
to_dict toolbox.
"""
context = Bunch( toolbox=self, trans=trans, **kwds )
if in_panel:
panel_elts = [ val for val in self.tool_panel.itervalues() ]
filters = self.filter_factory.build_filters( trans, **kwds )
filtered_panel_elts = []
for index, elt in enumerate( panel_elts ):
elt = _filter_for_panel( elt, filters, context )
if elt:
filtered_panel_elts.append( elt )
panel_elts = filtered_panel_elts
panel_elts = list( self.tool_panel_contents( trans, **kwds ) )
# Produce panel.
rval = []
kwargs = dict(
+1 -1
View File
@@ -26,7 +26,7 @@ $().ready(function() {
Tool to bundle:
</label>
<select name="tool_id">
%for key, val in toolbox.tool_panel.items():
%for val in toolbox.tool_panel_contents( trans ):
%if isinstance( val, Tool ):
<option value="${val.id|h}">${val.name|h}</option>
%elif isinstance( val, ToolSection ):
+1 -1
View File
@@ -26,7 +26,7 @@ $().ready(function() {
Tool to reload:
</label>
<select name="tool_id">
%for key, val in toolbox.tool_panel.items():
%for val in toolbox.tool_panel_contents( trans ):
%if isinstance( val, Tool ):
<option value="${val.id}">${val.name|h}</option>
%elif isinstance( val, ToolSection ):
@@ -284,7 +284,7 @@
<img src="${h.url_for('/static/images/loading_small_white_bg.gif')}" id="search-spinner" class="search-spinner" />
</div>
<div class="toolSectionList">
%for key, val in app.toolbox.tool_panel.items():
%for val in app.toolbox.tool_panel_contents( trans ):
<div class="toolSectionWrapper">
%if isinstance( val, Tool ):
${render_tool( val, False )}