Skip to content

Commit

Permalink
Add UI for Conda dependency uninstall
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed Mar 12, 2017
1 parent 6902e62 commit 95106ea
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
19 changes: 12 additions & 7 deletions lib/galaxy/web/base/controllers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1125,15 +1125,20 @@ def job_info( self, trans, jobid=None ):

@web.expose
@web.require_admin
def manage_tool_dependencies( self, trans, install_dependencies=False, build_cache=False, install_for_tools=[], viewkey='View tool-centric dependencies'):
def manage_tool_dependencies( self, trans, install_dependencies=False, uninstall_dependencies=False, selected_tool_ids=None, viewkey='View tool-centric dependencies'):
if not selected_tool_ids:
selected_tool_ids = []
tools_by_id = trans.app.toolbox.tools_by_id
if install_dependencies:
# install the dependencies for the tools in the install_for_tools list
if not isinstance(install_for_tools, list):
install_for_tools = [install_for_tools]
requirements = set([tools_by_id[tid].tool_requirements for tid in install_for_tools])
[trans.app.toolbox.tools_by_id[install_for_tools[0]]._view.install_dependencies(r) for r in requirements]
view = six.next(six.itervalues(trans.app.toolbox.tools_by_id))._view
if selected_tool_ids:
# install the dependencies for the tools in the selected_tool_ids list
if not isinstance(selected_tool_ids, list):
selected_tool_ids = [selected_tool_ids]
requirements = set([tools_by_id[tid].tool_requirements for tid in selected_tool_ids])
if install_dependencies:
[view.install_dependencies(r) for r in requirements]
elif uninstall_dependencies:
[view.uninstall_dependencies(index=None, requirements=r) for r in requirements]
tool_ids_by_requirements = {}
for tid, tool in trans.app.toolbox.tools_by_id.items():
if tool.tool_requirements not in tool_ids_by_requirements:
Expand Down
9 changes: 5 additions & 4 deletions templates/webapps/galaxy/admin/manage_dependencies.mako
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<%def name="render_tool_centric_table( tools, requirements_status)">
<tr>
<th bgcolor="#D8D8D8">Install</th>
<th bgcolor="#D8D8D8">Select</th>
<th bgcolor="#D8D8D8">Name</th>
<th bgcolor="#D8D8D8">ID</th>
<th bgcolor="#D8D8D8">Requirement</th>
Expand All @@ -42,7 +42,7 @@
<tr class="tr">
%endif
<td>
<input type="checkbox" name="install_for_tools" value="${tool.id}"/>
<input type="checkbox" name="selected_tool_ids" value="${tool.id}"/>
</td>
<td>${ tool.name | h }</td>
<td>${ tool.id | h }</td>
Expand All @@ -55,7 +55,7 @@

<%def name="render_dependencies_details( tools, requirements_status, tool_ids_by_requirements)">
<tr>
<th bgcolor="#D8D8D8">Install</th>
<th bgcolor="#D8D8D8">Select</th>
<th bgcolor="#D8D8D8">Used by</th>
<th bgcolor="#D8D8D8">Environment Path</th>
<th bgcolor="#D8D8D8">Requirement</th>
Expand All @@ -74,7 +74,7 @@
<tr class="tr">
%endif
<td>
<input type="checkbox" name="install_for_tools" value="${tool_ids[0]}"/>
<input type="checkbox" name="selected_tool_ids" value="${tool_ids[0]}"/>
</td>
<td>${ ", ".join([tools[tid].name for tid in tool_ids]) | h }</td>
${render_tool_dependencies( r_status, ctr=ctr, show_environment_path=True, ncols_extra=3) }
Expand Down Expand Up @@ -111,4 +111,5 @@
</div>
</div>
<input type="submit" name="install_dependencies" value="Install checked dependencies using Conda"/>
<input type="submit" name="uninstall_dependencies" value="Uninstall checked dependencies using Conda"/>
</form>

0 comments on commit 95106ea

Please sign in to comment.