galaxy-commits
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
March 2013
- 1 participants
- 183 discussions
commit/galaxy-central: greg: Extract several methods from Galaxy's admin_toolshed controller and the tool shed's repository controller and move them to ~/tool_shed/galaxy_install/repository_util in preparation for enhancing the Galaxy api to enable installing a repository from the tool shed.
by commits-noreply@bitbucket.org 22 Mar '13
by commits-noreply@bitbucket.org 22 Mar '13
22 Mar '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/dab01cbc83dc/
Changeset: dab01cbc83dc
User: greg
Date: 2013-03-22 19:38:01
Summary: Extract several methods from Galaxy's admin_toolshed controller and the tool shed's repository controller and move them to ~/tool_shed/galaxy_install/repository_util in preparation for enhancing the Galaxy api to enable installing a repository from the tool shed.
Affected #: 6 files
diff -r b45e7e2cf125642efcbbcb112778a44f64de4ec2 -r dab01cbc83dceddd9f02a48deb32c7ffb1817eba lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -3040,9 +3040,9 @@
pass
class ToolShedRepository( object ):
- api_collection_visible_keys = ( 'id', 'name', 'tool_shed', 'owner', 'installed_changeset_revision', 'changeset_revision', 'ctx_rev', 'includes_datatypes',
+ api_collection_visible_keys = ( 'id', 'tool_shed', 'name', 'owner', 'installed_changeset_revision', 'changeset_revision', 'ctx_rev', 'includes_datatypes',
'update_available', 'deleted', 'uninstalled', 'dist_to_shed', 'status', 'error_message' )
- api_element_visible_keys = ( 'id', 'name', 'tool_shed', 'owner', 'installed_changeset_revision', 'changeset_revision', 'ctx_rev', 'includes_datatypes',
+ api_element_visible_keys = ( 'id', 'tool_shed', 'name', 'owner', 'installed_changeset_revision', 'changeset_revision', 'ctx_rev', 'includes_datatypes',
'update_available', 'deleted', 'uninstalled', 'dist_to_shed', 'status', 'error_message' )
installation_status = Bunch( NEW='New',
CLONING='Cloning',
@@ -3079,10 +3079,8 @@
self.dist_to_shed = dist_to_shed
self.status = status
self.error_message = error_message
- def as_dict( self, trans ):
- tsr_dict = self.get_api_value( view='element' )
- tsr_dict[ 'id' ] = trans.security.encode_id( self.id )
- return tsr_dict
+ def as_dict( self, value_mapper=None ):
+ return self.get_api_value( view='element', value_mapper=value_mapper )
def repo_files_directory( self, app ):
repo_path = self.repo_path( app )
if repo_path:
@@ -3182,7 +3180,7 @@
try:
rval[ key ] = self.__getattribute__( key )
if key in value_mapper:
- rval[ key ] = value_mapper.get( key )( rval[ key ] )
+ rval[ key ] = value_mapper.get( key, rval[ key ] )
except AttributeError:
rval[ key ] = None
return rval
diff -r b45e7e2cf125642efcbbcb112778a44f64de4ec2 -r dab01cbc83dceddd9f02a48deb32c7ffb1817eba lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py
--- a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py
+++ b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py
@@ -373,91 +373,6 @@
tool_version = tool_util.get_tool_version( app, guid )
return tool_version.get_version_ids( app, reverse=True )
- def handle_repository_contents( self, trans, tool_shed_repository, tool_path, repository_clone_url, relative_install_dir, tool_shed=None,
- tool_section=None, shed_tool_conf=None, reinstalling=False ):
- """
- Generate the metadata for the installed tool shed repository, among other things. This method is called from Galaxy (never the tool shed)
- when an admin is installing a new repository or reinstalling an uninstalled repository.
- """
- shed_config_dict = trans.app.toolbox.get_shed_config_dict_by_filename( shed_tool_conf )
- metadata_dict, invalid_file_tups = metadata_util.generate_metadata_for_changeset_revision( app=trans.app,
- repository=tool_shed_repository,
- changeset_revision=tool_shed_repository.changeset_revision,
- repository_clone_url=repository_clone_url,
- shed_config_dict=shed_config_dict,
- relative_install_dir=relative_install_dir,
- repository_files_dir=None,
- resetting_all_metadata_on_repository=False,
- updating_installed_repository=False,
- persist=True )
- tool_shed_repository.metadata = metadata_dict
- trans.sa_session.add( tool_shed_repository )
- trans.sa_session.flush()
- if 'tool_dependencies' in metadata_dict and not reinstalling:
- tool_dependencies = tool_dependency_util.create_tool_dependency_objects( trans.app, tool_shed_repository, relative_install_dir, set_status=True )
- if 'tools' in metadata_dict:
- tool_panel_dict = tool_util.generate_tool_panel_dict_for_new_install( metadata_dict[ 'tools' ], tool_section )
- sample_files = metadata_dict.get( 'sample_files', [] )
- tool_index_sample_files = tool_util.get_tool_index_sample_files( sample_files )
- tool_util.copy_sample_files( trans.app, tool_index_sample_files, tool_path=tool_path )
- sample_files_copied = [ str( s ) for s in tool_index_sample_files ]
- repository_tools_tups = suc.get_repository_tools_tups( trans.app, metadata_dict )
- if repository_tools_tups:
- # Handle missing data table entries for tool parameters that are dynamically generated select lists.
- repository_tools_tups = tool_util.handle_missing_data_table_entry( trans.app, relative_install_dir, tool_path, repository_tools_tups )
- # Handle missing index files for tool parameters that are dynamically generated select lists.
- repository_tools_tups, sample_files_copied = tool_util.handle_missing_index_file( trans.app,
- tool_path,
- sample_files,
- repository_tools_tups,
- sample_files_copied )
- # Copy remaining sample files included in the repository to the ~/tool-data directory of the local Galaxy instance.
- tool_util.copy_sample_files( trans.app, sample_files, tool_path=tool_path, sample_files_copied=sample_files_copied )
- tool_util.add_to_tool_panel( app=trans.app,
- repository_name=tool_shed_repository.name,
- repository_clone_url=repository_clone_url,
- changeset_revision=tool_shed_repository.installed_changeset_revision,
- repository_tools_tups=repository_tools_tups,
- owner=tool_shed_repository.owner,
- shed_tool_conf=shed_tool_conf,
- tool_panel_dict=tool_panel_dict,
- new_install=True )
- if 'data_manager' in metadata_dict:
- new_data_managers = data_manager_util.install_data_managers( trans.app,
- trans.app.config.shed_data_manager_config_file,
- metadata_dict,
- shed_config_dict,
- relative_install_dir,
- tool_shed_repository,
- repository_tools_tups )
- if 'datatypes' in metadata_dict:
- tool_shed_repository.status = trans.model.ToolShedRepository.installation_status.LOADING_PROPRIETARY_DATATYPES
- if not tool_shed_repository.includes_datatypes:
- tool_shed_repository.includes_datatypes = True
- trans.sa_session.add( tool_shed_repository )
- trans.sa_session.flush()
- files_dir = relative_install_dir
- if shed_config_dict.get( 'tool_path' ):
- files_dir = os.path.join( shed_config_dict['tool_path'], files_dir )
- datatypes_config = suc.get_config_from_disk( 'datatypes_conf.xml', files_dir )
- # Load data types required by tools.
- converter_path, display_path = datatype_util.alter_config_and_load_prorietary_datatypes( trans.app, datatypes_config, files_dir, override=False )
- if converter_path or display_path:
- # Create a dictionary of tool shed repository related information.
- repository_dict = datatype_util.create_repository_dict_for_proprietary_datatypes( tool_shed=tool_shed,
- name=tool_shed_repository.name,
- owner=tool_shed_repository.owner,
- installed_changeset_revision=tool_shed_repository.installed_changeset_revision,
- tool_dicts=metadata_dict.get( 'tools', [] ),
- converter_path=converter_path,
- display_path=display_path )
- if converter_path:
- # Load proprietary datatype converters
- trans.app.datatypes_registry.load_datatype_converters( trans.app.toolbox, installed_repository_dict=repository_dict )
- if display_path:
- # Load proprietary datatype display applications
- trans.app.datatypes_registry.load_display_applications( installed_repository_dict=repository_dict )
-
@web.expose
@web.require_admin
def import_workflow( self, trans, workflow_name, repository_id, **kwd ):
@@ -638,15 +553,15 @@
repo = hg.repository( suc.get_configured_ui(), path=os.path.abspath( install_dir ) )
repository_util.pull_repository( repo, repository_clone_url, current_changeset_revision )
suc.update_repository( repo, ctx_rev=current_ctx_rev )
- self.handle_repository_contents( trans,
- tool_shed_repository=tool_shed_repository,
- tool_path=tool_path,
- repository_clone_url=repository_clone_url,
- relative_install_dir=relative_install_dir,
- tool_shed=tool_shed_repository.tool_shed,
- tool_section=tool_section,
- shed_tool_conf=shed_tool_conf,
- reinstalling=reinstalling )
+ repository_util.handle_repository_contents( trans,
+ tool_shed_repository=tool_shed_repository,
+ tool_path=tool_path,
+ repository_clone_url=repository_clone_url,
+ relative_install_dir=relative_install_dir,
+ tool_shed=tool_shed_repository.tool_shed,
+ tool_section=tool_section,
+ shed_tool_conf=shed_tool_conf,
+ reinstalling=reinstalling )
trans.sa_session.refresh( tool_shed_repository )
metadata = tool_shed_repository.metadata
if 'tools' in metadata:
@@ -956,7 +871,7 @@
install_tool_dependencies = kwd.get( 'install_tool_dependencies', '' )
encoded_repo_info_dicts = util.listify( kwd.get( 'encoded_repo_info_dicts', None ) )
if not encoded_repo_info_dicts:
- # The request originated in the tool shed.
+ # The request originated in the tool shed via a tool search.
repository_ids = kwd.get( 'repository_ids', None )
changeset_revisions = kwd.get( 'changeset_revisions', None )
# Get the information necessary to install each repository.
@@ -981,78 +896,40 @@
else:
install_tool_dependencies = False
tool_path = suc.get_tool_path_by_shed_tool_conf_filename( trans, shed_tool_conf )
+ installation_dict = dict( install_repository_dependencies=install_repository_dependencies,
+ new_tool_panel_section=new_tool_panel_section,
+ no_changes_checked=False,
+ reinstalling=False,
+ repo_info_dicts=repo_info_dicts,
+ tool_panel_section=tool_panel_section,
+ tool_path=tool_path,
+ tool_shed_url=tool_shed_url )
created_or_updated_tool_shed_repositories, tool_panel_section_keys, repo_info_dicts, filtered_repo_info_dicts, message = \
- repository_dependency_util.create_repository_dependency_objects( trans,
- tool_path,
- tool_shed_url,
- repo_info_dicts,
- reinstalling=False,
- install_repository_dependencies=install_repository_dependencies,
- no_changes_checked=False,
- tool_panel_section=tool_panel_section,
- new_tool_panel_section=new_tool_panel_section )
+ repository_util.handle_tool_shed_repositories( trans, installation_dict )
if message and len( repo_info_dicts ) == 1:
- installed_tool_shed_repository = created_or_updated_tool_shed_repositories[ 0 ]
- message+= 'Click <a href="%s">here</a> to manage the repository. ' % \
- ( web.url_for( controller='admin_toolshed', action='manage_repository', id=trans.security.encode_id( installed_tool_shed_repository.id ) ) )
return trans.response.send_redirect( web.url_for( controller='admin_toolshed',
action='browse_repositories',
message=message,
status='error' ) )
+
if created_or_updated_tool_shed_repositories:
- # Handle contained tools.
- if includes_tools_for_display_in_tool_panel and ( new_tool_panel_section or tool_panel_section ):
- if new_tool_panel_section:
- section_id = new_tool_panel_section.lower().replace( ' ', '_' )
- tool_panel_section_key = 'section_%s' % str( section_id )
- if tool_panel_section_key in trans.app.toolbox.tool_panel:
- # Appending a tool to an existing section in trans.app.toolbox.tool_panel
- log.debug( "Appending to tool panel section: %s" % new_tool_panel_section )
- tool_section = trans.app.toolbox.tool_panel[ tool_panel_section_key ]
- else:
- # Appending a new section to trans.app.toolbox.tool_panel
- log.debug( "Loading new tool panel section: %s" % new_tool_panel_section )
- elem = Element( 'section' )
- elem.attrib[ 'name' ] = new_tool_panel_section
- elem.attrib[ 'id' ] = section_id
- elem.attrib[ 'version' ] = ''
- tool_section = tools.ToolSection( elem )
- trans.app.toolbox.tool_panel[ tool_panel_section_key ] = tool_section
- else:
- tool_panel_section_key = 'section_%s' % tool_panel_section
- tool_section = trans.app.toolbox.tool_panel[ tool_panel_section_key ]
- else:
- tool_panel_section_key = None
- tool_section = None
- encoded_repository_ids = [ trans.security.encode_id( tsr.id ) for tsr in created_or_updated_tool_shed_repositories ]
- # Create a one-to-one mapping of tool shed repository id and tool panel section key. All tools contained in the repositories
- # being installed will be loaded into the same section in the tool panel.
- for tsr in created_or_updated_tool_shed_repositories:
- tool_panel_section_keys.append( tool_panel_section_key )
- new_kwd = dict( includes_tools=includes_tools,
- includes_tools_for_display_in_tool_panel=includes_tools_for_display_in_tool_panel,
- has_repository_dependencies=has_repository_dependencies,
- install_repository_dependencies=install_repository_dependencies,
- includes_tool_dependencies=includes_tool_dependencies,
- install_tool_dependencies=install_tool_dependencies,
- message=message,
- repo_info_dicts=filtered_repo_info_dicts,
- shed_tool_conf=shed_tool_conf,
- status=status,
- tool_path=tool_path,
- tool_panel_section_keys=tool_panel_section_keys,
- tool_shed_repository_ids=encoded_repository_ids,
- tool_shed_url=tool_shed_url )
- encoded_kwd = encoding_util.tool_shed_encode( new_kwd )
- tsr_ids = [ r.id for r in created_or_updated_tool_shed_repositories ]
- tool_shed_repositories = []
- for tsr_id in tsr_ids:
- tsr = trans.sa_session.query( trans.model.ToolShedRepository ).get( tsr_id )
- tool_shed_repositories.append( tsr )
- clause_list = []
- for tsr_id in tsr_ids:
- clause_list.append( trans.model.ToolShedRepository.table.c.id == tsr_id )
- query = trans.sa_session.query( trans.model.ToolShedRepository ).filter( or_( *clause_list ) )
+ installation_dict = dict( created_or_updated_tool_shed_repositories=created_or_updated_tool_shed_repositories,
+ filtered_repo_info_dicts=filtered_repo_info_dicts,
+ has_repository_dependencies=has_repository_dependencies,
+ includes_tool_dependencies=includes_tool_dependencies,
+ includes_tools=includes_tools,
+ includes_tools_for_display_in_tool_panel=includes_tools_for_display_in_tool_panel,
+ install_repository_dependencies=install_repository_dependencies,
+ install_tool_dependencies=install_tool_dependencies,
+ message=message,
+ new_tool_panel_section=new_tool_panel_section,
+ shed_tool_conf=shed_tool_conf,
+ status=status,
+ tool_panel_section=tool_panel_section,
+ tool_panel_section_keys=tool_panel_section_keys,
+ tool_path=tool_path,
+ tool_shed_url=tool_shed_url )
+ encoded_kwd, query, tool_shed_repositories, encoded_repository_ids = repository_util.initiate_repository_installation( trans, installation_dict )
return trans.fill_template( 'admin/tool_shed_repository/initiate_repository_installation.mako',
encoded_kwd=encoded_kwd,
query=query,
diff -r b45e7e2cf125642efcbbcb112778a44f64de4ec2 -r dab01cbc83dceddd9f02a48deb32c7ffb1817eba lib/galaxy/webapps/tool_shed/controllers/repository.py
--- a/lib/galaxy/webapps/tool_shed/controllers/repository.py
+++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py
@@ -1,26 +1,47 @@
-import os, logging, re, tempfile, ConfigParser, string
-from time import gmtime, strftime
+import ConfigParser
+import logging
+import os
+import re
+import string
+import tempfile
+from time import gmtime
+from time import strftime
from datetime import date, datetime
-from galaxy import util, web
+from galaxy import util
+from galaxy import web
from galaxy.util.odict import odict
from galaxy.web.base.controller import BaseUIController
-from galaxy.web.form_builder import CheckboxField, build_select_field
+from galaxy.web.form_builder import CheckboxField
+from galaxy.web.form_builder import build_select_field
from galaxy.webapps.tool_shed import model
from galaxy.webapps.tool_shed.model import directory_hash_id
from galaxy.web.framework.helpers import grids
from galaxy.util import json
-from galaxy.model.orm import and_, or_
+from galaxy.model.orm import and_
+from galaxy.model.orm import or_
import tool_shed.util.shed_util_common as suc
-from tool_shed.util import encoding_util, metadata_util, readme_util, repository_dependency_util, review_util, tool_dependency_util, tool_util, workflow_util
+from tool_shed.util import encoding_util
+from tool_shed.util import metadata_util
+from tool_shed.util import readme_util
+from tool_shed.util import repository_dependency_util
+from tool_shed.util import review_util
+from tool_shed.util import tool_dependency_util
+from tool_shed.util import tool_util
+from tool_shed.util import workflow_util
from tool_shed.galaxy_install import repository_util
-from galaxy.webapps.tool_shed.util import common_util, container_util
+from galaxy.webapps.tool_shed.util import common_util
+from galaxy.webapps.tool_shed.util import container_util
import galaxy.tools
import tool_shed.grids.repository_grids as repository_grids
import tool_shed.grids.util as grids_util
from galaxy import eggs
eggs.require('mercurial')
-from mercurial import hg, ui, patch, commands
+
+from mercurial import commands
+from mercurial import hg
+from mercurial import patch
+from mercurial import ui
log = logging.getLogger( __name__ )
@@ -1124,35 +1145,17 @@
includes_tool_dependencies = False
repo_info_dicts = []
for tup in zip( util.listify( repository_ids ), util.listify( changeset_revisions ) ):
- repository_id, changeset_revision = tup
- repository = suc.get_repository_in_tool_shed( trans, repository_id )
- repository_clone_url = suc.generate_clone_url_for_repository_in_tool_shed( trans, repository )
- repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision )
- metadata = repository_metadata.metadata
- if not includes_tools:
- if 'tools' in metadata:
- includes_tools = True
- if not includes_tools_for_display_in_tool_panel:
- includes_tools_for_display_in_tool_panel = repository_metadata.includes_tools_for_display_in_tool_panel
- if not has_repository_dependencies:
- if 'repository_dependencies' in metadata:
- has_repository_dependencies = True
- if not includes_tool_dependencies:
- if 'tool_dependencies' in metadata:
- includes_tool_dependencies = True
- repo_dir = repository.repo_path( trans.app )
- repo = hg.repository( suc.get_configured_ui(), repo_dir )
- ctx = suc.get_changectx_for_changeset( repo, changeset_revision )
- repo_info_dict = repository_util.create_repo_info_dict( trans=trans,
- repository_clone_url=repository_clone_url,
- changeset_revision=changeset_revision,
- ctx_rev=str( ctx.rev() ),
- repository_owner=repository.user.username,
- repository_name=repository.name,
- repository=repository,
- repository_metadata=repository_metadata,
- tool_dependencies=None,
- repository_dependencies=None )
+ repository_id, changeset_revision = tup
+ repo_info_dict, cur_includes_tools, cur_includes_tool_dependencies, cur_includes_tools_for_display_in_tool_panel, cur_has_repository_dependencies = \
+ repository_util.get_repo_info_dict( trans, repository_id, changeset_revision )
+ if cur_has_repository_dependencies and not has_repository_dependencies:
+ has_repository_dependencies = True
+ if cur_includes_tools and not includes_tools:
+ includes_tools = True
+ if cur_includes_tool_dependencies and not includes_tool_dependencies:
+ includes_tool_dependencies = True
+ if cur_includes_tools_for_display_in_tool_panel and not includes_tools_for_display_in_tool_panel:
+ includes_tools_for_display_in_tool_panel = True
repo_info_dicts.append( encoding_util.tool_shed_encode( repo_info_dict ) )
return dict( includes_tools=includes_tools,
includes_tools_for_display_in_tool_panel=includes_tools_for_display_in_tool_panel,
diff -r b45e7e2cf125642efcbbcb112778a44f64de4ec2 -r dab01cbc83dceddd9f02a48deb32c7ffb1817eba lib/galaxy/webapps/tool_shed/model/__init__.py
--- a/lib/galaxy/webapps/tool_shed/model/__init__.py
+++ b/lib/galaxy/webapps/tool_shed/model/__init__.py
@@ -192,10 +192,10 @@
class RepositoryMetadata( object, APIItem ):
api_collection_visible_keys = ( 'id', 'repository_id', 'changeset_revision', 'malicious', 'downloadable', 'has_repository_dependencies', 'includes_datatypes',
- 'includes_tools', 'includes_tool_dependencies', 'includes_workflows' )
+ 'includes_tools', 'includes_tool_dependencies', 'includes_tools_for_display_in_tool_panel', 'includes_workflows' )
api_element_visible_keys = ( 'id', 'repository_id', 'changeset_revision', 'malicious', 'downloadable', 'tools_functionally_correct',
'do_not_test', 'time_last_tested', 'tool_test_errors', 'has_repository_dependencies', 'includes_datatypes', 'includes_tools',
- 'includes_tool_dependencies', 'includes_workflows' )
+ 'includes_tool_dependencies', 'includes_tools_for_display_in_tool_panel', 'includes_workflows' )
def __init__( self, id=None, repository_id=None, changeset_revision=None, metadata=None, tool_versions=None, malicious=False, downloadable=False,
tools_functionally_correct=False, do_not_test=False, time_last_tested=None, tool_test_errors=None, has_repository_dependencies=False,
includes_datatypes=False, includes_tools=False, includes_tool_dependencies=False, includes_workflows=False ):
diff -r b45e7e2cf125642efcbbcb112778a44f64de4ec2 -r dab01cbc83dceddd9f02a48deb32c7ffb1817eba lib/tool_shed/galaxy_install/repository_util.py
--- a/lib/tool_shed/galaxy_install/repository_util.py
+++ b/lib/tool_shed/galaxy_install/repository_util.py
@@ -1,14 +1,31 @@
-import os, logging, threading, urllib2
-from galaxy.web import url_for
+import logging
+import os
+import threading
+import urllib2
+from galaxy import tools
+from galaxy import web
+from galaxy.model.orm import or_
from galaxy.webapps.tool_shed.util import container_util
import tool_shed.util.shed_util_common as suc
-from tool_shed.util import encoding_util, repository_dependency_util, tool_dependency_util, tool_util
+from tool_shed.util import data_manager_util
+from tool_shed.util import datatype_util
+from tool_shed.util import encoding_util
+from tool_shed.util import repository_dependency_util
+from tool_shed.util import metadata_util
+from tool_shed.util import tool_dependency_util
+from tool_shed.util import tool_util
from galaxy import eggs
import pkg_resources
pkg_resources.require( 'mercurial' )
-from mercurial import hg, ui, commands
+from mercurial import commands
+from mercurial import hg
+from mercurial import ui
+
+pkg_resources.require( 'elementtree' )
+from elementtree import ElementTree
+from elementtree.ElementTree import Element
log = logging.getLogger( __name__ )
@@ -41,7 +58,7 @@
repository_dependency_util.get_repository_dependencies_for_changeset_revision( trans=trans,
repository=repository,
repository_metadata=repository_metadata,
- toolshed_base_url=str( url_for( '/', qualified=True ) ).rstrip( '/' ),
+ toolshed_base_url=str( web.url_for( '/', qualified=True ) ).rstrip( '/' ),
key_rd_dicts_to_be_processed=None,
all_repository_dependencies=None,
handled_key_rd_dicts=None,
@@ -74,6 +91,39 @@
tool_dependencies )
return repo_info_dict
+def get_repo_info_dict( trans, repository_id, changeset_revision ):
+ repository = suc.get_repository_in_tool_shed( trans, repository_id )
+ repository_clone_url = suc.generate_clone_url_for_repository_in_tool_shed( trans, repository )
+ repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision )
+ metadata = repository_metadata.metadata
+ if 'tools' in metadata:
+ includes_tools = True
+ else:
+ includes_tools = False
+ includes_tools_for_display_in_tool_panel = repository_metadata.includes_tools_for_display_in_tool_panel
+ if 'repository_dependencies' in metadata:
+ has_repository_dependencies = True
+ else:
+ has_repository_dependencies = False
+ if 'tool_dependencies' in metadata:
+ includes_tool_dependencies = True
+ else:
+ includes_tool_dependencies = False
+ repo_dir = repository.repo_path( trans.app )
+ repo = hg.repository( suc.get_configured_ui(), repo_dir )
+ ctx = suc.get_changectx_for_changeset( repo, changeset_revision )
+ repo_info_dict = create_repo_info_dict( trans=trans,
+ repository_clone_url=repository_clone_url,
+ changeset_revision=changeset_revision,
+ ctx_rev=str( ctx.rev() ),
+ repository_owner=repository.user.username,
+ repository_name=repository.name,
+ repository=repository,
+ repository_metadata=repository_metadata,
+ tool_dependencies=None,
+ repository_dependencies=None )
+ return repo_info_dict, includes_tools, includes_tool_dependencies, includes_tools_for_display_in_tool_panel, has_repository_dependencies
+
def get_update_to_changeset_revision_and_ctx_rev( trans, repository ):
"""Return the changeset revision hash to which the repository can be updated."""
changeset_revision_dict = {}
@@ -117,6 +167,186 @@
changeset_revision_dict[ 'ctx_rev' ] = None
return changeset_revision_dict
+def handle_repository_contents( trans, tool_shed_repository, tool_path, repository_clone_url, relative_install_dir, tool_shed=None, tool_section=None, shed_tool_conf=None,
+ reinstalling=False ):
+ """
+ Generate the metadata for the installed tool shed repository, among other things. This method is called from Galaxy (never the tool shed)
+ when an administrator is installing a new repository or reinstalling an uninstalled repository.
+ """
+ shed_config_dict = trans.app.toolbox.get_shed_config_dict_by_filename( shed_tool_conf )
+ metadata_dict, invalid_file_tups = metadata_util.generate_metadata_for_changeset_revision( app=trans.app,
+ repository=tool_shed_repository,
+ changeset_revision=tool_shed_repository.changeset_revision,
+ repository_clone_url=repository_clone_url,
+ shed_config_dict=shed_config_dict,
+ relative_install_dir=relative_install_dir,
+ repository_files_dir=None,
+ resetting_all_metadata_on_repository=False,
+ updating_installed_repository=False,
+ persist=True )
+ tool_shed_repository.metadata = metadata_dict
+ trans.sa_session.add( tool_shed_repository )
+ trans.sa_session.flush()
+ if 'tool_dependencies' in metadata_dict and not reinstalling:
+ tool_dependencies = tool_dependency_util.create_tool_dependency_objects( trans.app, tool_shed_repository, relative_install_dir, set_status=True )
+ if 'tools' in metadata_dict:
+ tool_panel_dict = tool_util.generate_tool_panel_dict_for_new_install( metadata_dict[ 'tools' ], tool_section )
+ sample_files = metadata_dict.get( 'sample_files', [] )
+ tool_index_sample_files = tool_util.get_tool_index_sample_files( sample_files )
+ tool_util.copy_sample_files( trans.app, tool_index_sample_files, tool_path=tool_path )
+ sample_files_copied = [ str( s ) for s in tool_index_sample_files ]
+ repository_tools_tups = suc.get_repository_tools_tups( trans.app, metadata_dict )
+ if repository_tools_tups:
+ # Handle missing data table entries for tool parameters that are dynamically generated select lists.
+ repository_tools_tups = tool_util.handle_missing_data_table_entry( trans.app, relative_install_dir, tool_path, repository_tools_tups )
+ # Handle missing index files for tool parameters that are dynamically generated select lists.
+ repository_tools_tups, sample_files_copied = tool_util.handle_missing_index_file( trans.app, tool_path, sample_files, repository_tools_tups, sample_files_copied )
+ # Copy remaining sample files included in the repository to the ~/tool-data directory of the local Galaxy instance.
+ tool_util.copy_sample_files( trans.app, sample_files, tool_path=tool_path, sample_files_copied=sample_files_copied )
+ tool_util.add_to_tool_panel( app=trans.app,
+ repository_name=tool_shed_repository.name,
+ repository_clone_url=repository_clone_url,
+ changeset_revision=tool_shed_repository.installed_changeset_revision,
+ repository_tools_tups=repository_tools_tups,
+ owner=tool_shed_repository.owner,
+ shed_tool_conf=shed_tool_conf,
+ tool_panel_dict=tool_panel_dict,
+ new_install=True )
+ if 'data_manager' in metadata_dict:
+ new_data_managers = data_manager_util.install_data_managers( trans.app,
+ trans.app.config.shed_data_manager_config_file,
+ metadata_dict,
+ shed_config_dict,
+ relative_install_dir,
+ tool_shed_repository,
+ repository_tools_tups )
+ if 'datatypes' in metadata_dict:
+ tool_shed_repository.status = trans.model.ToolShedRepository.installation_status.LOADING_PROPRIETARY_DATATYPES
+ if not tool_shed_repository.includes_datatypes:
+ tool_shed_repository.includes_datatypes = True
+ trans.sa_session.add( tool_shed_repository )
+ trans.sa_session.flush()
+ files_dir = relative_install_dir
+ if shed_config_dict.get( 'tool_path' ):
+ files_dir = os.path.join( shed_config_dict[ 'tool_path' ], files_dir )
+ datatypes_config = suc.get_config_from_disk( 'datatypes_conf.xml', files_dir )
+ # Load data types required by tools.
+ converter_path, display_path = datatype_util.alter_config_and_load_prorietary_datatypes( trans.app, datatypes_config, files_dir, override=False )
+ if converter_path or display_path:
+ # Create a dictionary of tool shed repository related information.
+ repository_dict = datatype_util.create_repository_dict_for_proprietary_datatypes( tool_shed=tool_shed,
+ name=tool_shed_repository.name,
+ owner=tool_shed_repository.owner,
+ installed_changeset_revision=tool_shed_repository.installed_changeset_revision,
+ tool_dicts=metadata_dict.get( 'tools', [] ),
+ converter_path=converter_path,
+ display_path=display_path )
+ if converter_path:
+ # Load proprietary datatype converters
+ trans.app.datatypes_registry.load_datatype_converters( trans.app.toolbox, installed_repository_dict=repository_dict )
+ if display_path:
+ # Load proprietary datatype display applications
+ trans.app.datatypes_registry.load_display_applications( installed_repository_dict=repository_dict )
+
+def handle_tool_shed_repositories( trans, installation_dict ):
+ # The following installation_dict entries are all required.
+ install_repository_dependencies = installation_dict[ 'install_repository_dependencies' ]
+ new_tool_panel_section = installation_dict[ 'new_tool_panel_section' ]
+ no_changes_checked = installation_dict[ 'no_changes_checked' ]
+ reinstalling = installation_dict[ 'reinstalling' ]
+ repo_info_dicts = installation_dict[ 'repo_info_dicts' ]
+ tool_panel_section = installation_dict[ 'tool_panel_section' ]
+ tool_path = installation_dict[ 'tool_path' ]
+ tool_shed_url = installation_dict[ 'tool_shed_url' ]
+ created_or_updated_tool_shed_repositories, tool_panel_section_keys, repo_info_dicts, filtered_repo_info_dicts, message = \
+ repository_dependency_util.create_repository_dependency_objects( trans=trans,
+ tool_path=tool_path,
+ tool_shed_url=tool_shed_url,
+ repo_info_dicts=repo_info_dicts,
+ reinstalling=reinstalling,
+ install_repository_dependencies=install_repository_dependencies,
+ no_changes_checked=no_changes_checked,
+ tool_panel_section=tool_panel_section,
+ new_tool_panel_section=new_tool_panel_section )
+ if message and len( repo_info_dicts ) == 1:
+ installed_tool_shed_repository = created_or_updated_tool_shed_repositories[ 0 ]
+ message += 'Click <a href="%s">here</a> to manage the repository. ' % \
+ ( web.url_for( controller='admin_toolshed', action='manage_repository', id=trans.security.encode_id( installed_tool_shed_repository.id ) ) )
+ return created_or_updated_tool_shed_repositories, tool_panel_section_keys, repo_info_dicts, filtered_repo_info_dicts, message
+
+def initiate_repository_installation( trans, installation_dict ):
+ # The following installation_dict entries are all required.
+ created_or_updated_tool_shed_repositories = installation_dict[ 'created_or_updated_tool_shed_repositories' ]
+ filtered_repo_info_dicts = installation_dict[ 'filtered_repo_info_dicts' ]
+ has_repository_dependencies = installation_dict[ 'has_repository_dependencies' ]
+ includes_tool_dependencies = installation_dict[ 'includes_tool_dependencies' ]
+ includes_tools = installation_dict[ 'includes_tools' ]
+ includes_tools_for_display_in_tool_panel = installation_dict[ 'includes_tools_for_display_in_tool_panel' ]
+ install_repository_dependencies = installation_dict[ 'install_repository_dependencies' ]
+ install_tool_dependencies = installation_dict[ 'install_tool_dependencies' ]
+ message = installation_dict[ 'message' ]
+ new_tool_panel_section = installation_dict[ 'new_tool_panel_section' ]
+ shed_tool_conf = installation_dict[ 'shed_tool_conf' ]
+ status = installation_dict[ 'status' ]
+ tool_panel_section = installation_dict[ 'tool_panel_section' ]
+ tool_panel_section_keys = installation_dict[ 'tool_panel_section_keys' ]
+ tool_path = installation_dict[ 'tool_path' ]
+ tool_shed_url = installation_dict[ 'tool_shed_url' ]
+ # Handle contained tools.
+ if includes_tools_for_display_in_tool_panel and ( new_tool_panel_section or tool_panel_section ):
+ if new_tool_panel_section:
+ section_id = new_tool_panel_section.lower().replace( ' ', '_' )
+ tool_panel_section_key = 'section_%s' % str( section_id )
+ if tool_panel_section_key in trans.app.toolbox.tool_panel:
+ # Appending a tool to an existing section in trans.app.toolbox.tool_panel
+ log.debug( "Appending to tool panel section: %s" % new_tool_panel_section )
+ tool_section = trans.app.toolbox.tool_panel[ tool_panel_section_key ]
+ else:
+ # Appending a new section to trans.app.toolbox.tool_panel
+ log.debug( "Loading new tool panel section: %s" % new_tool_panel_section )
+ elem = Element( 'section' )
+ elem.attrib[ 'name' ] = new_tool_panel_section
+ elem.attrib[ 'id' ] = section_id
+ elem.attrib[ 'version' ] = ''
+ tool_section = tools.ToolSection( elem )
+ trans.app.toolbox.tool_panel[ tool_panel_section_key ] = tool_section
+ else:
+ tool_panel_section_key = 'section_%s' % tool_panel_section
+ tool_section = trans.app.toolbox.tool_panel[ tool_panel_section_key ]
+ else:
+ tool_panel_section_key = None
+ tool_section = None
+ encoded_repository_ids = [ trans.security.encode_id( tsr.id ) for tsr in created_or_updated_tool_shed_repositories ]
+ # Create a one-to-one mapping of tool shed repository id and tool panel section key. All tools contained in the repositories being installed will be loaded
+ # into the same section in the tool panel.
+ for tsr in created_or_updated_tool_shed_repositories:
+ tool_panel_section_keys.append( tool_panel_section_key )
+ new_kwd = dict( includes_tools=includes_tools,
+ includes_tools_for_display_in_tool_panel=includes_tools_for_display_in_tool_panel,
+ has_repository_dependencies=has_repository_dependencies,
+ install_repository_dependencies=install_repository_dependencies,
+ includes_tool_dependencies=includes_tool_dependencies,
+ install_tool_dependencies=install_tool_dependencies,
+ message=message,
+ repo_info_dicts=filtered_repo_info_dicts,
+ shed_tool_conf=shed_tool_conf,
+ status=status,
+ tool_path=tool_path,
+ tool_panel_section_keys=tool_panel_section_keys,
+ tool_shed_repository_ids=encoded_repository_ids,
+ tool_shed_url=tool_shed_url )
+ encoded_kwd = encoding_util.tool_shed_encode( new_kwd )
+ tsr_ids = [ r.id for r in created_or_updated_tool_shed_repositories ]
+ tool_shed_repositories = []
+ for tsr_id in tsr_ids:
+ tsr = trans.sa_session.query( trans.model.ToolShedRepository ).get( tsr_id )
+ tool_shed_repositories.append( tsr )
+ clause_list = []
+ for tsr_id in tsr_ids:
+ clause_list.append( trans.model.ToolShedRepository.table.c.id == tsr_id )
+ query = trans.sa_session.query( trans.model.ToolShedRepository ).filter( or_( *clause_list ) )
+ return encoded_kwd, query, tool_shed_repositories, encoded_repository_ids
+
def merge_containers_dicts_for_new_install( containers_dicts ):
"""
When installing one or more tool shed repositories for the first time, the received list of containers_dicts contains a containers_dict for
diff -r b45e7e2cf125642efcbbcb112778a44f64de4ec2 -r dab01cbc83dceddd9f02a48deb32c7ffb1817eba lib/tool_shed/util/shed_util_common.py
--- a/lib/tool_shed/util/shed_util_common.py
+++ b/lib/tool_shed/util/shed_util_common.py
@@ -1,6 +1,12 @@
-import os, shutil, tempfile, logging, string, urllib2
+import logging
+import os
+import shutil
+import string
+import tempfile
+import urllib2
from datetime import datetime
-from time import gmtime, strftime
+from time import gmtime
+from time import strftime
from galaxy import util
from galaxy.util import json
from galaxy.web import url_for
@@ -16,8 +22,10 @@
from mercurial import hg, ui, commands
pkg_resources.require( 'elementtree' )
-from elementtree import ElementTree, ElementInclude
-from elementtree.ElementTree import Element, SubElement
+from elementtree import ElementTree
+from elementtree import ElementInclude
+from elementtree.ElementTree import Element
+from elementtree.ElementTree import SubElement
eggs.require( 'markupsafe' )
import markupsafe
@@ -522,7 +530,7 @@
if changeset_revision in changeset_revisions:
return changeset_revision
elif not found_after_changeset_revision and changeset_revision == after_changeset_revision:
- # We've found the changeset in the changelog for which we need to get the next downloadable changset.
+ # We've found the changeset in the changelog for which we need to get the next downloadable changeset.
found_after_changeset_revision = True
return None
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/cfb18b939f74/
Changeset: cfb18b939f74
Branch: next-stable
User: dan
Date: 2013-03-22 19:23:24
Summary: Fix for average_rating in repository_review.
Affected #: 1 file
diff -r fc236ecff8ecd8864dee797e9a70ec800e63948d -r cfb18b939f74aaa97c277e172aee5a8e0f24b55e lib/galaxy/webapps/tool_shed/controllers/repository_review.py
--- a/lib/galaxy/webapps/tool_shed/controllers/repository_review.py
+++ b/lib/galaxy/webapps/tool_shed/controllers/repository_review.py
@@ -320,7 +320,8 @@
trans.model.ComponentReview.table.c.deleted == False,
trans.model.ComponentReview.table.c.approved != trans.model.ComponentReview.approved_states.NA ) ) \
.scalar()
- review.rating = int( average_rating )
+ if average_rating is not None:
+ review.rating = int( average_rating )
trans.sa_session.add( review )
trans.sa_session.flush()
# Update the information in components_dict.
https://bitbucket.org/galaxy/galaxy-central/commits/b45e7e2cf125/
Changeset: b45e7e2cf125
User: dan
Date: 2013-03-22 19:23:24
Summary: Fix for average_rating in repository_review.
Affected #: 1 file
diff -r c923439d8226f292160faf04b1c66a6baa2450af -r b45e7e2cf125642efcbbcb112778a44f64de4ec2 lib/galaxy/webapps/tool_shed/controllers/repository_review.py
--- a/lib/galaxy/webapps/tool_shed/controllers/repository_review.py
+++ b/lib/galaxy/webapps/tool_shed/controllers/repository_review.py
@@ -320,7 +320,8 @@
trans.model.ComponentReview.table.c.deleted == False,
trans.model.ComponentReview.table.c.approved != trans.model.ComponentReview.approved_states.NA ) ) \
.scalar()
- review.rating = int( average_rating )
+ if average_rating is not None:
+ review.rating = int( average_rating )
trans.sa_session.add( review )
trans.sa_session.flush()
# Update the information in components_dict.
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: dan: Add some comments to the new-style display applications module.
by commits-noreply@bitbucket.org 22 Mar '13
by commits-noreply@bitbucket.org 22 Mar '13
22 Mar '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/c923439d8226/
Changeset: c923439d8226
User: dan
Date: 2013-03-22 17:33:10
Summary: Add some comments to the new-style display applications module.
Affected #: 2 files
diff -r 49c09e9f8c8b97ca37ddf484efe4a539c7bbf9cc -r c923439d8226f292160faf04b1c66a6baa2450af lib/galaxy/datatypes/display_applications/__init__.py
--- a/lib/galaxy/datatypes/display_applications/__init__.py
+++ b/lib/galaxy/datatypes/display_applications/__init__.py
@@ -1,1 +1,3 @@
-
+"""
+Contains functionality of the newer XML defined external display applications (not hardcoded into datatype classes).
+"""
diff -r 49c09e9f8c8b97ca37ddf484efe4a539c7bbf9cc -r c923439d8226f292160faf04b1c66a6baa2450af lib/galaxy/datatypes/display_applications/link_generator.py
--- a/lib/galaxy/datatypes/display_applications/link_generator.py
+++ b/lib/galaxy/datatypes/display_applications/link_generator.py
@@ -1,8 +1,11 @@
-"""Classes to generate links for display applications.
+"""Classes to generate links for old-style display applications.
Separating Transaction based elements of display applications from datatypes.
"""
+#FIXME: The code contained within this file is for old-style display applications, but
+#this module namespace is intended to only handle the new-style display applications.
+
import urllib
# for the url_for hack
@@ -19,6 +22,8 @@
#TODO: these could be extended to handle file_function and parse/contain the builds.txt files
+#HACK: these duplicate functionality from the individual datatype classes themselves
+
def get_display_app_link_generator( display_app_name ):
"""Returns an instance of the proper link generator class
based on the display_app_name or DisplayAppLinkGenerator
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
5 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/c78e28a5f748/
Changeset: c78e28a5f748
Branch: stable
User: dan
Date: 2013-03-22 17:23:05
Summary: Do not display old-style display links in server-side history when they are disabled.
Affected #: 1 file
diff -r c0a665a31e9160fa344255d6f3fe22a0ab2b6a6f -r c78e28a5f748e16b0a168d36ba55e5625f322548 lib/galaxy/datatypes/data.py
--- a/lib/galaxy/datatypes/data.py
+++ b/lib/galaxy/datatypes/data.py
@@ -437,12 +437,12 @@
apply anyway.
"""
try:
- if type in self.get_display_types():
+ if app.config.enable_old_display_applications and type in self.get_display_types():
return target_frame, getattr ( self, self.supported_display_apps[type]['links_function'] ) ( dataset, type, app, base_url, **kwd )
except:
log.exception( 'Function %s is referred to in datatype %s for generating links for type %s, but is not accessible' \
% ( self.supported_display_apps[type]['links_function'], self.__class__.__name__, type ) )
- return []
+ return target_frame, []
def get_converter_types(self, original_dataset, datatypes_registry):
"""Returns available converters by type for this dataset"""
return datatypes_registry.get_converters_by_datatype(original_dataset.ext)
https://bitbucket.org/galaxy/galaxy-central/commits/12b05ec9d3de/
Changeset: 12b05ec9d3de
Branch: next-stable
User: dan
Date: 2013-03-22 17:23:05
Summary: Do not display old-style display links in server-side history when they are disabled.
Affected #: 1 file
diff -r 66c67f015f9e8beb1bfaf4365bdaeb41d9090fe2 -r 12b05ec9d3de16202bb3005c39d61b6d643bfdcb lib/galaxy/datatypes/data.py
--- a/lib/galaxy/datatypes/data.py
+++ b/lib/galaxy/datatypes/data.py
@@ -448,12 +448,12 @@
apply anyway.
"""
try:
- if type in self.get_display_types():
+ if app.config.enable_old_display_applications and type in self.get_display_types():
return target_frame, getattr ( self, self.supported_display_apps[type]['links_function'] ) ( dataset, type, app, base_url, **kwd )
except:
log.exception( 'Function %s is referred to in datatype %s for generating links for type %s, but is not accessible' \
% ( self.supported_display_apps[type]['links_function'], self.__class__.__name__, type ) )
- return []
+ return target_frame, []
def get_converter_types(self, original_dataset, datatypes_registry):
"""Returns available converters by type for this dataset"""
return datatypes_registry.get_converters_by_datatype(original_dataset.ext)
https://bitbucket.org/galaxy/galaxy-central/commits/6701d9bb937e/
Changeset: 6701d9bb937e
User: dan
Date: 2013-03-22 17:23:05
Summary: Do not display old-style display links in server-side history when they are disabled.
Affected #: 1 file
diff -r 56799709a0f35d1f5cde0aa8f38939eafea98294 -r 6701d9bb937e488ac9797d14ad81ef1ced48cd41 lib/galaxy/datatypes/data.py
--- a/lib/galaxy/datatypes/data.py
+++ b/lib/galaxy/datatypes/data.py
@@ -448,12 +448,12 @@
apply anyway.
"""
try:
- if type in self.get_display_types():
+ if app.config.enable_old_display_applications and type in self.get_display_types():
return target_frame, getattr ( self, self.supported_display_apps[type]['links_function'] ) ( dataset, type, app, base_url, **kwd )
except:
log.exception( 'Function %s is referred to in datatype %s for generating links for type %s, but is not accessible' \
% ( self.supported_display_apps[type]['links_function'], self.__class__.__name__, type ) )
- return []
+ return target_frame, []
def get_converter_types(self, original_dataset, datatypes_registry):
"""Returns available converters by type for this dataset"""
return datatypes_registry.get_converters_by_datatype(original_dataset.ext)
https://bitbucket.org/galaxy/galaxy-central/commits/fc236ecff8ec/
Changeset: fc236ecff8ec
Branch: next-stable
User: dan
Date: 2013-03-22 17:26:03
Summary: Do not display old-style display links in client-side history when they are disabled.
Affected #: 1 file
diff -r 12b05ec9d3de16202bb3005c39d61b6d643bfdcb -r fc236ecff8ecd8864dee797e9a70ec800e63948d lib/galaxy/web/base/controller.py
--- a/lib/galaxy/web/base/controller.py
+++ b/lib/galaxy/web/base/controller.py
@@ -394,6 +394,8 @@
def get_old_display_applications( self, trans, hda ):
display_apps = []
+ if not trans.app.config.enable_old_display_applications:
+ return display_apps
for display_app_name in hda.datatype.get_display_types():
link_generator = get_display_app_link_generator( display_app_name )
display_links = link_generator.generate_links( trans, hda )
https://bitbucket.org/galaxy/galaxy-central/commits/49c09e9f8c8b/
Changeset: 49c09e9f8c8b
User: dan
Date: 2013-03-22 17:26:03
Summary: Do not display old-style display links in client-side history when they are disabled.
Affected #: 1 file
Diff not available.
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
3 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/c0a665a31e91/
Changeset: c0a665a31e91
Branch: stable
User: dan
Date: 2013-03-22 16:43:42
Summary: Allow old-style display applications to be disabled.
Affected #: 3 files
diff -r 779b54139013946613772d02a3fbb61e067f3267 -r c0a665a31e9160fa344255d6f3fe22a0ab2b6a6f lib/galaxy/config.py
--- a/lib/galaxy/config.py
+++ b/lib/galaxy/config.py
@@ -141,6 +141,7 @@
self.log_actions = string_as_bool( kwargs.get( 'log_actions', 'False' ) )
self.log_events = string_as_bool( kwargs.get( 'log_events', 'False' ) )
self.sanitize_all_html = string_as_bool( kwargs.get( 'sanitize_all_html', True ) )
+ self.enable_old_display_applications = string_as_bool( kwargs.get( "enable_old_display_applications", "True" ) )
self.ucsc_display_sites = kwargs.get( 'ucsc_display_sites', "main,test,archaea,ucla" ).lower().split(",")
self.gbrowse_display_sites = kwargs.get( 'gbrowse_display_sites', "modencode,sgd_yeast,tair,wormbase,wormbase_ws120,wormbase_ws140,wormbase_ws170,wormbase_ws180,wormbase_ws190,wormbase_ws200,wormbase_ws204,wormbase_ws210,wormbase_ws220,wormbase_ws225" ).lower().split(",")
self.genetrack_display_sites = kwargs.get( 'genetrack_display_sites', "main,test" ).lower().split(",")
diff -r 779b54139013946613772d02a3fbb61e067f3267 -r c0a665a31e9160fa344255d6f3fe22a0ab2b6a6f lib/galaxy/webapps/galaxy/controllers/dataset.py
--- a/lib/galaxy/webapps/galaxy/controllers/dataset.py
+++ b/lib/galaxy/webapps/galaxy/controllers/dataset.py
@@ -700,6 +700,8 @@
@web.expose
def display_at( self, trans, dataset_id, filename=None, **kwd ):
"""Sets up a dataset permissions so it is viewable at an external site"""
+ if not trans.app.config.enable_old_display_applications:
+ return trans.show_error_message( "This method of accessing external display applications has been disabled by a Galaxy administrator." )
site = filename
data = trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( dataset_id )
if not data:
diff -r 779b54139013946613772d02a3fbb61e067f3267 -r c0a665a31e9160fa344255d6f3fe22a0ab2b6a6f universe_wsgi.ini.sample
--- a/universe_wsgi.ini.sample
+++ b/universe_wsgi.ini.sample
@@ -247,6 +247,16 @@
# them).
#display_servers = hgw1.cse.ucsc.edu,hgw2.cse.ucsc.edu,hgw3.cse.ucsc.edu,hgw4.cse.ucsc.edu,hgw…
+# To disable the old-style display applications that are hardcoded into datatype classes,
+# set enable_old_display_applications = False.
+# This may be desirable due to using the new-style, XML-defined, display applications that
+# have been defined for many of the datatypes that have the old-style.
+# There is also a potential security concern with the old-style applications,
+# where a malicious party could provide a link that appears to reference the Galaxy server,
+# but contains a redirect to a third-party server, tricking a Galaxy user to access said
+# site.
+#enable_old_display_applications = True
+
# -- Next gen LIMS interface on top of existing Galaxy Sample/Request management code.
use_nglims = False
https://bitbucket.org/galaxy/galaxy-central/commits/66c67f015f9e/
Changeset: 66c67f015f9e
Branch: next-stable
User: dan
Date: 2013-03-22 16:43:42
Summary: Allow old-style display applications to be disabled.
Affected #: 3 files
diff -r 3bbbcdb044afdbd380d6cd4c0f721ab7262c5555 -r 66c67f015f9e8beb1bfaf4365bdaeb41d9090fe2 lib/galaxy/config.py
--- a/lib/galaxy/config.py
+++ b/lib/galaxy/config.py
@@ -151,6 +151,7 @@
self.log_actions = string_as_bool( kwargs.get( 'log_actions', 'False' ) )
self.log_events = string_as_bool( kwargs.get( 'log_events', 'False' ) )
self.sanitize_all_html = string_as_bool( kwargs.get( 'sanitize_all_html', True ) )
+ self.enable_old_display_applications = string_as_bool( kwargs.get( "enable_old_display_applications", "True" ) )
self.ucsc_display_sites = kwargs.get( 'ucsc_display_sites', "main,test,archaea,ucla" ).lower().split(",")
self.gbrowse_display_sites = kwargs.get( 'gbrowse_display_sites', "modencode,sgd_yeast,tair,wormbase,wormbase_ws120,wormbase_ws140,wormbase_ws170,wormbase_ws180,wormbase_ws190,wormbase_ws200,wormbase_ws204,wormbase_ws210,wormbase_ws220,wormbase_ws225" ).lower().split(",")
self.brand = kwargs.get( 'brand', None )
diff -r 3bbbcdb044afdbd380d6cd4c0f721ab7262c5555 -r 66c67f015f9e8beb1bfaf4365bdaeb41d9090fe2 lib/galaxy/webapps/galaxy/controllers/dataset.py
--- a/lib/galaxy/webapps/galaxy/controllers/dataset.py
+++ b/lib/galaxy/webapps/galaxy/controllers/dataset.py
@@ -697,6 +697,8 @@
@web.expose
def display_at( self, trans, dataset_id, filename=None, **kwd ):
"""Sets up a dataset permissions so it is viewable at an external site"""
+ if not trans.app.config.enable_old_display_applications:
+ return trans.show_error_message( "This method of accessing external display applications has been disabled by a Galaxy administrator." )
site = filename
data = trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( dataset_id )
if not data:
diff -r 3bbbcdb044afdbd380d6cd4c0f721ab7262c5555 -r 66c67f015f9e8beb1bfaf4365bdaeb41d9090fe2 universe_wsgi.ini.sample
--- a/universe_wsgi.ini.sample
+++ b/universe_wsgi.ini.sample
@@ -247,6 +247,16 @@
# them).
#display_servers = hgw1.cse.ucsc.edu,hgw2.cse.ucsc.edu,hgw3.cse.ucsc.edu,hgw4.cse.ucsc.edu,hgw…
+# To disable the old-style display applications that are hardcoded into datatype classes,
+# set enable_old_display_applications = False.
+# This may be desirable due to using the new-style, XML-defined, display applications that
+# have been defined for many of the datatypes that have the old-style.
+# There is also a potential security concern with the old-style applications,
+# where a malicious party could provide a link that appears to reference the Galaxy server,
+# but contains a redirect to a third-party server, tricking a Galaxy user to access said
+# site.
+#enable_old_display_applications = True
+
# -- Next gen LIMS interface on top of existing Galaxy Sample/Request management code.
use_nglims = False
https://bitbucket.org/galaxy/galaxy-central/commits/56799709a0f3/
Changeset: 56799709a0f3
User: dan
Date: 2013-03-22 16:43:42
Summary: Allow old-style display applications to be disabled.
Affected #: 3 files
diff -r d629a346b859c91ba0da27f865952580d1054d80 -r 56799709a0f35d1f5cde0aa8f38939eafea98294 lib/galaxy/config.py
--- a/lib/galaxy/config.py
+++ b/lib/galaxy/config.py
@@ -151,6 +151,7 @@
self.log_actions = string_as_bool( kwargs.get( 'log_actions', 'False' ) )
self.log_events = string_as_bool( kwargs.get( 'log_events', 'False' ) )
self.sanitize_all_html = string_as_bool( kwargs.get( 'sanitize_all_html', True ) )
+ self.enable_old_display_applications = string_as_bool( kwargs.get( "enable_old_display_applications", "True" ) )
self.ucsc_display_sites = kwargs.get( 'ucsc_display_sites', "main,test,archaea,ucla" ).lower().split(",")
self.gbrowse_display_sites = kwargs.get( 'gbrowse_display_sites', "modencode,sgd_yeast,tair,wormbase,wormbase_ws120,wormbase_ws140,wormbase_ws170,wormbase_ws180,wormbase_ws190,wormbase_ws200,wormbase_ws204,wormbase_ws210,wormbase_ws220,wormbase_ws225" ).lower().split(",")
self.brand = kwargs.get( 'brand', None )
diff -r d629a346b859c91ba0da27f865952580d1054d80 -r 56799709a0f35d1f5cde0aa8f38939eafea98294 lib/galaxy/webapps/galaxy/controllers/dataset.py
--- a/lib/galaxy/webapps/galaxy/controllers/dataset.py
+++ b/lib/galaxy/webapps/galaxy/controllers/dataset.py
@@ -697,6 +697,8 @@
@web.expose
def display_at( self, trans, dataset_id, filename=None, **kwd ):
"""Sets up a dataset permissions so it is viewable at an external site"""
+ if not trans.app.config.enable_old_display_applications:
+ return trans.show_error_message( "This method of accessing external display applications has been disabled by a Galaxy administrator." )
site = filename
data = trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( dataset_id )
if not data:
diff -r d629a346b859c91ba0da27f865952580d1054d80 -r 56799709a0f35d1f5cde0aa8f38939eafea98294 universe_wsgi.ini.sample
--- a/universe_wsgi.ini.sample
+++ b/universe_wsgi.ini.sample
@@ -247,6 +247,16 @@
# them).
#display_servers = hgw1.cse.ucsc.edu,hgw2.cse.ucsc.edu,hgw3.cse.ucsc.edu,hgw4.cse.ucsc.edu,hgw…
+# To disable the old-style display applications that are hardcoded into datatype classes,
+# set enable_old_display_applications = False.
+# This may be desirable due to using the new-style, XML-defined, display applications that
+# have been defined for many of the datatypes that have the old-style.
+# There is also a potential security concern with the old-style applications,
+# where a malicious party could provide a link that appears to reference the Galaxy server,
+# but contains a redirect to a third-party server, tricking a Galaxy user to access said
+# site.
+#enable_old_display_applications = True
+
# -- Next gen LIMS interface on top of existing Galaxy Sample/Request management code.
use_nglims = False
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Eliminate unnecessary resource mappers and api classes in the tool shed api, clean up the remaining tool shed api classes, and enhance the tool shed api by adding the ability to retrieve information about a specified repository and repository revision.
by commits-noreply@bitbucket.org 22 Mar '13
by commits-noreply@bitbucket.org 22 Mar '13
22 Mar '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/d629a346b859/
Changeset: d629a346b859
User: greg
Date: 2013-03-22 15:43:58
Summary: Eliminate unnecessary resource mappers and api classes in the tool shed api, clean up the remaining tool shed api classes, and enhance the tool shed api by adding the ability to retrieve information about a specified repository and repository revision.
Affected #: 6 files
diff -r 14ab08c0fbfe3e9735e94f4e399aeabc870fe4b2 -r d629a346b859c91ba0da27f865952580d1054d80 lib/galaxy/webapps/tool_shed/api/repositories.py
--- a/lib/galaxy/webapps/tool_shed/api/repositories.py
+++ b/lib/galaxy/webapps/tool_shed/api/repositories.py
@@ -1,10 +1,30 @@
import logging
+from galaxy.web.framework.helpers import time_ago
import tool_shed.util.shed_util_common as suc
-from galaxy import web, util
+from galaxy import web
+from galaxy import util
from galaxy.web.base.controller import BaseAPIController
+from galaxy import eggs
+import pkg_resources
+
+pkg_resources.require( 'mercurial' )
+from mercurial import hg, ui, commands
+
log = logging.getLogger( __name__ )
+def default_repository_value_mapper( trans, repository ):
+ value_mapper={ 'id' : trans.security.encode_id( repository.id ),
+ 'user_id' : trans.security.encode_id( repository.user_id ) }
+ return value_mapper
+
+def default_repository_metadata_value_mapper( trans, repository_metadata ):
+ value_mapper = { 'id' : trans.security.encode_id( repository_metadata.id ),
+ 'repository_id' : trans.security.encode_id( repository_metadata.repository_id ) }
+ if repository_metadata.time_last_tested:
+ value_mapper[ 'time_last_tested' ] = time_ago( repository_metadata.time_last_tested )
+ return value_mapper
+
class RepositoriesController( BaseAPIController ):
"""RESTful controller for interactions with repositories in the Tool Shed."""
@@ -15,6 +35,7 @@
GET /api/repositories
Displays a collection (list) of repositories.
"""
+ # Example URL: http://localhost:9009/api/repositories
repository_dicts = []
deleted = util.string_as_bool( deleted )
try:
@@ -23,12 +44,10 @@
.order_by( trans.app.model.Repository.table.c.name ) \
.all()
for repository in query:
- value_mapper={ 'id' : trans.security.encode_id( repository.id ),
- 'user_id' : trans.security.encode_id( repository.user_id ) }
- repository_dict = repository.get_api_value( view='collection', value_mapper=value_mapper )
- repository_dict[ 'url' ] = web.url_for( controller='repository_contents',
- action='index',
- repository_id=trans.security.encode_id( repository.id ) )
+ repository_dict = repository.get_api_value( view='collection', value_mapper=default_repository_value_mapper( trans, repository ) )
+ repository_dict[ 'url' ] = web.url_for( controller='repositories',
+ action='show',
+ id=trans.security.encode_id( repository.id ) )
repository_dicts.append( repository_dict )
return repository_dicts
except Exception, e:
@@ -41,21 +60,67 @@
def show( self, trans, id, **kwd ):
"""
GET /api/repositories/{encoded_repository_id}
- Displays information about a repository in the Tool Shed.
+ Returns information about a repository in the Tool Shed.
- :param id: the encoded id of the `Repository` object
+ :param id: the encoded id of the Repository object
"""
+ # Example URL: http://localhost:9009/api/repositories/f9cad7b01a472135
try:
repository = suc.get_repository_in_tool_shed( trans, id )
- value_mapper={ 'id' : trans.security.encode_id( repository.id ),
- 'user_id' : trans.security.encode_id( repository.user_id ) }
- repository_dict = repository.get_api_value( view='element', value_mapper=value_mapper )
- repository_dict[ 'url' ] = web.url_for( controller='repository_contents',
- action='index',
- repository_id=trans.security.encode_id( repository.id ) )
+ repository_dict = repository.get_api_value( view='element', value_mapper=default_repository_value_mapper( trans, repository ) )
+ repository_dict[ 'url' ] = web.url_for( controller='repositories',
+ action='show',
+ id=trans.security.encode_id( repository.id ) )
return repository_dict
except Exception, e:
message = "Error in the Tool Shed repositories API in show: %s" % str( e )
log.error( message, exc_info=True )
trans.response.status = 500
return message
+
+ @web.expose_api
+ def get_repository_and_revision( self, trans, name, owner, changeset_revision, **kwd ):
+ """
+ GET /api/repository/get_repository_and_revision
+ Returns information about a repository revision in the Tool Shed.
+
+ :param name: the name of the Repository object
+ :param owner: the owner of the Repository object
+ :param changset_revision: the changset_revision of the RepositoryMetadata object associated with the Repository object
+ """
+ # Example URL: http://localhost:9009/api/repositories/get_repository_and_revision?name=add…
+ try:
+ # Get the repository information.
+ repository = suc.get_repository_by_name_and_owner( trans.app, name, owner )
+ encoded_repository_id = trans.security.encode_id( repository.id )
+ repository_dict = repository.get_api_value( view='element', value_mapper=default_repository_value_mapper( trans, repository ) )
+ repository_dict[ 'url' ] = web.url_for( controller='repositories',
+ action='show',
+ id=encoded_repository_id )
+ # Get the repository_metadata information.
+ repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, encoded_repository_id, changeset_revision )
+ if not repository_metadata:
+ # The changeset_revision column in the repository_metadata table has been updated with a new value value, so find the
+ # changeset_revision to which we need to update.
+ repo_dir = repository.repo_path( trans.app )
+ repo = hg.repository( suc.get_configured_ui(), repo_dir )
+ new_changeset_revision = suc.get_next_downloadable_changeset_revision( repository, repo, changeset_revision )
+ repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, encoded_repository_id, new_changeset_revision )
+ if repository_metadata:
+ encoded_repository_metadata_id = trans.security.encode_id( repository_metadata.id )
+ repository_metadata_dict = repository_metadata.get_api_value( view='collection',
+ value_mapper=default_repository_metadata_value_mapper( trans, repository_metadata ) )
+ repository_metadata_dict[ 'url' ] = web.url_for( controller='repository_revisions',
+ action='show',
+ id=encoded_repository_metadata_id )
+ return repository_dict, repository_metadata_dict
+ else:
+ message = "Unable to locate repository_metadata record for repository id %d and changeset_revision %s" % ( repository.id, changeset_revision )
+ log.error( message, exc_info=True )
+ trans.response.status = 500
+ return repository_dict, {}
+ except Exception, e:
+ message = "Error in the Tool Shed repositories API in get_repository_and_revision: %s" % str( e )
+ log.error( message, exc_info=True )
+ trans.response.status = 500
+ return message
diff -r 14ab08c0fbfe3e9735e94f4e399aeabc870fe4b2 -r d629a346b859c91ba0da27f865952580d1054d80 lib/galaxy/webapps/tool_shed/api/repository_contents.py
--- a/lib/galaxy/webapps/tool_shed/api/repository_contents.py
+++ /dev/null
@@ -1,33 +0,0 @@
-import logging
-import tool_shed.util.shed_util_common as suc
-from galaxy import web
-from galaxy.web.base.controller import BaseAPIController
-
-log = logging.getLogger( __name__ )
-
-
-class RepositoryContentsController( BaseAPIController ):
-
- @web.expose_api
- def index( self, trans, **kwd ):
- """
- GET /api/repositories/{encoded_repository_id}
- Displays a collection (dictionary) of repository contents.
-
- :param repository_id: the encoded id of the `Repository` object
- """
- try:
- repository_id = kwd[ 'repository_id' ]
- repository = suc.get_repository_in_tool_shed( trans, repository_id )
- value_mapper={ 'id' : trans.security.encode_id( repository.id ),
- 'user_id' : trans.security.encode_id( repository.user_id ) }
- repository_dict = repository.as_dict( value_mapper )
- repository_dict[ 'url' ] = web.url_for( controller='repository_contents',
- action='index',
- repository_id=repository_id )
- return repository_dict
- except Exception, e:
- message = "Error in the Tool Shed repository_contents API in index: %s" % str( e )
- log.error( message, exc_info=True )
- trans.response.status = 500
- return message
diff -r 14ab08c0fbfe3e9735e94f4e399aeabc870fe4b2 -r d629a346b859c91ba0da27f865952580d1054d80 lib/galaxy/webapps/tool_shed/api/repository_revision_contents.py
--- a/lib/galaxy/webapps/tool_shed/api/repository_revision_contents.py
+++ /dev/null
@@ -1,39 +0,0 @@
-import logging
-from galaxy import web
-from galaxy.web.framework.helpers import time_ago
-from tool_shed.util import metadata_util
-from galaxy.web.base.controller import BaseAPIController
-
-log = logging.getLogger( __name__ )
-
-def default_value_mapper( trans, repository_metadata ):
- value_mapper = { 'id' : trans.security.encode_id( repository_metadata.id ),
- 'repository_id' : trans.security.encode_id( repository_metadata.repository_id ) }
- if repository_metadata.time_last_tested:
- value_mapper[ 'time_last_tested' ] = time_ago( repository_metadata.time_last_tested )
- return value_mapper
-
-
-class RepositoryRevisionContentsController( BaseAPIController ):
-
- @web.expose_api
- def index( self, trans, **kwd ):
- """
- GET /api/repository_revisions/{encoded_repository_metadata_id}
- Displays a collection (dictionary) of repository_metadata contents.
-
- :param repository_metadata_id: the encoded id of the `RepositoryMetadata` object
- """
- try:
- repository_metadata_id = kwd.get( 'repository_metadata_id', None )
- repository_metadata = metadata_util.get_repository_metadata_by_id( trans, repository_metadata_id )
- repository_dict = repository_metadata.as_dict( value_mapper=default_value_mapper( trans, repository_metadata ) )
- repository_dict[ 'url' ] = web.url_for( controller='repository_revision_contents',
- action='index',
- repository_metadata_id=repository_metadata_id )
- return repository_dict
- except Exception, e:
- message = "Error in the Tool Shed repository_revision_contents API in index: %s" % str( e )
- log.error( message, exc_info=True )
- trans.response.status = 500
- return message
diff -r 14ab08c0fbfe3e9735e94f4e399aeabc870fe4b2 -r d629a346b859c91ba0da27f865952580d1054d80 lib/galaxy/webapps/tool_shed/api/repository_revisions.py
--- a/lib/galaxy/webapps/tool_shed/api/repository_revisions.py
+++ b/lib/galaxy/webapps/tool_shed/api/repository_revisions.py
@@ -1,7 +1,9 @@
-import datetime, logging
+import datetime
+import logging
from galaxy.web.framework.helpers import time_ago
from tool_shed.util import metadata_util
-from galaxy import web, util
+from galaxy import web
+from galaxy import util
from galaxy.model.orm import and_
from galaxy.web.base.controller import BaseAPIController
@@ -24,6 +26,7 @@
GET /api/repository_revisions
Displays a collection (list) of repository revisions.
"""
+ # Example URL: http://localhost:9009/api/repository_revisions
repository_metadata_dicts = []
# Build up an anded clause list of filters.
clause_list = []
@@ -55,9 +58,9 @@
for repository_metadata in query:
repository_metadata_dict = repository_metadata.get_api_value( view='collection',
value_mapper=default_value_mapper( trans, repository_metadata ) )
- repository_metadata_dict[ 'url' ] = web.url_for( controller='repository_revision_contents',
- action='index',
- repository_metadata_id=trans.security.encode_id( repository_metadata.id ) )
+ repository_metadata_dict[ 'url' ] = web.url_for( controller='repository_revisions',
+ action='show',
+ id=trans.security.encode_id( repository_metadata.id ) )
repository_metadata_dicts.append( repository_metadata_dict )
return repository_metadata_dicts
except Exception, e:
@@ -74,12 +77,13 @@
:param id: the encoded id of the `RepositoryMetadata` object
"""
+ # Example URL: http://localhost:9009/api/repository_revisions/bb125606ff9ea620
try:
repository_metadata = metadata_util.get_repository_metadata_by_id( trans, id )
repository_metadata_dict = repository_metadata.as_dict( value_mapper=default_value_mapper( trans, repository_metadata ) )
- repository_metadata_dict[ 'url' ] = web.url_for( controller='repository_revision_contents',
- action='index',
- repository_metadata_id=trans.security.encode_id( repository_metadata.id ) )
+ repository_metadata_dict[ 'url' ] = web.url_for( controller='repository_revisions',
+ action='show',
+ id=trans.security.encode_id( repository_metadata.id ) )
return repository_metadata_dict
except Exception, e:
message = "Error in the Tool Shed repository_revisions API in show: %s" % str( e )
@@ -114,7 +118,7 @@
trans.response.status = 500
return message
repository_metadata_dict = repository_metadata.as_dict( value_mapper=default_value_mapper( trans, repository_metadata ) )
- repository_metadata_dict[ 'url' ] = web.url_for( controller='repository_revision_contents',
- action='index',
- repository_metadata_id=trans.security.encode_id( repository_metadata.id ) )
+ repository_metadata_dict[ 'url' ] = web.url_for( controller='repository_revisions',
+ action='show',
+ id=trans.security.encode_id( repository_metadata.id ) )
return repository_metadata_dict
diff -r 14ab08c0fbfe3e9735e94f4e399aeabc870fe4b2 -r d629a346b859c91ba0da27f865952580d1054d80 lib/galaxy/webapps/tool_shed/buildapp.py
--- a/lib/galaxy/webapps/tool_shed/buildapp.py
+++ b/lib/galaxy/webapps/tool_shed/buildapp.py
@@ -1,8 +1,11 @@
"""
Provides factory methods to assemble the Galaxy web application
"""
-
-import logging, atexit, os, os.path, sys, config
+import atexit
+import config
+import logging
+import os
+import sys
from inspect import isclass
@@ -69,22 +72,21 @@
webapp.add_route( '/:controller/:action', action='index' )
webapp.add_route( '/:action', controller='repository', action='index' )
webapp.add_route( '/repos/*path_info', controller='hg', action='handle_request', path_info='/' )
- # Add the web API.
+ # Add the web API. # A good resource for RESTful services - http://routes.readthedocs.org/en/latest/restful.html
webapp.add_api_controllers( 'galaxy.webapps.tool_shed.api', app )
- webapp.api_mapper.resource( 'content',
- 'contents',
- controller='repository_contents',
+ webapp.api_mapper.resource( 'repository',
+ 'repositories',
+ controller='repositories',
+ collection={ 'get_repository_and_revision' : 'GET' },
name_prefix='repository_',
- path_prefix='/api/repositories/:repository_id',
+ path_prefix='/api',
parent_resources=dict( member_name='repository', collection_name='repositories' ) )
- webapp.api_mapper.resource( 'content',
- 'contents',
- controller='repository_revision_contents',
+ webapp.api_mapper.resource( 'repository_revision',
+ 'repository_revisions',
+ controller='repository_revisions',
name_prefix='repository_revision_',
- path_prefix='/api/repository_revisions/:repository_metadata_id',
+ path_prefix='/api',
parent_resources=dict( member_name='repository_revision', collection_name='repository_revisions' ) )
- webapp.api_mapper.resource( 'repository', 'repositories', path_prefix='/api' )
- webapp.api_mapper.resource( 'repository_revision', 'repository_revisions', path_prefix='/api' )
webapp.finalize_config()
# Wrap the webapp in some useful middleware
if kwargs.get( 'middleware', True ):
diff -r 14ab08c0fbfe3e9735e94f4e399aeabc870fe4b2 -r d629a346b859c91ba0da27f865952580d1054d80 scripts/api/tool_shed_repository_revision_update.py
--- a/scripts/api/tool_shed_repository_revision_update.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env python
-"""
-PUT/update script to update appropriate values in a repository_metadata table record in the Tool Shed.
-
-usage: tool_shed_repository_revision_update.py key url key1=value1 key2=value2 ...
-"""
-
-import os, sys
-sys.path.insert( 0, os.path.dirname( __file__ ) )
-from common import update
-
-import pkg_resources
-pkg_resources.require( "simplejson" )
-
-import simplejson
-
-to_json_string = simplejson.dumps
-from_json_string = simplejson.loads
-
-data = {}
-for key, value in [ kwarg.split( '=', 1 ) for kwarg in sys.argv[ 3: ] ]:
- """
- This example script will properly handle updating the value of one or more of the following RepositoryMetadata attributes:
- tools_functionally_correct, do_not_test, tool_test_errors
- """
- if key in [ 'tools_functionally_correct', 'do_not_test' ]:
- if str( value ).lower() in [ 'true', 'yes', 'on' ]:
- new_value = True
- else:
- new_value = False
- elif key in [ 'tool_test_errors' ]:
- new_value = from_json_string( value )
- else:
- new_value = str( value )
- data[ key ] = new_value
-
-update( sys.argv[ 1 ], sys.argv[ 2 ], data )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: inithello: Update install and test script to correctly load tool data tables.
by commits-noreply@bitbucket.org 21 Mar '13
by commits-noreply@bitbucket.org 21 Mar '13
21 Mar '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/14ab08c0fbfe/
Changeset: 14ab08c0fbfe
User: inithello
Date: 2013-03-22 00:23:43
Summary: Update install and test script to correctly load tool data tables.
Affected #: 1 file
diff -r b79e2393c8ad8c88bda682e0767f572c0c09e26a -r 14ab08c0fbfe3e9735e94f4e399aeabc870fe4b2 test/install_and_test_tool_shed_repositories/functional_tests.py
--- a/test/install_and_test_tool_shed_repositories/functional_tests.py
+++ b/test/install_and_test_tool_shed_repositories/functional_tests.py
@@ -107,12 +107,21 @@
else:
additional_tool_data_tables = None
additional_tool_data_path = None
-# And set up a blank tool_data_table_conf.xml and shed_tool_data_table_conf.xml.
+
+# Also set up default tool data tables.
+if os.path.exists( 'tool_data_table_conf.xml' ):
+ tool_data_table_conf = 'tool_data_table_conf.xml'
+elif os.path.exists( 'tool_data_table_conf.xml.sample' ):
+ tool_data_table_conf = 'tool_data_table_conf.xml.sample'
+else:
+ tool_data_table_conf = None
+
+# And set up a blank shed_tool_data_table_conf.xml.
tool_data_table_conf_xml_template = '''<?xml version="1.0"?><tables></tables>
'''
-
+
# The tool shed url and api key must be set for this script to work correctly. Additionally, if the tool shed url does not
# point to one of the defaults, the GALAXY_INSTALL_TEST_TOOL_SHEDS_CONF needs to point to a tool sheds configuration file
# that contains a definition for that tool shed.
@@ -328,7 +337,7 @@
galaxy_test_proxy_port = None
# Set up the configuration files for the Galaxy instance.
shed_tool_data_table_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_SHED_TOOL_DATA_TABLE_CONF', os.path.join( galaxy_test_tmp_dir, 'test_shed_tool_data_table_conf.xml' ) )
- galaxy_tool_data_table_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_TOOL_DATA_TABLE_CONF', os.path.join( galaxy_test_tmp_dir, 'test_tool_data_table_conf.xml' ) )
+ galaxy_tool_data_table_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_TOOL_DATA_TABLE_CONF', tool_data_table_conf )
galaxy_tool_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_TOOL_CONF', os.path.join( galaxy_test_tmp_dir, 'test_tool_conf.xml' ) )
galaxy_shed_tool_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_SHED_TOOL_CONF', os.path.join( galaxy_test_tmp_dir, 'test_shed_tool_conf.xml' ) )
galaxy_migrated_tool_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_MIGRATED_TOOL_CONF', os.path.join( galaxy_test_tmp_dir, 'test_migrated_tool_conf.xml' ) )
@@ -350,7 +359,7 @@
galaxy_file_path = os.path.join( galaxy_db_path, 'files' )
new_repos_path = tempfile.mkdtemp( dir=galaxy_test_tmp_dir )
galaxy_tempfiles = tempfile.mkdtemp( dir=galaxy_test_tmp_dir )
- galaxy_shed_tool_path = tempfile.mkdtemp( dir=galaxy_test_tmp_dir )
+ galaxy_shed_tool_path = tempfile.mkdtemp( dir=galaxy_test_tmp_dir, prefix='shed_tools' )
galaxy_migrated_tool_path = tempfile.mkdtemp( dir=galaxy_test_tmp_dir )
galaxy_tool_dependency_dir = tempfile.mkdtemp( dir=galaxy_test_tmp_dir )
os.environ[ 'GALAXY_INSTALL_TEST_TOOL_DEPENDENCY_DIR' ] = galaxy_tool_dependency_dir
@@ -367,9 +376,6 @@
print "Database connection: ", database_connection
- # Generate the tool_data_table_conf.xml file.
- file( galaxy_tool_data_table_conf_file, 'w' ).write( tool_data_table_conf_xml_template )
- os.environ[ 'GALAXY_INSTALL_TEST_TOOL_DATA_TABLE_CONF' ] = galaxy_tool_data_table_conf_file
# Generate the shed_tool_data_table_conf.xml file.
file( shed_tool_data_table_conf_file, 'w' ).write( tool_data_table_conf_xml_template )
os.environ[ 'GALAXY_INSTALL_TEST_SHED_TOOL_DATA_TABLE_CONF' ] = shed_tool_data_table_conf_file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: inithello: Merge in bugfix from next-stable.
by commits-noreply@bitbucket.org 21 Mar '13
by commits-noreply@bitbucket.org 21 Mar '13
21 Mar '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/3bbbcdb044af/
Changeset: 3bbbcdb044af
Branch: next-stable
User: inithello
Date: 2013-03-21 19:54:42
Summary: Merge in bugfix from next-stable.
Affected #: 27 files
diff -r 24d068f7a44dab10f8574d15aa4063ccdb0edb22 -r 3bbbcdb044afdbd380d6cd4c0f721ab7262c5555 lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -1516,6 +1516,11 @@
# other model classes.
hda = self
rval = dict( id = hda.id,
+ uuid = ( lambda uuid: str( uuid ) if uuid else None )( hda.dataset.uuid ),
+ history_id = hda.history.id,
+ hid = hda.hid,
+ file_ext = hda.ext,
+ peek = ( lambda hda: hda.display_peek() if hda.peek and hda.peek != 'no peek' else None )( hda ),
model_class = self.__class__.__name__,
name = hda.name,
deleted = hda.deleted,
diff -r 24d068f7a44dab10f8574d15aa4063ccdb0edb22 -r 3bbbcdb044afdbd380d6cd4c0f721ab7262c5555 lib/galaxy/web/base/controller.py
--- a/lib/galaxy/web/base/controller.py
+++ b/lib/galaxy/web/base/controller.py
@@ -6,12 +6,16 @@
import os
import re
import pkg_resources
+import urllib
pkg_resources.require("SQLAlchemy >= 0.4")
+pkg_resources.require( "Routes" )
+import routes
from sqlalchemy import func, and_, select
from paste.httpexceptions import HTTPBadRequest, HTTPInternalServerError, HTTPNotImplemented, HTTPRequestRangeNotSatisfiable
from galaxy import util, web
+from gettext import gettext
from galaxy.datatypes.interval import ChromatinInteractions
from galaxy.exceptions import ItemAccessibilityException, ItemDeletionException, ItemOwnershipException, MessageException
from galaxy.security.validate_user_input import validate_publicname
@@ -25,6 +29,11 @@
from galaxy.datatypes.data import Text
+from galaxy.datatypes.display_applications import util as da_util
+from galaxy.datatypes.metadata import FileParameter
+
+from galaxy.datatypes.display_applications.link_generator import get_display_app_link_generator
+
log = logging.getLogger( __name__ )
# States for passing messages
@@ -322,6 +331,85 @@
return dataset.conversion_messages.PENDING
return None
+ def get_hda_dict( self, trans, hda ):
+ hda_dict = hda.get_api_value( view='element' )
+ history = hda.history
+
+ # Add additional attributes that depend on trans can hence must be added here rather than at the model level.
+ if trans.user_is_admin() or trans.app.config.expose_dataset_path:
+ hda_dict[ 'file_name' ] = hda.file_name
+
+ if not hda_dict[ 'deleted' ]:
+ hda_dict[ 'download_url' ] = url_for( 'history_contents_display', history_id = trans.security.encode_id( history.id ),
+ history_content_id = trans.security.encode_id( hda.id ) )
+
+ can_access_hda = trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), hda.dataset )
+ hda_dict[ 'accessible' ] = ( trans.user_is_admin() or can_access_hda )
+ hda_dict[ 'api_type' ] = "file"
+
+ if not( hda.purged or hda.deleted or hda.dataset.purged ):
+ meta_files = []
+ for meta_type in hda.metadata.spec.keys():
+ if isinstance( hda.metadata.spec[ meta_type ].param, FileParameter ):
+ meta_files.append( dict( file_type=meta_type ) )
+ if meta_files:
+ hda_dict[ 'meta_files' ] = meta_files
+
+ hda_dict[ 'display_apps' ] = self.get_display_apps( trans, hda )
+ hda_dict[ 'display_types' ] = self.get_old_display_applications( trans, hda )
+ hda_dict[ 'visualizations' ] = hda.get_visualizations()
+
+ if hda.creating_job and hda.creating_job.tool_id:
+ tool_used = trans.app.toolbox.get_tool( hda.creating_job.tool_id )
+ if tool_used and tool_used.force_history_refresh:
+ hda_dict[ 'force_history_refresh' ] = True
+
+ return trans.security.encode_dict_ids( hda_dict )
+
+ def get_display_apps( self, trans, hda ):
+ #TODO: make more straightforward (somehow)
+ display_apps = []
+
+ def get_display_app_url( display_app_link, hda, trans ):
+ web_url_for = routes.URLGenerator( trans.webapp.mapper, trans.environ )
+ dataset_hash, user_hash = da_util.encode_dataset_user( trans, hda, None )
+ return web_url_for( controller='dataset',
+ action="display_application",
+ dataset_id=dataset_hash,
+ user_id=user_hash,
+ app_name=urllib.quote_plus( display_app_link.display_application.id ),
+ link_name=urllib.quote_plus( display_app_link.id ) )
+
+ for display_app in hda.get_display_applications( trans ).itervalues():
+ app_links = []
+ for display_app_link in display_app.links.itervalues():
+ app_links.append({
+ 'target' : display_app_link.url.get( 'target_frame', '_blank' ),
+ 'href' : get_display_app_url( display_app_link, hda, trans ),
+ 'text' : gettext( display_app_link.name )
+ })
+ display_apps.append( dict( label=display_app.name, links=app_links ) )
+
+ return display_apps
+
+ def get_old_display_applications( self, trans, hda ):
+ display_apps = []
+ for display_app_name in hda.datatype.get_display_types():
+ link_generator = get_display_app_link_generator( display_app_name )
+ display_links = link_generator.generate_links( trans, hda )
+
+ app_links = []
+ for display_name, display_link in display_links:
+ app_links.append({
+ 'target' : '_blank',
+ 'href' : display_link,
+ 'text' : display_name
+ })
+ if app_links:
+ display_apps.append( dict( label=hda.datatype.get_display_label( display_app_name ), links=app_links ) )
+
+ return display_apps
+
class UsesLibraryMixin:
diff -r 24d068f7a44dab10f8574d15aa4063ccdb0edb22 -r 3bbbcdb044afdbd380d6cd4c0f721ab7262c5555 lib/galaxy/webapps/galaxy/api/datasets.py
--- a/lib/galaxy/webapps/galaxy/api/datasets.py
+++ b/lib/galaxy/webapps/galaxy/api/datasets.py
@@ -50,8 +50,11 @@
elif data_type == 'genome_data':
rval = self._get_genome_data( trans, dataset, kwd.get('dbkey', None) )
else:
- # Default: return dataset as API value.
- rval = dataset.get_api_value()
+ # Default: return dataset as dict.
+ if hda_ldda == 'hda':
+ rval = self.get_hda_dict( trans, dataset )
+ else:
+ rval = dataset.get_api_value()
except Exception, e:
rval = "Error in dataset API at listing contents: " + str( e )
diff -r 24d068f7a44dab10f8574d15aa4063ccdb0edb22 -r 3bbbcdb044afdbd380d6cd4c0f721ab7262c5555 lib/galaxy/webapps/galaxy/api/history_contents.py
--- a/lib/galaxy/webapps/galaxy/api/history_contents.py
+++ b/lib/galaxy/webapps/galaxy/api/history_contents.py
@@ -2,24 +2,12 @@
API operations on the contents of a history.
"""
import logging
-import urllib
-from gettext import gettext
from galaxy import web
from galaxy.web.base.controller import BaseAPIController, url_for
from galaxy.web.base.controller import UsesHistoryDatasetAssociationMixin, UsesHistoryMixin
from galaxy.web.base.controller import UsesLibraryMixin, UsesLibraryMixinItems
-from galaxy.web.framework.helpers import to_unicode
-from galaxy.datatypes.display_applications import util
-from galaxy.datatypes.metadata import FileParameter
-
-from galaxy.datatypes.display_applications.link_generator import get_display_app_link_generator
-
-import pkg_resources
-pkg_resources.require( "Routes" )
-import routes
-
log = logging.getLogger( __name__ )
class HistoryContentsController( BaseAPIController, UsesHistoryDatasetAssociationMixin, UsesHistoryMixin,
@@ -67,7 +55,7 @@
if encoded_hda_id in ids:
#TODO: share code with show
try:
- rval.append( get_hda_dict( trans, history, hda, for_editing=True ) )
+ rval.append( self.get_hda_dict( trans, hda ) )
except Exception, exc:
# don't fail entire list if hda err's, record and move on
@@ -149,7 +137,7 @@
hda = self.get_history_dataset_association( trans, history, id,
check_ownership=True, check_accessible=True )
- hda_dict = get_hda_dict( trans, history, hda, for_editing=True )
+ hda_dict = self.get_hda_dict( trans, hda )
except Exception, e:
msg = "Error in history API at listing dataset: %s" % ( str(e) )
@@ -175,107 +163,22 @@
if from_ld_id:
try:
ld = self.get_library_dataset( trans, from_ld_id, check_ownership=False, check_accessible=False )
- assert type( ld ) is trans.app.model.LibraryDataset, "Library content id ( %s ) is not a dataset" % from_ld_id
+ assert type( ld ) is trans.app.model.LibraryDataset, (
+ "Library content id ( %s ) is not a dataset" % from_ld_id )
+
except AssertionError, e:
trans.response.status = 400
return str( e )
+
except Exception, e:
return str( e )
+
hda = ld.library_dataset_dataset_association.to_history_dataset_association( history, add_to_history=True )
trans.sa_session.flush()
return hda.get_api_value()
+
else:
# TODO: implement other "upload" methods here.
trans.response.status = 403
return "Not implemented."
-
-#TODO: move these into model
-def get_hda_dict( trans, history, hda, for_editing ):
- hda_dict = hda.get_api_value( view='element' )
-
- hda_dict[ 'id' ] = trans.security.encode_id( hda.id )
- hda_dict[ 'history_id' ] = trans.security.encode_id( history.id )
- hda_dict[ 'hid' ] = hda.hid
-
- hda_dict[ 'file_ext' ] = hda.ext
- if trans.user_is_admin() or trans.app.config.expose_dataset_path:
- hda_dict[ 'file_name' ] = hda.file_name
-
- if not hda_dict[ 'deleted' ]:
- hda_dict[ 'download_url' ] = url_for( 'history_contents_display', history_id = trans.security.encode_id( history.id ), history_content_id = trans.security.encode_id( hda.id ) )
-
- can_access_hda = trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), hda.dataset )
- hda_dict[ 'accessible' ] = ( trans.user_is_admin() or can_access_hda )
- hda_dict[ 'api_type' ] = "file"
-
- if not( hda.purged or hda.deleted or hda.dataset.purged ):
- meta_files = []
- for meta_type in hda.metadata.spec.keys():
- if isinstance( hda.metadata.spec[ meta_type ].param, FileParameter ):
- meta_files.append( dict( file_type=meta_type ) )
- if meta_files:
- hda_dict[ 'meta_files' ] = meta_files
-
- hda_dict[ 'display_apps' ] = get_display_apps( trans, hda )
- hda_dict[ 'display_types' ] = get_old_display_applications( trans, hda )
-
- if hda.dataset.uuid is None:
- hda_dict['uuid'] = None
- else:
- hda_dict['uuid'] = str(hda.dataset.uuid)
-
- hda_dict[ 'visualizations' ] = hda.get_visualizations()
- if hda.peek and hda.peek != 'no peek':
- hda_dict[ 'peek' ] = to_unicode( hda.display_peek() )
-
- if hda.creating_job and hda.creating_job.tool_id:
- tool_used = trans.app.toolbox.get_tool( hda.creating_job.tool_id )
- if tool_used and tool_used.force_history_refresh:
- hda_dict[ 'force_history_refresh' ] = True
-
- return hda_dict
-
-def get_display_apps( trans, hda ):
- #TODO: make more straightforward (somehow)
- display_apps = []
-
- def get_display_app_url( display_app_link, hda, trans ):
- web_url_for = routes.URLGenerator( trans.webapp.mapper, trans.environ )
- dataset_hash, user_hash = util.encode_dataset_user( trans, hda, None )
- return web_url_for( controller='dataset',
- action="display_application",
- dataset_id=dataset_hash,
- user_id=user_hash,
- app_name=urllib.quote_plus( display_app_link.display_application.id ),
- link_name=urllib.quote_plus( display_app_link.id ) )
-
- for display_app in hda.get_display_applications( trans ).itervalues():
- app_links = []
- for display_app_link in display_app.links.itervalues():
- app_links.append({
- 'target' : display_app_link.url.get( 'target_frame', '_blank' ),
- 'href' : get_display_app_url( display_app_link, hda, trans ),
- 'text' : gettext( display_app_link.name )
- })
- display_apps.append( dict( label=display_app.name, links=app_links ) )
-
- return display_apps
-
-def get_old_display_applications( trans, hda ):
- display_apps = []
- for display_app_name in hda.datatype.get_display_types():
- link_generator = get_display_app_link_generator( display_app_name )
- display_links = link_generator.generate_links( trans, hda )
-
- app_links = []
- for display_name, display_link in display_links:
- app_links.append({
- 'target' : '_blank',
- 'href' : display_link,
- 'text' : display_name
- })
- if app_links:
- display_apps.append( dict( label=hda.datatype.get_display_label( display_app_name ), links=app_links ) )
-
- return display_apps
diff -r 24d068f7a44dab10f8574d15aa4063ccdb0edb22 -r 3bbbcdb044afdbd380d6cd4c0f721ab7262c5555 lib/galaxy/webapps/galaxy/controllers/tool_runner.py
--- a/lib/galaxy/webapps/galaxy/controllers/tool_runner.py
+++ b/lib/galaxy/webapps/galaxy/controllers/tool_runner.py
@@ -312,4 +312,4 @@
<p><b>Please do not use your browser\'s "stop" or "reload" buttons until the upload is complete, or it may be interrupted.</b></p><p>You may safely continue to use Galaxy while the upload is in progress. Using "stop" and "reload" on pages other than Galaxy is also safe.</p>
"""
- return trans.show_message( msg, refresh_frames='history' )
+ return trans.show_message( msg )
diff -r 24d068f7a44dab10f8574d15aa4063ccdb0edb22 -r 3bbbcdb044afdbd380d6cd4c0f721ab7262c5555 lib/galaxy/webapps/tool_shed/api/repositories.py
--- a/lib/galaxy/webapps/tool_shed/api/repositories.py
+++ b/lib/galaxy/webapps/tool_shed/api/repositories.py
@@ -1,24 +1,21 @@
+import logging
import tool_shed.util.shed_util_common as suc
from galaxy import web, util
from galaxy.web.base.controller import BaseAPIController
-from galaxy.web.framework.helpers import is_true
-
-import pkg_resources
-pkg_resources.require( "Routes" )
-import routes
-import logging
log = logging.getLogger( __name__ )
+
class RepositoriesController( BaseAPIController ):
"""RESTful controller for interactions with repositories in the Tool Shed."""
+
@web.expose_api
def index( self, trans, deleted=False, **kwd ):
"""
- GET /api/repository_revisions
+ GET /api/repositories
Displays a collection (list) of repositories.
"""
- rval = []
+ repository_dicts = []
deleted = util.string_as_bool( deleted )
try:
query = trans.sa_session.query( trans.app.model.Repository ) \
@@ -28,30 +25,37 @@
for repository in query:
value_mapper={ 'id' : trans.security.encode_id( repository.id ),
'user_id' : trans.security.encode_id( repository.user_id ) }
- item = repository.get_api_value( view='collection', value_mapper=value_mapper )
- item[ 'url' ] = web.url_for( 'repository_contents', repository_id=trans.security.encode_id( repository.id ) )
- rval.append( item )
+ repository_dict = repository.get_api_value( view='collection', value_mapper=value_mapper )
+ repository_dict[ 'url' ] = web.url_for( controller='repository_contents',
+ action='index',
+ repository_id=trans.security.encode_id( repository.id ) )
+ repository_dicts.append( repository_dict )
+ return repository_dicts
except Exception, e:
message = "Error in the Tool Shed repositories API in index: %s" % str( e )
log.error( message, exc_info=True )
trans.response.status = 500
return message
- return rval
+
@web.expose_api
def show( self, trans, id, **kwd ):
"""
GET /api/repositories/{encoded_repository_id}
Displays information about a repository in the Tool Shed.
+
+ :param id: the encoded id of the `Repository` object
"""
try:
repository = suc.get_repository_in_tool_shed( trans, id )
value_mapper={ 'id' : trans.security.encode_id( repository.id ),
'user_id' : trans.security.encode_id( repository.user_id ) }
- repository_data = repository.get_api_value( view='element', value_mapper=value_mapper )
- repository_data[ 'contents_url' ] = web.url_for( 'repository_contents', repository_id=id )
+ repository_dict = repository.get_api_value( view='element', value_mapper=value_mapper )
+ repository_dict[ 'url' ] = web.url_for( controller='repository_contents',
+ action='index',
+ repository_id=trans.security.encode_id( repository.id ) )
+ return repository_dict
except Exception, e:
message = "Error in the Tool Shed repositories API in show: %s" % str( e )
log.error( message, exc_info=True )
trans.response.status = 500
return message
- return repository_data
diff -r 24d068f7a44dab10f8574d15aa4063ccdb0edb22 -r 3bbbcdb044afdbd380d6cd4c0f721ab7262c5555 lib/galaxy/webapps/tool_shed/api/repository_contents.py
--- a/lib/galaxy/webapps/tool_shed/api/repository_contents.py
+++ b/lib/galaxy/webapps/tool_shed/api/repository_contents.py
@@ -3,33 +3,31 @@
from galaxy import web
from galaxy.web.base.controller import BaseAPIController
-import pkg_resources
-pkg_resources.require( "Routes" )
-import routes
-
log = logging.getLogger( __name__ )
+
class RepositoryContentsController( BaseAPIController ):
+
@web.expose_api
def index( self, trans, **kwd ):
"""
- GET /api/repositories/{encoded_repository_id}/contents
+ GET /api/repositories/{encoded_repository_id}
Displays a collection (dictionary) of repository contents.
- :param repository_id: an encoded id string of the `Repository` to inspect
+ :param repository_id: the encoded id of the `Repository` object
"""
- rval = []
- repository_id = kwd.get( 'repository_id', None )
try:
+ repository_id = kwd[ 'repository_id' ]
repository = suc.get_repository_in_tool_shed( trans, repository_id )
- value_mapper={ 'id' : repository_id,
+ value_mapper={ 'id' : trans.security.encode_id( repository.id ),
'user_id' : trans.security.encode_id( repository.user_id ) }
repository_dict = repository.as_dict( value_mapper )
- repository_dict[ 'url' ] = web.url_for( 'repository_contents', repository_id=repository_id )
- rval.append( repository_dict )
+ repository_dict[ 'url' ] = web.url_for( controller='repository_contents',
+ action='index',
+ repository_id=repository_id )
+ return repository_dict
except Exception, e:
message = "Error in the Tool Shed repository_contents API in index: %s" % str( e )
log.error( message, exc_info=True )
trans.response.status = 500
return message
- return rval
diff -r 24d068f7a44dab10f8574d15aa4063ccdb0edb22 -r 3bbbcdb044afdbd380d6cd4c0f721ab7262c5555 lib/galaxy/webapps/tool_shed/api/repository_revision_contents.py
--- a/lib/galaxy/webapps/tool_shed/api/repository_revision_contents.py
+++ b/lib/galaxy/webapps/tool_shed/api/repository_revision_contents.py
@@ -1,14 +1,9 @@
import logging
+from galaxy import web
from galaxy.web.framework.helpers import time_ago
-import tool_shed.util.shed_util_common as suc
from tool_shed.util import metadata_util
-from galaxy import web
from galaxy.web.base.controller import BaseAPIController
-import pkg_resources
-pkg_resources.require( "Routes" )
-import routes
-
log = logging.getLogger( __name__ )
def default_value_mapper( trans, repository_metadata ):
@@ -18,25 +13,27 @@
value_mapper[ 'time_last_tested' ] = time_ago( repository_metadata.time_last_tested )
return value_mapper
+
class RepositoryRevisionContentsController( BaseAPIController ):
+
@web.expose_api
def index( self, trans, **kwd ):
"""
- GET /api/repository_revisions/{encoded_repository_metadata_id}/contents
+ GET /api/repository_revisions/{encoded_repository_metadata_id}
Displays a collection (dictionary) of repository_metadata contents.
- :param repository_metadata_id: an encoded id string of the `RepositoryMetadata` to inspect
+ :param repository_metadata_id: the encoded id of the `RepositoryMetadata` object
"""
- rval = []
- repository_metadata_id = kwd.get( 'repository_metadata_id', None )
try:
+ repository_metadata_id = kwd.get( 'repository_metadata_id', None )
repository_metadata = metadata_util.get_repository_metadata_by_id( trans, repository_metadata_id )
repository_dict = repository_metadata.as_dict( value_mapper=default_value_mapper( trans, repository_metadata ) )
- repository_dict[ 'url' ] = web.url_for( 'repository_revision_contents', repository_metadata_id=repository_metadata_id )
- rval.append( repository_dict )
+ repository_dict[ 'url' ] = web.url_for( controller='repository_revision_contents',
+ action='index',
+ repository_metadata_id=repository_metadata_id )
+ return repository_dict
except Exception, e:
- message = "Error in the Tool Shed repository_revision_contents API in index: %s" % str( e )
+ message = "Error in the Tool Shed repository_revision_contents API in index: %s" % str( e )
log.error( message, exc_info=True )
trans.response.status = 500
return message
- return rval
diff -r 24d068f7a44dab10f8574d15aa4063ccdb0edb22 -r 3bbbcdb044afdbd380d6cd4c0f721ab7262c5555 lib/galaxy/webapps/tool_shed/api/repository_revisions.py
--- a/lib/galaxy/webapps/tool_shed/api/repository_revisions.py
+++ b/lib/galaxy/webapps/tool_shed/api/repository_revisions.py
@@ -1,16 +1,9 @@
-import datetime
+import datetime, logging
from galaxy.web.framework.helpers import time_ago
-import tool_shed.util.shed_util_common as suc
from tool_shed.util import metadata_util
from galaxy import web, util
-from galaxy.model.orm import and_, or_
+from galaxy.model.orm import and_
from galaxy.web.base.controller import BaseAPIController
-from galaxy.web.framework.helpers import is_true
-
-import pkg_resources
-pkg_resources.require( "Routes" )
-import routes
-import logging
log = logging.getLogger( __name__ )
@@ -21,15 +14,17 @@
value_mapper[ 'time_last_tested' ] = time_ago( repository_metadata.time_last_tested )
return value_mapper
+
class RepositoryRevisionsController( BaseAPIController ):
"""RESTful controller for interactions with tool shed repository revisions."""
+
@web.expose_api
def index( self, trans, **kwd ):
"""
GET /api/repository_revisions
Displays a collection (list) of repository revisions.
"""
- rval = []
+ repository_metadata_dicts = []
# Build up an anded clause list of filters.
clause_list = []
# Filter by downloadable if received.
@@ -58,32 +53,40 @@
.order_by( trans.app.model.RepositoryMetadata.table.c.repository_id ) \
.all()
for repository_metadata in query:
- item = repository_metadata.get_api_value( view='collection',
- value_mapper=default_value_mapper( trans, repository_metadata ) )
- item[ 'url' ] = web.url_for( 'repository_revision', id=trans.security.encode_id( repository_metadata.id ) )
- rval.append( item )
+ repository_metadata_dict = repository_metadata.get_api_value( view='collection',
+ value_mapper=default_value_mapper( trans, repository_metadata ) )
+ repository_metadata_dict[ 'url' ] = web.url_for( controller='repository_revision_contents',
+ action='index',
+ repository_metadata_id=trans.security.encode_id( repository_metadata.id ) )
+ repository_metadata_dicts.append( repository_metadata_dict )
+ return repository_metadata_dicts
except Exception, e:
- rval = "Error in the Tool Shed repository_revisions API in index: " + str( e )
- log.error( rval + ": %s" % str( e ) )
+ message = "Error in the Tool Shed repository_revisions API in index: " + str( e )
+ log.error( message, exc_info=True )
trans.response.status = 500
- return rval
+ return message
+
@web.expose_api
def show( self, trans, id, **kwd ):
"""
GET /api/repository_revisions/{encoded_repository_metadata_id}
Displays information about a repository_metadata record in the Tool Shed.
+
+ :param id: the encoded id of the `RepositoryMetadata` object
"""
try:
repository_metadata = metadata_util.get_repository_metadata_by_id( trans, id )
- repository_data = repository_metadata.get_api_value( view='element',
- value_mapper=default_value_mapper( trans, repository_metadata ) )
- repository_data[ 'contents_url' ] = web.url_for( 'repository_revision_contents', repository_metadata_id=id )
+ repository_metadata_dict = repository_metadata.as_dict( value_mapper=default_value_mapper( trans, repository_metadata ) )
+ repository_metadata_dict[ 'url' ] = web.url_for( controller='repository_revision_contents',
+ action='index',
+ repository_metadata_id=trans.security.encode_id( repository_metadata.id ) )
+ return repository_metadata_dict
except Exception, e:
message = "Error in the Tool Shed repository_revisions API in show: %s" % str( e )
log.error( message, exc_info=True )
trans.response.status = 500
return message
- return repository_data
+
@web.expose_api
def update( self, trans, payload, **kwd ):
"""
@@ -110,6 +113,8 @@
log.error( message, exc_info=True )
trans.response.status = 500
return message
- item = repository_metadata.as_dict( value_mapper=default_value_mapper( trans, repository_metadata ) )
- item[ 'url' ] = web.url_for( 'repository_revision', id=repository_metadata_id )
- return [ item ]
+ repository_metadata_dict = repository_metadata.as_dict( value_mapper=default_value_mapper( trans, repository_metadata ) )
+ repository_metadata_dict[ 'url' ] = web.url_for( controller='repository_revision_contents',
+ action='index',
+ repository_metadata_id=trans.security.encode_id( repository_metadata.id ) )
+ return repository_metadata_dict
diff -r 24d068f7a44dab10f8574d15aa4063ccdb0edb22 -r 3bbbcdb044afdbd380d6cd4c0f721ab7262c5555 lib/tool_shed/scripts/api/tool_shed_repository_revision_update.py
--- /dev/null
+++ b/lib/tool_shed/scripts/api/tool_shed_repository_revision_update.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+"""
+PUT/update script to update appropriate values in a repository_metadata table record in the Tool Shed.
+
+usage: tool_shed_repository_revision_update.py key url key1=value1 key2=value2 ...
+"""
+
+import os, sys
+sys.path.insert( 0, os.path.dirname( __file__ ) )
+from common import update
+
+import pkg_resources
+pkg_resources.require( "simplejson" )
+
+import simplejson
+
+to_json_string = simplejson.dumps
+from_json_string = simplejson.loads
+
+data = {}
+for key, value in [ kwarg.split( '=', 1 ) for kwarg in sys.argv[ 3: ] ]:
+ """
+ This example script will properly handle updating the value of one or more of the following RepositoryMetadata attributes:
+ tools_functionally_correct, do_not_test, tool_test_errors
+ """
+ if key in [ 'tools_functionally_correct', 'do_not_test' ]:
+ if str( value ).lower() in [ 'true', 'yes', 'on' ]:
+ new_value = True
+ else:
+ new_value = False
+ elif key in [ 'tool_test_errors' ]:
+ new_value = from_json_string( value )
+ else:
+ new_value = str( value )
+ data[ key ] = new_value
+
+update( sys.argv[ 1 ], sys.argv[ 2 ], data )
diff -r 24d068f7a44dab10f8574d15aa4063ccdb0edb22 -r 3bbbcdb044afdbd380d6cd4c0f721ab7262c5555 test/casperjs/anon-history-tests.js
--- a/test/casperjs/anon-history-tests.js
+++ b/test/casperjs/anon-history-tests.js
@@ -68,15 +68,10 @@
});
// ------------------------------------------------------------------- check the empty history for well formedness
-// grab the history frame bounds for mouse later tests
-spaceghost.then( function(){
- historyFrameInfo = this.getElementInfo( 'iframe[name="galaxy_history"]' );
- //this.debug( 'historyFrameInfo:' + this.jsonStr( historyFrameInfo ) );
-});
-
spaceghost.thenOpen( spaceghost.baseUrl, function testPanelStructure(){
this.test.comment( 'history panel for anonymous user, new history' );
- this.withFrame( spaceghost.data.selectors.frames.history, function(){
+
+ this.withHistoryPanel( function(){
this.test.comment( "frame should have proper url and title: 'History'" );
this.test.assertMatch( this.getCurrentUrl(), /\/history/, 'Found history frame url' );
this.test.assertTitle( this.getTitle(), 'History', 'Found history frame title' );
@@ -103,15 +98,12 @@
'Message contains "' + emptyMsgStr + '"' );
this.test.comment( 'name should have a tooltip with info on anon-user name editing' );
- // mouse over to find tooltip
- this.historypanel.hoverOver( nameSelector, function testingHover(){
- this.test.assertExists( tooltipSelector, "Found tooltip after name hover" );
- this.test.assertSelectorHasText( tooltipSelector, anonNameTooltip );
- }, historyFrameInfo );
+ this.historypanel.hoverOver( nameSelector );
+ this.test.assertExists( tooltipSelector, "Found tooltip after name hover" );
+ this.test.assertSelectorHasText( tooltipSelector, anonNameTooltip );
this.test.comment( 'name should NOT be editable when clicked by anon-user' );
- this.assertDoesntHaveClass( nameSelector, editableTextClass,
- "Name field is not classed as editable text" );
+ this.assertDoesntHaveClass( nameSelector, editableTextClass, "Name field is not classed as editable text" );
this.click( nameSelector );
this.test.assertDoesntExist( editableTextInput, "Clicking on name does not create an input" );
});
@@ -120,12 +112,13 @@
// ------------------------------------------------------------------- anon user can upload file
spaceghost.then( function testAnonUpload(){
this.test.comment( 'anon-user should be able to upload files' );
+
spaceghost.tools.uploadFile( filepathToUpload, function uploadCallback( _uploadInfo ){
- this.debug( 'uploaded HDA info: ' + this.jsonStr( _uploadInfo ) );
+ this.debug( 'uploaded HDA info: ' + this.jsonStr( this.quickInfo( _uploadInfo.hdaElement ) ) );
var hasHda = _uploadInfo.hdaElement,
hasClass = _uploadInfo.hdaElement.attributes[ 'class' ],
hasOkClass = _uploadInfo.hdaElement.attributes[ 'class' ].indexOf( 'historyItem-ok' ) !== -1;
- this.test.assert( ( hasHda && hasClass && hasOkClass ), "Uploaded file: " + _uploadInfo.name );
+ this.test.assert( ( hasHda && hasClass && hasOkClass ), "Uploaded file: " + _uploadInfo.hdaElement.text );
testUploadInfo = _uploadInfo;
});
});
@@ -134,19 +127,18 @@
this.test.assertNotVisible( emptyMsgSelector, 'Empty history message is not visible' );
});
-
// ------------------------------------------------------------------- anon user can run tool on file
// ------------------------------------------------------------------- anon user registers/logs in -> same history
spaceghost.user.loginOrRegisterUser( email, password );
spaceghost.thenOpen( spaceghost.baseUrl, function(){
+ this.test.comment( 'anon-user should login and be associated with previous history' );
- this.test.comment( 'anon-user should login and be associated with previous history' );
var loggedInAs = spaceghost.user.loggedInAs();
this.test.assert( loggedInAs === email, 'loggedInAs() matches email: "' + loggedInAs + '"' );
- this.withFrame( spaceghost.data.selectors.frames.history, function(){
- var hdaInfo = this.historypanel.hdaElementInfoByTitle( testUploadInfo.name, testUploadInfo.hid );
+ this.historypanel.waitForHdas( function(){
+ var hdaInfo = this.historypanel.hdaElementInfoByTitle( testUploadInfo.hdaElement.text );
this.test.assert( hdaInfo !== null, "After logging in - found a matching hda by name and hid" );
if( hdaInfo ){
this.test.assert( testUploadInfo.hdaElement.attributes.id === hdaInfo.attributes.id,
@@ -155,17 +147,18 @@
});
});
+// ------------------------------------------------------------------- logs out -> new history
spaceghost.user.logout();
spaceghost.thenOpen( spaceghost.baseUrl, function(){
this.test.comment( 'logging out should create a new, anonymous history' );
- this.withFrame( spaceghost.data.selectors.frames.history, function(){
+
+ this.historypanel.waitForHdas( function(){
this.test.assertSelectorHasText( nameSelector, unnamedName, 'History name is ' + unnamedName );
this.test.assertSelectorHasText( emptyMsgSelector, emptyMsgStr,
'Message contains "' + emptyMsgStr + '"' );
});
});
-
// ===================================================================
spaceghost.run( function(){
this.test.done();
diff -r 24d068f7a44dab10f8574d15aa4063ccdb0edb22 -r 3bbbcdb044afdbd380d6cd4c0f721ab7262c5555 test/casperjs/casperjs_runner.py
--- a/test/casperjs/casperjs_runner.py
+++ b/test/casperjs/casperjs_runner.py
@@ -73,7 +73,7 @@
debug = False
# bit of a hack - this is the beginning of the last string when capserjs --verbose=true --logLevel=debug
# use this to get subprocess to stop waiting for output
- casper_done_str = '# Tests complete'
+ casper_done_str = '# Stopping'
# convert js test results to unittest.TestResults
results_adapter = None #CasperJsonToUnittestResultsConverter()
@@ -209,7 +209,8 @@
js_test_results = json.loads( results )
failures = js_test_results[ 'testResults' ][ 'failures' ]
assert len( failures ) == 0, (
- "Some assertions failed in the headless browser tests (see the log for details)" )
+ "%d assertions failed in the headless browser tests" %( len( failures ) )
+ + " (see the log for details)" )
# ---------------------------------------------------------------- TestCase overrides
def setUp( self ):
@@ -299,10 +300,12 @@
# ==================================================================== TESTCASE EXAMPLE
# these could be broken out into other py files - shouldn't be necc. ATM
class Test_01_User( CasperJSTestCase ):
- """TestCase that uses javascript and a headless browser to test dynamic pages.
+ """Tests for the Galaxy user centered functionality:
+ registration, login, etc.
"""
def test_10_registration( self ):
- """User registration tests: register new user, logout, attempt bad registrations.
+ """User registration tests:
+ register new user, logout, attempt bad registrations.
"""
# all keywords will be compiled into a single JSON obj and passed to the server
#self.run_js_script( 'registration-tests.js',
@@ -331,7 +334,7 @@
class Test_03_HistoryPanel( CasperJSTestCase ):
- """(Minimal) casperjs tests for tools.
+ """Tests for History fetching, rendering, and modeling.
"""
def test_00_history_panel( self ):
"""Test history panel basics (controls, structure, refresh, history options menu, etc.).
@@ -339,13 +342,18 @@
self.run_js_script( 'history-panel-tests.js' )
def test_10_anonymous_histories( self ):
+ """Test history options button.
+ """
+ self.run_js_script( 'history-options-tests.js' )
+
+ def test_20_anonymous_histories( self ):
"""Test history panel basics with an anonymous user.
"""
self.run_js_script( 'anon-history-tests.js' )
class Test_04_HDAs( CasperJSTestCase ):
- """(Minimal) casperjs tests for tools.
+ """Tests for HistoryDatasetAssociation fetching, rendering, and modeling.
"""
def test_00_HDA_states( self ):
"""Test structure rendering of HDAs in all the possible HDA states
diff -r 24d068f7a44dab10f8574d15aa4063ccdb0edb22 -r 3bbbcdb044afdbd380d6cd4c0f721ab7262c5555 test/casperjs/hda-state-tests.js
--- a/test/casperjs/hda-state-tests.js
+++ b/test/casperjs/hda-state-tests.js
@@ -55,17 +55,10 @@
// start a new user
spaceghost.user.loginOrRegisterUser( email, password );
-// grab the history frame bounds for later mouse tests
-spaceghost.then( function(){
- historyFrameInfo = this.getElementInfo( 'iframe[name="galaxy_history"]' );
- //this.debug( 'historyFrameInfo:' + this.jsonStr( historyFrameInfo ) );
-});
-
// upload a file
spaceghost.then( function upload(){
spaceghost.tools.uploadFile( filepathToUpload, function uploadCallback( _uploadInfo ){
testUploadInfo = _uploadInfo;
- this.info( 'testUploadInfo:' + this.jsonStr( testUploadInfo ) );
});
});
@@ -73,13 +66,12 @@
// =================================================================== TEST HELPERS
//NOTE: to be called with fn.call( spaceghost, ... )
-function testTitle( hdaSelector, hid, name ){
- var titleSelector = hdaSelector + ' ' + this.historypanel.data.selectors.hda.title,
- titleShouldBe = hid + ': ' + name;
+function testTitle( hdaSelector, name ){
+ var titleSelector = hdaSelector + ' ' + this.historypanel.data.selectors.hda.title;
this.test.assertVisible( titleSelector,
'HDA title is visible' );
- this.test.assertSelectorHasText( titleSelector, titleShouldBe,
- 'HDA has proper hid and title' );
+ this.test.assertSelectorHasText( titleSelector, name,
+ 'HDA contains name (' + name + '): ' + this.fetchText( titleSelector ) );
}
function testTitleButtonStructure( hdaSelector, shouldHaveTheseButtons ){
@@ -87,28 +79,9 @@
shouldHaveTheseButtons = shouldHaveTheseButtons || [ 'display', 'edit', 'delete' ];
var hdaDbId = this.getElementAttribute( hdaSelector, 'id' ).split( '-' )[1],
- buttonsArea = hdaSelector + ' ' + this.historypanel.data.selectors.hda.titleButtons,
- buttons = {
- // this seems backwards -> TODO: move buttonsArea concat into loop below, move this data to historypanel.data
- display : {
- nodeName : this.historypanel.data.text.hda.ok.nodeNames.displayButton,
- selector : buttonsArea + ' ' + this.historypanel.data.selectors.hda.displayButton,
- tooltip : this.historypanel.data.text.hda.ok.tooltips.displayButton,
- hrefTpl : this.historypanel.data.text.hda.ok.hrefs.displayButton
- },
- edit : {
- nodeName : this.historypanel.data.text.hda.ok.nodeNames.editAttrButton,
- selector : buttonsArea + ' ' + this.historypanel.data.selectors.hda.editAttrButton,
- tooltip : this.historypanel.data.text.hda.ok.tooltips.editAttrButton,
- hrefTpl : this.historypanel.data.text.hda.ok.hrefs.editAttrButton
- },
- 'delete' : {
- nodeName : this.historypanel.data.text.hda.ok.nodeNames.deleteButton,
- selector : buttonsArea + ' ' + this.historypanel.data.selectors.hda.deleteButton,
- tooltip : this.historypanel.data.text.hda.ok.tooltips.deleteButton,
- hrefTpl : this.historypanel.data.text.hda.ok.hrefs.deleteButton
- }
- };
+ buttonsArea = hdaSelector + ' ' + this.historypanel.data.selectors.hda.titleButtonArea,
+ buttons = this.historypanel.data.hdaTitleButtons;
+
this.test.assertVisible( buttonsArea, 'Button area is visible' );
for( var i=0; i<shouldHaveTheseButtons.length; i++ ){
@@ -123,7 +96,7 @@
this.test.assertVisible( button.selector, buttonName + ' button is visible' );
var buttonElement = this.getElementInfo( button.selector );
- this.debug( 'buttonElement:' + this.jsonStr( buttonElement ) );
+ this.debug( 'buttonElement:' + this.jsonStr( this.quickInfo( buttonElement ) ) );
// should be an anchor
this.test.assert( buttonElement.nodeName === button.nodeName,
@@ -135,12 +108,13 @@
this.assertTextContains( href, hrefShouldBe,
buttonName + ' has proper href (' + hrefShouldBe + '): ' + href );
- this.historypanel.hoverOver( button.selector, function testingHover(){
- var tooltipText = button.tooltip;
- this.test.assertVisible( tooltipSelector, buttonName + ' button tooltip is visible when hovering' );
- this.test.assertSelectorHasText( tooltipSelector, tooltipText,
- buttonName + ' button has tooltip text: "' + tooltipText + '"' );
- }, historyFrameInfo );
+ this.historypanel.hoverOver( button.selector );
+ var tooltipText = button.tooltip;
+ this.test.assertVisible( tooltipSelector, buttonName + ' button tooltip is visible when hovering' );
+ this.test.assertSelectorHasText( tooltipSelector, tooltipText,
+ buttonName + ' button has tooltip text: "' + tooltipText + '"' );
+ // clear the tooltip
+ this.page.sendEvent( 'mouseover', 0, 0 );
}
}
@@ -185,6 +159,7 @@
this.test.comment( 'Primary action buttons div should exist and be visible' );
this.test.assertExists( buttonsSelector, 'Primary action buttons div exists' );
this.test.assertVisible( buttonsSelector, 'Primary action buttons div is visible' );
+ //TODO: ...
}
function testSecondaryActionButtons( hdaSelector ){
@@ -193,6 +168,7 @@
this.test.comment( 'Secondary action buttons div should exist and be visible' );
this.test.assertExists( buttonsSelector, 'Secondary action buttons div exists' );
this.test.assertVisible( buttonsSelector, 'Secondary action buttons div is visible' );
+ //TODO: ...
}
function testPeek( hdaSelector, expectedPeekArray ){
@@ -239,112 +215,97 @@
// =================================================================== TESTS
// ------------------------------------------------------------------- ok state
-spaceghost.then( function checkOkState(){
+spaceghost.withHistoryPanel( function(){
this.test.comment( 'HDAs in the "ok" state should be well formed' );
- this.withFrame( spaceghost.data.selectors.frames.history, function(){
- var uploadSelector = '#' + testUploadInfo.hdaElement.attributes.id;
- this.test.assertVisible( uploadSelector, 'HDA is visible' );
+ var uploadSelector = '#' + testUploadInfo.hdaElement.attributes.id;
+ this.test.assertVisible( uploadSelector, 'HDA is visible' );
- this.test.comment( 'should have the proper state class' );
- this.assertHasClass( uploadSelector, this.historypanel.data.selectors.hda.wrapper.stateClasses.ok,
- 'HDA has ok state class' );
+ this.test.comment( 'should have the proper state class' );
+ this.assertHasClass( uploadSelector, this.historypanel.data.selectors.hda.wrapper.stateClasses.ok,
+ 'HDA has ok state class' );
- // since we're using css there's no great way to test state icon (.state-icon is empty)
+ // since we're using css there's no great way to test state icon (.state-icon is empty)
- this.test.comment( 'should have proper title and hid' );
- testTitle.call( spaceghost, uploadSelector, testUploadInfo.hid, testUploadInfo.name );
+ this.test.comment( 'should have proper title and hid' );
+ testTitle.call( spaceghost, uploadSelector, testUploadInfo.filename );
- this.test.comment( 'should have all of the three, main buttons' );
- testTitleButtonStructure.call( spaceghost, uploadSelector );
+ this.test.comment( 'should have all of the three, main buttons' );
+ testTitleButtonStructure.call( spaceghost, uploadSelector );
- this.test.comment( 'body is not visible before clicking the hda title' );
- var body = uploadSelector + ' ' + this.historypanel.data.selectors.hda.body;
- this.test.assertNotVisible( body, 'body is not visible' );
+ this.test.comment( 'body is not visible before clicking the hda title' );
+ var body = uploadSelector + ' ' + this.historypanel.data.selectors.hda.body;
+ this.test.assertNotVisible( body, 'body is not visible' );
- this.test.comment( 'clicking the hda title should expand its body' );
- var hdaTitle = uploadSelector + ' ' + this.historypanel.data.selectors.hda.title;
- this.click( hdaTitle );
- this.wait( 500, function(){
+ this.test.comment( 'clicking the hda title should expand its body' );
+ this.historypanel.thenExpandHda( uploadSelector, function(){
+ // ugh.
+ this.jumpToHistory( function(){
testExpandedBody.call( spaceghost, uploadSelector, summaryShouldBeArray, infoShouldBe, false );
});
});
});
+// restore to collapsed
+spaceghost.then( function(){
+ this.test.comment( "Collapsing hda in 'ok' state should hide body again" );
+ var uploadSelector = '#' + testUploadInfo.hdaElement.attributes.id;
-// restore to collapsed
-spaceghost.then( function collapseOkState(){
- this.test.comment( "Collapsing hda in 'ok' state should hide body again" );
- this.withFrame( spaceghost.data.selectors.frames.history, function(){
- var uploadSelector = '#' + testUploadInfo.hdaElement.attributes.id,
- hdaTitle = uploadSelector + ' ' + this.historypanel.data.selectors.hda.title;
- body = uploadSelector + ' ' + this.historypanel.data.selectors.hda.body;
-
- this.click( hdaTitle );
- this.wait( 500, function(){
- this.test.assertNotVisible( body, 'body is not visible' );
- });
+ spaceghost.historypanel.thenCollapseHda( uploadSelector, function collapseOkState(){
+ this.test.assertNotVisible( uploadSelector + ' ' + this.historypanel.data.selectors.hda.body,
+ 'body is not visible' );
});
});
+// ------------------------------------------------------------------- new state
+spaceghost.withHistoryPanel( function(){
+ // set state directly through model, wait for re-render
+ //TODO: not ideal to test this
+ this.evaluate( function(){
+ return Galaxy.currHistoryPanel.model.hdas.at( 0 ).set( 'state', 'new' );
+ });
+ this.wait( 1000, function(){
+ this.test.comment( 'HDAs in the "new" state should be well formed' );
-// ------------------------------------------------------------------- new state
-spaceghost.then( function checkNewState(){
- this.test.comment( 'HDAs in the "new" state should be well formed' );
+ var uploadSelector = '#' + testUploadInfo.hdaElement.attributes.id;
+ this.test.assertVisible( uploadSelector, 'HDA is visible' );
- this.withFrame( spaceghost.data.selectors.frames.history, function(){
- // set state directly through model
- //TODO: not ideal
- this.evaluate( function(){
- return Galaxy.currHistoryPanel.model.hdas.at( 0 ).set( 'state', 'new' );
- });
- // wait for re-render
- this.wait( 500, function(){
- var uploadSelector = '#' + testUploadInfo.hdaElement.attributes.id;
- this.test.assertVisible( uploadSelector, 'HDA is visible' );
+ // should have proper title and hid
+ testTitle.call( spaceghost, uploadSelector, testUploadInfo.filename );
- // should have proper title and hid
- testTitle.call( spaceghost, uploadSelector, testUploadInfo.hid, testUploadInfo.name );
+ this.test.comment( 'new HDA should have the new state class' );
+ this.assertHasClass( uploadSelector, this.historypanel.data.selectors.hda.wrapper.stateClasses['new'],
+ 'HDA has new state class' );
- this.test.comment( 'new HDA should have the new state class' );
- this.assertHasClass( uploadSelector, this.historypanel.data.selectors.hda.wrapper.stateClasses['new'],
- 'HDA has new state class' );
+ this.test.comment( 'new HDA should NOT have any of the three, main buttons' );
+ var buttonSelector = uploadSelector + ' ' + this.historypanel.data.selectors.hda.titleButtons + ' a';
+ this.test.assertDoesntExist( buttonSelector, 'No display, edit, or delete buttons' );
- this.test.comment( 'new HDA should NOT have any of the three, main buttons' );
- var buttonSelector = uploadSelector + ' ' + this.historypanel.data.selectors.hda.titleButtons + ' a';
- this.test.assertDoesntExist( buttonSelector, 'No display, edit, or delete buttons' );
+ this.test.comment( 'clicking the title of the new HDA will expand the body' );
- this.test.comment( 'clicking the title of the new HDA will expand the body' );
- var hdaTitle = uploadSelector + ' ' + this.historypanel.data.selectors.hda.title;
- this.click( hdaTitle );
- this.wait( 500, function(){
- var bodySelector = uploadSelector + ' ' + this.historypanel.data.selectors.hda.body;
- this.test.assertVisible( bodySelector, 'HDA body is visible (after expanding)' );
+ this.historypanel.thenExpandHda( uploadSelector, function(){
+ var bodySelector = uploadSelector + ' ' + this.historypanel.data.selectors.hda.body;
+ this.test.assertVisible( bodySelector, 'HDA body is visible (after expanding)' );
- var expectedBodyText = 'This is a new dataset';
- this.test.comment( 'the body should have the text: ' + expectedBodyText );
- this.test.assertSelectorHasText( bodySelector, expectedBodyText,
- 'HDA body has text: ' + expectedBodyText );
-
- // restore to collapsed
- this.click( hdaTitle );
- });
+ var expectedBodyText = 'This is a new dataset';
+ this.test.comment( 'the body should have the text: ' + expectedBodyText );
+ this.test.assertSelectorHasText( bodySelector, expectedBodyText,
+ 'HDA body has text: ' + expectedBodyText );
});
});
});
// restore state, collapse
-spaceghost.then( function revertStateAndCollapse(){
- this.withFrame( spaceghost.data.selectors.frames.history, function(){
+spaceghost.withHistoryPanel( function revertStateAndCollapse(){
+ var uploadSelector = '#' + testUploadInfo.hdaElement.attributes.id;
+
+ this.historypanel.thenCollapseHda( uploadSelector, function(){
this.evaluate( function(){
return Galaxy.currHistoryPanel.model.hdas.at( 0 ).set( 'state', 'ok' );
});
- this.wait( 500, function(){
- var hdaTitle = '#' + testUploadInfo.hdaElement.attributes.id
- + ' ' + this.historypanel.data.selectors.hda.title;
- this.click( hdaTitle );
- });
});
+ this.wait( 1000 );
});
-
+/*
+*/
// ===================================================================
spaceghost.run( function(){
diff -r 24d068f7a44dab10f8574d15aa4063ccdb0edb22 -r 3bbbcdb044afdbd380d6cd4c0f721ab7262c5555 test/casperjs/history-options-tests.js
--- /dev/null
+++ b/test/casperjs/history-options-tests.js
@@ -0,0 +1,145 @@
+// have to handle errors here - or phantom/casper won't bail but _HANG_
+try {
+ var utils = require( 'utils' ),
+ xpath = require( 'casper' ).selectXPath,
+ format = utils.format,
+
+ //...if there's a better way - please let me know, universe
+ scriptDir = require( 'system' ).args[3]
+ // remove the script filename
+ .replace( /[\w|\.|\-|_]*$/, '' )
+ // if given rel. path, prepend the curr dir
+ .replace( /^(?!\/)/, './' ),
+ spaceghost = require( scriptDir + 'spaceghost' ).create({
+ // script options here (can be overridden by CLI)
+ //verbose: true,
+ //logLevel: debug,
+ scriptDir: scriptDir
+ });
+
+ spaceghost.start();
+
+} catch( error ){
+ console.debug( error );
+ phantom.exit( 1 );
+}
+
+// ===================================================================
+/* TODO:
+ possibly break this file up
+*/
+// =================================================================== globals and helpers
+var email = spaceghost.user.getRandomEmail(),
+ password = '123456';
+if( spaceghost.fixtureData.testUser ){
+ email = spaceghost.fixtureData.testUser.email;
+ password = spaceghost.fixtureData.testUser.password;
+ spaceghost.info( 'Will use fixtureData.testUser: ' + email );
+}
+
+// selectors and labels
+var includeDeletedOptionsLabel = spaceghost.historyoptions.data.labels.options.includeDeleted;
+
+// local
+var filepathToUpload = '../../test-data/1.txt',
+ testUploadInfo = {};
+
+
+// =================================================================== TESTS
+// ------------------------------------------------------------------- set up
+// start a new user
+spaceghost.user.loginOrRegisterUser( email, password );
+
+spaceghost.tools.uploadFile( filepathToUpload, function uploadCallback( _uploadInfo ){
+ testUploadInfo = _uploadInfo;
+});
+
+// ------------------------------------------------------------------- history options menu structure
+//NOTE: options menu should be functionally tested elsewhere
+spaceghost.historypanel.waitForHdas().then( function checkHistoryOptions(){
+ this.test.comment( 'History options icon should be in place and menu should have the proper structure' );
+
+ // check the button and icon
+ this.test.assertExists( this.historyoptions.data.selectors.button, "Found history options button" );
+ this.test.assertVisible( this.historyoptions.data.selectors.button, "History options button is visible" );
+ this.test.assertVisible( this.historyoptions.data.selectors.buttonIcon, "History options icon is visible" );
+
+ // open the menu
+ this.click( this.historyoptions.data.selectors.button );
+ this.test.assertVisible( this.historyoptions.data.selectors.menu,
+ "Menu is visible when options button is clicked" );
+
+ // check the options
+ var historyOptions = this.historyoptions.data.labels.options;
+ for( var optionKey in historyOptions ){
+ if( historyOptions.hasOwnProperty( optionKey ) ){
+ var optionLabel = historyOptions[ optionKey ];
+ this.test.assertVisible( this.historyoptions.data.selectors.optionXpathByLabelFn( optionLabel ),
+ 'Option label is visible: ' + optionLabel );
+ }
+ }
+
+ // clear the menu
+ this.click( 'body' );
+ this.test.assertNotVisible( this.historyoptions.data.selectors.menu,
+ "Clicking away from the menu closes it" );
+});
+
+// ------------------------------------------------------------------- options allow showing/hiding deleted hdas
+spaceghost.then( function(){
+ this.test.comment( 'Deleting HDA' );
+ var uploadSelector = '#' + testUploadInfo.hdaElement.attributes.id;
+
+ this.historypanel.deleteHda( uploadSelector, function(){
+ this.test.assertNotExists( uploadSelector, "Deleted HDA is NOT in the DOM" );
+ });
+});
+
+spaceghost.then( function(){
+ this.test.comment( 'History options->' + includeDeletedOptionsLabel + ' shows deleted datasets' );
+ var uploadSelector = '#' + testUploadInfo.hdaElement.attributes.id;
+
+ this.historyoptions.includeDeleted( function(){
+ this.test.assertExists( uploadSelector,
+ "Deleted HDA is in the DOM (using history options -> " + includeDeletedOptionsLabel + ")" );
+ this.test.assertVisible( uploadSelector,
+ "Deleted HDA is visible again (using history options -> " + includeDeletedOptionsLabel + ")" );
+ });
+});
+
+spaceghost.then( function(){
+ this.test.comment( 'History options->' + includeDeletedOptionsLabel + ' (again) re-hides deleted datasets' );
+
+ this.historyoptions.excludeDeleted( function(){
+ this.test.assertDoesntExist( '#' + testUploadInfo.hdaElement.attributes.id,
+ "Deleted HDA is not in the DOM (using history options -> " + includeDeletedOptionsLabel + ")" );
+ });
+ // undelete the uploaded file
+ this.historypanel.undeleteHda( '#' + testUploadInfo.hdaElement.attributes.id );
+});
+
+// ------------------------------------------------------------------- hidden hdas aren't shown
+// ------------------------------------------------------------------- history options allows showing hidden hdas
+// can't test this yet w/o a way to make hdas hidden thru the ui or api
+
+
+// ------------------------------------------------------------------- history options collapses all expanded hdas
+spaceghost.then( function(){
+ this.historypanel.thenExpandHda( '#' + testUploadInfo.hdaElement.attributes.id );
+});
+spaceghost.then( function(){
+ this.test.comment( 'History option collapses all expanded hdas' );
+
+ this.historyoptions.collapseExpanded( function(){
+ var uploadedSelector = '#' + testUploadInfo.hdaElement.attributes.id;
+ this.withHistoryPanel( function(){
+ this.test.assertNotVisible( uploadedSelector + ' ' + this.historypanel.data.selectors.hda.body,
+ "Body for uploaded file is not visible" );
+ });
+ });
+});
+
+// ===================================================================
+spaceghost.run( function(){
+ this.test.done();
+});
diff -r 24d068f7a44dab10f8574d15aa4063ccdb0edb22 -r 3bbbcdb044afdbd380d6cd4c0f721ab7262c5555 test/casperjs/history-panel-tests.js
--- a/test/casperjs/history-panel-tests.js
+++ b/test/casperjs/history-panel-tests.js
@@ -72,177 +72,164 @@
// ------------------------------------------------------------------- set up
// start a new user
spaceghost.user.loginOrRegisterUser( email, password );
-//??: why is a reload needed here? If we don't, loggedInAs === '' ...
-spaceghost.thenOpen( spaceghost.baseUrl, function(){
- var loggedInAs = spaceghost.user.loggedInAs();
- this.test.assert( loggedInAs === email, 'loggedInAs() matches email: "' + loggedInAs + '"' );
+
+// ------------------------------------------------------------------- check structure of empty history
+spaceghost.thenOpen( spaceghost.baseUrl ).historypanel.waitForHdas( function(){
+ this.test.comment( 'history panel with a new, empty history should be well formed' );
+ this.test.comment( "frame should have proper url and title: 'History'" );
+ this.test.assertMatch( this.getCurrentUrl(), /\/history/, 'Found history frame url' );
+ this.test.assertTitle( this.getTitle(), 'History', 'Found history frame title' );
+
+ this.test.comment( "history name should exist, be visible, and have text " + unnamedName );
+ this.test.assertExists( nameSelector, nameSelector + ' exists' );
+ this.test.assertVisible( nameSelector, 'History name is visible' );
+ this.test.assertSelectorHasText( nameSelector, unnamedName, 'History name is ' + unnamedName );
+
+ this.test.comment( "history subtitle should display size and size should be: " + initialSizeStr );
+ this.test.assertExists( subtitleSelector, 'Found ' + subtitleSelector );
+ this.test.assertVisible( subtitleSelector, 'History subtitle is visible' );
+ this.test.assertSelectorHasText( subtitleSelector, initialSizeStr,
+ 'History subtitle has "' + initialSizeStr + '"' );
+
+ this.test.comment( "tags and annotation icons should be available" );
+ this.test.assertExists( tagIconSelector, 'Tag icon button found' );
+ this.test.assertExists( annoIconSelector, 'Annotation icon button found' );
+
+ this.test.comment( "A message about the current history being empty should be displayed" );
+ this.test.assertExists( emptyMsgSelector, emptyMsgSelector + ' exists' );
+ this.test.assertVisible( emptyMsgSelector, 'Empty history message is visible' );
+ this.test.assertSelectorHasText( emptyMsgSelector, emptyMsgStr,
+ 'Message contains "' + emptyMsgStr + '"' );
});
-// grab the history frame bounds for later mouse tests
-spaceghost.then( function(){
- historyFrameInfo = this.getElementInfo( 'iframe[name="galaxy_history"]' );
- //this.debug( 'historyFrameInfo:' + this.jsonStr( historyFrameInfo ) );
-});
+// ------------------------------------------------------------------- name editing
+spaceghost.withHistoryPanel( function(){
+ this.test.comment( 'history panel, editing the history name' );
-// ------------------------------------------------------------------- check structure of empty history
-spaceghost.thenOpen( spaceghost.baseUrl, function testPanelStructure(){
- this.test.comment( 'history panel, new history' );
- this.withFrame( spaceghost.data.selectors.frames.history, function(){
- this.test.comment( "frame should have proper url and title: 'History'" );
- this.test.assertMatch( this.getCurrentUrl(), /\/history/, 'Found history frame url' );
- this.test.assertTitle( this.getTitle(), 'History', 'Found history frame title' );
+ this.test.comment( 'name should have a tooltip with proper info on name editing' );
+ this.historypanel.hoverOver( nameSelector );
+ this.test.assertExists( tooltipSelector, "Found tooltip after name hover" );
+ this.test.assertSelectorHasText( tooltipSelector, nameTooltip );
+ // clear the tooltip
+ this.page.sendEvent( 'mousemove', -1, -1 );
- this.test.comment( "history name should exist, be visible, and have text " + unnamedName );
- this.test.assertExists( nameSelector, nameSelector + ' exists' );
- this.test.assertVisible( nameSelector, 'History name is visible' );
- this.test.assertSelectorHasText( nameSelector, unnamedName, 'History name is ' + unnamedName );
+ this.test.comment( 'name should be create an input when clicked' );
+ this.assertHasClass( nameSelector, editableTextClass, "Name field classed for editable text" );
+ this.click( nameSelector );
+ this.test.assertExists( editableTextInput, "Clicking on name creates an input" );
- this.test.comment( "history subtitle should display size and size should be: " + initialSizeStr );
- this.test.assertExists( subtitleSelector, 'Found ' + subtitleSelector );
- this.test.assertVisible( subtitleSelector, 'History subtitle is visible' );
- this.test.assertSelectorHasText( subtitleSelector, initialSizeStr,
- 'History subtitle has "' + initialSizeStr + '"' );
-
- this.test.comment( "tags and annotation icons should be available" );
- this.test.assertExists( tagIconSelector, 'Tag icon button found' );
- this.test.assertExists( annoIconSelector, 'Annotation icon button found' );
-
- this.test.comment( "A message about the current history being empty should be displayed" );
- this.test.assertExists( emptyMsgSelector, emptyMsgSelector + ' exists' );
- this.test.assertVisible( emptyMsgSelector, 'Empty history message is visible' );
- this.test.assertSelectorHasText( emptyMsgSelector, emptyMsgStr,
- 'Message contains "' + emptyMsgStr + '"' );
+ this.test.comment( 'name should be editable by entering keys and pressing enter' );
+ //NOTE: casperjs.sendKeys adds a click before and a selector.blur after sending - won't work here
+ this.page.sendEvent( 'keypress', newHistoryName );
+ this.page.sendEvent( 'keypress', this.page.event.key.Enter );
+ // wait for send and re-render name
+ this.wait( 1000, function(){
+ this.test.assertSelectorHasText( nameSelector, newHistoryName, 'History name is ' + newHistoryName );
+ this.test.assertDoesntExist( editableTextInput, "Input disappears after pressing enter" );
});
});
-// ------------------------------------------------------------------- name editing
-spaceghost.then( function(){
- this.test.comment( 'history panel, editing the history name' );
- this.withFrame( spaceghost.data.selectors.frames.history, function(){
- this.test.comment( 'name should have a tooltip with proper info on name editing' );
- var nameInfo = this.getElementInfo( nameSelector );
- this.page.sendEvent( 'mousemove', historyFrameInfo.x + nameInfo.x + 1, historyFrameInfo.y + nameInfo.y + 1 );
- this.test.assertExists( tooltipSelector, "Found tooltip after name hover" );
- this.test.assertSelectorHasText( tooltipSelector, nameTooltip );
+spaceghost.withHistoryPanel( function(){
+ this.test.comment( 'name should revert if user clicks away while editing' );
- this.test.comment( 'name should be create an input when clicked' );
- this.assertHasClass( nameSelector, editableTextClass, "Name field classed for editable text" );
- this.click( nameSelector );
- this.test.assertExists( editableTextInput, "Clicking on name creates an input" );
+ this.click( nameSelector );
+ this.page.sendEvent( 'keypress', "Woodchipper metagenomics, Fargo, ND" );
- this.test.comment( 'name should be editable by entering keys and pressing enter' );
- //NOTE: casperjs.sendKeys adds a click before and a selector.blur after sending - won't work here
- this.page.sendEvent( 'keypress', newHistoryName );
- this.page.sendEvent( 'keypress', this.page.event.key.Enter );
- this.wait( 1000, function(){
- this.test.assertSelectorHasText( nameSelector, newHistoryName, 'History name is ' + newHistoryName );
- this.test.assertDoesntExist( editableTextInput, "Input disappears after pressing enter" );
- });
+ this.page.sendEvent( 'mousedown', -1, -1 );
+ this.wait( 1000, function(){
+ this.test.assertSelectorHasText( nameSelector, newHistoryName, 'History name is STILL ' + newHistoryName );
+ this.test.assertDoesntExist( editableTextInput, "Input disappears after clicking away" );
});
});
-spaceghost.then( function(){
- this.withFrame( spaceghost.data.selectors.frames.history, function(){
- this.test.comment( 'name should revert if user clicks away while editing' );
- this.click( nameSelector );
- this.page.sendEvent( 'keypress', "Woodchipper metagenomics, Fargo, ND" );
- // click above the name input element
- var inputInfo = this.getElementInfo( editableTextInput );
- this.page.sendEvent( 'mousedown', historyFrameInfo.x + inputInfo.x + 1, historyFrameInfo.y + inputInfo.y - 5 );
+spaceghost.withHistoryPanel( function(){
+ this.test.comment( 'name should revert if user hits ESC while editing' );
- this.wait( 1000, function(){
- this.test.assertSelectorHasText( nameSelector, newHistoryName, 'History name is STILL ' + newHistoryName );
- this.test.assertDoesntExist( editableTextInput, "Input disappears after clicking away" );
- });
- });
-});
-spaceghost.then( function(){
- this.withFrame( spaceghost.data.selectors.frames.history, function(){
- this.test.comment( 'name should revert if user hits ESC while editing' );
- this.click( nameSelector );
- this.page.sendEvent( 'keypress', "Arsenic Bacteria" );
+ this.click( nameSelector );
+ this.page.sendEvent( 'keypress', "Arsenic Bacteria" );
- this.page.sendEvent( 'keypress', this.page.event.key.Escape );
- this.wait( 1000, function(){
- this.test.assertSelectorHasText( nameSelector, newHistoryName, 'History name is STILL ' + newHistoryName );
- this.test.assertDoesntExist( editableTextInput, "Input disappears after hitting ESC" );
- });
+ this.page.sendEvent( 'keypress', this.page.event.key.Escape );
+ this.wait( 1000, function(){
+ this.test.assertSelectorHasText( nameSelector, newHistoryName, 'History name is STILL ' + newHistoryName );
+ this.test.assertDoesntExist( editableTextInput, "Input disappears after hitting ESC" );
});
});
// ------------------------------------------------------------------- check structure of NON empty history
// upload file: 1.txt
-spaceghost.then( function upload(){
+spaceghost.tools.uploadFile( filepathToUpload, function uploadCallback( _uploadInfo ){
this.test.comment( 'uploaded file should appear in history' );
- spaceghost.tools.uploadFile( filepathToUpload, function uploadCallback( _uploadInfo ){
- this.debug( 'uploaded HDA info: ' + this.jsonStr( _uploadInfo ) );
- var hasHda = _uploadInfo.hdaElement,
- hasClass = _uploadInfo.hdaElement.attributes[ 'class' ],
- hasOkClass = _uploadInfo.hdaElement.attributes[ 'class' ].indexOf( wrapperOkClassName ) !== -1;
- this.test.assert( ( hasHda && hasClass && hasOkClass ), "Uploaded file: " + _uploadInfo.name );
- testUploadInfo = _uploadInfo;
- });
+
+ this.debug( 'uploaded HDA info: ' + this.jsonStr( _uploadInfo ) );
+ var hasHda = _uploadInfo.hdaElement,
+ hasClass = _uploadInfo.hdaElement.attributes[ 'class' ],
+ hasOkClass = _uploadInfo.hdaElement.attributes[ 'class' ].indexOf( wrapperOkClassName ) !== -1;
+ this.test.assert( ( hasHda && hasClass && hasOkClass ), "Uploaded file: " + _uploadInfo.name );
+ testUploadInfo = _uploadInfo;
});
-spaceghost.then( function checkPanelStructure(){
+spaceghost.withHistoryPanel( function checkPanelStructure(){
this.test.comment( 'checking structure of non-empty panel' );
- this.withFrame( spaceghost.data.selectors.frames.history, function(){
- this.test.comment( "history name should exist, be visible, and have text " + unnamedName );
- this.test.assertExists( nameSelector, nameSelector + ' exists' );
- this.test.assertVisible( nameSelector, 'History name is visible' );
- this.test.assertSelectorHasText( nameSelector, newHistoryName, 'History name is ' + newHistoryName );
+ this.test.comment( "history name should exist, be visible, and have text " + unnamedName );
+ this.test.assertExists( nameSelector, nameSelector + ' exists' );
+ this.test.assertVisible( nameSelector, 'History name is visible' );
+ this.test.assertSelectorHasText( nameSelector, newHistoryName, 'History name is ' + newHistoryName );
- this.test.comment( "history subtitle should display size and size should be " + onetxtFilesize + " bytes" );
- var onetxtFilesize = require( 'fs' ).size( this.options.scriptDir + filepathToUpload ),
- expectedSubtitle = onetxtFilesize + ' bytes';
- this.test.assertExists( subtitleSelector, 'Found ' + subtitleSelector );
- this.test.assertVisible( subtitleSelector, 'History subtitle is visible' );
- this.test.assertSelectorHasText( subtitleSelector, expectedSubtitle,
- 'History subtitle has "' + expectedSubtitle + '"' );
+ this.test.comment( "history subtitle should display size and size should be " + onetxtFilesize + " bytes" );
+ var onetxtFilesize = require( 'fs' ).size( this.options.scriptDir + filepathToUpload ),
+ expectedSubtitle = onetxtFilesize + ' bytes';
+ this.test.assertExists( subtitleSelector, 'Found ' + subtitleSelector );
+ this.test.assertVisible( subtitleSelector, 'History subtitle is visible' );
+ this.test.assertSelectorHasText( subtitleSelector, expectedSubtitle,
+ 'History subtitle has "' + expectedSubtitle + '": ' + this.fetchText( subtitleSelector ).trim() );
- this.test.comment( "tags and annotation icons should be available" );
- this.test.assertExists( tagIconSelector, 'Tag icon button found' );
- this.test.assertExists( annoIconSelector, 'Annotation icon button found' );
+ this.test.comment( "tags and annotation icons should be available" );
+ this.test.assertExists( tagIconSelector, 'Tag icon button found' );
+ this.test.assertExists( annoIconSelector, 'Annotation icon button found' );
- this.test.comment( "A message about the current history being empty should NOT be displayed" );
- this.test.assertExists( emptyMsgSelector, emptyMsgSelector + ' exists' );
- this.test.assertNotVisible( emptyMsgSelector, 'Empty history message is NOT visible' );
- });
+ this.test.comment( "A message about the current history being empty should NOT be displayed" );
+ this.test.assertExists( emptyMsgSelector, emptyMsgSelector + ' exists' );
+ this.test.assertNotVisible( emptyMsgSelector, 'Empty history message is NOT visible' );
});
// ------------------------------------------------------------------- tags
// keeping this light here - better for it's own test file
//TODO: check tooltips
-spaceghost.then( function openTags(){
+spaceghost.withHistoryPanel( function openTags(){
this.test.comment( 'tag area should open when the history panel tag icon is clicked' );
- this.withFrame( spaceghost.data.selectors.frames.history, function(){
- this.mouseEvent( 'click', tagIconSelector );
- this.wait( 1000, function(){
- this.test.assertVisible( tagAreaSelector, 'Tag area is now displayed' );
- });
+
+ this.click( tagIconSelector );
+ this.wait( 1000, function(){
+ this.test.assertVisible( tagAreaSelector, 'Tag area is now displayed' );
+ });
+});
+spaceghost.withHistoryPanel( function closeAnnotation(){
+ this.test.comment( 'annotation area should close when the history panel tag icon is clicked again' );
+
+ this.click( tagIconSelector );
+ this.wait( 1000, function(){
+ this.test.assertNotVisible( tagAreaSelector, 'Tag area is now hidden' );
});
});
// ------------------------------------------------------------------- annotation
// keeping this light here - better for it's own test file
//TODO: check tooltips
-spaceghost.then( function openAnnotation(){
+spaceghost.withHistoryPanel( function openAnnotation(){
this.test.comment( 'annotation area should open when the history panel annotation icon is clicked' );
- this.withFrame( spaceghost.data.selectors.frames.history, function(){
- this.mouseEvent( 'click', annoIconSelector );
- this.wait( 1000, function(){
- this.test.assertVisible( annoAreaSelector, 'Annotation area is now displayed' );
- });
+
+ this.click( annoIconSelector );
+ this.wait( 1000, function(){
+ this.test.assertVisible( annoAreaSelector, 'Annotation area is now displayed' );
});
});
-spaceghost.then( function closeAnnotation(){
+spaceghost.withHistoryPanel( function closeAnnotation(){
this.test.comment( 'annotation area should close when the history panel tag icon is clicked again' );
- this.withFrame( spaceghost.data.selectors.frames.history, function bler(){
- this.mouseEvent( 'click', annoIconSelector );
- this.wait( 1000, function(){
- this.test.assertNotVisible( annoAreaSelector, 'Tag area is now hidden' );
- });
+
+ this.click( annoIconSelector );
+ this.wait( 1000, function(){
+ this.test.assertNotVisible( annoAreaSelector, 'Annotation area is now hidden' );
});
});
@@ -261,96 +248,16 @@
});
});
-// ------------------------------------------------------------------- history options menu structure
-//NOTE: options menu should be functionally tested elsewhere
-spaceghost.then( function historyOptions(){
- this.test.comment( 'History options icon should be in place and menu should have the proper structure' );
-
- // check the button and icon
- this.test.assertExists( this.historyoptions.data.selectors.button, "Found history options button" );
- this.test.assertVisible( this.historyoptions.data.selectors.button, "History options button is visible" );
- this.test.assertVisible( this.historyoptions.data.selectors.buttonIcon, "History options icon is visible" );
-
- // open the menu
- this.click( this.historyoptions.data.selectors.button );
- this.test.assertVisible( this.historyoptions.data.selectors.menu,
- "Menu is visible when options button is clicked" );
-
- // check the options
- for( var optionKey in this.historyoptions.data.labels.options ){
- if( this.historyoptions.data.labels.options.hasOwnProperty( optionKey ) ){
- var optionLabel = this.historyoptions.data.labels.options[ optionKey ],
- optionXpath = this.historyoptions.data.selectors.optionXpathByLabelFn( optionLabel );
- this.test.assertVisible( optionXpath, 'Option label is visible: ' + optionLabel );
- }
- }
-});
-
-// ------------------------------------------------------------------- deleted hdas aren't in the dom
-spaceghost.then( function(){
- this.test.comment( 'deleted hdas shouldn\'t be in the history panel DOM' );
-
- this.historypanel.deleteHda( '#' + testUploadInfo.hdaElement.attributes.id, function(){
- this.test.assertDoesntExist( '#' + testUploadInfo.hdaElement.attributes.id,
- "Deleted HDA is not in the DOM" );
- });
-});
-
-// ------------------------------------------------------------------- options allow showing/hiding deleted hdas
-spaceghost.then( function(){
- this.test.comment( 'History options->' + includeDeletedOptionsLabel + ' shows deleted datasets' );
-
- this.historyoptions.includeDeleted();
- this.withFrame( spaceghost.data.selectors.frames.history, function(){
- this.waitForSelector( nameSelector, function(){
- this.test.assertExists( '#' + testUploadInfo.hdaElement.attributes.id,
- "Deleted HDA is in the DOM (using history options -> " + includeDeletedOptionsLabel + ")" );
- this.test.assertVisible( '#' + testUploadInfo.hdaElement.attributes.id,
- "Deleted HDA is visible again (using history options -> " + includeDeletedOptionsLabel + ")" );
- });
- });
-});
-
-spaceghost.then( function(){
- this.test.comment( 'History options->' + includeDeletedOptionsLabel + ' (again) re-hides deleted datasets' );
-
- this.historyoptions.includeDeleted();
- this.withFrame( spaceghost.data.selectors.frames.history, function(){
- this.waitForSelector( nameSelector, function(){
- this.test.assertDoesntExist( '#' + testUploadInfo.hdaElement.attributes.id,
- "Deleted HDA is not in the DOM (using history options -> " + includeDeletedOptionsLabel + ")" );
- });
- });
-});
-
-// undelete the uploaded file
-spaceghost.then( function(){
- this.historyoptions.includeDeleted();
- this.withFrame( spaceghost.data.selectors.frames.history, function(){
- this.waitForSelector( nameSelector, function(){
- //TODO: to conv. fn
- this.click( '#' + testUploadInfo.hdaElement.attributes.id
- + ' ' + this.historypanel.data.selectors.history.undeleteLink );
- });
- });
-});
-
-// ------------------------------------------------------------------- hidden hdas aren't shown
-// ------------------------------------------------------------------- history options allows showing hidden hdas
-// can't test this yet w/o a way to make hdas hidden thru the ui or api
-
// ------------------------------------------------------------------- hdas can be expanded by clicking on the hda name
// broken in webkit w/ jq 1.7
-spaceghost.then( function(){
+spaceghost.historypanel.waitForHdas( function(){
this.test.comment( 'HDAs can be expanded by clicking on the name' );
var uploadedSelector = '#' + testUploadInfo.hdaElement.attributes.id;
- this.withFrame( spaceghost.data.selectors.frames.history, function(){
- this.click( uploadedSelector + ' .historyItemTitle' );
- this.wait( 1000, function(){
- this.test.assertVisible( uploadedSelector + ' ' + this.historypanel.data.selectors.hda.body,
- "Body for uploaded file is visible" );
- });
+ this.click( uploadedSelector + ' ' + this.historypanel.data.selectors.hda.title );
+ this.wait( 1000, function(){
+ this.test.assertVisible( uploadedSelector + ' ' + this.historypanel.data.selectors.hda.body,
+ "Body for uploaded file is visible" );
});
});
@@ -360,26 +267,22 @@
var uploadedSelector = '#' + testUploadInfo.hdaElement.attributes.id;
this.click( refreshButtonSelector );
- this.withFrame( spaceghost.data.selectors.frames.history, function(){
- this.waitForSelector( nameSelector, function(){
- this.test.assertVisible( uploadedSelector + ' ' + this.historypanel.data.selectors.hda.body,
- "Body for uploaded file is visible" );
- });
+ this.historypanel.waitForHdas( function(){
+ this.test.assertVisible( uploadedSelector + ' ' + this.historypanel.data.selectors.hda.body,
+ "Body for uploaded file is visible" );
});
// this will break: webkit + jq 1.7
});
// ------------------------------------------------------------------- expanded hdas collapse by clicking name again
-spaceghost.then( function(){
+spaceghost.withHistoryPanel( function(){
this.test.comment( 'Expanded hdas collapse by clicking name again' );
var uploadedSelector = '#' + testUploadInfo.hdaElement.attributes.id;
- this.withFrame( spaceghost.data.selectors.frames.history, function(){
- this.click( uploadedSelector + ' ' + this.historypanel.data.selectors.hda.title );
- this.wait( 500, function(){
- this.test.assertNotVisible( uploadedSelector + ' ' + this.historypanel.data.selectors.hda.body,
- "Body for uploaded file is not visible" );
- });
+ this.click( uploadedSelector + ' ' + this.historypanel.data.selectors.hda.title );
+ this.wait( 500, function(){
+ this.test.assertNotVisible( uploadedSelector + ' ' + this.historypanel.data.selectors.hda.body,
+ "Body for uploaded file is not visible" );
});
});
@@ -389,32 +292,9 @@
var uploadedSelector = '#' + testUploadInfo.hdaElement.attributes.id;
this.click( refreshButtonSelector );
- this.withFrame( spaceghost.data.selectors.frames.history, function(){
- this.waitForSelector( nameSelector, function(){
- this.test.assertNotVisible( uploadedSelector + ' ' + this.historypanel.data.selectors.hda.body,
- "Body for uploaded file is not visible" );
- });
- });
-});
-
-// ------------------------------------------------------------------- history options collapses all expanded hdas
-spaceghost.then( function(){
- // expand again
- this.withFrame( spaceghost.data.selectors.frames.history, function(){
- this.click( '#' + testUploadInfo.hdaElement.attributes.id + ' ' + this.historypanel.data.selectors.hda.title );
- this.wait( 500, function(){});
- });
-});
-spaceghost.then( function(){
- this.test.comment( 'History option collapses all expanded hdas' );
- var uploadedSelector = '#' + testUploadInfo.hdaElement.attributes.id;
-
- this.historyoptions.collapseExpanded();
- this.wait( 500, function(){
- this.withFrame( spaceghost.data.selectors.frames.history, function(){
- this.test.assertNotVisible( uploadedSelector + ' ' + this.historypanel.data.selectors.hda.body,
- "Body for uploaded file is not visible" );
- });
+ this.historypanel.waitForHdas( function(){
+ this.test.assertNotVisible( uploadedSelector + ' ' + this.historypanel.data.selectors.hda.body,
+ "Body for uploaded file is not visible" );
});
});
diff -r 24d068f7a44dab10f8574d15aa4063ccdb0edb22 -r 3bbbcdb044afdbd380d6cd4c0f721ab7262c5555 test/casperjs/login-tests.js
--- a/test/casperjs/login-tests.js
+++ b/test/casperjs/login-tests.js
@@ -39,6 +39,8 @@
password = spaceghost.fixtureData.testUser.password;
}
+var userEmailSelector = '//a[contains(text(),"Logged in as")]/span["id=#user-email"]';
+
// =================================================================== TESTS
// register a user (again...)
spaceghost.thenOpen( spaceghost.baseUrl, function(){
@@ -52,8 +54,7 @@
spaceghost.user.logout();
});
spaceghost.then( function(){
- this.test.assertSelectorDoesntHaveText(
- xpath( '//a[contains(text(),"Logged in as")]/span["id=#user-email"]' ), /\w/ );
+ this.test.assertSelectorDoesntHaveText( xpath( userEmailSelector ), /\w/ );
this.test.assert( spaceghost.user.loggedInAs() === '', 'loggedInAs() is empty string' );
});
@@ -63,8 +64,7 @@
spaceghost.user._submitLogin( email, password ); //No such user
});
spaceghost.thenOpen( spaceghost.baseUrl, function(){
- this.test.assertSelectorHasText(
- xpath( '//a[contains(text(),"Logged in as")]/span["id=#user-email"]' ), email );
+ this.test.assertSelectorHasText( xpath( userEmailSelector ), email );
this.test.assert( spaceghost.user.loggedInAs() === email, 'loggedInAs() matches email' );
});
diff -r 24d068f7a44dab10f8574d15aa4063ccdb0edb22 -r 3bbbcdb044afdbd380d6cd4c0f721ab7262c5555 test/casperjs/modules/api.js
--- /dev/null
+++ b/test/casperjs/modules/api.js
@@ -0,0 +1,231 @@
+// =================================================================== module object, exports
+/** Creates a new api module object.
+ * @param {SpaceGhost} spaceghost a spaceghost instance
+ * @exported
+ */
+exports.create = function createAPI( spaceghost, apikey ){
+ return new API( spaceghost );
+};
+
+/** User object constructor.
+ * @param {SpaceGhost} spaceghost a spaceghost instance
+ * @param {String} apikey apikey for use when not using session authentication
+ */
+var API = function API( spaceghost, apikey ){
+ this.spaceghost = spaceghost;
+ this.apikey = apikey;
+
+ this.encodedIdExpectedLength = 16;
+ this.jQueryLocation = '../../static/scripts/libs/jquery/jquery.js';
+
+ this.histories = new HistoriesAPI( this );
+ this.hdas = new HDAAPI( this );
+};
+exports.API = API;
+
+API.prototype.toString = function toString(){
+ return ( this.spaceghost + '.API:'
+ + (( this.apikey )?( this.apikey ):( '(session)' )) );
+};
+
+// ------------------------------------------------------------------- APIError
+APIError.prototype = new Error();
+APIError.prototype.constructor = Error;
+/** @class Thrown when Galaxy the API returns an error from a request */
+function APIError( msg ){
+ Error.apply( this, arguments );
+ this.name = "APIError";
+ this.message = msg;
+}
+exports.APIError = APIError;
+
+/* ------------------------------------------------------------------- TODO:
+ can we component-ize this to become the basis for js-based api binding/resource
+
+*/
+// =================================================================== INTERNAL
+var utils = require( 'utils' );
+
+API.prototype._ajax = function _ajax( url, options ){
+ options = options || {};
+ options.async = false;
+
+ this.ensureJQuery( '../../static/scripts/libs/jquery/jquery.js' );
+ var resp = this.spaceghost.evaluate( function( url, options ){
+ return jQuery.ajax( url, options );
+ }, url, options );
+ //this.spaceghost.debug( 'resp: ' + this.spaceghost.jsonStr( resp ) );
+
+ if( resp.status !== 200 ){
+ // grrr... this doesn't lose the \n\r\t
+ throw new APIError( resp.responseText.replace( /[\s\n\r\t]+/gm, ' ' ).replace( /"/, '' ) );
+ }
+ return JSON.parse( resp.responseText );
+};
+
+// =================================================================== MISC
+API.prototype.isEncodedId = function isEncodedId( id ){
+ if( typeof id !== 'string' ){ return false; }
+ if( id.match( /[g-zG-Z]/ ) ){ return false; }
+ return ( id.length === this.encodedIdExpectedLength );
+};
+
+// ------------------------------------------------------------------- is type or throw err
+API.prototype.ensureId = function ensureId( id ){
+ if( !this.isEncodedId( id ) ){
+ throw new APIError( 'ID is not a valid encoded id: ' + id );
+ }
+ return id;
+};
+
+API.prototype.ensureObject = function ensureObject( obj ){
+ if( !utils.isObject( obj ) ){
+ throw new APIError( 'Not a valid object: ' + obj );
+ }
+ return obj;
+};
+
+// ------------------------------------------------------------------- jquery
+// using jq for the ajax in this module - that's why these are here
+//TODO:?? could go in spaceghost
+API.prototype.hasJQuery = function hasJQuery(){
+ return this.spaceghost.evaluate( function pageHasJQuery(){
+ var has = false;
+ try {
+ has = typeof ( jQuery + '' ) === 'string';
+ } catch( err ){}
+ return has;
+ });
+};
+
+API.prototype.ensureJQuery = function ensureJQuery(){
+ if( !this.hasJQuery() ){
+ var absLoc = this.spaceghost.options.scriptDir + this.jQueryLocation,
+ injected = this.spaceghost.page.injectJs( absLoc );
+ if( !injected ){
+ throw new APIError( 'Could not inject jQuery' );
+ }
+ }
+};
+
+
+// =================================================================== HISTORIES
+var HistoriesAPI = function HistoriesAPI( api ){
+ this.api = api;
+};
+HistoriesAPI.prototype.toString = function toString(){
+ return this.api + '.HistoriesAPI';
+};
+
+// -------------------------------------------------------------------
+HistoriesAPI.prototype.urlTpls = {
+ index : 'api/histories',
+ show : 'api/histories/%s',
+ create : 'api/histories',
+ delete_ : 'api/histories/%s',
+ undelete: 'api/histories/deleted/%s/undelete'
+};
+
+HistoriesAPI.prototype.index = function index( deleted ){
+ this.api.spaceghost.info( 'history.index: ' + (( deleted )?( 'w deleted' ):( '(wo deleted)' )) );
+
+ deleted = deleted || false;
+ return this.api._ajax( this.urlTpls.index, {
+ data : { deleted: deleted }
+ });
+};
+
+HistoriesAPI.prototype.show = function show( id, deleted ){
+ this.api.spaceghost.info( 'history.show: ' + [ id, (( deleted )?( 'w deleted' ):( '' )) ] );
+
+ id = ( id === 'most_recently_used' )?( id ):( this.api.ensureId( id ) );
+ deleted = deleted || false;
+ return this.api._ajax( utils.format( this.urlTpls.show, id ), {
+ data : { deleted: deleted }
+ });
+};
+
+HistoriesAPI.prototype.create = function create( payload ){
+ this.api.spaceghost.info( 'history.create: ' + this.api.spaceghost.jsonStr( payload ) );
+
+ // py.payload <-> ajax.data
+ payload = this.api.ensureObject( payload );
+ return this.api._ajax( utils.format( this.urlTpls.create ), {
+ type : 'POST',
+ data : payload
+ });
+};
+
+HistoriesAPI.prototype.delete_ = function delete_( id, purge ){
+ this.api.spaceghost.info( 'history.delete: ' + [ id, (( purge )?( '(purge!)' ):( '' )) ] );
+
+ // py.payload <-> ajax.data
+ var payload = ( purge )?({ purge: true }):({});
+ return this.api._ajax( utils.format( this.urlTpls.delete_, this.api.ensureId( id ) ), {
+ type : 'DELETE',
+ data : payload
+ });
+};
+
+HistoriesAPI.prototype.undelete = function undelete( id ){
+ //throw ( 'unimplemented' );
+ this.api.spaceghost.info( 'history.undelete: ' + id );
+
+ return this.api._ajax( utils.format( this.urlTpls.undelete, this.api.ensureId( id ) ), {
+ type : 'POST'
+ });
+};
+
+
+// =================================================================== HDAS
+var HDAAPI = function HDAAPI( api ){
+ this.api = api;
+};
+HDAAPI.prototype.toString = function toString(){
+ return this.api + '.HDAAPI';
+};
+
+// -------------------------------------------------------------------
+HDAAPI.prototype.urlTpls = {
+ index : 'api/histories/%s/contents',
+ show : 'api/histories/%s/contents/%s',
+ create : 'api/histories/%s/contents'//,
+ // not implemented
+ //delete_ : 'api/histories/%s',
+ //undelete: 'api/histories/deleted/%s/undelete'
+};
+
+HDAAPI.prototype.index = function index( historyId, ids ){
+ this.api.spaceghost.info( 'history.index: ' + [ historyId, ids ] );
+ var data = {};
+ if( ids ){
+ ids = ( utils.isArray( ids ) )?( ids.join( ',' ) ):( ids );
+ data.ids = ids;
+ }
+
+ return this.api._ajax( utils.format( this.urlTpls.index, this.api.ensureId( historyId ) ), {
+ data : data
+ });
+};
+
+HDAAPI.prototype.show = function show( historyId, id, deleted ){
+ this.api.spaceghost.info( 'history.show: ' + [ id, (( deleted )?( 'w deleted' ):( '' )) ] );
+
+ id = ( id === 'most_recently_used' )?( id ):( this.api.ensureId( id ) );
+ deleted = deleted || false;
+ return this.api._ajax( utils.format( this.urlTpls.show, id ), {
+ data : { deleted: deleted }
+ });
+};
+
+HDAAPI.prototype.create = function create( historyId, payload ){
+ this.api.spaceghost.info( 'history.create: ' + this.api.spaceghost.jsonStr( payload ) );
+
+ // py.payload <-> ajax.data
+ payload = this.api.ensureObject( payload );
+ return this.api._ajax( utils.format( this.urlTpls.create ), {
+ type : 'POST',
+ data : payload
+ });
+};
+
This diff is so big that we needed to truncate the remainder.
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: dannon: Fix broken tool_dependency_util -- was missing galaxy's 'util' import as well as 'shutil'.
by commits-noreply@bitbucket.org 21 Mar '13
by commits-noreply@bitbucket.org 21 Mar '13
21 Mar '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/24d068f7a44d/
Changeset: 24d068f7a44d
Branch: next-stable
User: dannon
Date: 2013-03-21 18:45:12
Summary: Fix broken tool_dependency_util -- was missing galaxy's 'util' import as well as 'shutil'.
Affected #: 1 file
diff -r 0cd8201b4b4848002adbdbcac647d76f112db4d8 -r 24d068f7a44dab10f8574d15aa4063ccdb0edb22 lib/tool_shed/util/tool_dependency_util.py
--- a/lib/tool_shed/util/tool_dependency_util.py
+++ b/lib/tool_shed/util/tool_dependency_util.py
@@ -1,13 +1,15 @@
-import os, logging
+import logging
+import os
+import shutil
+
+from galaxy import eggs
+eggs.require( 'elementtree' )
+from elementtree import ElementTree, ElementInclude
+
from galaxy.model.orm import and_
import tool_shed.util.shed_util_common as suc
-from galaxy import eggs
-import pkg_resources
-
-pkg_resources.require( 'elementtree' )
-from elementtree import ElementTree, ElementInclude
-from elementtree.ElementTree import Element, SubElement
+from galaxy import util
log = logging.getLogger( __name__ )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/0cd8201b4b48/
changeset: 0cd8201b4b48
branch: next-stable
user: carlfeberhard
date: 2013-03-21 18:55:36
summary: history, view: fix show_deleted/hide_deleted
affected #: 1 file
diff -r 55a425f1f2f363f6e9fe94ab539bb58daeb8d136 -r 0cd8201b4b4848002adbdbcac647d76f112db4d8 templates/webapps/galaxy/history/view.mako
--- a/templates/webapps/galaxy/history/view.mako
+++ b/templates/webapps/galaxy/history/view.mako
@@ -98,9 +98,9 @@
<a href="${get_history_link( history )}">${_('refresh')}</a> |
%endif
%if show_deleted:
- <a href="${h.url_for(controller='history', id=trans.security.encode_id(history.id), show_deleted=False, use_panels=use_panels )}">${_('hide deleted')}</a> |
+ <a href="${h.url_for(controller='history', action='view', id=trans.security.encode_id(history.id), show_deleted=False, use_panels=use_panels )}">${_('hide deleted')}</a> |
%else:
- <a href="${h.url_for(controller='history', id=trans.security.encode_id(history.id), show_deleted=True, use_panels=use_panels )}">${_('show deleted')}</a> |
+ <a href="${h.url_for(controller='history', action='view', id=trans.security.encode_id(history.id), show_deleted=True, use_panels=use_panels )}">${_('show deleted')}</a> |
%endif
<a href="#" class="toggle">collapse all</a></div>
https://bitbucket.org/galaxy/galaxy-central/commits/b79e2393c8ad/
changeset: b79e2393c8ad
user: carlfeberhard
date: 2013-03-21 18:56:18
summary: merge stable
affected #: 1 file
diff -r 903c3458a6783a878d5e31c6574cec550711e88a -r b79e2393c8ad8c88bda682e0767f572c0c09e26a templates/webapps/galaxy/history/view.mako
--- a/templates/webapps/galaxy/history/view.mako
+++ b/templates/webapps/galaxy/history/view.mako
@@ -98,9 +98,9 @@
<a href="${get_history_link( history )}">${_('refresh')}</a> |
%endif
%if show_deleted:
- <a href="${h.url_for(controller='history', id=trans.security.encode_id(history.id), show_deleted=False, use_panels=use_panels )}">${_('hide deleted')}</a> |
+ <a href="${h.url_for(controller='history', action='view', id=trans.security.encode_id(history.id), show_deleted=False, use_panels=use_panels )}">${_('hide deleted')}</a> |
%else:
- <a href="${h.url_for(controller='history', id=trans.security.encode_id(history.id), show_deleted=True, use_panels=use_panels )}">${_('show deleted')}</a> |
+ <a href="${h.url_for(controller='history', action='view', id=trans.security.encode_id(history.id), show_deleted=True, use_panels=use_panels )}">${_('show deleted')}</a> |
%endif
<a href="#" class="toggle">collapse all</a></div>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0