diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index 7183cbe76b85..6cb627c24389 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -3928,6 +3928,13 @@ def get_internal_version(self, version): raise Exception("Version does not exist") return list(reversed(self.workflows))[version] + def show_in_tool_panel(self, user_id): + sa_session = object_session(self) + return bool(sa_session.query(StoredWorkflowMenuEntry).filter( + StoredWorkflowMenuEntry.stored_workflow_id == self.id, + StoredWorkflowMenuEntry.user_id == user_id, + ).count()) + def copy_tags_from(self, target_user, source_workflow): # Override to only copy owner tags. for src_swta in source_workflow.owner_tags: diff --git a/lib/galaxy/tools/deps/container_resolvers/__init__.py b/lib/galaxy/tools/deps/container_resolvers/__init__.py index 9b8ad92484a0..0e819f9458a8 100644 --- a/lib/galaxy/tools/deps/container_resolvers/__init__.py +++ b/lib/galaxy/tools/deps/container_resolvers/__init__.py @@ -23,15 +23,12 @@ def __init__(self, app_info=None, **kwds): self.app_info = app_info self.resolver_kwds = kwds - def _get_config_option(self, key, default=None, config_prefix=None, **kwds): + def _get_config_option(self, key, default=None): """Look in resolver-specific settings for option and then fallback to global settings. """ - global_key = "%s_%s" % (config_prefix, key) - if key in kwds: - return kwds.get(key) - elif self.app_info and hasattr(self.app_info, global_key): - return getattr(self.app_info, global_key) + if self.app_info and hasattr(self.app_info, key): + return getattr(self.app_info, key) else: return default diff --git a/lib/galaxy/tools/deps/container_resolvers/mulled.py b/lib/galaxy/tools/deps/container_resolvers/mulled.py index 64a48b8673cf..fc53d5cf7a85 100644 --- a/lib/galaxy/tools/deps/container_resolvers/mulled.py +++ b/lib/galaxy/tools/deps/container_resolvers/mulled.py @@ -351,11 +351,11 @@ def __init__(self, app_info=None, namespace="local", hash_func="v2", **kwds): self.hash_func = hash_func self._mulled_kwds = { 'namespace': namespace, - 'channels': self._get_config_option("channels", DEFAULT_CHANNELS, prefix="mulled"), + 'channels': self._get_config_option("mulled_channels", DEFAULT_CHANNELS), 'hash_func': self.hash_func, 'command': 'build-and-test', } - self.auto_init = self._get_config_option("auto_init", DEFAULT_CHANNELS, prefix="involucro") + self.auto_init = self._get_config_option("involucro_auto_init", True) def resolve(self, enabled_container_types, tool_info): if tool_info.requires_galaxy_python_environment: @@ -396,13 +396,13 @@ def __init__(self, app_info=None, hash_func="v2", **kwds): self.cache_directory = kwds.get("cache_directory", os.path.join(app_info.container_image_cache_path, "singularity", "mulled")) self.hash_func = hash_func self._mulled_kwds = { - 'channels': self._get_config_option("channels", DEFAULT_CHANNELS, prefix="mulled"), + 'channels': self._get_config_option("mulled_channels", DEFAULT_CHANNELS), 'hash_func': self.hash_func, 'command': 'build-and-test', 'singularity': True, 'singularity_image_dir': self.cache_directory, } - self.auto_init = self._get_config_option("auto_init", DEFAULT_CHANNELS, prefix="involucro") + self.auto_init = self._get_config_option("involucro_auto_init", True) def resolve(self, enabled_container_types, tool_info): if tool_info.requires_galaxy_python_environment: diff --git a/lib/galaxy/tools/deps/mulled/mulled_build.py b/lib/galaxy/tools/deps/mulled/mulled_build.py index 97feb4a34f25..15aa0f2affc4 100644 --- a/lib/galaxy/tools/deps/mulled/mulled_build.py +++ b/lib/galaxy/tools/deps/mulled/mulled_build.py @@ -39,7 +39,7 @@ from ..conda_compat import MetaData DIRNAME = os.path.dirname(__file__) -DEFAULT_CHANNELS = "conda-forge,bioconda" +DEFAULT_CHANNELS = ["conda-forge", "bioconda"] DEFAULT_REPOSITORY_TEMPLATE = "quay.io/${namespace}/${image}" DEFAULT_BINDS = ["build/dist:/usr/local/"] DEFAULT_WORKING_DIR = '/source/' @@ -322,7 +322,7 @@ def add_build_arguments(parser): help='quay.io namespace.') parser.add_argument('-r', '--repository_template', dest='repository_template', default=DEFAULT_REPOSITORY_TEMPLATE, help='Docker repository target for publication (only quay.io or compat. API is currently supported).') - parser.add_argument('-c', '--channels', dest='channels', default=DEFAULT_CHANNELS, + parser.add_argument('-c', '--channels', dest='channels', default=",".join(DEFAULT_CHANNELS), help='Comma separated list of target conda channels.') parser.add_argument('--conda-version', dest="conda_version", default=None, help="Change to specified version of Conda before installing packages.") diff --git a/lib/galaxy/tools/wrappers.py b/lib/galaxy/tools/wrappers.py index 44e003585c17..a614344bd2df 100644 --- a/lib/galaxy/tools/wrappers.py +++ b/lib/galaxy/tools/wrappers.py @@ -444,6 +444,10 @@ def keys(self): def is_collection(self): return True + @property + def element_identifier(self): + return self.name + @property def is_input_supplied(self): return self.__input_supplied diff --git a/lib/galaxy/webapps/galaxy/api/workflows.py b/lib/galaxy/webapps/galaxy/api/workflows.py index b34854542890..17b58a0a9d33 100644 --- a/lib/galaxy/webapps/galaxy/api/workflows.py +++ b/lib/galaxy/webapps/galaxy/api/workflows.py @@ -140,11 +140,7 @@ def get_workflows_list(self, trans, kwd): item['url'] = url_for('workflow', id=encoded_id) item['owner'] = wf.user.username item['number_of_steps'] = wf.latest_workflow.step_count - item['show_in_tool_panel'] = False - for x in user.stored_workflow_menu_entries: - if x.stored_workflow_id == wf.id: - item['show_in_tool_panel'] = True - break + item['show_in_tool_panel'] = wf.show_in_tool_panel(user_id=user.id) rval.append(item) for wf_sa in trans.sa_session.query(model.StoredWorkflowUserShareAssociation).join( model.StoredWorkflowUserShareAssociation.stored_workflow).options( @@ -159,11 +155,7 @@ def get_workflows_list(self, trans, kwd): item['slug'] = wf_sa.stored_workflow.slug item['owner'] = wf_sa.stored_workflow.user.username item['number_of_steps'] = wf_sa.stored_workflow.latest_workflow.step_count - item['show_in_tool_panel'] = False - for x in user.stored_workflow_menu_entries: - if x.stored_workflow_id == wf_sa.id: - item['show_in_tool_panel'] = True - break + item['show_in_tool_panel'] = wf_sa.stored_workflow.show_in_tool_panel(user_id=user.id) rval.append(item) if missing_tools: workflows_missing_tools = [] diff --git a/test/functional/tools/identifier_collection.xml b/test/functional/tools/identifier_collection.xml index e5f0a3e4dcc5..e4306558c2a5 100644 --- a/test/functional/tools/identifier_collection.xml +++ b/test/functional/tools/identifier_collection.xml @@ -1,15 +1,33 @@ - + #for $input in $input1: echo '$input.element_identifier' >> 'output1'; #end for - + + + + + + + + + + + + + + + + + + +