diff --git a/client/galaxy/scripts/apps/analysis.js b/client/galaxy/scripts/apps/analysis.js index 957053199f4d..9d3a4eee3a09 100644 --- a/client/galaxy/scripts/apps/analysis.js +++ b/client/galaxy/scripts/apps/analysis.js @@ -87,6 +87,7 @@ window.app = function app( options, bootstrapped ){ '(/)workflow(/)' : 'show_workflows', '(/)workflow/run(/)' : 'show_run', '(/)pages(/)(:action_id)' : 'show_pages', + '(/)datasets(/)(:action_id)' : 'show_datasets', '(/)workflow/configure_menu(/)' : 'show_configure_menu', '(/)workflow/import_workflow' : 'show_import_workflow', '(/)custom_builds' : 'show_custom_builds' @@ -123,6 +124,10 @@ window.app = function app( options, bootstrapped ){ this.page.display( new UserPreferences.Forms( { form_id: form_id, user_id: Galaxy.params.id } ) ); }, + show_datasets : function() { + this.page.display( new GridView( { url_base: Galaxy.root + 'dataset/list', dict_format: true } ) ); + }, + show_pages : function( action_id ) { if ( action_id == 'list' ) { this.page.display( new PageList.View() ); diff --git a/client/galaxy/scripts/layout/menu.js b/client/galaxy/scripts/layout/menu.js index c0daf5379bd3..ca030c53bdcb 100644 --- a/client/galaxy/scripts/layout/menu.js +++ b/client/galaxy/scripts/layout/menu.js @@ -271,8 +271,8 @@ var Collection = Backbone.Collection.extend({ target : 'galaxy_main' },{ title : _l('Saved Datasets'), - url : 'dataset/list', - target : 'galaxy_main' + url : 'datasets/list', + target : '_top' },{ title : _l('Saved Pages'), url : 'pages/list', diff --git a/config/job_conf.xml.sample_advanced b/config/job_conf.xml.sample_advanced index 8b73e027df75..bdb4f8f0bbe7 100644 --- a/config/job_conf.xml.sample_advanced +++ b/config/job_conf.xml.sample_advanced @@ -440,6 +440,53 @@ the deployer. --> + + true + + + + + + + + + + + + + + + + + + + + diff --git a/lib/galaxy/tools/deps/conda_util.py b/lib/galaxy/tools/deps/conda_util.py index 00ca742f24e7..00efe51b8ca2 100644 --- a/lib/galaxy/tools/deps/conda_util.py +++ b/lib/galaxy/tools/deps/conda_util.py @@ -488,7 +488,7 @@ def cleanup_failed_install(conda_target, conda_context=None): cleanup_failed_install_of_environment(conda_target.install_environment, conda_context=conda_context) -def best_search_result(conda_target, conda_context=None, channels_override=None): +def best_search_result(conda_target, conda_context=None, channels_override=None, offline=False): """Find best "conda search" result for specified target. Return ``None`` if no results match. @@ -498,6 +498,8 @@ def best_search_result(conda_target, conda_context=None, channels_override=None) conda_context.ensure_channels_configured() search_cmd = [conda_context.conda_exec, "search", "--full-name", "--json"] + if offline: + search_cmd.append("--offline") if channels_override: search_cmd.append("--override-channels") for channel in channels_override: diff --git a/lib/galaxy/tools/deps/container_resolvers/mulled.py b/lib/galaxy/tools/deps/container_resolvers/mulled.py index d30355700437..cccc84320b94 100644 --- a/lib/galaxy/tools/deps/container_resolvers/mulled.py +++ b/lib/galaxy/tools/deps/container_resolvers/mulled.py @@ -18,9 +18,10 @@ ) from ..mulled.mulled_build_tool import requirements_to_mulled_targets from ..mulled.util import ( - image_name, mulled_tags_for, split_tag, + v1_image_name, + v2_image_name, ) from ..requirements import ContainerDescription @@ -28,13 +29,15 @@ CachedMulledImageSingleTarget = collections.namedtuple("CachedMulledImageSingleTarget", ["package_name", "version", "build", "image_identifier"]) -CachedMulledImageMultiTarget = collections.namedtuple("CachedMulledImageMultiTarget", ["hash", "image_identifier"]) +CachedV1MulledImageMultiTarget = collections.namedtuple("CachedV1MulledImageMultiTarget", ["hash", "build", "image_identifier"]) +CachedV2MulledImageMultiTarget = collections.namedtuple("CachedV2MulledImageMultiTarget", ["package_hash", "version_hash", "build", "image_identifier"]) CachedMulledImageSingleTarget.multi_target = False -CachedMulledImageMultiTarget.multi_target = True +CachedV1MulledImageMultiTarget.multi_target = "v1" +CachedV2MulledImageMultiTarget.multi_target = "v2" -def list_cached_mulled_images(namespace=None): +def list_cached_mulled_images(namespace=None, hash_func="v2"): command = build_docker_images_command(truncate=True, sudo=False) command = "%s | tail -n +2 | tr -s ' ' | cut -d' ' -f1,2" % command images_and_versions = check_output(command) @@ -44,15 +47,36 @@ def output_line_to_image(line): image_name, version = line.split(" ", 1) identifier = "%s:%s" % (image_name, version) url, namespace, package_description = image_name.split("/") + if not version or version == "latest": + version = None + image = None if package_description.startswith("mulled-v1-"): + if hash_func == "v2": + return None + hash = package_description - image = CachedMulledImageMultiTarget(hash, identifier) - else: build = None - if not version or version == "latest": - version = None + if version and version.isdigit(): + build = version + image = CachedV1MulledImageMultiTarget(hash, build, identifier) + elif package_description.startswith("mulled-v2-"): + if hash_func == "v1": + return None + + version_hash = None + build = None + if version and "-" in version: + version_hash, build = version.rsplit("-", 1) + elif version.isdigit(): + version_hash, build = None, version + elif version: + log.debug("Unparsable mulled image tag encountered [%s]" % version) + + image = CachedV2MulledImageMultiTarget(package_description, version_hash, build, identifier) + else: + build = None if version and "--" in version: version, build = split_tag(version) @@ -60,7 +84,9 @@ def output_line_to_image(line): return image - return [output_line_to_image(_) for _ in filter(name_filter, images_and_versions.splitlines())] + # TODO: Sort on build ... + raw_images = [output_line_to_image(_) for _ in filter(name_filter, images_and_versions.splitlines())] + return [i for i in raw_images if i is not None] def get_filter(namespace): @@ -68,11 +94,11 @@ def get_filter(namespace): return lambda name: name.startswith(prefix) and name.count("/") == 2 -def cached_container_description(targets, namespace): +def cached_container_description(targets, namespace, hash_func="v2"): if len(targets) == 0: return None - cached_images = list_cached_mulled_images(namespace) + cached_images = list_cached_mulled_images(namespace, hash_func=hash_func) image = None if len(targets) == 1: target = targets[0] @@ -84,10 +110,32 @@ def cached_container_description(targets, namespace): if not target.version or target.version == cached_image.version: image = cached_image break - else: - name = image_name(targets) + elif hash_func == "v2": + name = v2_image_name(targets) + if ":" in name: + package_hash, version_hash = name.split(":", 2) + else: + package_hash, version_hash = name, None + + for cached_image in cached_images: + if cached_image.multi_target != "v2": + continue + + if version_hash is None: + # Just match on package hash... + if package_hash == cached_image.package_hash: + image = cached_image + break + else: + # Match on package and version hash... + if package_hash == cached_image.package_hash and version_hash == cached_image.version_hash: + image = cached_image + break + + elif hash_func == "v1": + name = v1_image_name(targets) for cached_image in cached_images: - if not cached_image.multi_target: + if cached_image.multi_target != "v1": continue if name == cached_image.hash: @@ -109,16 +157,17 @@ class CachedMulledContainerResolver(ContainerResolver): resolver_type = "cached_mulled" - def __init__(self, app_info=None, namespace=None): + def __init__(self, app_info=None, namespace=None, hash_func="v2"): super(CachedMulledContainerResolver, self).__init__(app_info) self.namespace = namespace + self.hash_func = hash_func def resolve(self, enabled_container_types, tool_info): if tool_info.requires_galaxy_python_environment: return None targets = mulled_targets(tool_info) - return cached_container_description(targets, self.namespace) + return cached_container_description(targets, self.namespace, hash_func=self.hash_func) def __str__(self): return "CachedMulledContainerResolver[namespace=%s]" % self.namespace @@ -130,9 +179,10 @@ class MulledContainerResolver(ContainerResolver): resolver_type = "mulled" - def __init__(self, app_info=None, namespace="biocontainers"): + def __init__(self, app_info=None, namespace="biocontainers", hash_func="v2"): super(MulledContainerResolver, self).__init__(app_info) self.namespace = namespace + self.hash_func = hash_func def resolve(self, enabled_container_types, tool_info): if tool_info.requires_galaxy_python_environment: @@ -162,10 +212,25 @@ def resolve(self, enabled_container_types, tool_info): version, build = split_tag(tags[0]) name = "%s:%s--%s" % (target.package_name, version, build) else: - base_image_name = image_name(targets) - tags = mulled_tags_for(self.namespace, base_image_name) - if tags: - name = "%s:%s" % (base_image_name, tags[0]) + def tags_if_available(image_name): + if ":" in image_name: + repo_name, tag_prefix = image_name.split(":", 2) + else: + repo_name = image_name + tag_prefix = None + tags = mulled_tags_for(self.namespace, repo_name, tag_prefix=tag_prefix) + return tags + + if self.hash_func == "v2": + base_image_name = v2_image_name(targets) + tags = tags_if_available(base_image_name) + if tags: + name = "%s:%s" % (base_image_name, tags[0]) + elif self.hash_func == "v1": + base_image_name = v1_image_name(targets) + tags = tags_if_available(base_image_name) + if tags: + name = "%s:%s" % (base_image_name, tags[0]) if name: return ContainerDescription( @@ -183,12 +248,13 @@ class BuildMulledContainerResolver(ContainerResolver): resolver_type = "build_mulled" - def __init__(self, app_info=None, namespace="local", **kwds): + def __init__(self, app_info=None, namespace="local", hash_func="v2", **kwds): super(BuildMulledContainerResolver, self).__init__(app_info) self._involucro_context_kwds = { 'involucro_bin': self._get_config_option("involucro_path", None) } self.namespace = namespace + self.hash_func = hash_func self._mulled_kwds = { 'namespace': namespace, 'channels': self._get_config_option("channels", DEFAULT_CHANNELS, prefix="mulled"), @@ -206,9 +272,10 @@ def resolve(self, enabled_container_types, tool_info): mull_targets( targets, involucro_context=self._get_involucro_context(), + hash_func=self.hash_func, **self._mulled_kwds ) - return cached_container_description(targets, self.namespace) + return cached_container_description(targets, self.namespace, hash_func=self.hash_func) def _get_involucro_context(self): involucro_context = InvolucroContext(**self._involucro_context_kwds) diff --git a/lib/galaxy/tools/deps/containers.py b/lib/galaxy/tools/deps/containers.py index 12ff447d515f..15d7b69f1bf0 100644 --- a/lib/galaxy/tools/deps/containers.py +++ b/lib/galaxy/tools/deps/containers.py @@ -10,6 +10,7 @@ import six from galaxy.util import asbool +from galaxy.util import in_directory from galaxy.util import plugin_config from .container_resolvers.explicit import ExplicitContainerResolver @@ -21,12 +22,14 @@ from .requirements import ContainerDescription from .requirements import DEFAULT_CONTAINER_RESOLVE_DEPENDENCIES, DEFAULT_CONTAINER_SHELL from ..deps import docker_util +from ..deps import singularity_util log = logging.getLogger(__name__) DOCKER_CONTAINER_TYPE = "docker" +SINGULARITY_CONTAINER_TYPE = "singularity" DEFAULT_CONTAINER_TYPE = DOCKER_CONTAINER_TYPE -ALL_CONTAINER_TYPES = [DOCKER_CONTAINER_TYPE] +ALL_CONTAINER_TYPES = [DOCKER_CONTAINER_TYPE, SINGULARITY_CONTAINER_TYPE] LOAD_CACHED_IMAGE_COMMAND_TEMPLATE = ''' python << EOF @@ -315,7 +318,105 @@ def containerize_command(self, command): """ -class DockerContainer(Container): +def preprocess_volumes(volumes_raw_str, container_type): + """Process Galaxy volume specification string to either Docker or Singularity specification. + + Galaxy allows the mount try "default_ro" which translates to ro for Docker and + ro for Singularity iff no subdirectories are rw (Singularity does not allow ro + parent directories with rw subdirectories). + + >>> preprocess_volumes("/a/b", DOCKER_CONTAINER_TYPE) + '/a/b:rw' + >>> preprocess_volumes("/a/b:ro,/a/b/c:rw", DOCKER_CONTAINER_TYPE) + '/a/b:ro,/a/b/c:rw' + >>> preprocess_volumes("/a/b:default_ro,/a/b/c:rw", DOCKER_CONTAINER_TYPE) + '/a/b:ro,/a/b/c:rw' + >>> preprocess_volumes("/a/b:default_ro,/a/b/c:rw", SINGULARITY_CONTAINER_TYPE) + '/a/b:rw,/a/b/c:rw' + """ + + volumes_raw_strs = [v.strip() for v in volumes_raw_str.split(",")] + volumes = [] + rw_paths = [] + + for volume_raw_str in volumes_raw_strs: + volume_parts = volume_raw_str.split(":") + if len(volume_parts) > 2: + raise Exception("Unparsable volumes string in configuration [%s]" % volumes_raw_str) + if len(volume_parts) == 1: + volume_parts.append("rw") + volumes.append(volume_parts) + if volume_parts[1] == "rw": + rw_paths.append(volume_parts[0]) + + for volume in volumes: + path = volume[0] + how = volume[1] + + if how == "default_ro": + how = "ro" + if container_type == SINGULARITY_CONTAINER_TYPE: + for rw_path in rw_paths: + if in_directory(rw_path, path): + how = "rw" + + volume[1] = how + + return ",".join([":".join(v) for v in volumes]) + + +class HasDockerLikeVolumes: + """Mixin to share functionality related to Docker volume handling. + + Singularity seems to have a fairly compatible syntax for volume handling. + """ + + def _expand_volume_str(self, value): + if not value: + return value + + template = string.Template(value) + variables = dict() + + def add_var(name, value): + if value: + variables[name] = os.path.abspath(value) + + add_var("working_directory", self.job_info.working_directory) + add_var("job_directory", self.job_info.job_directory) + add_var("tool_directory", self.job_info.tool_directory) + add_var("galaxy_root", self.app_info.galaxy_root_dir) + add_var("default_file_path", self.app_info.default_file_path) + add_var("library_import_dir", self.app_info.library_import_dir) + + if self.job_info.job_directory and self.job_info.job_directory_type == "pulsar": + # We have a Pulsar job directory, so everything needed (excluding index + # files) should be available in job_directory... + defaults = "$job_directory:default_ro,$tool_directory:default_ro,$job_directory/outputs:rw,$working_directory:rw" + else: + defaults = "$galaxy_root:default_ro,$tool_directory:default_ro" + if self.job_info.job_directory: + defaults += ",$job_directory:default_ro" + if self.app_info.outputs_to_working_directory: + # Should need default_file_path (which is of course an estimate given + # object stores anyway). + defaults += ",$working_directory:rw,$default_file_path:default_ro" + else: + defaults += ",$working_directory:rw,$default_file_path:rw" + + if self.app_info.library_import_dir: + defaults += ",$library_import_dir:default_ro" + + # Define $defaults that can easily be extended with external library and + # index data without deployer worrying about above details. + variables["defaults"] = string.Template(defaults).safe_substitute(variables) + + return template.safe_substitute(variables) + + +class DockerContainer(Container, HasDockerLikeVolumes): + + container_type = DOCKER_CONTAINER_TYPE def containerize_command(self, command): def prop(name, default): @@ -338,9 +439,10 @@ def prop(name, default): if not working_directory: raise Exception("Cannot containerize command [%s] without defined working directory." % working_directory) - volumes_raw = self.__expand_str(self.destination_info.get("docker_volumes", "$defaults")) + volumes_raw = self._expand_volume_str(self.destination_info.get("docker_volumes", "$defaults")) + preprocessed_volumes_str = preprocess_volumes(volumes_raw, self.container_type) # TODO: Remove redundant volumes... - volumes = docker_util.DockerVolume.volumes_from_str(volumes_raw) + volumes = docker_util.DockerVolume.volumes_from_str(preprocessed_volumes_str) volumes_from = self.destination_info.get("docker_volumes_from", docker_util.DEFAULT_VOLUMES_FROM) docker_host_props = dict( @@ -394,57 +496,61 @@ def __get_destination_overridable_property(self, name): else: return getattr(self.app_info, name) - def __expand_str(self, value): - if not value: - return value - template = string.Template(value) - variables = dict() +def docker_cache_path(cache_directory, container_id): + file_container_id = container_id.replace("/", "_slash_") + cache_file_name = "docker_%s.tar" % file_container_id + return os.path.join(cache_directory, cache_file_name) - def add_var(name, value): - if value: - variables[name] = os.path.abspath(value) - add_var("working_directory", self.job_info.working_directory) - add_var("job_directory", self.job_info.job_directory) - add_var("tool_directory", self.job_info.tool_directory) - add_var("galaxy_root", self.app_info.galaxy_root_dir) - add_var("default_file_path", self.app_info.default_file_path) - add_var("library_import_dir", self.app_info.library_import_dir) +class SingularityContainer(Container, HasDockerLikeVolumes): - if self.job_info.job_directory and self.job_info.job_directory_type == "pulsar": - # We have a Pulsar job directory, so everything needed (excluding index - # files) should be available in job_directory... - defaults = "$job_directory:ro,$tool_directory:ro,$job_directory/outputs:rw,$working_directory:rw" - else: - defaults = "$galaxy_root:ro,$tool_directory:ro" - if self.job_info.job_directory: - defaults += ",$job_directory:ro" - if self.app_info.outputs_to_working_directory: - # Should need default_file_path (which is a course estimate given - # object stores anyway). - defaults += ",$working_directory:rw,$default_file_path:ro" - else: - defaults += ",$working_directory:rw,$default_file_path:rw" + container_type = SINGULARITY_CONTAINER_TYPE - if self.app_info.library_import_dir: - defaults += ",$library_import_dir:ro" + def containerize_command(self, command): + def prop(name, default): + destination_name = "singularity_%s" % name + return self.destination_info.get(destination_name, default) - # Define $defaults that can easily be extended with external library and - # index data without deployer worrying about above details. - variables["defaults"] = string.Template(defaults).safe_substitute(variables) + env = [] + for pass_through_var in self.tool_info.env_pass_through: + env.append((pass_through_var, "$%s" % pass_through_var)) - return template.safe_substitute(variables) + # Allow destinations to explicitly set environment variables just for + # docker container. Better approach is to set for destination and then + # pass through only what tool needs however. (See todo in ToolInfo.) + for key, value in six.iteritems(self.destination_info): + if key.startswith("singularity_env_"): + real_key = key[len("singularity_env_"):] + env.append((real_key, value)) + + working_directory = self.job_info.working_directory + if not working_directory: + raise Exception("Cannot containerize command [%s] without defined working directory." % working_directory) + volumes_raw = self._expand_volume_str(self.destination_info.get("singularity_volumes", "$defaults")) + volumes = docker_util.DockerVolume.volumes_from_str(volumes_raw) -def docker_cache_path(cache_directory, container_id): - file_container_id = container_id.replace("/", "_slash_") - cache_file_name = "docker_%s.tar" % file_container_id - return os.path.join(cache_directory, cache_file_name) + singularity_target_kwds = dict( + singularity_cmd=prop("cmd", singularity_util.DEFAULT_SINGULARITY_COMMAND), + sudo=asbool(prop("sudo", singularity_util.DEFAULT_SUDO)), + sudo_cmd=prop("sudo_cmd", singularity_util.DEFAULT_SUDO_COMMAND), + ) + run_command = singularity_util.build_singularity_run_command( + command, + self.container_id, + volumes=volumes, + env=env, + working_directory=working_directory, + run_extra_arguments=prop("run_extra_arguments", singularity_util.DEFAULT_RUN_EXTRA_ARGUMENTS), + **singularity_target_kwds + ) + return run_command CONTAINER_CLASSES = dict( docker=DockerContainer, + singularity=SingularityContainer, ) diff --git a/lib/galaxy/tools/deps/docker_util.py b/lib/galaxy/tools/deps/docker_util.py index 5d27d2b353ad..629cc59d81d3 100644 --- a/lib/galaxy/tools/deps/docker_util.py +++ b/lib/galaxy/tools/deps/docker_util.py @@ -28,7 +28,7 @@ def __init__(self, path, to_path=None, how=DEFAULT_VOLUME_MOUNT_TYPE): self.from_path = path self.to_path = to_path or path if not DockerVolume.__valid_how(how): - raise ValueError("Invalid way to specify docker volume %s" % how) + raise ValueError("Invalid way to specify Docker volume %s" % how) self.how = how @staticmethod @@ -41,7 +41,7 @@ def volumes_from_str(volumes_as_str): @staticmethod def volume_from_str(as_str): if not as_str: - raise ValueError("Failed to parse docker volume from %s" % as_str) + raise ValueError("Failed to parse Docker volume from %s" % as_str) parts = as_str.split(":", 2) kwds = dict(path=parts[0]) if len(parts) == 2: diff --git a/lib/galaxy/tools/deps/mulled/invfile.lua b/lib/galaxy/tools/deps/mulled/invfile.lua index 693d7ecf6f9c..4a51f9f5ae48 100644 --- a/lib/galaxy/tools/deps/mulled/invfile.lua +++ b/lib/galaxy/tools/deps/mulled/invfile.lua @@ -45,6 +45,13 @@ if conda_image == '' then conda_image = 'continuumio/miniconda:latest' end + +local singularity_image = VAR.SINGULARITY_IMAGE +if singularity_image == '' then + singularity_image = 'quay.io/biocontainers/singularity:2.3--0' +end + + local destination_base_image = VAR.DEST_BASE_IMAGE if destination_base_image == '' then destination_base_image = 'bgruening/busybox-bash:0.1' @@ -85,6 +92,25 @@ inv.task('build') .inImage(destination_base_image) .as(repo) +if VAR.SINGULARITY ~= '' then + inv.task('singularity') + .using(singularity_image) + .withHostConfig({binds = {"build:/data","singularity_import:/import"}, privileged = true}) + .withConfig({entrypoint = {'/bin/sh', '-c'}}) + -- this will create a container that is the size of our conda dependencies + 20MiB + -- The 20 MiB can be improved at some point, but this seems to work for now. + .run("du -sc /data/dist/ | tail -n 1 | cut -f 1 | awk '{print int($1/1024)+20}'") + .run("singularity create --size `du -sc /data/dist/ | tail -n 1 | cut -f 1 | awk '{print int($1/1024)+20}'` /import/" .. VAR.SINGULARITY_IMAGE_NAME) + .run('mkdir -p /usr/local/var/singularity/mnt/container && singularity bootstrap /import/' .. VAR.SINGULARITY_IMAGE_NAME .. ' /import/Singularity') + .run('chown ' .. VAR.USER_ID .. ' /import/' .. VAR.SINGULARITY_IMAGE_NAME) +end + +inv.task('cleanup') + .using(conda_image) + .withHostConfig({binds = {"build:/data"}}) + .run('rm', '-rf', '/data/dist') + + if VAR.TEST_BINDS == '' then inv.task('test') .using(repo) @@ -103,9 +129,14 @@ inv.task('push') inv.task('build-and-test') .runTask('build') + .runTask('singularity') + .runTask('cleanup') .runTask('test') + inv.task('all') .runTask('build') + .runTask('singularity') + .runTask('cleanup') .runTask('test') .runTask('push') diff --git a/lib/galaxy/tools/deps/mulled/mulled_build.py b/lib/galaxy/tools/deps/mulled/mulled_build.py index f2cc20f304fb..b444ba8460db 100644 --- a/lib/galaxy/tools/deps/mulled/mulled_build.py +++ b/lib/galaxy/tools/deps/mulled/mulled_build.py @@ -12,6 +12,7 @@ import json import os +import shutil import string import subprocess import sys @@ -25,7 +26,14 @@ from galaxy.tools.deps import commands, installable from ._cli import arg_parser -from .util import build_target, conda_build_target_str, image_name +from .util import ( + build_target, + conda_build_target_str, + create_repository, + quay_repository, + v1_image_name, + v2_image_name, +) from ..conda_compat import MetaData DIRNAME = os.path.dirname(__file__) @@ -37,6 +45,24 @@ DEFAULT_WORKING_DIR = '/source/' IS_OS_X = _platform == "darwin" INVOLUCRO_VERSION = "1.1.2" +DEST_BASE_IMAGE = os.environ.get('DEST_BASE_IMAGE', None) + +SINGULARITY_TEMPLATE = """Bootstrap: docker +From: bgruening/busybox-bash:0.1 + +%%setup + + echo "Copying conda environment" + mkdir -p /tmp/conda + cp -r /data/dist/* /tmp/conda/ + +%%post + mkdir -p /usr/local + cp -R /tmp/conda/* /usr/local/ + +%%test + %(container_test)s +""" def involucro_link(): @@ -111,23 +137,56 @@ def conda_versions(pkg_name, file_name): return ret +class BuildExistsException(Exception): + """Exception indicating mull_targets is skipping an existing build. + + If mull_targets is called with rebuild=False and the target built is already published + an instance of this exception is thrown. + """ + + def mull_targets( targets, involucro_context=None, - command="build", channels=DEFAULT_CHANNELS, namespace="mulled", + command="build", channels=DEFAULT_CHANNELS, namespace="biocontainers", test='true', test_files=None, image_build=None, name_override=None, repository_template=DEFAULT_REPOSITORY_TEMPLATE, dry_run=False, - conda_version=None, verbose=False, binds=DEFAULT_BINDS + conda_version=None, verbose=False, binds=DEFAULT_BINDS, rebuild=True, + oauth_token=None, hash_func="v2", singularity=False, ): targets = list(targets) if involucro_context is None: involucro_context = InvolucroContext() + image_function = v1_image_name if hash_func == "v1" else v2_image_name + if len(targets) > 2 and image_build is None: + # Force an image build in this case - this seems hacky probably + # shouldn't work this way but single case broken else wise. + image_build = "0" + repo_template_kwds = { "namespace": namespace, - "image": image_name(targets, image_build=image_build, name_override=name_override) + "image": image_function(targets, image_build=image_build, name_override=name_override) } repo = string.Template(repository_template).safe_substitute(repo_template_kwds) + if not rebuild or "push" in command: + repo_name = repo_template_kwds["image"].split(":", 1)[0] + repo_data = quay_repository(repo_template_kwds["namespace"], repo_name) + if not rebuild: + tags = repo_data.get("tags", []) + + target_tag = None + if ":" in repo_template_kwds["image"]: + image_name_parts = repo_template_kwds["image"].split(":") + assert len(image_name_parts) == 2, ": not allowed in image name [%s]" % repo_template_kwds["image"] + target_tag = image_name_parts[1] + + if tags and (target_tag is None or target_tag in tags): + raise BuildExistsException() + if "push" in command and "error_type" in repo_data and oauth_token: + # Explicitly create the repository so it can be built as public. + create_repository(repo_template_kwds["namespace"], repo_name, oauth_token) + for channel in channels: if channel.startswith('file://'): bind_path = channel.lstrip('file://') @@ -144,8 +203,16 @@ def mull_targets( '-set', "REPO='%s'" % repo, '-set', "BINDS='%s'" % bind_str, ] + + if DEST_BASE_IMAGE: + involucro_args.extend(["-set", "DEST_BASE_IMAGE='%s'" % DEST_BASE_IMAGE]) if verbose: involucro_args.extend(["-set", "VERBOSE='1'"]) + if singularity: + singularity_image_name = repo_template_kwds['image'] + involucro_args.extend(["-set", "SINGULARITY='1'"]) + involucro_args.extend(["-set", "SINGULARITY_IMAGE_NAME='%s'" % singularity_image_name]) + involucro_args.extend(["-set", "USER_ID='%s:%s'" % (os.getuid(), os.getgid() )]) if conda_version is not None: verbose = "--verbose" if verbose else "--quiet" involucro_args.extend(["-set", "PREINSTALL='conda install %s --yes conda=%s'" % (verbose, conda_version)]) @@ -165,7 +232,18 @@ def mull_targets( print(" ".join(involucro_context.build_command(involucro_args))) if not dry_run: ensure_installed(involucro_context, True) - return involucro_context.exec_command(involucro_args) + if singularity: + if not os.path.exists('./singularity_import'): + os.mkdir('./singularity_import') + with open('./singularity_import/Singularity', 'w+') as sin_def: + fill_template = SINGULARITY_TEMPLATE % {'container_test': test} + sin_def.write(fill_template) + ret = involucro_context.exec_command(involucro_args) + if singularity: + # we can not remove this folder as it contains the image wich is owned by root + pass + # shutil.rmtree('./singularity_import') + return ret return 0 @@ -194,7 +272,14 @@ def build_command(self, involucro_args): def exec_command(self, involucro_args): cmd = self.build_command(involucro_args) - return self.shell_exec(" ".join(cmd)) + # Create ./build dir manually, otherwise Docker will do it as root + os.mkdir('./build') + try: + res = self.shell_exec(" ".join(cmd)) + finally: + # delete build directory in any case + shutil.rmtree('./build') + return res def is_installed(self): return os.path.exists(self.involucro_bin) @@ -212,9 +297,10 @@ def ensure_installed(involucro_context, auto_init): def install_involucro(involucro_context=None, to_path=None): - to_path = involucro_context.involucro_bin - download_cmd = " ".join(commands.download_command(involucro_link(), to=to_path, quote_url=True)) - full_cmd = "%s && chmod +x %s" % (download_cmd, to_path) + install_path = os.path.abspath(involucro_context.involucro_bin) + involucro_context.involucro_bin = install_path + download_cmd = " ".join(commands.download_command(involucro_link(), to=install_path, quote_url=True)) + full_cmd = "%s && chmod +x %s" % (download_cmd, install_path) return involucro_context.shell_exec(full_cmd) @@ -222,13 +308,13 @@ def add_build_arguments(parser): """Base arguments describing how to 'mull'.""" parser.add_argument('--involucro-path', dest="involucro_path", default=None, help="Path to involucro (if not set will look in working directory and on PATH).") - parser.add_argument('--force-rebuild', dest="force_rebuild", action="store_true", - help="Rebuild package even if already published.") parser.add_argument('--dry-run', dest='dry_run', action="store_true", help='Just print commands instead of executing them.') parser.add_argument('--verbose', dest='verbose', action="store_true", help='Cause process to be verbose.') - parser.add_argument('-n', '--namespace', dest='namespace', default="mulled", + parser.add_argument('--singularity', action="store_true", + help='Additionally build a singularity image.') + parser.add_argument('-n', '--namespace', dest='namespace', default="biocontainers", 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).') @@ -238,6 +324,10 @@ def add_build_arguments(parser): help='Dependent conda channels.') parser.add_argument('--conda-version', dest="conda_version", default=None, help="Change to specified version of Conda before installing packages.") + parser.add_argument('--oauth-token', dest="oauth_token", default=None, + help="If set, use this token when communicating with quay.io API.") + parser.add_argument('--check-published', dest="rebuild", action='store_false') + parser.add_argument('--hash', dest="hash", choices=["v1", "v2"], default="v2") def add_single_image_arguments(parser): @@ -273,6 +363,8 @@ def args_to_mull_targets_kwds(args): kwds["namespace"] = args.namespace if hasattr(args, "dry_run"): kwds["dry_run"] = args.dry_run + if hasattr(args, "singularity"): + kwds["singularity"] = args.singularity if hasattr(args, "test"): kwds["test"] = args.test if hasattr(args, "test_files"): @@ -289,6 +381,12 @@ def args_to_mull_targets_kwds(args): kwds["repository_template"] = args.repository_template if hasattr(args, "conda_version"): kwds["conda_version"] = args.conda_version + if hasattr(args, "oauth_token"): + kwds["oauth_token"] = args.oauth_token + if hasattr(args, "rebuild"): + kwds["rebuild"] = args.rebuild + if hasattr(args, "hash"): + kwds["hash_func"] = args.hash kwds["involucro_context"] = context_from_args(args) diff --git a/lib/galaxy/tools/deps/mulled/mulled_build_channel.py b/lib/galaxy/tools/deps/mulled/mulled_build_channel.py index 6463d3ea58d2..23e3021187bf 100644 --- a/lib/galaxy/tools/deps/mulled/mulled_build_channel.py +++ b/lib/galaxy/tools/deps/mulled/mulled_build_channel.py @@ -87,6 +87,8 @@ def add_channel_arguments(parser): parser.add_argument('--diff-hours', dest='diff_hours', default="25", help='If finding all recently changed recipes, use this number of hours.') parser.add_argument('--recipes-dir', dest="recipes_dir", default="./bioconda-recipes") + parser.add_argument('--force-rebuild', dest="force_rebuild", action="store_true", + help="Rebuild package even if already published.") def main(argv=None): diff --git a/lib/galaxy/tools/deps/mulled/mulled_build_files.py b/lib/galaxy/tools/deps/mulled/mulled_build_files.py index 931da7647c16..b555f692c792 100644 --- a/lib/galaxy/tools/deps/mulled/mulled_build_files.py +++ b/lib/galaxy/tools/deps/mulled/mulled_build_files.py @@ -20,6 +20,7 @@ from .mulled_build import ( add_build_arguments, args_to_mull_targets_kwds, + BuildExistsException, mull_targets, target_str_to_targets, ) @@ -33,8 +34,19 @@ def main(argv=None): parser.add_argument('files', metavar="FILES", default=".", help="Path to directory (or single file) of TSV files describing composite recipes.") args = parser.parse_args() - for targets in generate_targets(args.files): - mull_targets(targets, **args_to_mull_targets_kwds(args)) + for (targets, image_build, name_override) in generate_targets(args.files): + if not image_build and len(targets) > 1: + # Specify an explict tag in this case. + image_build = "0" + try: + mull_targets( + targets, + image_build=image_build, + name_override=name_override, + **args_to_mull_targets_kwds(args) + ) + except BuildExistsException: + continue def generate_targets(target_source): @@ -59,14 +71,14 @@ def generate_targets(target_source): def line_to_targets(line_str): line = _parse_line(line_str) - return target_str_to_targets(line) + return (target_str_to_targets(line.targets), line.image_build, line.name_override) _Line = collections.namedtuple("_Line", ["targets", "image_build", "name_override"]) def _parse_line(line_str): - line_parts = line_str.split(" ") + line_parts = line_str.split("\t") assert len(line_parts) < 3, "Too many fields in line [%s], expect at most 3 - targets, image build number, and name override." % line_str line_parts += [None] * (3 - len(line_parts)) return _Line(*line_parts) diff --git a/lib/galaxy/tools/deps/mulled/mulled_search.py b/lib/galaxy/tools/deps/mulled/mulled_search.py old mode 100644 new mode 100755 index 724956a13351..4e0662d12b5e --- a/lib/galaxy/tools/deps/mulled/mulled_search.py +++ b/lib/galaxy/tools/deps/mulled/mulled_search.py @@ -112,8 +112,8 @@ def get_additional_repository_information(self, repository_string): def main(argv=None): parser = argparse.ArgumentParser(description='Searches in a given quay organization for a repository') - parser.add_argument('-o', '--organization', dest='organization_string', default="mulled", - help='Change organization. Default is mulled.') + parser.add_argument('-o', '--organization', dest='organization_string', default="biocontainers", + help='Change organization. Default is biocontainers.') parser.add_argument('--non-strict', dest='non_strict', action="store_true", help='Autocorrection of typos activated. Lists more results but can be confusing.\ For too many queries quay.io blocks the request and the results can be incomplete.') diff --git a/lib/galaxy/tools/deps/mulled/util.py b/lib/galaxy/tools/deps/mulled/util.py index 6ea62f241c9e..46ede34a55d7 100644 --- a/lib/galaxy/tools/deps/mulled/util.py +++ b/lib/galaxy/tools/deps/mulled/util.py @@ -12,16 +12,22 @@ requests = None +def create_repository(namespace, repo_name, oauth_token): + assert oauth_token + headers = {'Authorization': 'Bearer %s' % oauth_token} + data = { + "repository": repo_name, + "namespace": namespace, + "description": "", + "visibility": "public", + } + requests.post("https://quay.io/api/v1/repository", json=data, headers=headers) + + def quay_versions(namespace, pkg_name): """Get all version tags for a Docker image stored on quay.io for supplied package name.""" - if requests is None: - raise Exception("requets library is unavailable, functionality not available.") + data = quay_repository(namespace, pkg_name) - assert namespace is not None - assert pkg_name is not None - url = 'https://quay.io/api/v1/repository/%s/%s' % (namespace, pkg_name) - response = requests.get(url, timeout=None) - data = response.json() if 'error_type' in data and data['error_type'] == "invalid_token": return [] @@ -31,12 +37,26 @@ def quay_versions(namespace, pkg_name): return [tag for tag in data['tags'] if tag != 'latest'] -def mulled_tags_for(namespace, image): +def quay_repository(namespace, pkg_name): + if requests is None: + raise Exception("requets library is unavailable, functionality not available.") + + assert namespace is not None + assert pkg_name is not None + url = 'https://quay.io/api/v1/repository/%s/%s' % (namespace, pkg_name) + response = requests.get(url, timeout=None) + data = response.json() + return data + + +def mulled_tags_for(namespace, image, tag_prefix=None): """Fetch remote tags available for supplied image name. The result will be sorted so newest tags are first. """ tags = quay_versions(namespace, image) + if tag_prefix is not None: + tags = [t for t in tags if t.startswith(tag_prefix)] tags = version_sorted(tags) return tags @@ -77,25 +97,49 @@ def conda_build_target_str(target): return rval -def image_name(targets, image_build=None, name_override=None): +def _simple_image_name(targets, image_build=None): + target = targets[0] + suffix = "" + if target.version is not None: + if image_build is not None: + print("WARNING: Hard-coding image build instead of using Conda build - this is not recommended.") + suffix = image_build + else: + suffix += ":%s" % target.version + build = target.build + if build is not None: + suffix += "--%s" % build + return "%s%s" % (target.package_name, suffix) + + +def v1_image_name(targets, image_build=None, name_override=None): + """Generate mulled hash version 1 container identifier for supplied arguments. + + If a single target is specified, simply use the supplied name and version as + the repository name and tag respectively. If multiple targets are supplied, + hash the package names and versions together as the repository name. For mulled + version 1 containers the image build is the repository tag (if supplied). + + >>> single_targets = [build_target("samtools", version="1.3.1")] + >>> v1_image_name(single_targets) + 'samtools:1.3.1' + >>> multi_targets = [build_target("samtools", version="1.3.1"), build_target("bwa", version="0.7.13")] + >>> v1_image_name(multi_targets) + 'mulled-v1-b06ecbd9141f0dbbc0c287375fc0813adfcbdfbd' + >>> multi_targets_on_versionless = [build_target("samtools", version="1.3.1"), build_target("bwa")] + >>> v1_image_name(multi_targets_on_versionless) + 'mulled-v1-bda945976caa5734347fbf7f35066d9f58519e0c' + >>> multi_targets_versionless = [build_target("samtools"), build_target("bwa")] + >>> v1_image_name(multi_targets_versionless) + 'mulled-v1-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40' + """ if name_override is not None: print("WARNING: Overriding mulled image name, auto-detection of 'mulled' package attributes will fail to detect result.") return name_override targets = list(targets) if len(targets) == 1: - target = targets[0] - suffix = "" - if target.version is not None: - if image_build is not None: - print("WARNING: Hard-coding image build instead of using Conda build - this is not recommended.") - suffix = image_build - else: - suffix += ":%s" % target.version - build = target.build - if build is not None: - suffix += "--%s" % build - return "%s%s" % (target.package_name, suffix) + return _simple_image_name(targets, image_build=image_build) else: targets_order = sorted(targets, key=lambda t: t.package_name) requirements_buffer = "\n".join(map(conda_build_target_str, targets_order)) @@ -105,6 +149,66 @@ def image_name(targets, image_build=None, name_override=None): return "mulled-v1-%s%s" % (m.hexdigest(), suffix) +def v2_image_name(targets, image_build=None, name_override=None): + """Generate mulled hash version 2 container identifier for supplied arguments. + + If a single target is specified, simply use the supplied name and version as + the repository name and tag respectively. If multiple targets are supplied, + hash the package names as the repository name and hash the package versions (if set) + as the tag. + + >>> single_targets = [build_target("samtools", version="1.3.1")] + >>> v2_image_name(single_targets) + 'samtools:1.3.1' + >>> multi_targets = [build_target("samtools", version="1.3.1"), build_target("bwa", version="0.7.13")] + >>> v2_image_name(multi_targets) + 'mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40:4d0535c94ef45be8459f429561f0894c3fe0ebcf' + >>> multi_targets_on_versionless = [build_target("samtools", version="1.3.1"), build_target("bwa")] + >>> v2_image_name(multi_targets_on_versionless) + 'mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40:b0c847e4fb89c343b04036e33b2daa19c4152cf5' + >>> multi_targets_versionless = [build_target("samtools"), build_target("bwa")] + >>> v2_image_name(multi_targets_versionless) + 'mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40' + """ + if name_override is not None: + print("WARNING: Overriding mulled image name, auto-detection of 'mulled' package attributes will fail to detect result.") + return name_override + + targets = list(targets) + if len(targets) == 1: + return _simple_image_name(targets, image_build=image_build) + else: + targets_order = sorted(targets, key=lambda t: t.package_name) + package_name_buffer = "\n".join(map(lambda t: t.package_name, targets_order)) + package_hash = hashlib.sha1() + package_hash.update(package_name_buffer.encode()) + + versions = map(lambda t: t.version, targets_order) + if any(versions): + # Only hash versions if at least one package has versions... + version_name_buffer = "\n".join(map(lambda t: t.version or "null", targets_order)) + version_hash = hashlib.sha1() + version_hash.update(version_name_buffer.encode()) + version_hash_str = version_hash.hexdigest() + else: + version_hash_str = "" + + if not image_build: + build_suffix = "" + elif version_hash_str: + # tagged verson is - + build_suffix = "-%s" % image_build + else: + # tagged version is simply the build + build_suffix = image_build + suffix = "" + if version_hash_str or build_suffix: + suffix = ":%s%s" % (version_hash_str, build_suffix) + return "mulled-v2-%s%s" % (package_hash.hexdigest(), suffix) + + +image_name = v1_image_name # deprecated + __all__ = ( "build_target", "conda_build_target_str", @@ -113,5 +217,7 @@ def image_name(targets, image_build=None, name_override=None): "quay_versions", "split_tag", "Target", + "v1_image_name", + "v2_image_name", "version_sorted", ) diff --git a/lib/galaxy/tools/deps/singularity_util.py b/lib/galaxy/tools/deps/singularity_util.py new file mode 100644 index 000000000000..d850c5c7b9c0 --- /dev/null +++ b/lib/galaxy/tools/deps/singularity_util.py @@ -0,0 +1,58 @@ +from six.moves import shlex_quote + + +DEFAULT_WORKING_DIRECTORY = None +DEFAULT_SINGULARITY_COMMAND = "singularity" +DEFAULT_SUDO = False +DEFAULT_SUDO_COMMAND = "sudo" +DEFAULT_RUN_EXTRA_ARGUMENTS = None + + +def build_singularity_run_command( + container_command, + image, + volumes=[], + env=[], + working_directory=DEFAULT_WORKING_DIRECTORY, + singularity_cmd=DEFAULT_SINGULARITY_COMMAND, + run_extra_arguments=DEFAULT_RUN_EXTRA_ARGUMENTS, + sudo=DEFAULT_SUDO, + sudo_cmd=DEFAULT_SUDO_COMMAND, +): + command_parts = [] + # http://singularity.lbl.gov/docs-environment-metadata + for (key, value) in env: + command_parts.extend(["SINGULARITYENV_%s=%s" % (key, value)]) + command_parts += _singularity_prefix( + singularity_cmd=singularity_cmd, + sudo=sudo, + sudo_cmd=sudo_cmd, + ) + command_parts.append("exec") + for volume in volumes: + command_parts.extend(["-B", shlex_quote(str(volume))]) + if working_directory: + command_parts.extend(["--pwd", shlex_quote(working_directory)]) + if run_extra_arguments: + command_parts.append(run_extra_arguments) + full_image = image + command_parts.append(shlex_quote(full_image)) + command_parts.append(container_command) + return " ".join(command_parts) + + +def _singularity_prefix( + singularity_cmd=DEFAULT_SINGULARITY_COMMAND, + sudo=DEFAULT_SUDO, + sudo_cmd=DEFAULT_SUDO_COMMAND, + **kwds +): + """Prefix to issue a singularity command.""" + command_parts = [] + if sudo: + command_parts.append(sudo_cmd) + command_parts.append(singularity_cmd) + return command_parts + + +__all__ = ("build_singularity_run_command",) diff --git a/lib/galaxy/web/framework/helpers/grids.py b/lib/galaxy/web/framework/helpers/grids.py index 1e3ee4bac045..16934753d65f 100644 --- a/lib/galaxy/web/framework/helpers/grids.py +++ b/lib/galaxy/web/framework/helpers/grids.py @@ -339,7 +339,8 @@ def url( *args, **kwargs ): 'default_filter_dict' : self.default_filter, 'advanced_search' : self.advanced_search, 'info_text' : self.info_text, - 'url' : url(dict()) + 'url' : url(dict()), + 'refresh_frames' : kwargs.get( 'refresh_frames', [] ) } if current_item: grid_config['current_item_id'] = current_item.id diff --git a/lib/galaxy/webapps/galaxy/buildapp.py b/lib/galaxy/webapps/galaxy/buildapp.py index e0c99924566d..88aff51c3390 100644 --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -111,6 +111,7 @@ def paste_app_factory( global_conf, **kwargs ): webapp.add_client_route( '/workflow/run' ) webapp.add_client_route( '/workflow/import_workflow' ) webapp.add_client_route( '/pages/{action_id}' ) + webapp.add_client_route( '/datasets/{action_id}' ) webapp.add_client_route( '/workflow/configure_menu' ) webapp.add_client_route( '/custom_builds' ) diff --git a/lib/galaxy/webapps/galaxy/controllers/dataset.py b/lib/galaxy/webapps/galaxy/controllers/dataset.py index 03011ec06d3b..2eff5f295bab 100644 --- a/lib/galaxy/webapps/galaxy/controllers/dataset.py +++ b/lib/galaxy/webapps/galaxy/controllers/dataset.py @@ -53,7 +53,6 @@ def get_accepted_filters( self ): # Grid definition title = "Saved Datasets" model_class = model.HistoryDatasetAssociation - template = '/dataset/grid.mako' default_sort_key = "-update_time" columns = [ grids.TextColumn( "Name", key="name", @@ -463,6 +462,7 @@ def __ok_to_edit_metadata( dataset_id ): return trans.show_error_message( "You do not have permission to edit this dataset's ( id: %s ) information." % str( dataset_id ) ) @web.expose + @web.json @web.require_login( "see all available datasets" ) def list( self, trans, **kwargs ): """List all available datasets""" @@ -501,9 +501,10 @@ def list( self, trans, **kwargs ): status, message = trans.webapp.controllers['history']._list_switch( trans, histories ) # Current history changed, refresh history frame; if switching to a dataset, set hda seek. - trans.template_context['refresh_frames'] = ['history'] + kwargs['refresh_frames'] = ['history'] if operation == "switch": hda_ids = [ trans.security.encode_id( hda.id ) for hda in hdas ] + # TODO: Highlighting does not work, has to be revisited trans.template_context[ 'seek_hda_ids' ] = hda_ids elif operation == "copy to current history": # @@ -517,9 +518,10 @@ def list( self, trans, **kwargs ): status, message = self._copy_datasets( trans, hda_ids, target_histories ) # Current history changed, refresh history frame. - trans.template_context['refresh_frames'] = ['history'] + kwargs['refresh_frames'] = ['history'] # Render the list view + kwargs[ 'dict_format' ] = True return self.stored_list_grid( trans, status=status, message=message, **kwargs ) @web.expose diff --git a/static/maps/layout/menu.js.map b/static/maps/layout/menu.js.map index b7fd2420a800..8c228a7c1140 100644 --- a/static/maps/layout/menu.js.map +++ b/static/maps/layout/menu.js.map @@ -1 +1 @@ -{"version":3,"file":"menu.js","sources":["../../src/layout/menu.js"],"names":["define","GenericNav","Webhooks","_l","Collection","Backbone","extend","model","Model","defaults","visible","target","fetch","options","self","this","reset","extendedNavItem","GenericNavView","add","render","id","title","url","tooltip","disabled","Galaxy","user","onclick","window","location","root","menu","user_requests","lims_doc_url","callback","webhooks","$","document","ready","each","models","index","webhook","toJSON","activate","name","icon","config","function","Function","get","cls","helpTab","support_url","search_url","mailing_lists","screencasts_url","wiki_url","citation_url","router","navigate","trigger","terms_url","push","biostar_url","unshift","biostar_url_redirect","userTab","divider","noscratchbook","allow_user_creation","activeView","active_view","set","jQuery","Deferred","resolve","promise","Tab","View","initialize","setElement","_template","$dropdown","$toggle","$menu","$note","listenTo","events","click .dropdown-toggle","remove","$el","attr","css","visibility","_formatUrl","html","removeClass","addClass","display","placement","show","off","on","hide","empty","_","menuItem","append","_buildMenuItem","e","preventDefault","frame","_toggleClick","buildLink","label","m","popover","content","setTimeout","attributes","indexOf","charAt"],"mappings":"AACAA,QAAQ,0BAA2B,eAAgB,sBAAuB,SAAUC,EAAYC,EAAUC,GAC1G,GAAIC,GAAaC,SAASD,WAAWE,QACjCC,MAAOF,SAASG,MAAMF,QAClBG,UACIC,SAAkB,EAClBC,OAAkB,aAG1BC,MAAO,SAAUC,GACb,GAAIC,GAAOC,IACXF,GAAUA,MACVE,KAAKC,OAKL,IAAIC,GAAkB,GAAIhB,GAAWiB,cACrCH,MAAKI,IAAIF,EAAgBG,UAKzBL,KAAKI,KACDE,GAAkB,WAClBC,MAAkBnB,EAAG,gBACrBoB,IAAkB,GAClBC,QAAkBrB,EAAG,wBAMzBY,KAAKI,KACDE,GAAkB,WAClBC,MAAkBnB,EAAG,YACrBqB,QAAkBrB,EAAG,8BACrBsB,UAAmBC,OAAOC,KAAKN,GAC/BE,IAAkB,WAClBZ,OAAkB,cAClBiB,QAAkB,WACIC,OAAOC,SAAWJ,OAAOK,KAAO,cAO1DhB,KAAKI,KACDE,GAAkB,SAClBC,MAAkBnB,EAAG,eACrBoB,IAAkB,gBAClBC,QAAkBrB,EAAG,8BACrB6B,OACQV,MAAUnB,EAAG,kBACboB,IAAU,iBAEVD,MAAUnB,EAAG,aACboB,IAAU,2BAEVD,MAAUnB,EAAG,aACboB,IAAU,4BAEVD,MAA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mE,IAAK,aAAa,GAFxBnE,EAAM4C,IAAK,WAAc5C,EAAM4C,IAAK,aAAgBzB,OAAOuF,MAAM9F,IAAKZ,EAAMkH,aAoBxFzB,WAAY,SAAUzE,GAClB,MAAqB,gBAAPA,IAA2C,KAAxBA,EAAImG,QAAS,OAAoC,KAAnBnG,EAAIoG,OAAQ,GAAajG,OAAOK,KAAOR,EAAMA,GAIhH4D,UAAW,WACP,MAAQ,kJAUhB,QACI/E,WAAcA,EACd2E,IAAcA"} \ No newline at end of file +{"version":3,"file":"menu.js","sources":["../../src/layout/menu.js"],"names":["define","GenericNav","Webhooks","_l","Collection","Backbone","extend","model","Model","defaults","visible","target","fetch","options","self","this","reset","extendedNavItem","GenericNavView","add","render","id","title","url","tooltip","disabled","Galaxy","user","onclick","window","location","root","menu","user_requests","lims_doc_url","callback","webhooks","$","document","ready","each","models","index","webhook","toJSON","activate","name","icon","config","function","Function","get","cls","helpTab","support_url","search_url","mailing_lists","screencasts_url","wiki_url","citation_url","router","navigate","trigger","terms_url","push","biostar_url","unshift","biostar_url_redirect","userTab","divider","noscratchbook","allow_user_creation","activeView","active_view","set","jQuery","Deferred","resolve","promise","Tab","View","initialize","setElement","_template","$dropdown","$toggle","$menu","$note","listenTo","events","click .dropdown-toggle","remove","$el","attr","css","visibility","_formatUrl","html","removeClass","addClass","display","placement","show","off","on","hide","empty","_","menuItem","append","_buildMenuItem","e","preventDefault","frame","_toggleClick","buildLink","label","m","popover","content","setTimeout","attributes","indexOf","charAt"],"mappings":"AACAA,QAAQ,0BAA2B,eAAgB,sBAAuB,SAAUC,EAAYC,EAAUC,GAC1G,GAAIC,GAAaC,SAASD,WAAWE,QACjCC,MAAOF,SAASG,MAAMF,QAClBG,UACIC,SAAkB,EAClBC,OAAkB,aAG1BC,MAAO,SAAUC,GACb,GAAIC,GAAOC,IACXF,GAAUA,MACVE,KAAKC,OAKL,IAAIC,GAAkB,GAAIhB,GAAWiB,cACrCH,MAAKI,IAAIF,EAAgBG,UA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AAInF,GAAOC,KACPR,EAAQQ,KAAKR,KACjBwG,GAAEC,iBACF3E,EAAG,YAAaoE,OAChBlG,EAAMuD,QAAS,WAAY,SAAUuD,GACjC9G,EAAMc,KAAOgG,EAAEhG,IAAMgG,EAAElE,IAAK,SAAYkE,EAAE3C,IAAK,aAAa,KAE1DnE,EAAM4C,IAAK,aAUbpC,KAAKsE,QAAQiC,SAAWvG,KAAKsE,QAAQiC,QAAS,WAC9CvG,KAAKsE,QAAQiC,SACTrB,MAAc,EACdI,UAAc,SACdkB,QAAc,UAAYJ,EAAW,QAAS,8BAAiC,OACrDA,EAAW,WAAY,+BAAkC,0BACpFG,QAAS,QACZE,WAAY,WAAa1G,EAAKuE,QAAQiC,QAAS,YAAe,MAhBxD/G,EAAM4C,IAAK,QAGb5C,EAAMmE,IAAK,aAAa,GAFxBnE,EAAM4C,IAAK,WAAc5C,EAAM4C,IAAK,aAAgBzB,OAAOuF,MAAM9F,IAAKZ,EAAMkH,aAoBxFzB,WAAY,SAAUzE,GAClB,MAAqB,gBAAPA,IAA2C,KAAxBA,EAAImG,QAAS,OAAoC,KAAnBnG,EAAIoG,OAAQ,GAAajG,OAAOK,KAAOR,EAAMA,GAIhH4D,UAAW,WACP,MAAQ,kJAUhB,QACI/E,WAAcA,EACd2E,IAAcA"} \ No newline at end of file diff --git a/static/scripts/bundled/analysis.bundled.js b/static/scripts/bundled/analysis.bundled.js index 00c7f3d2f62d..540d5ba68d37 100644 --- a/static/scripts/bundled/analysis.bundled.js +++ b/static/scripts/bundled/analysis.bundled.js @@ -1,6 +1,6 @@ -webpackJsonp([3,1],[function(e,t,i){(function(e,t){var n=i(1),s=n,a=i(33).GalaxyApp,o=i(62),r=i(96),l=i(95),c=i(34),d=i(28),h=i(137),u=i(136),p=i(85),f=i(77),g=i(126),m=i(141),v=i(139),_=i(84),y=i(4),w=i(7);window.app=function(i,n){window.Galaxy=new a(i,n),Galaxy.debug("analysis app"),Galaxy.params=Galaxy.config.params;var b=e.View.extend({initialize:function(e){this.message=e.message||"Undefined Message",this.msg_status=e.type||"info",this.render()},render:function(){this.$el.html(t.escape(this.message)).addClass(this.msg_status+"message")}}),x=e.Router.extend({initialize:function(e,t){this.page=e,this.options=t},push:function(e,t){t=t||{},t.__identifer=Math.random().toString(36).substr(2),s.isEmptyObject(t)||(e+=e.indexOf("?")==-1?"?":"&",e+=s.param(t,!0)),this.navigate(e,{trigger:!0})},execute:function(e,t,i){Galaxy.debug("router execute:",e,t,i);var n=o.parse(t.pop());t.push(n),e&&(this.authenticate(t,i)?e.apply(this,t):this.loginRequired())},routes:{"(/)":"home","(/)root*":"home","(/)tours(/)(:tour_id)":"show_tours","(/)user(/)":"show_user","(/)user(/)(:form_id)":"show_user_form","(/)workflow(/)":"show_workflows","(/)workflow/run(/)":"show_run","(/)pages(/)(:action_id)":"show_pages","(/)workflow/configure_menu(/)":"show_configure_menu","(/)workflow/import_workflow":"show_import_workflow","(/)custom_builds":"show_custom_builds"},require_login:["show_user","show_user_form","show_workflows","show_configure_menu"],loginRequired:function(){this.page.display(new b({type:"error",message:"You must be logged in to make this request."}))},authenticate:function(e,t){return Galaxy.user&&Galaxy.user.id||this.require_login.indexOf(t)==-1},show_tours:function(e){e?p.giveTour(e):this.page.display(new p.ToursView)},show_user:function(){this.page.display(new h.View)},show_user_form:function(e){this.page.display(new h.Forms({form_id:e,user_id:Galaxy.params.id}))},show_pages:function(e){"list"==e?this.page.display(new g.View):this.page.display(new f({url_base:Galaxy.root+"page/list_published",dict_format:!0}))},show_workflows:function(){this.page.display(new m.View)},show_run:function(){this._loadWorkflow()},show_import_workflow:function(){this.page.display(new m.ImportWorkflowView)},show_configure_menu:function(){this.page.display(new v.View)},show_custom_builds:function(){var e=this,t=this.page.historyPanel.historyView;return t&&t.model&&t.model.id?void this.page.display(new u.View):void window.setTimeout(function(){e.show_custom_builds()},500)},home:function(e){e.tool_id||e.job_id?"upload1"===e.tool_id?(this.page.toolPanel.upload.show(),this._loadCenterIframe("welcome")):this._loadToolForm(e):e.workflow_id?this._loadWorkflow():e.m_c?this._loadCenterIframe(e.m_c+"/"+e.m_a):this._loadCenterIframe("welcome")},_loadToolForm:function(e){e.id=e.tool_id,this.page.display(new d.View(e))},_loadCenterIframe:function(e,t){t=t||Galaxy.root,e=t+e,this.page.$("#galaxy_main").prop("src",e)},_loadWorkflow:function(){var e=this;y.get({url:Galaxy.root+"api/workflows/"+y.getQueryString("id")+"/download",data:{style:"run"},success:function(t){e.page.display(new _.View(t))},error:function(t){var i="Error occurred while loading the resource.",n={message:i,status:"error",persistent:!0,cls:"errormessage"};e.page.display(new w.Message(n))}})}});s(function(){Galaxy.page=new c.View(t.extend(i,{Left:r,Right:l,Router:x})),e.history.start({root:Galaxy.root,pushState:!0})})}}).call(t,i(3),i(2))},,,,,,,function(e,t,i){var n,s;(function(a,o,r){n=[i(4),i(23),i(58),i(22),i(54),i(12),i(8)],s=function(e,t,i,n,s,l,c){var d=a.View.extend({tagName:"label",initialize:function(e){this.model=e&&e.model||new a.Model(e),this.tagName=e.tagName||this.tagName,this.setElement(o("<"+this.tagName+"/>")),this.listenTo(this.model,"change",this.render,this),this.render()},title:function(e){this.model.set("title",e)},value:function(){return this.model.get("title")},render:function(){return this.$el.removeClass().addClass("ui-label").addClass(this.model.get("cls")).html(this.model.get("title")),this}}),h=a.View.extend({initialize:function(e){this.model=e&&e.model||new a.Model({message:null,status:"info",cls:"",persistent:!1,fade:!0}).set(e),this.listenTo(this.model,"change",this.render,this),this.render()},update:function(e){this.model.set(e)},render:function(){this.$el.removeClass().addClass("ui-message").addClass(this.model.get("cls"));var e=this.model.get("status");if(this.model.get("large")?this.$el.addClass(("success"==e&&"done"||"danger"==e&&"error"||e)+"messagelarge"):this.$el.addClass("alert").addClass("alert-"+e),this.model.get("message")){if(this.$el.html(this.messageForDisplay()),this.$el[this.model.get("fade")?"fadeIn":"show"](),this.timeout&&window.clearTimeout(this.timeout),!this.model.get("persistent")){var t=this;this.timeout=window.setTimeout(function(){t.model.set("message","")},3e3)}}else this.$el.fadeOut();return this},messageForDisplay:function(){return r.escape(this.model.get("message"))}}),u=h.extend({messageForDisplay:function(){return this.model.get("message")}}),p=a.View.extend({initialize:function(e){this.model=e&&e.model||new a.Model({type:"text",placeholder:"",disabled:!1,readonly:!1,visible:!0,cls:"",area:!1,color:null,style:null}).set(e),this.tagName=this.model.get("area")?"textarea":"input",this.setElement(o("<"+this.tagName+"/>")),this.listenTo(this.model,"change",this.render,this),this.render()},events:{input:"_onchange"},value:function(e){return void 0!==e&&this.model.set("value","string"==typeof e?e:""),this.model.get("value")},render:function(){var e=this;this.$el.removeClass().addClass("ui-"+this.tagName).addClass(this.model.get("cls")).addClass(this.model.get("style")).attr("id",this.model.id).attr("type",this.model.get("type")).attr("placeholder",this.model.get("placeholder")).css("color",this.model.get("color")||"").css("border-color",this.model.get("color")||"");var t=this.model.get("datalist");return o.isArray(t)&&t.length>0&&this.$el.autocomplete({source:function(t,i){i(e.model.get("datalist"))},change:function(){e._onchange()}}),this.model.get("value")!==this.$el.val()&&this.$el.val(this.model.get("value")),r.each(["readonly","disabled"],function(t){e.model.get(t)?e.$el.attr(t,!0):e.$el.removeAttr(t)}),this.$el[this.model.get("visible")?"show":"hide"](),this},_onchange:function(){this.value(this.$el.val()),this.model.get("onchange")&&this.model.get("onchange")(this.model.get("value"))}}),f=a.View.extend({initialize:function(e){this.model=e&&e.model||new a.Model(e),this.setElement(o("
").append(this.$info=o("
")).append(this.$hidden=o("
"))),this.listenTo(this.model,"change",this.render,this),this.render()},value:function(e){return void 0!==e&&this.model.set("value",e),this.model.get("value")},render:function(){return this.$el.attr("id",this.model.id),this.$hidden.val(this.model.get("value")),this.model.get("info")?this.$info.show().text(this.model.get("info")):this.$info.hide(),this}}),g=a.View.extend({initialize:function(e){var t=this;this.model=e&&e.model||new a.Model(e),this.setElement(o("
").append(this.$info=o("
")).append(this.$file=o("").attr("type","file").addClass("ui-margin-bottom")).append(this.$text=o("',"
","
"].join("")}});return{CitationView:n,CitationListView:s}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3))},function(e,t,i){var n,s;(function(a,o,r){n=[i(49),i(41),i(6),i(5)],s=function(e,t,i,n){"use strict";var s=e.FoldoutListItemView,l=e.ListItemView,c=s.extend({className:s.prototype.className+" dataset-collection",id:function(){return["dataset_collection",this.model.get("id")].join("-")},initialize:function(e){this.linkTarget=e.linkTarget||"_blank",this.hasUser=e.hasUser,s.prototype.initialize.call(this,e)},_setUpListeners:function(){s.prototype._setUpListeners.call(this),this.listenTo(this.model,"change",function(e,t){a.has(e.changed,"deleted")?this.render():a.has(e.changed,"element_count")&&this.$("> .title-bar .subtitle").replaceWith(this._renderSubtitle())})},_renderSubtitle:function(){return o(this.templates.subtitle(this.model.toJSON(),this))},_getFoldoutPanelOptions:function(){var e=s.prototype._getFoldoutPanelOptions.call(this);return a.extend(e,{linkTarget:this.linkTarget,hasUser:this.hasUser})},$selector:function(){return this.$("> .selector")},toString:function(){var e=this.model?this.model+"":"(no model)";return"DCListItemView("+e+")"}});c.prototype.templates=function(){var e=a.extend({},s.prototype.templates.warnings,{error:i.wrapTemplate(["<% if( model.error ){ %>",'
',n("There was an error getting the data for this collection"),": <%- model.error %>","
","<% } %>"]),purged:i.wrapTemplate(["<% if( model.purged ){ %>",'
',n("This collection has been deleted and removed from disk"),"
","<% } %>"]),deleted:i.wrapTemplate(["<% if( model.deleted && !model.purged ){ %>",'
',n("This collection has been deleted"),"
","<% } %>"])}),t=i.wrapTemplate(['
','
','<%- collection.element_identifier || collection.name %>',"
",'
',"
"],"collection"),o=i.wrapTemplate(['
','<% var countText = collection.element_count? ( collection.element_count + " " ) : ""; %>','<% if( collection.collection_type === "list" ){ %>',n("a list of <%- countText %>datasets"),'<% } else if( collection.collection_type === "paired" ){ %>',n("a pair of datasets"),'<% } else if( collection.collection_type === "list:paired" ){ %>',n("a list of <%- countText %>dataset pairs"),'<% } else if( collection.collection_type === "list:list" ){ %>',n("a list of <%- countText %>dataset lists"),"<% } %>","
"],"collection");return a.extend({},s.prototype.templates,{warnings:e,titleBar:t,subtitle:o})}();var d=l.extend({className:l.prototype.className+" dataset-collection-element",initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger),this.log("DCEListItemView.initialize:",e),l.prototype.initialize.call(this,e)},toString:function(){var e=this.model?this.model+"":"(no model)";return"DCEListItemView("+e+")"}});d.prototype.templates=function(){var e=i.wrapTemplate(['
','
','<%- element.element_identifier %>',"
",'
',"
"],"element");return a.extend({},l.prototype.templates,{titleBar:e})}();var h=t.DatasetListItemView.extend({className:t.DatasetListItemView.prototype.className+" dataset-collection-element",initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger),this.log("DatasetDCEListItemView.initialize:",e),t.DatasetListItemView.prototype.initialize.call(this,e)},_fetchModelDetails:function(){var e=this;return e.model.inReadyState()&&!e.model.hasDetails()?e.model.fetch({silent:!0}):r.when()},toString:function(){var e=this.model?this.model+"":"(no model)";return"DatasetDCEListItemView("+e+")"}});h.prototype.templates=function(){var e=i.wrapTemplate(['
','','
','<%- element.element_identifier %>',"
","
"],"element");return a.extend({},t.DatasetListItemView.prototype.templates,{titleBar:e})}();var u=c.extend({className:c.prototype.className+" dataset-collection-element",_swapNewRender:function(e){c.prototype._swapNewRender.call(this,e);var t=this.model.get("state")||"ok";return this.$el.addClass("state-"+t),this.$el},toString:function(){var e=this.model?this.model+"":"(no model)";return"NestedDCDCEListItemView("+e+")"}});return{DCListItemView:c,DCEListItemView:d,DatasetDCEListItemView:h,NestedDCDCEListItemView:u}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2),i(1),i(1))},function(e,t,i){var n,s;(function(a,o,r){n=[i(76),i(6),i(5)],s=function(e,t,i){"use strict";var n={defaults:{model_class:"DatasetCollectionElement",element_identifier:null,element_index:null,element_type:null},_mergeObject:function(e){return a.extend(e,e.object,{element_id:e.id}),delete e.object,e},constructor:function(e,t){e=this._mergeObject(e),this.idAttribute="element_id",o.Model.apply(this,arguments)},parse:function(e,t){var i=e;return i=this._mergeObject(i)}},s=o.Model.extend(t.LoggableMixin).extend(n).extend({_logNamespace:"collections"}),l=o.Collection.extend(t.LoggableMixin).extend({_logNamespace:"collections",model:s,toString:function(){return["DatasetCollectionElementCollection(",this.length,")"].join("")}}),c=e.DatasetAssociation.extend(t.mixin(n,{url:function(){return this.has("history_id")?Galaxy.root+"api/histories/"+this.get("history_id")+"/contents/"+this.get("id"):(console.warn("no endpoint for non-hdas within a collection yet"),Galaxy.root+"api/datasets")},defaults:a.extend({},e.DatasetAssociation.prototype.defaults,n.defaults),_downloadQueryParameters:function(){return"?to_ext="+this.get("file_ext")+"&hdca_id="+this.get("parent_hdca_id")+"&element_identifier="+this.get("element_identifier")},constructor:function(e,t){this.debug("\t DatasetDCE.constructor:",e,t),n.constructor.call(this,e,t)},hasDetails:function(){return this.elements&&this.elements.length},toString:function(){var e=this.get("element_identifier");return["DatasetDCE(",e,")"].join("")}})),d=l.extend({model:c,toString:function(){return["DatasetDCECollection(",this.length,")"].join("")}}),h=o.Model.extend(t.LoggableMixin).extend(t.SearchableModelMixin).extend({_logNamespace:"collections",defaults:{collection_type:null,deleted:!1},collectionClass:l,initialize:function(e,t){this.debug(this+"(DatasetCollection).initialize:",e,t,this),this.elements=this._createElementsModel(),this.on("change:elements",function(){this.log("change:elements"),this.elements=this._createElementsModel()})},_createElementsModel:function(){this.debug(this+"._createElementsModel",this.collectionClass,this.get("elements"),this.elements);var e=this.get("elements")||[];this.unset("elements",{silent:!0});var t=this;return a.each(e,function(e,i){a.extend(e,{parent_hdca_id:t.get("id")})}),this.elements=new this.collectionClass(e),this.elements},toJSON:function(){var e=o.Model.prototype.toJSON.call(this);return this.elements&&(e.elements=this.elements.toJSON()),e},inReadyState:function(){var e=this.get("populated");return this.isDeletedOrPurged()||e},hasDetails:function(){return 0!==this.elements.length},getVisibleContents:function(e){return this.elements},parse:function(e,t){var i=o.Model.prototype.parse.call(this,e,t);return i.create_time&&(i.create_time=new Date(i.create_time)),i.update_time&&(i.update_time=new Date(i.update_time)),i},delete:function(e){return this.get("deleted")?r.when():this.save({deleted:!0},e)},undelete:function(e){return!this.get("deleted")||this.get("purged")?r.when():this.save({deleted:!1},e)},isDeletedOrPurged:function(){return this.get("deleted")||this.get("purged")},searchAttributes:["name"],toString:function(){var e=[this.get("id"),this.get("name")||this.get("element_identifier")];return"DatasetCollection("+e.join(",")+")"}}),u=h.extend({collectionClass:d,toString:function(){return"List"+h.prototype.toString.call(this)}}),p=u.extend({toString:function(){return"Pair"+h.prototype.toString.call(this)}}),f=h.extend(t.mixin(n,{constructor:function(e,t){this.debug("\t NestedDCDCE.constructor:",e,t),n.constructor.call(this,e,t)},toString:function(){var e=this.object?""+this.object:this.get("element_identifier");return["NestedDCDCE(",e,")"].join("")}})),g=l.extend({model:f,toString:function(){return["NestedDCDCECollection(",this.length,")"].join("")}}),m=p.extend(t.mixin(n,{constructor:function(e,t){this.debug("\t NestedPairDCDCE.constructor:",e,t),n.constructor.call(this,e,t)},toString:function(){var e=this.object?""+this.object:this.get("element_identifier");return["NestedPairDCDCE(",e,")"].join("")}})),v=g.extend({model:m,toString:function(){return["NestedPairDCDCECollection(",this.length,")"].join("")}}),_=h.extend({collectionClass:v,toString:function(){return["ListPairedDatasetCollection(",this.get("name"),")"].join("")}}),y=u.extend(t.mixin(n,{constructor:function(e,t){this.debug("\t NestedListDCDCE.constructor:",e,t),n.constructor.call(this,e,t)},toString:function(){var e=this.object?""+this.object:this.get("element_identifier");return["NestedListDCDCE(",e,")"].join("")}})),w=g.extend({model:y,toString:function(){return["NestedListDCDCECollection(",this.length,")"].join("")}}),b=h.extend({collectionClass:w,toString:function(){return["ListOfListsDatasetCollection(",this.get("name"),")"].join("")}});return{ListDatasetCollection:u,PairDatasetCollection:p,ListPairedDatasetCollection:_,ListOfListsDatasetCollection:b}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2),i(3),i(1))},function(e,t,i){var n,s;(function(a,o,r,l){n=[i(46),i(11),i(6),i(73),i(8),i(92),i(5),i(89)],s=function(e,t,i,n,s,c,d){"use strict";function h(e,t){var i=e.toJSON(),n=m(i,{defaultHideSourceItems:t,creationFn:function(t,i,n){return t=t.map(function(e){return{id:e.id,name:e.name,src:"dataset"===e.history_content_type?"hda":"hdca"}}),e.createHDCA(t,"list",i,n)}});return n}var u="collections",p=a.View.extend(i.LoggableMixin).extend({_logNamespace:u,tagName:"li",className:"collection-element",initialize:function(e){this.element=e.element||{},this.selected=e.selected||!1},render:function(){return this.$el.attr("data-element-id",this.element.id).attr("draggable",!0).html(this.template({element:this.element})),this.selected&&this.$el.addClass("selected"),this},template:o.template(['',"<%- element.name %>","",'"].join("")),select:function(e){this.$el.toggleClass("selected",e),this.trigger("select",{source:this,selected:this.$el.hasClass("selected")})},discard:function(){var e=this,t=this.$el.parent().width();this.$el.animate({"margin-right":t},"fast",function(){e.trigger("discard",{source:e}),e.destroy()})},destroy:function(){this.off(),this.$el.remove()},events:{click:"_click","click .name":"_clickName","click .discard":"_clickDiscard",dragstart:"_dragstart",dragend:"_dragend",dragover:"_sendToParent",drop:"_sendToParent"},_click:function(e){e.stopPropagation(),this.select(e)},_clickName:function(e){e.stopPropagation(),e.preventDefault();var t=([d("Enter a new name for the element"),":\n(",d("Note that changing the name here will not rename the dataset"),")"].join(""),prompt(d("Enter a new name for the element")+":",this.element.name));t&&(this.element.name=t,this.render())},_clickDiscard:function(e){e.stopPropagation(),this.discard()},_dragstart:function(e){e.originalEvent&&(e=e.originalEvent),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",JSON.stringify(this.element)),this.$el.addClass("dragging"),this.$el.parent().trigger("collection-element.dragstart",[this])},_dragend:function(e){this.$el.removeClass("dragging"),this.$el.parent().trigger("collection-element.dragend",[this])},_sendToParent:function(e){this.$el.parent().trigger(e)},toString:function(){return"DatasetCollectionElementView()"}}),f=a.View.extend(i.LoggableMixin).extend(n.CollectionCreatorMixin).extend({_logNamespace:u,elementViewClass:p,collectionClass:e.HistoryListDatasetCollection,className:"list-collection-creator collection-creator flex-row-container",minElements:1,defaultAttributes:{creationFn:function(){throw new TypeError("no creation fn for creator")},oncreate:function(){},oncancel:function(){},autoscrollDist:24,highlightClr:"rgba( 64, 255, 255, 1.0 )"},footerSettings:{".hide-originals":"hideOriginals"},initialize:function(e){this.metric("ListCollectionCreator.initialize",e);var t=this;o.each(this.defaultAttributes,function(i,n){i=e[n]||i,t[n]=i}),t.initialElements=e.elements||[],this._setUpCommonSettings(e),this._instanceSetUp(),this._elementsSetUp(),this._setUpBehaviors()},_instanceSetUp:function(){this.selectedIds={},this.$dragging=null,this.blocking=!1},_elementsSetUp:function(){this.invalidElements=[],this.workingElements=[],this.elementViews=[],this.workingElements=this.initialElements.slice(0),this._ensureElementIds(),this._validateElements(),this._mangleDuplicateNames(),this._sortElements()},_ensureElementIds:function(){return this.workingElements.forEach(function(e){e.hasOwnProperty("id")||(e.id=o.uniqueId())}),this.workingElements},_validateElements:function(){var e=this;return e.invalidElements=[],this.workingElements=this.workingElements.filter(function(t){var i=e._isElementInvalid(t);return i&&e.invalidElements.push({element:t,text:i}),!i}),this.workingElements},_isElementInvalid:function(e){if("dataset"!==e.history_content_type)return d("is not a dataset");var i=e.state===t.OK||o.contains(t.NOT_READY_STATES,e.state);return i?e.deleted||e.purged?d("has been deleted or purged"):null:d("has errored, is paused, or is not accessible")},_mangleDuplicateNames:function(){var e=900,t=1,i={};this.workingElements.forEach(function(n){for(var s=n.name;i.hasOwnProperty(s);)if(s=n.name+" ("+t+")",t+=1,t>=e)throw new Error("Safety hit in while loop - thats impressive");n.name=s,i[n.name]=!0})},_sortElements:function(e){},render:function(e,t){return this.workingElements.length .clear-selected").show():this.$(".collection-elements-controls > .clear-selected").hide()},_renderList:function(e,t){var i=this,n=l("
"),s=i.$list();o.each(this.elementViews,function(e){e.destroy(),i.removeElementView(e)}),i.workingElements.forEach(function(e){var t=i._createElementView(e);n.append(t.$el)}),i._renderClearSelected(),s.empty().append(n.children()),o.invoke(i.elementViews,"render"),s.height()>s.css("max-height")?s.css("border-width","1px 0px 1px 0px"):s.css("border-width","0px")},_createElementView:function(e){var t=new this.elementViewClass({element:e,selected:o.has(this.selectedIds,e.id)});return this.elementViews.push(t),this._listenToElementView(t),t},_listenToElementView:function(e){var t=this;t.listenTo(e,{select:function(e){var i=e.source.element;e.selected?t.selectedIds[i.id]=!0:delete t.selectedIds[i.id],t.trigger("elements:select",e)},discard:function(e){t.trigger("elements:discard",e)}})},addElementView:function(e){},removeElementView:function(e){delete this.selectedIds[e.element.id],this._renderClearSelected(),this.elementViews=o.without(this.elementViews,e),this.stopListening(e)},_renderNoElementsLeft:function(){this._disableNameAndCreate(!0),this.$(".collection-elements").append(this.templates.noElementsLeft())},_elementToJSON:function(e){return e},createList:function(e){if(!this.workingElements.length){var t=d("No valid elements for final list")+". ";return t+=''+d("Cancel")+" ",t+=d("or"),t+=' '+d("start over")+".",void this._showAlert(t)}var i=this,n=this.workingElements.map(function(e){return i._elementToJSON(e)});return i.blocking=!0,i.creationFn(n,e,i.hideOriginals).always(function(){i.blocking=!1}).fail(function(e,t,n){i.trigger("error",{xhr:e,status:t,message:d("An error occurred while creating this collection")})}).done(function(e,t,n){i.trigger("collection:created",e,t,n),i.metric("collection:created",e),"function"==typeof i.oncreate&&i.oncreate.call(this,e,t,n)})},_setUpBehaviors:function(){return this.on("error",this._errorHandler),this.once("rendered",function(){this.trigger("rendered:initial",this)}),this.on("elements:select",function(e){this._renderClearSelected()}),this.on("elements:discard",function(e){var t=e.source.element;this.removeElementView(e.source),this.workingElements=o.without(this.workingElements,t),this.workingElements.length||this._renderNoElementsLeft()}),this},_errorHandler:function(e){this.error(e);var t=this;if(content=e.message||d("An error occurred"),e.xhr){var i=e.xhr,n=e.message;0===i.readyState&&0===i.status?content+=": "+d("Galaxy could not be reached and may be updating.")+d(" Try again in a few minutes."):i.responseJSON?content+=":
"+JSON.stringify(i.responseJSON)+"
":content+=": "+n}t._showAlert(content,"alert-danger")},events:{"click .more-help":"_clickMoreHelp","click .less-help":"_clickLessHelp","click .main-help":"_toggleHelp","click .header .alert button":"_hideAlert","click .reset":"reset","click .clear-selected":"clearSelectedElements","click .collection-elements":"clearSelectedElements","dragover .collection-elements":"_dragoverElements","drop .collection-elements":"_dropElements","collection-element.dragstart .collection-elements":"_elementDragstart","collection-element.dragend .collection-elements":"_elementDragend","change .collection-name":"_changeName","keydown .collection-name":"_nameCheckForEnter","change .hide-originals":"_changeHideOriginals","click .cancel-create":"_cancelCreate","click .create-collection":"_clickCreate"},reset:function(){this._instanceSetUp(),this._elementsSetUp(),this.render()},clearSelectedElements:function(e){this.$(".collection-elements .collection-element").removeClass("selected"),this.$(".collection-elements-controls > .clear-selected").hide()},_dragoverElements:function(e){e.preventDefault();var t=this.$list();this._checkForAutoscroll(t,e.originalEvent.clientY);var i=this._getNearestElement(e.originalEvent.clientY);this.$(".element-drop-placeholder").remove();var n=r('
');i.length?i.before(n):t.append(n)},_checkForAutoscroll:function(e,t){var i=2,n=e.offset(),s=e.scrollTop(),a=t-n.top,o=n.top+e.outerHeight()-t;a>=0&&a=0&&oe&&a-o','',d("More help"),"",'","
",'
','','',"
"].join("")),middle:o.template(['",'
',"
"].join("")),footer:o.template(['
','
','","
",'
','','
',d("Name"),":
","
","
",'
','
','",'
','",'","
","
",'
','","
","
"].join("")),helpContent:o.template(["

",d(["Collections of datasets are permanent, ordered lists of datasets that can be passed to tools and ","workflows in order to have analyses done on each member of the entire group. This interface allows ","you to create a collection and re-order the final collection."].join("")),"

","
    ","
  • ",d(["Rename elements in the list by clicking on ",'the existing name.'].join("")),"
  • ","
  • ",d(["Discard elements from the final created list by clicking on the ",'"Discard" button.'].join("")),"
  • ","
  • ",d(["Reorder the list by clicking and dragging elements. Select multiple elements by clicking on ",'them and you can then move those selected by dragging the ',"entire group. Deselect them by clicking them again or by clicking the ",'the "Clear selected" link.'].join("")),"
  • ","
  • ",d(['Click the "Start over" link to begin again as if you had just opened ',"the interface."].join("")),"
  • ","
  • ",d(['Click the "Cancel" button to exit the interface.'].join("")),"
  • ","

","

",d(['Once your collection is complete, enter a name and ','click "Create list".'].join("")),"

"].join("")),invalidElements:o.template([d("The following selections could not be included due to problems:"),"
    <% _.each( problems, function( problem ){ %>","
  • <%- problem.element.name %>: <%- problem.text %>
  • ","<% }); %>
"].join("")),noElementsLeft:o.template(['
  • ',d("No elements left! "),d("Would you like to "),'',d("start over"),"?","
  • "].join("")),invalidInitial:o.template(['
    ','
    ','',"<% if( _.size( problems ) ){ %>",d("The following selections could not be included due to problems"),":","
      <% _.each( problems, function( problem ){ %>","
    • <%- problem.element.name %>: <%- problem.text %>
    • ","<% }); %>
    ","<% } else if( _.size( elements ) < 1 ){ %>",d("No datasets were selected"),".","<% } %>","
    ",d("At least one element is needed for the collection"),". ",d("You may need to "),'',d("cancel")," ",d("and reselect new elements"),".","
    ","
    ","
    ",'"].join(""))}),toString:function(){return"ListCollectionCreator"}}),g=function(e,t,i){var n,a=l.Deferred(),r=Galaxy.modal||new s.View;return t=o.defaults(t||{},{elements:e,oncancel:function(){r.hide(),a.reject("cancelled")},oncreate:function(e,t){r.hide(),a.resolve(t)}}),n=new i(t),r.show({title:t.title||d("Create a collection"),body:n.$el,width:"80%",height:"100%",closing_events:!0}),n.render(),window._collectionCreator=n,a},m=function(e,t){return t=t||{},t.title=d("Create a collection from a list of datasets"),g(e,t,f)};return{DatasetCollectionElementView:p,ListCollectionCreator:f,collectionCreatorModal:g,listCollectionCreatorModal:m,createListCollection:h}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(2),i(1),i(1))},function(e,t,i){var n,s;(function(a,o,r,l){n=[i(49),i(11),i(18),i(6),i(5)],s=function(e,t,i,n,s){"use strict";var c="dataset",d=e.ListItemView,h=d.extend({_logNamespace:c,className:d.prototype.className+" dataset",id:function(){return["dataset",this.model.get("id")].join("-")},initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger),this.log(this+".initialize:",e),d.prototype.initialize.call(this,e),this.linkTarget=e.linkTarget||"_blank"},_setUpListeners:function(){d.prototype._setUpListeners.call(this);var e=this;return e.listenTo(e.model,{change:function(t){e.model.changedAttributes().state&&e.model.inReadyState()&&e.expanded&&!e.model.hasDetails()?e.model.fetch({silent:!0}).done(function(){e.render()}):a.has(t.changed,"tags")&&1===a.keys(t.changed).length?e.$(".nametags").html(e._renderNametags()):e.render()}})},_fetchModelDetails:function(){var e=this;return e.model.inReadyState()&&!e.model.hasDetails()?e.model.fetch({silent:!0}):o.when()},remove:function(e,t){var i=this;e=e||this.fxSpeed,this.$el.fadeOut(e,function(){r.View.prototype.remove.call(i),t&&t.call(i)})},_swapNewRender:function(e){return d.prototype._swapNewRender.call(this,e),this.model.has("state")&&this.$el.addClass("state-"+this.model.get("state")), this.$el},_renderPrimaryActions:function(){return[this._renderDisplayButton()]},_renderDisplayButton:function(){var e=this.model.get("state");if(e===t.NOT_VIEWABLE||e===t.DISCARDED||!this.model.get("accessible"))return null;var n={target:this.linkTarget,classes:"display-btn"};if(this.model.get("purged"))n.disabled=!0,n.title=s("Cannot display datasets removed from disk");else if(e===t.UPLOAD)n.disabled=!0,n.title=s("This dataset must finish uploading before it can be viewed");else if(e===t.NEW)n.disabled=!0,n.title=s("This dataset is not yet viewable");else{n.title=s("View data"),n.href=this.model.urls.display;var a=this;n.onclick=function(e){Galaxy.frame&&Galaxy.frame.active&&(Galaxy.frame.addDataset(a.model.get("id")),e.preventDefault())}}return n.faIcon="fa-eye",i(n)},_renderDetails:function(){if(this.model.get("state")===t.NOT_VIEWABLE)return l(this.templates.noAccess(this.model.toJSON(),this));var e=d.prototype._renderDetails.call(this);return e.find(".actions .left").empty().append(this._renderSecondaryActions()),e.find(".summary").html(this._renderSummary()).prepend(this._renderDetailMessages()),e.find(".display-applications").html(this._renderDisplayApplications()),this._setUpBehaviors(e),e},_renderSummary:function(){var e=this.model.toJSON(),t=this.templates.summaries[e.state];return(t=t||this.templates.summaries.unknown)(e,this)},_renderDetailMessages:function(){var e=this,t=l('
    '),i=e.model.toJSON();return a.each(e.templates.detailMessages,function(n){t.append(l(n(i,e)))}),t},_renderDisplayApplications:function(){return this.model.isDeletedOrPurged()?"":[this.templates.displayApplications(this.model.get("display_apps"),this),this.templates.displayApplications(this.model.get("display_types"),this)].join("")},_renderSecondaryActions:function(){switch(this.debug("_renderSecondaryActions"),this.model.get("state")){case t.NOT_VIEWABLE:return[];case t.OK:case t.FAILED_METADATA:case t.ERROR:return[this._renderDownloadButton(),this._renderShowParamsButton()]}return[this._renderShowParamsButton()]},_renderShowParamsButton:function(){return i({title:s("View details"),classes:"params-btn",href:this.model.urls.show_params,target:this.linkTarget,faIcon:"fa-info-circle",onclick:function(e){Galaxy.frame&&Galaxy.frame.active&&(Galaxy.frame.add({title:"Dataset details",url:this.href}),e.preventDefault(),e.stopPropagation())}})},_renderDownloadButton:function(){return this.model.get("purged")||!this.model.hasData()?null:a.isEmpty(this.model.get("meta_files"))?l(['','',""].join("")):this._renderMetaFileDownloadButton()},_renderMetaFileDownloadButton:function(){var e=this.model.urls;return l(['"].join("\n"))},_renderNametags:function(){var e=a.template(["<% _.each(_.sortBy(_.uniq(tags), function(x) { return x }), function(tag){ %>",'<% if (tag.indexOf("name:") == 0){ %>','<%- tag.slice(5) %>',"<% } %>","<% }); %>"].join(""));return e({tags:this.model.get("tags")})},events:a.extend(a.clone(d.prototype.events),{"click .display-btn":function(e){this.trigger("display",this,e)},"click .params-btn":function(e){this.trigger("params",this,e)},"click .download-btn":function(e){this.trigger("download",this,e)}}),toString:function(){var e=this.model?this.model+"":"(no model)";return"DatasetListItemView("+e+")"}});return h.prototype.templates=function(){var e=a.extend({},d.prototype.templates.warnings,{failed_metadata:n.wrapTemplate(['<% if( model.state === "failed_metadata" ){ %>','
    ',s("An error occurred setting the metadata for this dataset"),"
    ","<% } %>"]),error:n.wrapTemplate(["<% if( model.error ){ %>",'
    ',s("There was an error getting the data for this dataset"),": <%- model.error %>","
    ","<% } %>"]),purged:n.wrapTemplate(["<% if( model.purged ){ %>",'
    ',s("This dataset has been deleted and removed from disk"),"
    ","<% } %>"]),deleted:n.wrapTemplate(["<% if( model.deleted && !model.purged ){ %>",'
    ',s("This dataset has been deleted"),"
    ","<% } %>"])}),i=n.wrapTemplate(['
    ','
    ','
    ','
    ','
    ',"
    ","<% if( !dataset.deleted && !dataset.purged ){ %>",'
    ','
    ','
    ',"<% if( dataset.peek ){ %>",'
    <%= dataset.peek %>
    ',"<% } %>","<% } %>","
    "],"dataset"),o=n.wrapTemplate(['
    ','
    ',s("You do not have permission to view this dataset"),"
    ","
    "],"dataset"),r={};r[t.OK]=r[t.FAILED_METADATA]=n.wrapTemplate(["<% if( dataset.misc_blurb ){ %>",'
    ','<%- dataset.misc_blurb %>',"
    ","<% } %>","<% if( dataset.file_ext ){ %>",'
    ','",'<%- dataset.file_ext %>',"
    ","<% } %>","<% if( dataset.metadata_dbkey ){ %>",'
    ','",'',"<%- dataset.metadata_dbkey %>","","
    ","<% } %>","<% if( dataset.misc_info ){ %>",'
    ','<%- dataset.misc_info %>',"
    ","<% } %>"],"dataset"),r[t.NEW]=n.wrapTemplate(["
    ",s("This is a new dataset and not all of its data are available yet"),"
    "],"dataset"),r[t.NOT_VIEWABLE]=n.wrapTemplate(["
    ",s("You do not have permission to view this dataset"),"
    "],"dataset"),r[t.DISCARDED]=n.wrapTemplate(["
    ",s("The job creating this dataset was cancelled before completion"),"
    "],"dataset"),r[t.QUEUED]=n.wrapTemplate(["
    ",s("This job is waiting to run"),"
    "],"dataset"),r[t.RUNNING]=n.wrapTemplate(["
    ",s("This job is currently running"),"
    "],"dataset"),r[t.UPLOAD]=n.wrapTemplate(["
    ",s("This dataset is currently uploading"),"
    "],"dataset"),r[t.SETTING_METADATA]=n.wrapTemplate(["
    ",s("Metadata is being auto-detected"),"
    "],"dataset"),r[t.PAUSED]=n.wrapTemplate(["
    ",s('This job is paused. Use the "Resume Paused Jobs" in the history menu to resume'),"
    "],"dataset"),r[t.ERROR]=n.wrapTemplate(["<% if( !dataset.purged ){ %>","
    <%- dataset.misc_blurb %>
    ","<% } %>",'',s("An error occurred with this dataset"),":",'
    <%- dataset.misc_info %>
    '],"dataset"),r[t.EMPTY]=n.wrapTemplate(["
    ",s("No data"),": <%- dataset.misc_blurb %>
    "],"dataset"),r.unknown=n.wrapTemplate(['
    Error: unknown dataset state: "<%- dataset.state %>"
    '],"dataset");var l={resubmitted:n.wrapTemplate(["<% if( model.resubmitted ){ %>",'
    ',s("The job creating this dataset has been resubmitted"),"
    ","<% } %>"])},c=n.wrapTemplate(["<% _.each( apps, function( app ){ %>",'
    ','<%- app.label %> ','',"<% _.each( app.links, function( link ){ %>",'',"<% print( _l( link.text ) ); %>"," ","<% }); %>","","
    ","<% }); %>"],"apps");return a.extend({},d.prototype.templates,{warnings:e,details:i,noAccess:o,summaries:r,detailMessages:l,displayApplications:c})}(),{DatasetListItemView:h}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2),i(1),i(3),i(1))},function(e,t,i){var n,s;(function(i,a,o){n=[],s=function(){return i.View.extend({initialize:function(e,t){this.app=e,this.app_options=e.model?e.model.attributes:{},this.field=t&&t.field||new i.View,this.model=t&&t.model||new i.Model({text_enable:this.app_options.text_enable||"Enable",text_disable:this.app_options.text_disable||"Disable",cls_enable:this.app_options.cls_enable||"fa fa-caret-square-o-down",cls_disable:this.app_options.cls_disable||"fa fa-caret-square-o-up",always_refresh:this.app_options.always_refresh}).set(t),this.setElement(this._template()),this.$field=this.$(".ui-form-field"),this.$info=this.$(".ui-form-info"),this.$preview=this.$(".ui-form-preview"),this.$collapsible=this.$(".ui-form-collapsible"),this.$collapsible_text=this.$(".ui-form-collapsible-text"),this.$collapsible_icon=this.$(".ui-form-collapsible-icon"),this.$title=this.$(".ui-form-title"),this.$title_text=this.$(".ui-form-title-text"),this.$error_text=this.$(".ui-form-error-text"),this.$error=this.$(".ui-form-error"),this.$backdrop=this.$(".ui-form-backdrop"),this.$field.prepend(this.field.$el);var n=this.model.get("collapsible_value");this.field.collapsed=void 0!==n&&JSON.stringify(this.model.get("value"))==JSON.stringify(n),this.listenTo(this.model,"change",this.render,this),this.render();var s=this;this.$collapsible.on("click",function(){s.field.collapsed=!s.field.collapsed,e.trigger&&e.trigger("change"),s.render()}),this.field.model&&!this.model.get("always_refresh")&&this.listenTo(this.field.model,"change:value",function(){s.reset()})},backdrop:function(){this.model.set("backdrop",!0)},error:function(e){this.model.set("error_text",e)},reset:function(){!this.model.get("fixed")&&this.model.set("error_text",null)},render:function(){a(".tooltip").hide();var e=this.model.get("help",""),t=this.model.get("argument");t&&e.indexOf("("+t+")")==-1&&(e+=" ("+t+")"),this.$info.html(e),this.$el[this.model.get("hidden")?"hide":"show"](),this.$preview[this.field.collapsed&&this.model.get("collapsible_preview")||this.model.get("disabled")?"show":"hide"]().html(o.escape(this.model.get("text_value")));var i=this.model.get("error_text");if(this.$error[i?"show":"hide"](),this.$el[i?"addClass":"removeClass"]("ui-error"),this.$error_text.html(i),this.$backdrop[this.model.get("backdrop")?"show":"hide"](),this.field.collapsed||this.model.get("disabled")?this.$field.hide():this.$field.show(),this.field.model&&this.field.model.set({color:this.model.get("color"),style:this.model.get("style")}),this.model.get("disabled")||void 0===this.model.get("collapsible_value"))this.$title_text.show().text(this.model.get("label")),this.$collapsible.hide();else{var n=this.field.collapsed?"enable":"disable";this.$title_text.hide(),this.$collapsible.show(),this.$collapsible_text.text(this.model.get("label")),this.$collapsible_icon.removeClass().addClass("icon").addClass(this.model.get("cls_"+n)).attr("data-original-title",this.model.get("text_"+n)).tooltip({placement:"bottom"})}},_template:function(){return a("
    ").addClass("ui-form-element").append(a("
    ").addClass("ui-form-error ui-error").append(a("").addClass("fa fa-arrow-down")).append(a("").addClass("ui-form-error-text"))).append(a("
    ").addClass("ui-form-title").append(a("
    ").addClass("ui-form-collapsible").append(a("").addClass("ui-form-collapsible-icon")).append(a("").addClass("ui-form-collapsible-text"))).append(a("").addClass("ui-form-title-text"))).append(a("
    ").addClass("ui-form-field").append(a("").addClass("ui-form-info")).append(a("
    ").addClass("ui-form-backdrop"))).append(a("
    ").addClass("ui-form-preview"))}})}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1),i(2))},function(e,t,i){var n,s;(function(a,o,r){n=[i(4),i(7),i(55),i(57),i(56),i(53)],s=function(e,t,i,n,s,l){return a.Model.extend({types:{text:"_fieldText",password:"_fieldText",select:"_fieldSelect",data_column:"_fieldSelect",genomebuild:"_fieldSelect",data:"_fieldData",data_collection:"_fieldData",integer:"_fieldSlider",float:"_fieldSlider",boolean:"_fieldBoolean",drill_down:"_fieldDrilldown",color:"_fieldColor",hidden:"_fieldHidden",hidden_data:"_fieldHidden",baseurl:"_fieldHidden",library_data:"_fieldLibrary",ftpfile:"_fieldFtp",upload:"_fieldUpload"},create:function(e){var t=this.types[e.type],i="function"==typeof this[t]?this[t].call(this,e):null;return i||(i=e.options?this._fieldSelect(e):this._fieldText(e),Galaxy.emit.debug("form-parameters::_addRow()","Auto matched field type ("+e.type+").")),void 0===e.value&&(e.value=null),i.value(e.value),i},_fieldData:function(e){return new i.View({id:"field-"+e.id,extensions:e.extensions,optional:e.optional,multiple:e.multiple,type:e.type,flavor:e.flavor,data:e.options,onchange:e.onchange})},_fieldSelect:function(e){if(e.is_workflow)return this._fieldText(e);"data_column"==e.type&&(e.error_text="Missing columns in referenced dataset.");var i=e.data;i||(i=[],o.each(e.options,function(e){i.push({label:e[0],value:e[1]})}));var n=t.Select;switch(e.display){case"checkboxes":n=t.Checkbox;break;case"radio":n=t.Radio;break;case"radiobutton":n=t.RadioButton}return new n.View({id:"field-"+e.id,data:i,error_text:e.error_text||"No options available",multiple:e.multiple,optional:e.optional,onchange:e.onchange,searchable:"workflow"!==e.flavor})},_fieldDrilldown:function(e){return e.is_workflow?this._fieldText(e):new t.Drilldown.View({id:"field-"+e.id,data:e.options,display:e.display,optional:e.optional,onchange:e.onchange})},_fieldText:function(i){if(i.options&&i.data)if(i.area=i.multiple,e.isEmpty(i.value))i.value=null;else if(r.isArray(i.value)){var n="";for(var s in i.value){if(n+=String(i.value[s]),!i.multiple)break;n+="\n"}i.value=n}return new t.Input({id:"field-"+i.id,type:i.type,area:i.area,readonly:i.readonly,placeholder:i.placeholder,datalist:i.datalist,onchange:i.onchange})},_fieldSlider:function(e){return new t.Slider.View({id:"field-"+e.id,precise:"float"==e.type,is_workflow:e.is_workflow,min:e.min,max:e.max,onchange:e.onchange})},_fieldHidden:function(e){return new t.Hidden({id:"field-"+e.id,info:e.info})},_fieldBoolean:function(e){return new t.RadioButton.View({id:"field-"+e.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}],onchange:e.onchange})},_fieldColor:function(e){return new l({id:"field-"+e.id,onchange:e.onchange})},_fieldLibrary:function(e){return new n.View({id:"field-"+e.id,optional:e.optional,multiple:e.multiple,onchange:e.onchange})},_fieldFtp:function(e){return new s.View({id:"field-"+e.id,optional:e.optional,multiple:e.multiple,onchange:e.onchange})},_fieldUpload:function(e){return new t.Upload({id:"field-"+e.id,onchange:e.onchange})}})}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(2),i(1))},function(e,t,i){var n,s;(function(a,o,r){n=[i(4),i(9),i(7)],s=function(e,t,i){var n=a.View.extend({initialize:function(t){this.list={},this.options=e.merge(t,{title:"Repeat",empty_text:"Not available.",max:null,min:null}),this.button_new=new i.ButtonIcon({icon:"fa-plus",title:"Insert "+this.options.title,tooltip:"Add new "+this.options.title+" block",floating:"clear",cls:"ui-button-icon form-repeat-add",onclick:function(){t.onnew&&t.onnew()}}),this.setElement(o("
    ").append(this.$list=o("
    ")).append(o("
    ").append(this.button_new.$el)))},size:function(){return r.size(this.list)},add:function(e){if(!e.id||this.list[e.id])return void Galaxy.emit.debug("form-repeat::add()","Duplicate or invalid repeat block id.");var n=new i.ButtonIcon({icon:"fa-trash-o",tooltip:"Delete this repeat block",cls:"ui-button-icon-plain form-repeat-delete",onclick:function(){e.ondel&&e.ondel()}}),s=new t.View({id:e.id,title:"placeholder",cls:e.cls||"ui-portlet-repeat",operations:{button_delete:n}});s.append(e.$el),s.$el.addClass("section-row").hide(),this.list[e.id]=s,this.$list.append(s.$el.fadeIn("fast")),this.options.max>0&&this.size()>=this.options.max&&this.button_new.disable(),this._refresh()},del:function(e){return this.list[e]?(this.$list.find("#"+e).remove(),delete this.list[e],this.button_new.enable(),void this._refresh()):void Galaxy.emit.debug("form-repeat::del()","Invalid repeat block id.")},delAll:function(){for(var e in this.list)this.del(e)},hideOptions:function(){this.button_new.$el.hide(),r.each(this.list,function(e){e.hideOperation("button_delete")}),r.isEmpty(this.list)&&this.$el.append(o("
    ").addClass("ui-form-info").html(this.options.empty_text))},_refresh:function(){var e=0;for(var t in this.list){var i=this.list[t];i.title(++e+": "+this.options.title),i[this.size()>this.options.min?"showOperation":"hideOperation"]("button_delete")}}});return{View:n}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1),i(2))},function(e,t,i){var n,s;(function(a,o,r,l){n=[i(4),i(7),i(9),i(44),i(42),i(43)],s=function(e,t,i,n,s,c){var d=a.View.extend({initialize:function(e,t){this.app=e,this.inputs=t.inputs,this.parameters=new c,this.setElement(o("
    ")),this.render()},render:function(){var e=this;this.$el.empty(),r.each(this.inputs,function(t){e.add(t)})},add:function(t){var i=l.extend(!0,{},t);switch(i.id=t.id=e.uid(),this.app.input_list[i.id]=i,i.type){case"conditional":this._addConditional(i);break;case"repeat":this._addRepeat(i);break;case"section":this._addSection(i);break;default:this._addRow(i)}},_addConditional:function(e){var t=this;e.test_param.id=e.id,this.app.model.get("sustain_conditionals")&&(e.test_param.disabled=!0);var i=this._addRow(e.test_param);i.model&&i.model.set("onchange",function(i){var n=t.app.data.matchCase(e,i);for(var s in e.cases){var a=e.cases[s],o=t.$("#"+e.id+"-section-"+s),r=!1;for(var l in a.inputs)if(!a.inputs[l].hidden){r=!0;break}s==n&&r?o.fadeIn("fast"):o.hide()}t.app.trigger("change")});for(var n in e.cases){var s=new d(this.app,{inputs:e.cases[n].inputs});this._append(s.$el.addClass("ui-form-section"),e.id+"-section-"+n)}i.trigger("change")},_addRepeat:function(e){function t(t){var n=e.id+"-section-"+a++,s=new d(i.app,{inputs:t});o.add({id:n,$el:s.$el,ondel:function(){o.del(n),i.app.trigger("change")}})}for(var i=this,a=0,o=new n.View({title:e.title||"Repeat",min:e.min,max:e.max,onnew:function(){t(e.inputs),i.app.trigger("change")}}),l=r.size(e.cache),c=0;c").addClass("ui-form-info").html(e.help)),this.app.on("expand",function(e){t.$("#"+e).length>0&&t.expand()}),this._append(t.$el,e.id)},_addRow:function(e){var t=this,i=e.id;e.onchange=e.onchange||function(){t.app.trigger("change",i)};var n=this.parameters.create(e);this.app.field_list[i]=n;var a=new s(this.app,{name:e.name,label:e.hide_label?"":e.label||e.name,value:e.value,text_value:e.text_value,collapsible_value:e.collapsible_value,collapsible_preview:e.collapsible_preview,help:e.help,argument:e.argument,disabled:e.disabled,color:e.color,style:e.style,backdrop:e.backdrop,hidden:e.hidden,fixed:e.fixed,field:n});return this.app.element_list[i]=a,this._append(a.$el,e.id),n},_append:function(e,t){this.$el.append(e.addClass("section-row").attr("id",t))}});return{View:d}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1),i(2),i(1))},function(e,t,i){var n,s;(function(a){n=[i(39),i(81),i(5)],s=function(e,t,i){"use strict";function n(e){return function(t,i){return this.isNew()&&(i=i||{},i.url=this.urlRoot+this.get("history_id")+"/contents",t=t||{},t.type="dataset_collection"),e.call(this,t,i)}}var s=t.HistoryContentMixin,o=e.ListDatasetCollection,r=e.PairDatasetCollection,l=e.ListPairedDatasetCollection,c=e.ListOfListsDatasetCollection,d=o.extend(s).extend({defaults:a.extend(a.clone(o.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"list",model_class:"HistoryDatasetCollectionAssociation"}),save:n(o.prototype.save),toString:function(){return"History"+o.prototype.toString.call(this)}}),h=r.extend(s).extend({defaults:a.extend(a.clone(r.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"paired",model_class:"HistoryDatasetCollectionAssociation"}),save:n(r.prototype.save),toString:function(){return"History"+r.prototype.toString.call(this)}}),u=l.extend(s).extend({defaults:a.extend(a.clone(l.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"list:paired",model_class:"HistoryDatasetCollectionAssociation"}),save:n(l.prototype.save),toString:function(){return"History"+l.prototype.toString.call(this)}}),p=c.extend(s).extend({defaults:a.extend(a.clone(c.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"list:list",model_class:"HistoryDatasetCollectionAssociation"}),save:n(c.prototype.save),toString:function(){return["HistoryListOfListsDatasetCollection(",this.get("name"),")"].join("")}});return{HistoryListDatasetCollection:d,HistoryPairDatasetCollection:h,HistoryListPairedDatasetCollection:u,HistoryListOfListsDatasetCollection:p}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2))},function(e,t,i){var n,s;(function(a,o,r){n=[i(72),i(79),i(46),i(48),i(6),i(146)],s=function(e,t,i,n,s,l){"use strict";var c=e.PaginatedCollection,d=c.extend(s.LoggableMixin).extend({_logNamespace:"history",model:function(e,n){if("dataset"===e.history_content_type)return new t.HistoryDatasetAssociation(e,n);if("dataset_collection"===e.history_content_type){switch(e.collection_type){case"list":return new i.HistoryListDatasetCollection(e,n);case"paired":return new i.HistoryPairDatasetCollection(e,n);case"list:paired":return new i.HistoryListPairedDatasetCollection(e,n);case"list:list":return new i.HistoryListOfListsDatasetCollection(e,n)}var s="Unknown collection_type: "+e.collection_type;return console.warn(s,e),{validationError:s}}return{validationError:"Unknown history_content_type: "+e.history_content_type}},limitPerPage:500,limitPerProgressiveFetch:500,order:"hid",urlRoot:Galaxy.root+"api/histories",url:function(){return this.urlRoot+"/"+this.historyId+"/contents"},initialize:function(e,t){t=t||{},c.prototype.initialize.call(this,e,t),this.history=t.history||null,this.setHistoryId(t.historyId||null),this.includeDeleted=t.includeDeleted||this.includeDeleted,this.includeHidden=t.includeHidden||this.includeHidden,this.model.prototype.idAttribute="type_id"},setHistoryId:function(e){this.historyId=e,this._setUpWebStorage()},_setUpWebStorage:function(e){if(this.historyId)return this.storage=new n.HistoryPrefs({id:n.HistoryPrefs.historyStorageKey(this.historyId)}),this.trigger("new-storage",this.storage,this),this.on({"include-deleted":function(e){this.storage.includeDeleted(e)},"include-hidden":function(e){this.storage.includeHidden(e)}}),this.includeDeleted=this.storage.includeDeleted()||!1,this.includeHidden=this.storage.includeHidden()||!1,this},comparators:a.extend(a.clone(c.prototype.comparators),{name:s.buildComparator("name",{ascending:!0}),"name-dsc":s.buildComparator("name",{ascending:!1}),hid:s.buildComparator("hid",{ascending:!1}),"hid-asc":s.buildComparator("hid",{ascending:!0})}),running:function(){return this.filter(function(e){return!e.inReadyState()})},runningAndActive:function(){return this.filter(function(e){return!e.inReadyState()&&e.get("visible")&&!e.get("deleted")})},getByHid:function(e){return this.findWhere({hid:e})},haveDetails:function(){return this.all(function(e){return e.hasDetails()})},hidden:function(){return this.filter(function(e){return e.hidden()})},deleted:function(){return this.filter(function(e){return e.get("deleted")})},visibleAndUndeleted:function(){return this.filter(function(e){return e.get("visible")&&!e.get("deleted")})},setIncludeDeleted:function(e,t){if(a.isBoolean(e)&&e!==this.includeDeleted){if(this.includeDeleted=e,a.result(t,"silent"))return;this.trigger("include-deleted",e,this)}},setIncludeHidden:function(e,t){if(a.isBoolean(e)&&e!==this.includeHidden){if(this.includeHidden=e,t=t||{},a.result(t,"silent"))return;this.trigger("include-hidden",e,this)}},fetch:function(e){if(e=e||{},this.historyId&&!e.details){var t=n.HistoryPrefs.get(this.historyId).toJSON();a.isEmpty(t.expandedIds)||(e.details=a.values(t.expandedIds).join(","))}return c.prototype.fetch.call(this,e)},_buildFetchData:function(e){return a.extend(c.prototype._buildFetchData.call(this,e),{v:"dev"})},_fetchParams:c.prototype._fetchParams.concat(["v","details"]),_buildFetchFilters:function(e){var t=c.prototype._buildFetchFilters.call(this,e)||{},i={};return this.includeDeleted||(i.deleted=!1,i.purged=!1),this.includeHidden||(i.visible=!0),a.defaults(t,i)},getTotalItemCount:function(){return this.history.contentsShown()},fetchUpdated:function(e,t){return e&&(t=t||{filters:{}},t.remove=!1,t.filters={"update_time-ge":e.toISOString(),visible:""}),this.fetch(t)},fetchDeleted:function(e){e=e||{};var t=this;return e.filters=a.extend(e.filters,{deleted:!0,purged:void 0}),e.remove=!1,t.trigger("fetching-deleted",t),t.fetch(e).always(function(){t.trigger("fetching-deleted-done",t)})},fetchHidden:function(e){e=e||{};var t=this;return e.filters=a.extend(e.filters,{visible:!1}),e.remove=!1,t.trigger("fetching-hidden",t),t.fetch(e).always(function(){t.trigger("fetching-hidden-done",t)})},fetchAllDetails:function(e){e=e||{};var t={details:"all"};return e.data=a.extend(e.data||{},t),this.fetch(e)},fetchCollectionCounts:function(e){return e=e||{},e.keys=["type_id","element_count"].join(","),e.filters=a.extend(e.filters||{},{history_content_type:"dataset_collection"}),e.remove=!1,this.fetch(e)},_filterAndUpdate:function(e,t){var i=this,n=i.model.prototype.idAttribute,s=[t];return i.fetch({filters:e,remove:!1}).then(function(e){return e=e.reduce(function(e,t,s){var a=i.get(t[n]);return a?e.concat(a):e},[]),i.ajaxQueue("save",s,e)})},ajaxQueue:function(e,t,i){return i=i||this.models,new l.AjaxQueue(i.slice().reverse().map(function(i,n){var s=a.isString(e)?i[e]:e;return function(){return s.apply(i,t)}})).deferred},progressivelyFetchDetails:function(e){function i(t){t=t||0;var o=a.extend(a.clone(e),{view:"summary",keys:c,limit:r,offset:t,reset:0===t,remove:!1});a.defer(function(){s.fetch.call(s,o).fail(n.reject).done(function(e){n.notify(e,r,t),e.length!==r?(s.allFetched=!0,n.resolve(e,r,t)):i(t+r)})})}e=e||{};var n=o.Deferred(),s=this,r=e.limitPerCall||s.limitPerProgressiveFetch,l=t.HistoryDatasetAssociation.prototype.searchAttributes,c=l.join(",");return i(),n},isCopyable:function(e){var t=["HistoryDatasetAssociation","HistoryDatasetCollectionAssociation"];return a.isObject(e)&&e.id&&a.contains(t,e.model_class)},copy:function(e){var t,i,n;a.isString(e)?(t=e,n="hda",i="dataset"):(t=e.id,n={HistoryDatasetAssociation:"hda",LibraryDatasetDatasetAssociation:"ldda",HistoryDatasetCollectionAssociation:"hdca"}[e.model_class]||"hda",i="hdca"===n?"dataset_collection":"dataset");var s=this,r=o.ajax(this.url(),{method:"POST",contentType:"application/json",data:JSON.stringify({content:t,source:n,type:i})}).done(function(e){s.add([e],{parse:!0})}).fail(function(e,a,o){s.trigger("error",s,r,{},"Error copying contents",{type:i,id:t,source:n})});return r},createHDCA:function(e,t,i,n,s){var a=this.model({history_content_type:"dataset_collection",collection_type:t,history_id:this.historyId,name:i,hide_source_items:n||!1,element_identifiers:e});return a.save(s)},haveSearchDetails:function(){return this.allFetched&&this.all(function(e){return a.has(e.attributes,"annotation")})},matches:function(e){return this.filter(function(t){return t.matches(e)})},clone:function(){var e=r.Collection.prototype.clone.call(this);return e.historyId=this.historyId,e},toString:function(){return["HistoryContents(",[this.historyId,this.length].join(),")"].join("")}});return{HistoryContents:d}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2),i(1),i(3))},function(e,t,i){var n,s;(function(a){n=[i(6)],s=function(e){"use strict";var t=e.SessionStorageModel.extend({defaults:{expandedIds:{},show_deleted:!1,show_hidden:!1},addExpanded:function(e){var t=this.get("expandedIds");t[e.id]=e.get("id"),this.save("expandedIds",t)},removeExpanded:function(e){var t=this.get("expandedIds");delete t[e.id],this.save("expandedIds",t)},isExpanded:function(e){return a.result(this.get("expandedIds"),e,!1)},allExpanded:function(){return a.values(this.get("expandedIds"))},clearExpanded:function(){this.set("expandedIds",{})},includeDeleted:function(e){return a.isUndefined(e)||this.set("show_deleted",e),this.get("show_deleted")},includeHidden:function(e){return a.isUndefined(e)||this.set("show_hidden",e),this.get("show_hidden")},toString:function(){return"HistoryPrefs("+this.id+")"}},{storageKeyPrefix:"history:",historyStorageKey:function(e){if(!e)throw new Error("HistoryPrefs.historyStorageKey needs valid id: "+e);return t.storageKeyPrefix+e},get:function(e){return new t({id:t.historyStorageKey(e)})},clearAll:function(e){for(var i in sessionStorage)0===i.indexOf(t.storageKeyPrefix)&&sessionStorage.removeItem(i)}});return{HistoryPrefs:t}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2))},function(e,t,i){var n,s;(function(a,o,r,l){n=[i(6),i(5)],s=function(e,t){"use strict";var i="list",n=a.View.extend(e.LoggableMixin).extend({_logNamespace:i,initialize:function(e){this.expanded=e.expanded||!1,this.log("\t expanded:",this.expanded),this.fxSpeed=void 0!==e.fxSpeed?e.fxSpeed:this.fxSpeed},fxSpeed:"fast",render:function(e){var t=this._buildNewRender();return this._setUpBehaviors(t),this._queueNewRender(t,e),this},_buildNewRender:function(){var e=o(this.templates.el(this.model.toJSON(),this));return this.expanded&&this.$details(e).replaceWith(this._renderDetails().show()),e},_queueNewRender:function(e,t){t=void 0===t?this.fxSpeed:t;var i=this;0===t?(i._swapNewRender(e),i.trigger("rendered",i)):o(i).queue("fx",[function(e){i.$el.fadeOut(t,e)},function(t){i._swapNewRender(e),t()},function(e){i.$el.fadeIn(t,e)},function(e){i.trigger("rendered",i),e()}])},_swapNewRender:function(e){return this.$el.empty().attr("class",r.isFunction(this.className)?this.className():this.className).append(e.children())},_setUpBehaviors:function(e){e=e||this.$el,e.find("[title]").tooltip({placement:"bottom"})},$details:function(e){return e=e||this.$el,e.find("> .details")},_renderDetails:function(){var e=o(this.templates.details(this.model.toJSON(),this));return this._setUpBehaviors(e),e},toggleExpanded:function(e){return e=void 0===e?!this.expanded:e,e?this.expand():this.collapse(),this},expand:function(){var e=this;return e._fetchModelDetails().always(function(){e._expand()})},_fetchModelDetails:function(){return this.model.hasDetails()?l.when():this.model.fetch()},_expand:function(){var e=this,t=e._renderDetails();e.$details().replaceWith(t),e.expanded=!0,e.$details().slideDown(e.fxSpeed,function(){e.trigger("expanded",e)})},collapse:function(){this.debug(this+"(ExpandableView).collapse");var e=this;e.expanded=!1,this.$details().slideUp(e.fxSpeed,function(){e.trigger("collapsed",e)})}}),s=n.extend(e.mixin(e.SelectableViewMixin,e.DraggableViewMixin,{tagName:"div",className:"list-item",initialize:function(t){n.prototype.initialize.call(this,t),e.SelectableViewMixin.initialize.call(this,t),e.DraggableViewMixin.initialize.call(this,t),this._setUpListeners()},_setUpListeners:function(){return this.on("selectable",function(e){e?this.$(".primary-actions").hide():this.$(".primary-actions").show()},this),this},_buildNewRender:function(){var e=n.prototype._buildNewRender.call(this);return e.children(".warnings").replaceWith(this._renderWarnings()), e.children(".title-bar").replaceWith(this._renderTitleBar()),e.children(".primary-actions").append(this._renderPrimaryActions()),e.find("> .title-bar .subtitle").replaceWith(this._renderSubtitle()),e},_swapNewRender:function(e){return n.prototype._swapNewRender.call(this,e),this.selectable&&this.showSelector(0),this.draggable&&this.draggableOn(),this.$el},_renderWarnings:function(){var e=this,t=o('
    '),i=e.model.toJSON();return r.each(e.templates.warnings,function(n){t.append(o(n(i,e)))}),t},_renderTitleBar:function(){return o(this.templates.titleBar(this.model.toJSON(),this))},_renderPrimaryActions:function(){return[]},_renderSubtitle:function(){return o(this.templates.subtitle(this.model.toJSON(),this))},events:{"click .title-bar":"_clickTitleBar","keydown .title-bar":"_keyDownTitleBar","click .selector":"toggleSelect"},_clickTitleBar:function(e){e.stopPropagation(),e.altKey?(this.toggleSelect(e),this.selectable||this.showSelector()):this.toggleExpanded()},_keyDownTitleBar:function(e){var t=32,i=13;return!e||"keydown"!==e.type||e.keyCode!==t&&e.keyCode!==i||(this.toggleExpanded(),e.stopPropagation(),!1)},toString:function(){var e=this.model?this.model+"":"(no model)";return"ListItemView("+e+")"}}));s.prototype.templates=function(){var t=e.wrapTemplate(['
    ','
    ','
    ','',"
    ",'
    ','
    ','
    ',"
    "]),i={},n=e.wrapTemplate(['
    ','','
    ','<%- element.name %>',"
    ",'
    ',"
    "],"element"),s=e.wrapTemplate(['
    ']),a=e.wrapTemplate(['
    ']);return{el:t,warnings:i,titleBar:n,subtitle:s,details:a}}();var c=s.extend({foldoutStyle:"foldout",foldoutPanelClass:null,initialize:function(e){"drilldown"===this.foldoutStyle&&(this.expanded=!1),this.foldoutStyle=e.foldoutStyle||this.foldoutStyle,this.foldoutPanelClass=e.foldoutPanelClass||this.foldoutPanelClass,s.prototype.initialize.call(this,e),this.foldout=this._createFoldoutPanel()},_renderDetails:function(){if("drilldown"===this.foldoutStyle)return o();var e=s.prototype._renderDetails.call(this);return this._attachFoldout(this.foldout,e)},_createFoldoutPanel:function(){var e=this.model,t=this._getFoldoutPanelClass(e),i=this._getFoldoutPanelOptions(e),n=new t(r.extend(i,{model:e}));return n},_getFoldoutPanelClass:function(){return this.foldoutPanelClass},_getFoldoutPanelOptions:function(){return{foldoutStyle:this.foldoutStyle,fxSpeed:this.fxSpeed}},_attachFoldout:function(e,t){return t=t||this.$("> .details"),this.foldout=e.render(0),e.$("> .controls").hide(),t.append(e.$el)},expand:function(){var e=this;return e._fetchModelDetails().always(function(){"foldout"===e.foldoutStyle?e._expand():"drilldown"===e.foldoutStyle&&e._expandByDrilldown()})},_expandByDrilldown:function(){var e=this;e.listenTo(e.foldout,"close",function(){e.trigger("collapsed:drilldown",e,e.foldout)}),e.trigger("expanded:drilldown",e,e.foldout)}});return c.prototype.templates=function(){var t=e.wrapTemplate(['
    ',"
    "],"collection");return r.extend({},s.prototype.templates,{details:t})}(),{ExpandableView:n,ListItemView:s,FoldoutListItemView:c}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1),i(2),i(1))},function(e,t,i){var n,s;(function(a,o){n=[i(6),i(5)],s=function(e,t){var i=a.View.extend(e.LoggableMixin).extend(e.HiddenUntilActivatedViewMixin).extend({tagName:"div",className:"tags-display",initialize:function(e){e.usePrompt===!1?this.label="":this.label='",this.hiddenUntilActivated(e.$activator,e)},render:function(){var e=this;return this.$el.html(this._template()),this.$input().select2({placeholder:"Add tags",width:"100%",tags:function(){return e._getTagsUsed()}}),this._setUpBehaviors(),this},_hashToName:function(e){return e.startsWith("#")?"name:"+e.slice(1):e},_nameToHash:function(e){return e.startsWith("name:")&&(e="#"+e.slice(5)),e},_template:function(){return[this.label,''].join("")},tagsToCSV:function(){var e=this,t=this.model.get("tags");return!o.isArray(t)||o.isEmpty(t)?"":t.map(function(t){return o.escape(e._nameToHash(t))}).sort().join(",")},$input:function(){return this.$el.find("input.tags-input")},_getTagsUsed:function(){var e=this;return o.map(Galaxy.user.get("tags_used"),e._nameToHash)},_setUpBehaviors:function(){var e=this;this.$input().on("change",function(t){t.val=o.map(t.val,e._hashToName),e.model.save({tags:t.val}),t.added&&e._addNewTagToTagsUsed(t.added.text+"")})},_addNewTagToTagsUsed:function(e){var t=Galaxy.user.get("tags_used");o.contains(t,e)||(t.push(e),t.sort(),Galaxy.user.set("tags_used",t))},remove:function(){this.$input.off(),this.stopListening(this.model),a.View.prototype.remove.call(this)},toString:function(){return["TagsEditor(",this.model+"",")"].join("")}});return{TagsEditor:i}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(2))},function(e,t,i){var n,s;(function(a,o){n=[i(2),i(19),i(10),i(28)],s=function(e,t,i,n){"use strict";var s={hidden:!1,show:function(){this.set("hidden",!1)},hide:function(){this.set("hidden",!0)},toggle:function(){this.set("hidden",!this.get("hidden"))},is_visible:function(){return!this.attributes.hidden}},r=a.Model.extend({defaults:{name:null,label:null,type:null,value:null,html:null,num_samples:5},initialize:function(e){this.attributes.html=unescape(this.attributes.html)},copy:function(){return new r(this.toJSON())},set_value:function(e){this.set("value",e||"")}}),l=a.Collection.extend({model:r}),c=r.extend({}),d=r.extend({set_value:function(e){this.set("value",parseInt(e,10))},get_samples:function(){return d3.scale.linear().domain([this.get("min"),this.get("max")]).ticks(this.get("num_samples"))}}),h=d.extend({set_value:function(e){this.set("value",parseFloat(e))}}),u=r.extend({get_samples:function(){return e.map(this.get("options"),function(e){return e[0]})}});r.subModelTypes={integer:d,float:h,data:c,select:u};var p=a.Model.extend({defaults:{id:null,name:null,description:null,target:null,inputs:[],outputs:[]},urlRoot:Galaxy.root+"api/tools",initialize:function(t){this.set("inputs",new l(e.map(t.inputs,function(e){var t=r.subModelTypes[e.type]||r;return new t(e)})))},toJSON:function(){var e=a.Model.prototype.toJSON.call(this);return e.inputs=this.get("inputs").map(function(e){return e.toJSON()}),e},remove_inputs:function(e){var t=this,i=t.get("inputs").filter(function(t){return e.indexOf(t.get("type"))!==-1});t.get("inputs").remove(i)},copy:function(e){var t=new p(this.toJSON());if(e){var i=new a.Collection;t.get("inputs").each(function(e){e.get_samples()&&i.push(e)}),t.set("inputs",i)}return t},apply_search_results:function(t){return e.indexOf(t,this.attributes.id)!==-1?this.show():this.hide(),this.is_visible()},set_input_value:function(e,t){this.get("inputs").find(function(t){return t.get("name")===e}).set("value",t)},set_input_values:function(t){var i=this;e.each(e.keys(t),function(e){i.set_input_value(e,t[e])})},run:function(){return this._run()},rerun:function(e,t){return this._run({action:"rerun",target_dataset_id:e.id,regions:t})},get_inputs_dict:function(){var e={};return this.get("inputs").each(function(t){e[t.get("name")]=t.get("value")}),e},_run:function(n){var s=e.extend({tool_id:this.id,inputs:this.get_inputs_dict()},n),a=o.Deferred(),r=new t.ServerStateDeferred({ajax_settings:{url:this.urlRoot,data:JSON.stringify(s),dataType:"json",contentType:"application/json",type:"POST"},interval:2e3,success_fn:function(e){return"pending"!==e}});return o.when(r.go()).then(function(e){a.resolve(new i.DatasetCollection(e))}),a}});e.extend(p.prototype,s);var f=(a.View.extend({}),a.Collection.extend({model:p})),g=a.Model.extend(s),m=a.Model.extend({defaults:{elems:[],open:!1},clear_search_results:function(){e.each(this.attributes.elems,function(e){e.show()}),this.show(),this.set("open",!1)},apply_search_results:function(t){var i,n=!0;e.each(this.attributes.elems,function(e){e instanceof g?(i=e,i.hide()):e instanceof p&&e.apply_search_results(t)&&(n=!1,i&&i.show())}),n?this.hide():(this.show(),this.set("open",!0))}});e.extend(m.prototype,s);var v=a.Model.extend({defaults:{search_hint_string:"search tools",min_chars_for_search:3,clear_btn_url:"",visible:!0,query:"",results:null,clear_key:27},urlRoot:Galaxy.root+"api/tools",initialize:function(){this.on("change:query",this.do_search)},do_search:function(){var e=this.attributes.query;if(e.length");e.append(E.tool_link(this.model.toJSON()));var t=this.model.get("form_style",null);if("upload1"===this.model.id)e.find("a").on("click",function(e){e.preventDefault(),Galaxy.upload.show()});else if("regular"===t){var i=this;e.find("a").on("click",function(e){e.preventDefault(),Galaxy.router.push("/",{tool_id:i.model.id,version:i.model.get("version")})})}return this.$el.append(e),this}}),b=y.extend({tagName:"div",className:"toolPanelLabel",render:function(){return this.$el.append(o("").text(this.model.attributes.text)),this}}),x=y.extend({tagName:"div",className:"toolSectionWrapper",initialize:function(){y.prototype.initialize.call(this),this.model.on("change:open",this.update_open,this)},render:function(){this.$el.append(E.panel_section(this.model.toJSON()));var t=this.$el.find(".toolSectionBody");return e.each(this.model.attributes.elems,function(e){if(e instanceof p){var i=new w({model:e,className:"toolTitle"});i.render(),t.append(i.$el)}else if(e instanceof g){var n=new b({model:e});n.render(),t.append(n.$el)}}),this},events:{"click .toolSectionTitle > a":"toggle"},toggle:function(){this.model.set("open",!this.model.attributes.open)},update_open:function(){this.model.attributes.open?this.$el.children(".toolSectionBody").slideDown("fast"):this.$el.children(".toolSectionBody").slideUp("fast")}}),C=a.View.extend({tagName:"div",id:"tool-search",className:"bar",events:{click:"focus_and_select","keyup :input":"query_changed","change :input":"query_changed","click #search-clear-btn":"clear"},render:function(){return this.$el.append(E.tool_search(this.model.toJSON())),this.model.is_visible()||this.$el.hide(),o("#messagebox").is(":visible")&&this.$el.css("top","95px"),this.$el.find("[title]").tooltip(),this},focus_and_select:function(){this.$el.find(":input").focus().select()},clear:function(){return this.model.clear_search(),this.$el.find(":input").val(""),this.focus_and_select(),!1},query_changed:function(e){return this.model.attributes.clear_key&&this.model.attributes.clear_key===e.which?(this.clear(),!1):void this.model.set("query",this.$el.find(":input").val())}}),$=a.View.extend({tagName:"div",className:"toolMenu",initialize:function(){this.model.get("tool_search").on("change:results",this.handle_search_results,this)},render:function(){var e=this,t=new C({model:this.model.get("tool_search")});return t.render(),e.$el.append(t.$el),this.model.get("layout").each(function(t){if(t instanceof m){var i=new x({model:t});i.render(),e.$el.append(i.$el)}else if(t instanceof p){var n=new w({model:t,className:"toolTitleNoSection"});n.render(),e.$el.append(n.$el)}else if(t instanceof g){var s=new b({model:t});s.render(),e.$el.append(s.$el)}}),e.$el.find("a.tool-link").click(function(t){var i=o(this).attr("class").split(/\s+/)[0],n=e.model.get("tools").get(i);e.trigger("tool_link_click",t,n)}),this},handle_search_results:function(){var e=this.model.get("tool_search").get("results");e&&0===e.length?o("#search-no-results").show():o("#search-no-results").hide()}}),k=a.View.extend({className:"toolForm",render:function(){this.$el.children().remove(),this.$el.append(E.tool_form(this.model.toJSON()))}}),E=(a.View.extend({className:"toolMenuAndView",initialize:function(){this.tool_panel_view=new $({collection:this.collection}),this.tool_form_view=new k},render:function(){this.tool_panel_view.render(),this.tool_panel_view.$el.css("float","left"),this.$el.append(this.tool_panel_view.$el),this.tool_form_view.$el.hide(),this.$el.append(this.tool_form_view.$el);var e=this;this.tool_panel_view.on("tool_link_click",function(t,i){t.preventDefault(),e.show_tool(i)})},show_tool:function(e){var t=this;e.fetch().done(function(){t.tool_form_view.model=e,t.tool_form_view.render(),t.tool_form_view.$el.show(),o("#left").width("650px")})}}),{tool_search:e.template(['',' ',''].join("")),panel_section:e.template(['",'