diff --git a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py index 4616f761d18..da081c95a64 100644 --- a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py @@ -12,7 +12,6 @@ from galaxy.exceptions import ConfigDoesNotAllowException from galaxy.tool_shed.galaxy_install import install_manager from galaxy.tool_shed.galaxy_install.repository_dependencies import repository_dependency_manager from galaxy.tool_shed.galaxy_install.tools import tool_panel_manager -from galaxy.tool_shed.util import tool_util from galaxy.tool_shed.util.repository_util import ( create_or_update_tool_shed_repository, get_absolute_path_to_file_in_repository, @@ -368,172 +367,3 @@ class AdminToolshed(AdminGalaxy): except Exception: log.exception("Problem you know in here somewhere...") raise - - @web.expose - @web.require_admin - @legacy_tool_shed_endpoint - def reselect_tool_panel_section(self, trans, **kwd): - """ - Select or change the tool panel section to contain the tools included in the tool shed repository - being reinstalled. If there are updates available for the repository in the tool shed, the - tool_dependencies and repository_dependencies associated with the updated changeset revision will - have been retrieved from the tool shed and passed in the received kwd. In this case, the stored - tool shed repository metadata from the Galaxy database will not be used since it is outdated. - """ - message = "" - status = "done" - repository_id = kwd.get("id", None) - latest_changeset_revision = kwd.get("latest_changeset_revision", None) - latest_ctx_rev = kwd.get("latest_ctx_rev", None) - tool_shed_repository = get_installed_tool_shed_repository(trans.app, repository_id) - repository_clone_url = common_util.generate_clone_url_for_installed_repository(trans.app, tool_shed_repository) - metadata = tool_shed_repository.metadata_ - tool_shed_url = common_util.get_tool_shed_url_from_tool_shed_registry( - trans.app, str(tool_shed_repository.tool_shed) - ) - tool_path = tool_shed_repository.get_tool_relative_path(trans.app)[0] - if latest_changeset_revision and latest_ctx_rev: - # There are updates available in the tool shed for the repository, so use the received - # dependency information which was retrieved from the tool shed. - encoded_updated_repo_info_dict = kwd.get("updated_repo_info_dict", None) - updated_repo_info_dict = encoding_util.tool_shed_decode(encoded_updated_repo_info_dict) - readme_files_dict = updated_repo_info_dict.get("readme_files_dict", None) - includes_data_managers = updated_repo_info_dict.get("includes_data_managers", False) - includes_tool_dependencies = updated_repo_info_dict.get("includes_tool_dependencies", False) - repo_info_dict = updated_repo_info_dict["repo_info_dict"] - else: - # There are no updates available from the tool shed for the repository, so use its locally stored metadata. - includes_data_managers = False - includes_tool_dependencies = False - readme_files_dict = None - tool_dependencies = None - if metadata: - if "data_manager" in metadata: - includes_data_managers = True - if "tool_dependencies" in metadata: - includes_tool_dependencies = True - # Since we're reinstalling, we need to send a request to the tool shed to get the README files. - params = dict( - name=tool_shed_repository.name, - owner=tool_shed_repository.owner, - changeset_revision=tool_shed_repository.installed_changeset_revision, - ) - pathspec = ["repository", "get_readme_files"] - raw_text = util.url_get( - tool_shed_url, - auth=self.app.tool_shed_registry.url_auth(tool_shed_url), - pathspec=pathspec, - params=params, - ) - readme_files_dict = json.loads(raw_text) - tool_dependencies = metadata.get("tool_dependencies", None) - rdim = repository_dependency_manager.RepositoryDependencyInstallManager(trans.app) - repository_dependencies = rdim.get_repository_dependencies_for_installed_tool_shed_repository( - trans.app, tool_shed_repository - ) - repo_info_dict = create_repo_info_dict( - trans.app, - repository_clone_url=repository_clone_url, - changeset_revision=tool_shed_repository.installed_changeset_revision, - ctx_rev=tool_shed_repository.ctx_rev, - repository_owner=tool_shed_repository.owner, - repository_name=tool_shed_repository.name, - tool_dependencies=tool_dependencies, - repository_dependencies=repository_dependencies, - ) - irm = trans.app.installed_repository_manager - dependencies_for_repository_dict = irm.get_dependencies_for_repository( - tool_shed_url, repo_info_dict, includes_tool_dependencies, updating=True - ) - includes_tool_dependencies = dependencies_for_repository_dict.get("includes_tool_dependencies", False) - includes_tools = dependencies_for_repository_dict.get("includes_tools", False) - includes_tools_for_display_in_tool_panel = dependencies_for_repository_dict.get( - "includes_tools_for_display_in_tool_panel", False - ) - installed_repository_dependencies = dependencies_for_repository_dict.get( - "installed_repository_dependencies", None - ) - installed_tool_dependencies = dependencies_for_repository_dict.get("installed_tool_dependencies", None) - missing_repository_dependencies = dependencies_for_repository_dict.get("missing_repository_dependencies", None) - missing_tool_dependencies = dependencies_for_repository_dict.get("missing_tool_dependencies", None) - if installed_repository_dependencies or missing_repository_dependencies: - has_repository_dependencies = True - else: - has_repository_dependencies = False - if includes_tools_for_display_in_tool_panel: - # Get the location in the tool panel in which the tools were originally loaded. - if "tool_panel_section" in metadata: - tool_panel_dict = metadata["tool_panel_section"] - if tool_panel_dict: - if tool_util.panel_entry_per_tool(tool_panel_dict): - # The following forces everything to be loaded into 1 section (or no section) in the tool panel. - tool_section_dicts = tool_panel_dict[next(iter(tool_panel_dict.keys()))] - tool_section_dict = tool_section_dicts[0] - original_section_name = tool_section_dict["name"] - else: - original_section_name = tool_panel_dict["name"] - else: - original_section_name = "" - else: - original_section_name = "" - tool_panel_section_select_field = tool_util.build_tool_panel_section_select_field(trans.app) - no_changes_check_box = CheckboxField("no_changes", value=True) - if original_section_name: - message += ( - "The tools contained in your %s repository were last loaded into the tool panel section %s. " - % (escape(tool_shed_repository.name), original_section_name) - ) - message += "Uncheck the No changes check box and select a different tool panel section to load the tools in a " - message += "different section in the tool panel. " - status = "warning" - else: - message += f"The tools contained in your {escape(tool_shed_repository.name)} repository were last loaded into the tool panel outside of any sections. " - message += "Uncheck the No changes check box and select a tool panel section to load the tools into that section. " - status = "warning" - else: - no_changes_check_box = None - original_section_name = "" - tool_panel_section_select_field = None - shed_tool_conf_select_field = tool_util.build_shed_tool_conf_select_field(trans.app) - dd = dependency_display.DependencyDisplayer(trans.app) - containers_dict = dd.populate_containers_dict_for_new_install( - tool_shed_url=tool_shed_url, - tool_path=tool_path, - readme_files_dict=readme_files_dict, - installed_repository_dependencies=installed_repository_dependencies, - missing_repository_dependencies=missing_repository_dependencies, - installed_tool_dependencies=installed_tool_dependencies, - missing_tool_dependencies=missing_tool_dependencies, - updating=False, - ) - # Since we're reinstalling we'll merge the list of missing repository dependencies into the list of - # installed repository dependencies since each displayed repository dependency will display a status, - # whether installed or missing. - containers_dict = dd.merge_missing_repository_dependencies_to_installed_container(containers_dict) - # Handle repository dependencies check box. - install_repository_dependencies_check_box = CheckboxField("install_repository_dependencies", value=True) - view = views.DependencyResolversView(self.app) - if view.installable_resolvers: - install_resolver_dependencies_check_box = CheckboxField("install_resolver_dependencies", value=True) - else: - install_resolver_dependencies_check_box = None - return trans.fill_template( - "/admin/tool_shed_repository/reselect_tool_panel_section.mako", - repository=tool_shed_repository, - no_changes_check_box=no_changes_check_box, - original_section_name=original_section_name, - includes_data_managers=includes_data_managers, - includes_tools=includes_tools, - includes_tools_for_display_in_tool_panel=includes_tools_for_display_in_tool_panel, - includes_tool_dependencies=includes_tool_dependencies, - has_repository_dependencies=has_repository_dependencies, - install_repository_dependencies_check_box=install_repository_dependencies_check_box, - install_resolver_dependencies_check_box=install_resolver_dependencies_check_box, - containers_dict=containers_dict, - tool_panel_section_select_field=tool_panel_section_select_field, - shed_tool_conf_select_field=shed_tool_conf_select_field, - encoded_repo_info_dict=encoding_util.tool_shed_encode(repo_info_dict), - repo_info_dict=repo_info_dict, - message=message, - status=status, - ) diff --git a/templates/admin/tool_shed_repository/reselect_tool_panel_section.mako b/templates/admin/tool_shed_repository/reselect_tool_panel_section.mako deleted file mode 100644 index 447085d6a32..00000000000 --- a/templates/admin/tool_shed_repository/reselect_tool_panel_section.mako +++ /dev/null @@ -1,101 +0,0 @@ -<%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/tool_shed/repository/common.mako" import="*" /> -<%namespace file="/webapps/tool_shed/common/common.mako" import="*" /> - -<%def name="stylesheets()"> - ${parent.stylesheets()} - ${h.css( "library" )} - - -<%def name="javascripts()"> - ${parent.javascripts()} - ${container_javascripts()} - - -%if message: - ${render_msg( message, status )} -%endif - -
-
-
-
- -
-
- <% readme_files_dict = containers_dict.get( 'readme_files', None ) %> - %if readme_files_dict: -
- - -
Repository README files - may contain important installation or license information
-
- ${render_readme_section( containers_dict )} -
- %endif - %if has_repository_dependencies or includes_tool_dependencies: -
- - -
Confirm dependency installation
-
- ${render_dependencies_section( install_resolver_dependencies_check_box, install_repository_dependencies_check_box, containers_dict, revision_label=None, export=False )} - %endif - %if shed_tool_conf_select_field: -
- - -
Choose the configuration file whose tool_path setting will be used for installing repositories
-
- <% - 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 its tool_path 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 tool_path setting you want used for installing repositories." - %> -
- - ${render_select(shed_tool_conf_select_field)} -
- ${select_help|h} -
-
-
- %else: - - %endif - %if includes_tools_for_display_in_tool_panel: -
-
- ${render_checkbox(no_changes_check_box)} - -
- Uncheck and select a different tool panel section to load the tools into a different section in the tool panel. -
-
-
- - -
- Add a new tool panel section to contain the installed tools (optional). -
-
-
- - ${render_select(tool_panel_section_select_field)} -
- Choose an existing section in your tool panel to contain the installed tools (optional). -
-
- %endif -
- -
-
-
-
diff --git a/templates/admin/tool_shed_repository/select_tool_panel_section.mako b/templates/admin/tool_shed_repository/select_tool_panel_section.mako deleted file mode 100644 index 4c980982984..00000000000 --- a/templates/admin/tool_shed_repository/select_tool_panel_section.mako +++ /dev/null @@ -1,188 +0,0 @@ -<%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/tool_shed/repository/common.mako" import="*" /> -<%namespace file="/webapps/tool_shed/common/common.mako" import="*" /> - -<%def name="stylesheets()"> - ${parent.stylesheets()} - ${h.css( "library" )} - - -<%def name="javascripts()"> - ${parent.javascripts()} - ${container_javascripts()} - - -<% - # 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 - can_display_resolver_installation = install_resolver_dependencies_check_box is not None -%> - -%if message: - ${render_msg( message, status )} -%endif - -
-

- The 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. -

-

- If you discover a repository that causes problems after installation, contact Galaxy support, - sending all necessary information, and appropriate action will be taken. -

-

- Contact the repository owner for - general questions or concerns. -

-
-
-
-
-
- - - - - - - - - - - -
-
- <% readme_files_dict = containers_dict.get( 'readme_files', None ) %> - %if readme_files_dict: -
- - -
Repository README file - may contain important installation or license information
-
- ${render_readme_section( containers_dict )} -
- %endif - <% - if requirements_status and install_resolver_dependencies_check_box or includes_tool_dependencies: - display_dependency_confirmation = True - else: - display_dependency_confirmation = False - %> - %if requirements_status: - %if not install_resolver_dependencies_check_box and not includes_tool_dependencies: -
- - - - -
- - This repository requires dependencies that cannot be installed through the Tool Shed -
-
-
-

This repository defines tool requirements that cannot be installed through the Tool Shed.

-

Please activate Conda dependency resolution, activate Docker dependency resolution, setup Environment Modules -or manually satisfy the dependencies listed below.

-

For details see the dependency resolver documentation.

-
- %endif -
- - -
The following tool dependencies are required by the current repository
-
-
- ${render_tool_dependency_resolver( requirements_status, prepare_for_install=True )} -
-
- %endif - %if can_display_repository_dependencies or display_dependency_confirmation: -
- - -
Confirm dependency installation
-
- ${render_dependencies_section( install_resolver_dependencies_check_box, install_repository_dependencies_check_box, containers_dict, revision_label=None, export=False, requirements_status=requirements_status )} -
- %endif - %if shed_tool_conf_select_field: - %if includes_tools_for_display_in_tool_panel: -
- - -
Choose the tool panel section to contain the installed tools (optional)
-
-
- %endif - <% - 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 its tool_path 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 tool_path setting you want used for installing repositories." - %> -
- - ${render_select(shed_tool_conf_select_field)} -
- ${select_help|h} -
-
-
-
- %else: - - %endif - %if includes_tools_for_display_in_tool_panel: -
- - -
- Add a new tool panel section to contain the installed tools (optional). -
-
-
- - ${render_select(tool_panel_section_select_field)} -
- Choose an existing section in your tool panel to contain the installed tools (optional). -
-
- %endif -
- -
- %if includes_tools_for_display_in_tool_panel: - Clicking Install without selecting a tool panel section will load the installed tools into the tool panel outside of any sections. - %endif -
-
-
-
-