diff --git a/lib/galaxy/util/shed_util_common.py b/lib/galaxy/util/shed_util_common.py index d14b8fe825b..c44adfc3caa 100644 --- a/lib/galaxy/util/shed_util_common.py +++ b/lib/galaxy/util/shed_util_common.py @@ -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 diff --git a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py index 6f4de43aa25..814d73379e0 100644 --- a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py @@ -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 ): diff --git a/templates/admin/tool_shed_repository/select_shed_tool_panel_config.mako b/templates/admin/tool_shed_repository/select_shed_tool_panel_config.mako new file mode 100644 index 00000000000..1dec9801789 --- /dev/null +++ b/templates/admin/tool_shed_repository/select_shed_tool_panel_config.mako @@ -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 + +
+