mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Allow a Galaxy admin to select a shed-related tool panel config file whose tool_path setting will be used to installed repositories into Galaxy for those repositories with which a tool panel selection is not necessary.
This commit is contained in:
@@ -2088,10 +2088,7 @@ def get_rev_label_from_changeset_revision( repo, changeset_revision ):
|
||||
label = "-1:%s" % changeset_revision
|
||||
return rev, label
|
||||
def get_shed_tool_conf_dict( app, shed_tool_conf ):
|
||||
"""
|
||||
Return the in-memory version of the shed_tool_conf file, which is stored in the config_elems entry
|
||||
in the shed_tool_conf_dict associated with the file.
|
||||
"""
|
||||
"""Return the in-memory version of the shed_tool_conf file, which is stored in the config_elems entry in the shed_tool_conf_dict associated with the file."""
|
||||
for index, shed_tool_conf_dict in enumerate( app.toolbox.shed_tool_confs ):
|
||||
if shed_tool_conf == shed_tool_conf_dict[ 'config_filename' ]:
|
||||
return index, shed_tool_conf_dict
|
||||
|
||||
@@ -1199,6 +1199,7 @@ class AdminToolshed( AdminGalaxy ):
|
||||
return trans.show_error_message( message )
|
||||
message = kwd.get( 'message', '' )
|
||||
status = kwd.get( 'status', 'done' )
|
||||
shed_tool_conf = kwd.get( 'shed_tool_conf', None )
|
||||
tool_shed_url = kwd[ 'tool_shed_url' ]
|
||||
# Handle repository dependencies.
|
||||
has_repository_dependencies = util.string_as_bool( kwd.get( 'has_repository_dependencies', False ) )
|
||||
@@ -1229,16 +1230,9 @@ class AdminToolshed( AdminGalaxy ):
|
||||
includes_tool_dependencies = util.string_as_bool( repo_information_dict.get( 'includes_tool_dependencies', False ) )
|
||||
encoded_repo_info_dicts = util.listify( repo_information_dict.get( 'repo_info_dicts', [] ) )
|
||||
repo_info_dicts = [ encoding_util.tool_shed_decode( encoded_repo_info_dict ) for encoded_repo_info_dict in encoded_repo_info_dicts ]
|
||||
if ( not includes_tools and not has_repository_dependencies ) or \
|
||||
if ( ( not includes_tools and not has_repository_dependencies ) and kwd.get( 'select_shed_tool_panel_config_button', False ) ) or \
|
||||
( ( includes_tools or has_repository_dependencies ) and kwd.get( 'select_tool_panel_section_button', False ) ):
|
||||
install_repository_dependencies = CheckboxField.is_checked( install_repository_dependencies )
|
||||
if includes_tools:
|
||||
shed_tool_conf = kwd[ 'shed_tool_conf' ]
|
||||
else:
|
||||
# If installing a repository that includes no tools, get the relative tool_path from the file to which the migrated_tools_config
|
||||
# setting points.
|
||||
# FIXME: default to a temporary file or raise an exception or display an appropriate error message.
|
||||
shed_tool_conf = trans.app.config.migrated_tools_config
|
||||
if includes_tool_dependencies:
|
||||
install_tool_dependencies = CheckboxField.is_checked( install_tool_dependencies )
|
||||
else:
|
||||
@@ -1327,14 +1321,7 @@ class AdminToolshed( AdminGalaxy ):
|
||||
return trans.response.send_redirect( web.url_for( controller='admin_toolshed',
|
||||
action='manage_repositories',
|
||||
**kwd ) )
|
||||
if len( trans.app.toolbox.shed_tool_confs ) > 1:
|
||||
shed_tool_conf_select_field = build_shed_tool_conf_select_field( trans )
|
||||
shed_tool_conf = None
|
||||
else:
|
||||
shed_tool_conf_dict = trans.app.toolbox.shed_tool_confs[0]
|
||||
shed_tool_conf = shed_tool_conf_dict[ 'config_filename' ]
|
||||
shed_tool_conf = shed_tool_conf.replace( './', '', 1 )
|
||||
shed_tool_conf_select_field = None
|
||||
shed_tool_conf_select_field = build_shed_tool_conf_select_field( trans )
|
||||
tool_path = suc.get_tool_path_by_shed_tool_conf_filename( trans, shed_tool_conf )
|
||||
tool_panel_section_select_field = build_tool_panel_section_select_field( trans )
|
||||
if len( repo_info_dicts ) == 1:
|
||||
@@ -1387,21 +1374,40 @@ class AdminToolshed( AdminGalaxy ):
|
||||
install_tool_dependencies_check_box = CheckboxField( 'install_tool_dependencies', checked=install_tool_dependencies_check_box_checked )
|
||||
# Handle repository dependencies check box.
|
||||
install_repository_dependencies_check_box = CheckboxField( 'install_repository_dependencies', checked=True )
|
||||
return trans.fill_template( '/admin/tool_shed_repository/select_tool_panel_section.mako',
|
||||
encoded_repo_info_dicts=encoded_repo_info_dicts,
|
||||
includes_tools=includes_tools,
|
||||
includes_tool_dependencies=includes_tool_dependencies,
|
||||
install_tool_dependencies_check_box=install_tool_dependencies_check_box,
|
||||
has_repository_dependencies=has_repository_dependencies,
|
||||
install_repository_dependencies_check_box=install_repository_dependencies_check_box,
|
||||
new_tool_panel_section=new_tool_panel_section,
|
||||
containers_dict=containers_dict,
|
||||
shed_tool_conf=shed_tool_conf,
|
||||
shed_tool_conf_select_field=shed_tool_conf_select_field,
|
||||
tool_panel_section_select_field=tool_panel_section_select_field,
|
||||
tool_shed_url=kwd[ 'tool_shed_url' ],
|
||||
message=message,
|
||||
status=status )
|
||||
if includes_tools or has_repository_dependencies:
|
||||
return trans.fill_template( '/admin/tool_shed_repository/select_tool_panel_section.mako',
|
||||
encoded_repo_info_dicts=encoded_repo_info_dicts,
|
||||
includes_tools=includes_tools,
|
||||
includes_tool_dependencies=includes_tool_dependencies,
|
||||
install_tool_dependencies_check_box=install_tool_dependencies_check_box,
|
||||
has_repository_dependencies=has_repository_dependencies,
|
||||
install_repository_dependencies_check_box=install_repository_dependencies_check_box,
|
||||
new_tool_panel_section=new_tool_panel_section,
|
||||
containers_dict=containers_dict,
|
||||
shed_tool_conf=shed_tool_conf,
|
||||
shed_tool_conf_select_field=shed_tool_conf_select_field,
|
||||
tool_panel_section_select_field=tool_panel_section_select_field,
|
||||
tool_shed_url=kwd[ 'tool_shed_url' ],
|
||||
message=message,
|
||||
status=status )
|
||||
else:
|
||||
# If installing repositories that includes no tools and has not repository dependencies, display a page allowing the Galaxy administrator to
|
||||
# select a shed-related tool panel configuration file whose tool_path setting will be the location the repositories will be installed.
|
||||
return trans.fill_template( '/admin/tool_shed_repository/select_shed_tool_panel_config.mako',
|
||||
encoded_repo_info_dicts=encoded_repo_info_dicts,
|
||||
includes_tools=includes_tools,
|
||||
includes_tool_dependencies=includes_tool_dependencies,
|
||||
install_tool_dependencies_check_box=install_tool_dependencies_check_box,
|
||||
has_repository_dependencies=has_repository_dependencies,
|
||||
install_repository_dependencies_check_box=install_repository_dependencies_check_box,
|
||||
new_tool_panel_section=new_tool_panel_section,
|
||||
containers_dict=containers_dict,
|
||||
shed_tool_conf=shed_tool_conf,
|
||||
shed_tool_conf_select_field=shed_tool_conf_select_field,
|
||||
tool_panel_section_select_field=tool_panel_section_select_field,
|
||||
tool_shed_url=kwd[ 'tool_shed_url' ],
|
||||
message=message,
|
||||
status=status )
|
||||
@web.expose
|
||||
@web.require_admin
|
||||
def reinstall_repository( self, trans, **kwd ):
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
<%inherit file="/base.mako"/>
|
||||
<%namespace file="/message.mako" import="render_msg" />
|
||||
<%namespace file="/admin/tool_shed_repository/common.mako" import="render_dependencies_section" />
|
||||
<%namespace file="/admin/tool_shed_repository/common.mako" import="render_readme_section" />
|
||||
<%namespace file="/webapps/community/repository/common.mako" import="*" />
|
||||
|
||||
<%def name="stylesheets()">
|
||||
${parent.stylesheets()}
|
||||
${h.css( "library" )}
|
||||
</%def>
|
||||
|
||||
<%def name="javascripts()">
|
||||
${parent.javascripts()}
|
||||
${h.js("libs/jquery/jquery.rating", "libs/jquery/jstorage" )}
|
||||
${container_javascripts()}
|
||||
</%def>
|
||||
|
||||
<%
|
||||
# Handle the case where an uninstalled repository encountered errors during the process of being reinstalled. In
|
||||
# this case, the repository metadata is an empty dictionary, but one or both of has_repository_dependencies
|
||||
# and includes_tool_dependencies may be True. If either of these are True but we have no metadata, we cannot install
|
||||
# repository dependencies on this pass.
|
||||
if has_repository_dependencies:
|
||||
repository_dependencies = containers_dict[ 'repository_dependencies' ]
|
||||
missing_repository_dependencies = containers_dict[ 'missing_repository_dependencies' ]
|
||||
if repository_dependencies or missing_repository_dependencies:
|
||||
can_display_repository_dependencies = True
|
||||
else:
|
||||
can_display_repository_dependencies = False
|
||||
else:
|
||||
can_display_repository_dependencies = False
|
||||
if includes_tool_dependencies:
|
||||
tool_dependencies = containers_dict[ 'tool_dependencies' ]
|
||||
missing_tool_dependencies = containers_dict[ 'missing_tool_dependencies' ]
|
||||
if tool_dependencies or missing_tool_dependencies:
|
||||
can_display_tool_dependencies = True
|
||||
else:
|
||||
can_display_tool_dependencies = False
|
||||
else:
|
||||
can_display_tool_dependencies = False
|
||||
%>
|
||||
|
||||
%if message:
|
||||
${render_msg( message, status )}
|
||||
%endif
|
||||
|
||||
<div class="warningmessage">
|
||||
<p>
|
||||
The core Galaxy development team does not maintain the contents of many Galaxy tool shed repositories. Some repository tools
|
||||
may include code that produces malicious behavior, so be aware of what you are installing.
|
||||
</p>
|
||||
<p>
|
||||
If you discover a repository that causes problems after installation, contact <a href="http://wiki.g2.bx.psu.edu/Support" target="_blank">Galaxy support</a>,
|
||||
sending all necessary information, and appropriate action will be taken.
|
||||
</p>
|
||||
<p>
|
||||
<a href="http://wiki.g2.bx.psu.edu/Tool%20Shed#Contacting_the_owner_of_a_repository" target="_blank">Contact the repository owner</a> for
|
||||
general questions or concerns.
|
||||
</p>
|
||||
</div>
|
||||
<div class="toolForm">
|
||||
<div class="toolFormBody">
|
||||
<form name="select_shed_tool_panel_config" id="select_shed_tool_panel_config" action="${h.url_for( controller='admin_toolshed', action='prepare_for_install', tool_shed_url=tool_shed_url, encoded_repo_info_dicts=encoded_repo_info_dicts, includes_tools=includes_tools, includes_tool_dependencies=includes_tool_dependencies )}" method="post" >
|
||||
<div style="clear: both"></div>
|
||||
<% readme_files_dict = containers_dict.get( 'readme_files', None ) %>
|
||||
%if readme_files_dict:
|
||||
<div class="form-row">
|
||||
<table class="colored" width="100%">
|
||||
<th bgcolor="#EBD9B2">Repository README file - may contain important installation or license information</th>
|
||||
</table>
|
||||
</div>
|
||||
${render_readme_section( containers_dict )}
|
||||
<div style="clear: both"></div>
|
||||
%endif
|
||||
%if can_display_repository_dependencies or can_display_tool_dependencies:
|
||||
<div class="form-row">
|
||||
<table class="colored" width="100%">
|
||||
<th bgcolor="#EBD9B2">Confirm dependency installation</th>
|
||||
</table>
|
||||
</div>
|
||||
${render_dependencies_section( install_repository_dependencies_check_box, install_tool_dependencies_check_box, containers_dict )}
|
||||
<div style="clear: both"></div>
|
||||
%endif
|
||||
<div class="form-row">
|
||||
<table class="colored" width="100%">
|
||||
<th bgcolor="#EBD9B2">Choose the configuration file whose tool_path setting will be used for installing repositories</th>
|
||||
</table>
|
||||
</div>
|
||||
%if shed_tool_conf_select_field:
|
||||
<%
|
||||
if len( shed_tool_conf_select_field.options ) == 1:
|
||||
select_help = "Your Galaxy instance is configured with 1 shed-related tool configuration file, so repositories will be "
|
||||
select_help += "installed using it's <b>tool_path</b> setting."
|
||||
else:
|
||||
select_help = "Your Galaxy instance is configured with %d shed-related tool configuration files, " % len( shed_tool_conf_select_field.options )
|
||||
select_help += "so select the file whose <b>tool_path</b> setting you want used for installing repositories."
|
||||
%>
|
||||
<div class="form-row">
|
||||
<label>Shed tool configuration file:</label>
|
||||
${shed_tool_conf_select_field.get_html()}
|
||||
<div class="toolParamHelp" style="clear: both;">
|
||||
${select_help}
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
%else:
|
||||
<input type="hidden" name="shed_tool_conf" value="${shed_tool_conf}"/>
|
||||
%endif
|
||||
<div class="form-row">
|
||||
<input type="submit" name="select_shed_tool_panel_config_button" value="Install"/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -87,12 +87,19 @@
|
||||
</table>
|
||||
</div>
|
||||
%if shed_tool_conf_select_field:
|
||||
<%
|
||||
if len( shed_tool_conf_select_field.options ) == 1:
|
||||
select_help = "Your Galaxy instance is configured with 1 shed-related tool configuration file, so repositories will be "
|
||||
select_help += "installed using it's <b>tool_path</b> setting."
|
||||
else:
|
||||
select_help = "Your Galaxy instance is configured with %d shed-related tool configuration files, " % len( shed_tool_conf_select_field.options )
|
||||
select_help += "so select the file whose <b>tool_path</b> setting you want used for installing repositories."
|
||||
%>
|
||||
<div class="form-row">
|
||||
<label>Shed tool configuration file:</label>
|
||||
${shed_tool_conf_select_field.get_html()}
|
||||
<div class="toolParamHelp" style="clear: both;">
|
||||
Your Galaxy instance is configured with ${len( shed_tool_conf_select_field.options )} shed tool configuration files,
|
||||
so choose one in which to configure the installed tools.
|
||||
${select_help}
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
|
||||
Reference in New Issue
Block a user