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
January 2014
- 1 participants
- 280 discussions
commit/galaxy-central: dan: Add a space between keywords.
by commits-noreply@bitbucket.org 21 Jan '14
by commits-noreply@bitbucket.org 21 Jan '14
21 Jan '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/df67fd5a8cfc/
Changeset: df67fd5a8cfc
User: dan
Date: 2014-01-21 18:06:15
Summary: Add a space between keywords.
Affected #: 1 file
diff -r f81f3667dfd843da3dcbe20f0e25188721e14168 -r df67fd5a8cfc10d269da1ef4b28a184be914badd lib/galaxy/web/framework/__init__.py
--- a/lib/galaxy/web/framework/__init__.py
+++ b/lib/galaxy/web/framework/__init__.py
@@ -812,7 +812,7 @@
host = None
if host in UCSC_SERVERS:
return
- external_display_path = url_for( controller='',action='display_application' )
+ external_display_path = url_for( controller='', action='display_application' )
if self.request.path.startswith( external_display_path ):
request_path_split = self.request.path.split( '/' )
try:
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/9435e231590a/
Changeset: 9435e231590a
Branch: external_display_application
User: BjoernGruening
Date: 2014-01-21 17:28:35
Summary: fix display_application with login_required=True
Affected #: 1 file
diff -r f04a1c3c060ed6bd4febfdd9e86ed3cc74cb810e -r 9435e231590ae159dd06bd309cb2e2ca2142bcff lib/galaxy/web/framework/__init__.py
--- a/lib/galaxy/web/framework/__init__.py
+++ b/lib/galaxy/web/framework/__init__.py
@@ -812,11 +812,13 @@
host = None
if host in UCSC_SERVERS:
return
- external_display_path = url_for( controller='dataset', action='display_application' )
+ external_display_path = url_for( controller='',action='display_application' )
if self.request.path.startswith( external_display_path ):
- request_path_split = external_display_path.split( '/' )
+ request_path_split = self.request.path.split( '/' )
try:
- if self.app.datatypes_registry.display_applications.get( request_path_split[-5] ) and request_path_split[-4] in self.app.datatypes_registry.display_applications.get( request_path_split[-5] ).links and request_path_split[-3] != 'None':
+ if self.app.datatypes_registry.display_applications.get( request_path_split[-5] ) and \
+ request_path_split[-4] in self.app.datatypes_registry.display_applications.get( request_path_split[-5] ).links and \
+ request_path_split[-3] != 'None':
return
except IndexError:
pass
https://bitbucket.org/galaxy/galaxy-central/commits/f81f3667dfd8/
Changeset: f81f3667dfd8
User: dan
Date: 2014-01-21 17:54:24
Summary: Merged in BjoernGruening/galaxy-central-bgruening/external_display_application (pull request #303)
fix display_application with login_required=True
Affected #: 1 file
diff -r 85a5461ef02d692b4893c16a2a878fa844ebd697 -r f81f3667dfd843da3dcbe20f0e25188721e14168 lib/galaxy/web/framework/__init__.py
--- a/lib/galaxy/web/framework/__init__.py
+++ b/lib/galaxy/web/framework/__init__.py
@@ -812,11 +812,13 @@
host = None
if host in UCSC_SERVERS:
return
- external_display_path = url_for( controller='dataset', action='display_application' )
+ external_display_path = url_for( controller='',action='display_application' )
if self.request.path.startswith( external_display_path ):
- request_path_split = external_display_path.split( '/' )
+ request_path_split = self.request.path.split( '/' )
try:
- if self.app.datatypes_registry.display_applications.get( request_path_split[-5] ) and request_path_split[-4] in self.app.datatypes_registry.display_applications.get( request_path_split[-5] ).links and request_path_split[-3] != 'None':
+ if self.app.datatypes_registry.display_applications.get( request_path_split[-5] ) and \
+ request_path_split[-4] in self.app.datatypes_registry.display_applications.get( request_path_split[-5] ).links and \
+ request_path_split[-3] != 'None':
return
except IndexError:
pass
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: Fixes and code cleanup for the tool shed's install and test framework.
by commits-noreply@bitbucket.org 21 Jan '14
by commits-noreply@bitbucket.org 21 Jan '14
21 Jan '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/85a5461ef02d/
Changeset: 85a5461ef02d
User: greg
Date: 2014-01-21 16:49:11
Summary: Fixes and code cleanup for the tool shed's install and test framework.
Affected #: 3 files
diff -r 3133b1ad1afc97875f0764f87a60552a2ac6df72 -r 85a5461ef02d692b4893c16a2a878fa844ebd697 test/install_and_test_tool_shed_repositories/base/util.py
--- a/test/install_and_test_tool_shed_repositories/base/util.py
+++ b/test/install_and_test_tool_shed_repositories/base/util.py
@@ -234,40 +234,42 @@
# Group summary display by repository owner.
repository_dicts_by_owner = {}
for repository_dict in repository_dicts:
- name = str( repository_dict[ 'name' ] )
- owner = str( repository_dict[ 'owner' ] )
- changeset_revision = str( repository_dict[ 'changeset_revision' ] )
- if owner in repository_dicts_by_owner:
- repository_dicts_by_owner[ owner ].append( repository_dict )
- else:
- repository_dicts_by_owner[ owner ] = [ repository_dict ]
+ name = str( repository_dict.get( 'name', '' ) )
+ owner = str( repository_dict.get('owner', '' ) )
+ changeset_revision = str( repository_dict.get( 'changeset_revision', '' ) )
+ if owner:
+ if owner in repository_dicts_by_owner:
+ repository_dicts_by_owner[ owner ].append( repository_dict )
+ else:
+ repository_dicts_by_owner[ owner ] = [ repository_dict ]
# Display grouped summary.
for owner, grouped_repository_dicts in repository_dicts_by_owner.items():
print "# "
for repository_dict in grouped_repository_dicts:
- name = str( repository_dict[ 'name' ] )
- owner = str( repository_dict[ 'owner' ] )
- changeset_revision = str( repository_dict[ 'changeset_revision' ] )
+ name = str( repository_dict.get( 'name', '' ) )
+ owner = str( repository_dict.get( 'owner', '' ) )
+ changeset_revision = str( repository_dict.get( 'changeset_revision', '' ) )
print "# Revision %s of repository %s owned by %s" % ( changeset_revision, name, owner )
def display_tool_dependencies_by_name( tool_dependency_dicts ):
# Group summary display by repository owner.
tool_dependency_dicts_by_name = {}
for tool_dependency_dict in tool_dependency_dicts:
- name = str( tool_dependency_dict[ 'name' ] )
- type = str( tool_dependency_dict[ 'type' ] )
- version = str( tool_dependency_dict[ 'version' ] )
- if name in tool_dependency_dicts_by_name:
- tool_dependency_dicts_by_name[ name ].append( tool_dependency_dict )
- else:
- tool_dependency_dicts_by_name[ name ] = [ tool_dependency_dict ]
+ name = str( tool_dependency_dict.get( 'name', '' ) )
+ type = str( tool_dependency_dict.get( 'type', '' ) )
+ version = str( tool_dependency_dict.get( 'version', '' ) )
+ if name:
+ if name in tool_dependency_dicts_by_name:
+ tool_dependency_dicts_by_name[ name ].append( tool_dependency_dict )
+ else:
+ tool_dependency_dicts_by_name[ name ] = [ tool_dependency_dict ]
# Display grouped summary.
for name, grouped_tool_dependency_dicts in tool_dependency_dicts_by_name.items():
print "# "
for tool_dependency_dict in grouped_tool_dependency_dicts:
- type = str( tool_dependency_dict[ 'type' ] )
- name = str( tool_dependency_dict[ 'name' ] )
- version = str( tool_dependency_dict[ 'version' ] )
+ type = str( tool_dependency_dict.get( 'type', '' ) )
+ name = str( tool_dependency_dict.get( 'name', '' ) )
+ version = str( tool_dependency_dict.get( 'version', '' ) )
print "# %s %s version %s" % ( type, name, version )
def get_database_version( app ):
@@ -292,15 +294,15 @@
Return the entire list of missing repository dependencies for the received repository. The entire
dependency tree will be inspected.
"""
- log.debug( 'Checking revision %s of repository %s owned by %s for missing repository dependencies.' % \
- ( str( repository.changeset_revision ), str( repository.name ), str( repository.owner ) ) )
+ print 'Checking revision %s of repository %s owned by %s for missing repository dependencies.' % \
+ ( repository.changeset_revision, repository.name, repository.owner )
missing_repository_dependencies = repository.missing_repository_dependencies
for missing_required_repository in missing_repository_dependencies:
- log.debug( 'Revision %s of required repository %s owned by %s has status %s.' % \
- ( str( missing_required_repository.changeset_revision ),
- str( missing_required_repository.name ),
- str( missing_required_repository.owner ),
- str( missing_required_repository.status ) ) )
+ print 'Revision %s of required repository %s owned by %s has status %s.' % \
+ ( missing_required_repository.changeset_revision,
+ missing_required_repository.name,
+ missing_required_repository.owner,
+ missing_required_repository.status )
for repository_dependency in repository.repository_dependencies:
if repository_dependency.missing_repository_dependencies:
missing_repository_dependencies.extend( get_missing_repository_dependencies( repository_dependency ) )
@@ -311,12 +313,12 @@
Return the entire list of missing tool dependencies for the received repository. The entire
dependency tree will be inspected.
"""
- log.debug( 'Checking revision %s of repository %s owned by %s for missing tool dependencies.' % \
- ( str( repository.changeset_revision ), str( repository.name ), str( repository.owner ) ) )
+ print 'Checking revision %s of repository %s owned by %s for missing tool dependencies.' % \
+ ( repository.changeset_revision, repository.name, repository.owner )
missing_tool_dependencies = repository.missing_tool_dependencies
for missing_tool_dependency in missing_tool_dependencies:
- log.debug( 'Tool dependency %s version %s has status %s.' % \
- ( str( missing_tool_dependency.name ), str( missing_tool_dependency.version ), str( missing_tool_dependency.status ) ) )
+ print 'Tool dependency %s version %s has status %s.' % \
+ ( missing_tool_dependency.name, missing_tool_dependency.version, missing_tool_dependency.status )
for repository_dependency in repository.repository_dependencies:
if repository_dependency.includes_tool_dependencies:
missing_tool_dependencies.extend( get_missing_tool_dependencies( repository_dependency ) )
@@ -334,7 +336,7 @@
error_message = ''
latest_revision_only = '-check_all_revisions' not in sys.argv
if latest_revision_only:
- log.debug( 'Testing is restricted to the latest downloadable revision in this test run.' )
+ print 'Testing is restricted to the latest downloadable revision in this test run.'
repository_dicts = []
parts = [ 'repository_revisions' ]
# We'll filter out deprecated repositories from testing since testing them is necessary only if reproducibility
@@ -360,32 +362,35 @@
# module that will generate the install methods.
repository_dict, error_message = get_repository_dict( galaxy_tool_shed_url, baseline_repository_dict )
if error_message:
- log.debug( 'Error getting additional details from the API: %s' % str( error_message ) )
+ print 'Error getting additional details from the API: %s' % error_message
else:
- changeset_revision = baseline_repository_dict[ 'changeset_revision' ]
- # We have to test deprecated repositories since other repositories can define them as dependencies, but
- # don't test empty repositories.
- if changeset_revision != suc.INITIAL_CHANGELOG_HASH:
- # If testing repositories of type tool_dependency_definition, filter accordingly.
- if test_framework == TOOL_DEPENDENCY_DEFINITIONS and repository_dict[ 'type' ] != rt_util.TOOL_DEPENDENCY_DEFINITION:
- continue
- # Merge the dictionary returned from /api/repository_revisions with the detailed repository_dict and
- # append it to the list of repository_dicts to install and test.
- if latest_revision_only:
- latest_revision = repository_dict[ 'latest_revision' ]
- if changeset_revision == latest_revision:
+ deprecated = asbool( repository_dict.get( 'deprecated', False ) )
+ # Filter deprecated repositories in the initial query. Repositories included in the query may have
+ # repository dependencies that are deprecated though.
+ if not deprecated:
+ changeset_revision = baseline_repository_dict.get( 'changeset_revision', suc.INITIAL_CHANGELOG_HASH )
+ if changeset_revision != suc.INITIAL_CHANGELOG_HASH:
+ # If testing repositories of type tool_dependency_definition, filter accordingly.
+ if test_framework == TOOL_DEPENDENCY_DEFINITIONS and \
+ repository_dict.get( 'type', None ) != rt_util.TOOL_DEPENDENCY_DEFINITION:
+ continue
+ # Merge the dictionary returned from /api/repository_revisions with the detailed repository_dict and
+ # append it to the list of repository_dicts to install and test.
+ if latest_revision_only:
+ latest_revision = repository_dict.get( 'latest_revision', None )
+ if changeset_revision == latest_revision:
+ repository_dicts.append( dict( repository_dict.items() + baseline_repository_dict.items() ) )
+ else:
repository_dicts.append( dict( repository_dict.items() + baseline_repository_dict.items() ) )
- else:
- repository_dicts.append( dict( repository_dict.items() + baseline_repository_dict.items() ) )
if testing_single_repository_dict:
- tsr_name = testing_single_repository_dict[ 'name' ]
- tsr_owner = testing_single_repository_dict[ 'owner' ]
- tsr_changeset_revision = testing_single_repository_dict[ 'changeset_revision' ]
- log.debug( 'Testing single repository with name %s and owner %s.' % ( str( tsr_name ), str( tsr_owner ) ) )
+ tsr_name = testing_single_repository_dict.get( 'name', None )
+ tsr_owner = testing_single_repository_dict.get( 'owner', None )
+ tsr_changeset_revision = testing_single_repository_dict.get( 'changeset_revision', None )
+ print 'Testing single repository with name %s and owner %s.' % ( tsr_name, tsr_owner )
for repository_to_install in repository_dicts:
- rti_name = repository_to_install[ 'name' ]
- rti_owner = repository_to_install[ 'owner' ]
- rti_changeset_revision = repository_to_install[ 'changeset_revision' ]
+ rti_name = repository_to_install.get( 'name', None )
+ rti_owner = repository_to_install.get( 'owner', None )
+ rti_changeset_revision = repository_to_install.get( 'changeset_revision', None )
if rti_name == tsr_name and rti_owner == tsr_owner:
if tsr_changeset_revision is None:
return [ repository_to_install ], error_message
@@ -395,17 +400,17 @@
return repository_dicts, error_message
# Get a list of repositories to test from the tool shed specified in the GALAXY_INSTALL_TEST_TOOL_SHED_URL
# environment variable.
- log.debug( "The Tool Shed's API url...\n%s" % str( api_url ) )
- log.debug( "...retrieved %d repository revisions for installation and possible testing." % len( repository_dicts ) )
- log.debug( "Repository revisions for testing:" )
+ print "The Tool Shed's API url...\n%s" % api_url
+ print "...retrieved %d repository revisions for installation and possible testing." % len( repository_dicts )
+ print "Repository revisions for testing:"
for repository_dict in repository_dicts:
repository_id = str( repository_dict.get( 'repository_id', None ) )
repository_metadata_id = str( repository_dict.get( 'id', None ) )
name = str( repository_dict.get( 'name', None ) )
owner = str( repository_dict.get( 'owner', None ) )
changeset_revision = str( repository_dict.get( 'changeset_revision', None ) )
- log.debug( "Revision %s of repository %s owned by %s with repository_id %s, (repository_metadata) id %s" % \
- ( changeset_revision, name, owner, repository_id, repository_metadata_id ) )
+ print "Revision %s of repository %s owned by %s with repository_id %s, (repository_metadata) id %s" % \
+ ( changeset_revision, name, owner, repository_id, repository_metadata_id )
return repository_dicts, error_message
def get_repository( name, owner, changeset_revision ):
@@ -549,9 +554,8 @@
install_and_test_statistics_dict[ 'successful_tool_dependency_installations' ] = []
install_and_test_statistics_dict[ 'repositories_with_installation_error' ] = []
install_and_test_statistics_dict[ 'tool_dependencies_with_installation_error' ] = []
- if test_framework == REPOSITORIES_WITH_TOOLS:
- install_and_test_statistics_dict[ 'all_tests_passed' ] = []
- install_and_test_statistics_dict[ 'at_least_one_test_failed' ] = []
+ install_and_test_statistics_dict[ 'all_tests_passed' ] = []
+ install_and_test_statistics_dict[ 'at_least_one_test_failed' ] = []
return install_and_test_statistics_dict
def initialize_tool_tests_results_dict( app, tool_test_results_dict ):
@@ -589,12 +593,12 @@
def install_repository( app, repository_dict ):
"""Install a repository defined by the received repository_dict from the tool shed into Galaxy."""
- name = str( repository_dict[ 'name' ] )
- owner = str( repository_dict[ 'owner' ] )
- changeset_revision = str( repository_dict[ 'changeset_revision' ] )
+ name = str( repository_dict.get( 'name', None ) )
+ owner = str( repository_dict.get( 'owner', None ) )
+ changeset_revision = str( repository_dict.get( 'changeset_revision', None ) )
error_message = ''
repository = None
- log.debug( "Installing revision %s of repository %s owned by %s." % ( changeset_revision, name, owner ) )
+ print "Installing revision %s of repository %s owned by %s." % ( changeset_revision, name, owner )
# Use the repository information dictionary to generate an install method that will install the repository into the
# embedded Galaxy application, with tool dependencies and repository dependencies, if any.
test_install_repositories.generate_install_method( repository_dict )
@@ -617,34 +621,33 @@
be excluded from testing for any reason.
"""
for exclude_dict in exclude_list_dicts:
- reason = exclude_dict[ 'reason' ]
- exclude_repositories = exclude_dict[ 'repositories' ]
+ reason = exclude_dict.get( 'reason', '' )
+ exclude_repositories = exclude_dict.get( 'repositories', None )
# 'repositories':
# [( name, owner, changeset_revision if changeset_revision else None ),
# ( name, owner, changeset_revision if changeset_revision else None )]
if ( name, owner, changeset_revision ) in exclude_repositories or ( name, owner, None ) in exclude_repositories:
- log.debug( 'Revision %s of repository %s owned by %s is excluded from testing because:\n%s' % \
- ( str( changeset_revision ), str( name ), str( owner ), str( reason ) ) )
+ print 'Revision %s of repository %s owned by %s is excluded from testing because:\n%s' % \
+ ( changeset_revision, name, owner, reason )
return True, reason
# Skip this repository if it has a repository dependency that is in the exclude list.
repository_dependency_dicts, error_message = \
get_repository_dependencies_dicts( galaxy_tool_shed_url, encoded_repository_metadata_id )
if error_message:
- log.debug( 'Error getting repository dependencies for revision %s of repository %s owned by %s:' % \
- ( changeset_revision, name, owner ) )
- log.debug( error_message )
+ print 'Error getting repository dependencies for revision %s of repository %s owned by %s:' % \
+ ( changeset_revision, name, owner )
+ print error_message
else:
for repository_dependency_dict in repository_dependency_dicts:
- rd_name = repository_dependency_dict[ 'name' ]
- rd_owner = repository_dependency_dict[ 'owner' ]
- rd_changeset_revision = repository_dependency_dict[ 'changeset_revision' ]
+ rd_name = repository_dependency_dict.get( 'name', '' )
+ rd_owner = repository_dependency_dict.get( 'owner', '' )
+ rd_changeset_revision = repository_dependency_dict.get( 'changeset_revision', '' )
if ( rd_name, rd_owner, rd_changeset_revision ) in exclude_repositories or \
( rd_name, rd_owner, None ) in exclude_repositories:
- log_msg = 'Revision %s of repository %s owned by %s is excluded from testing because ' % \
- ( str( changeset_revision ), str( name ), str( owner ), str( reason ) )
- log_msg += 'it requires revision %s of repository %s owned by %s (which is excluded from testing).' % \
+ print 'Revision %s of repository %s owned by %s is excluded from testing because ' % \
+ ( changeset_revision, name, owner, reason )
+ print 'it requires revision %s of repository %s owned by %s (which is excluded from testing).' % \
( rd_changeset_revision, rd_name, rd_owner )
- log.debug( log_msg )
reason = 'This repository requires revision %s of repository %s owned by %s which is excluded from testing.' % \
( rd_changeset_revision, rd_name, rd_owner )
return True, reason
@@ -690,8 +693,7 @@
exclude_tups = []
xml_tree, error_message = parse_xml( xml_filename )
if error_message:
- log.debug( 'The exclude file %s is invalid, so no repositories will be excluded from testing: %s' % \
- ( str( xml_filename ), str( error_message ) ) )
+ print 'The exclude file %s is invalid, so no repositories will be excluded from testing: %s' % ( xml_filename, error_message )
return exclude_list
tool_sheds = xml_tree.findall( 'repositories' )
xml_element = []
@@ -717,15 +719,14 @@
exclude_dict[ 'repositories' ].append( repository_tuple )
exclude_list.append( exclude_dict )
if exclude_tups:
- log.debug( 'The exclude file %s defines the following %d repositories to be excluded from testing:' % \
- ( str( xml_filename ), exclude_count ) )
+ print 'The exclude file %s defines the following %d repositories to be excluded from testing:' % ( xml_filename, exclude_count )
for name, owner, changeset_revision in exclude_tups:
if changeset_revision:
- log.debug( 'Revision %s of repository %s owned by %s.' % ( str( changeset_revision ), str( name ), str( owner ) ) )
+ print 'Revision %s of repository %s owned by %s.' % ( changeset_revision, name, owner )
else:
- log.debug( 'All revisions of repository %s owned by %s.' % ( str( name ), str( owner ) ) )
+ print 'All revisions of repository %s owned by %s.' % ( name, owner )
else:
- log.debug( 'The exclude file %s defines no repositories to be excluded from testing.' % str( xml_filename ) )
+ print 'The exclude file %s defines no repositories to be excluded from testing.' % xml_filename
return exclude_list
def populate_dependency_install_containers( app, repository, repository_identifier_dict, install_and_test_statistics_dict,
@@ -743,8 +744,8 @@
params = dict( test_install_error=False,
do_not_test=False )
if repository.missing_repository_dependencies:
- log.debug( 'The following repository dependencies for revision %s of repository %s owned by %s have installation errors:' % \
- ( repository_changeset_revision, repository_name, repository_owner ) )
+ print 'The following repository dependencies for revision %s of repository %s owned by %s have installation errors:' % \
+ ( repository_changeset_revision, repository_name, repository_owner )
params[ 'test_install_error' ] = True
# Keep statistics for this repository's repository dependencies that resulted in installation errors.
for missing_repository_dependency in repository.missing_repository_dependencies:
@@ -753,7 +754,7 @@
owner = str( missing_repository_dependency.owner )
changeset_revision = str( missing_repository_dependency.changeset_revision )
error_message = unicodify( missing_repository_dependency.error_message )
- log.debug( 'Revision %s of repository %s owned by %s:\n%s' % ( changeset_revision, name, owner, error_message ) )
+ print 'Revision %s of repository %s owned by %s:\n%s' % ( changeset_revision, name, owner, error_message )
missing_repository_dependency_info_dict = dict( tool_shed=tool_shed,
name=name,
owner=owner,
@@ -762,8 +763,8 @@
install_and_test_statistics_dict[ 'repositories_with_installation_error' ].append( missing_repository_dependency_info_dict )
tool_test_results_dict[ 'installation_errors' ][ 'repository_dependencies' ].append( missing_repository_dependency_info_dict )
if repository.missing_tool_dependencies:
- log.debug( 'The following tool dependencies for revision %s of repository %s owned by %s have installation errors:' % \
- ( repository_changeset_revision, repository_name, repository_owner ) )
+ print 'The following tool dependencies for revision %s of repository %s owned by %s have installation errors:' % \
+ ( repository_changeset_revision, repository_name, repository_owner )
params[ 'test_install_error' ] = True
# Keep statistics for this repository's tool dependencies that resulted in installation errors.
for missing_tool_dependency in repository.missing_tool_dependencies:
@@ -771,7 +772,7 @@
type = str( missing_tool_dependency.type )
version = str( missing_tool_dependency.version )
error_message = unicodify( missing_tool_dependency.error_message )
- log.debug( 'Version %s of tool dependency %s %s:\n%s' % ( version, type, name, error_message ) )
+ print 'Version %s of tool dependency %s %s:\n%s' % ( version, type, name, error_message )
missing_tool_dependency_info_dict = dict( type=type,
name=name,
version=version,
@@ -779,15 +780,15 @@
install_and_test_statistics_dict[ 'tool_dependencies_with_installation_error' ].append( missing_tool_dependency_info_dict )
tool_test_results_dict[ 'installation_errors' ][ 'tool_dependencies' ].append( missing_tool_dependency_info_dict )
if repository.installed_repository_dependencies:
- log.debug( 'The following repository dependencies for revision %s of repository %s owned by %s are installed:' % \
- ( repository_changeset_revision, repository_name, repository_owner ) )
+ print 'The following repository dependencies for revision %s of repository %s owned by %s are installed:' % \
+ ( repository_changeset_revision, repository_name, repository_owner )
# Keep statistics for this repository's tool dependencies that resulted in successful installations.
for repository_dependency in repository.installed_repository_dependencies:
tool_shed = str( repository_dependency.tool_shed )
name = str( repository_dependency.name )
owner = str( repository_dependency.owner )
changeset_revision = str( repository_dependency.changeset_revision )
- log.debug( 'Revision %s of repository %s owned by %s.' % ( changeset_revision, name, owner ) )
+ print 'Revision %s of repository %s owned by %s.' % ( changeset_revision, name, owner )
repository_dependency_info_dict = dict( tool_shed=tool_shed,
name=name,
owner=owner,
@@ -795,15 +796,15 @@
install_and_test_statistics_dict[ 'successful_repository_installations' ].append( repository_dependency_info_dict )
tool_test_results_dict[ 'successful_installations' ][ 'repository_dependencies' ].append( repository_dependency_info_dict )
if repository.installed_tool_dependencies:
- log.debug( 'The following tool dependencies for revision %s of repository %s owned by %s are installed:' % \
- ( repository_changeset_revision, repository_name, repository_owner ) )
+ print 'The following tool dependencies for revision %s of repository %s owned by %s are installed:' % \
+ ( repository_changeset_revision, repository_name, repository_owner )
# Keep statistics for this repository's tool dependencies that resulted in successful installations.
for tool_dependency in repository.installed_tool_dependencies:
name = str( tool_dependency.name )
type = str( tool_dependency.type )
version = str( tool_dependency.version )
installation_directory = tool_dependency.installation_directory( app )
- log.debug( 'Version %s of tool dependency %s %s is installed in: %s' % ( version, type, name, installation_directory ) )
+ print 'Version %s of tool dependency %s %s is installed in: %s' % ( version, type, name, installation_directory )
tool_dependency_info_dict = dict( type=type,
name=name,
version=version,
@@ -827,35 +828,35 @@
repository_changeset_revision = str( repository.changeset_revision )
repository_dependencies_dicts, error_message = get_repository_dependencies_dicts( galaxy_tool_shed_url, repository_metadata_id )
if error_message:
- log.debug( 'Cannot check or populate repository dependency install containers for version %s of repository %s owned by %s ' % \
- ( repository_changeset_revision, repository_name, repository_owner ) )
- log.debug( 'due to the following error getting repository_dependencies_dicts:\n%s' % str( error_message ) )
+ print 'Cannot check or populate repository dependency install containers for version %s of repository %s owned by %s ' % \
+ ( repository_changeset_revision, repository_name, repository_owner )
+ print 'due to the following error getting repository_dependencies_dicts:\n%s' % str( error_message )
else:
for repository_dependencies_dict in repository_dependencies_dicts:
if not isinstance( repository_dependencies_dict, dict ):
- log.debug( 'Skipping invalid repository_dependencies_dict: %s' % str( repository_dependencies_dict ) )
+ print 'Skipping invalid repository_dependencies_dict: %s' % str( repository_dependencies_dict )
continue
name = repository_dependencies_dict.get( 'name', None )
owner = repository_dependencies_dict.get( 'owner', None )
changeset_revision = repository_dependencies_dict.get( 'changeset_revision', None )
if name is None or owner is None or changeset_revision is None:
- log.debug( 'Skipping invalid repository_dependencies_dict due to missing name, owner or changeset_revision: %s' % \
- str( repository_dependencies_dict ) )
+ print 'Skipping invalid repository_dependencies_dict due to missing name, owner or changeset_revision: %s' % \
+ str( repository_dependencies_dict )
continue
name = str( name )
owner = str( owner )
changeset_revision = str( changeset_revision )
- log.debug( 'Checking installation containers for revision %s of repository dependency %s owned by %s' % \
- ( changeset_revision, name, owner ) )
+ print 'Checking installation containers for revision %s of repository dependency %s owned by %s' % \
+ ( changeset_revision, name, owner )
required_repository_metadata_id = repository_dependencies_dict[ 'id' ]
# Get the current list of tool_test_results dictionaries associated with the repository_metadata
# record in the tool shed.
tool_test_results_dicts, error_message = get_tool_test_results_dicts( galaxy_tool_shed_url,
required_repository_metadata_id )
if error_message:
- log.debug( 'Cannot check install container for version %s of repository dependency %s owned by %s ' % \
- ( changeset_revision, name, owner ) )
- log.debug( 'due to the following error getting tool_test_results:\n%s' % str( error_message ) )
+ print 'Cannot check install container for version %s of repository dependency %s owned by %s ' % \
+ ( changeset_revision, name, owner )
+ print 'due to the following error getting tool_test_results:\n%s' % str( error_message )
else:
# Check the required repository's time_last_tested value to see if its tool_test_results column
# has been updated within the past 12 hours. The RepositoryMetadata class's to_dict() method
@@ -863,19 +864,19 @@
twenty_hours_ago = ( datetime.utcnow() - timedelta( hours=20 ) ).isoformat()
time_last_tested, error_message = get_time_last_tested( galaxy_tool_shed_url, required_repository_metadata_id )
if time_last_tested is not None and time_last_tested < twenty_hours_ago:
- log.debug( 'The install containers for version %s of repository dependency %s owned by %s have been ' % \
- ( changeset_revision, name, owner ) )
- log.debug( 'populated within the past 20 hours (likely in this test run), so skipping this check.' )
+ print 'The install containers for version %s of repository dependency %s owned by %s have been ' % \
+ ( changeset_revision, name, owner )
+ print 'populated within the past 20 hours (likely in this test run), so skipping this check.'
continue
elif time_last_tested is None:
- log.debug( 'The time_last_tested column value is None for version %s of repository dependency %s owned by %s.' % \
- ( changeset_revision, name, owner ) )
+ print 'The time_last_tested column value is None for version %s of repository dependency %s owned by %s.' % \
+ ( changeset_revision, name, owner )
elif time_last_tested < twenty_hours_ago:
- log.debug( 'Version %s of repository dependency %s owned by %s was last tested less than 20 hours ago.' % \
- ( changeset_revision, name, owner ) )
+ print 'Version %s of repository dependency %s owned by %s was last tested less than 20 hours ago.' % \
+ ( changeset_revision, name, owner )
else:
- log.debug( 'Version %s of repository dependency %s owned by %s was last tested more than 20 hours ago.' % \
- ( changeset_revision, name, owner ) )
+ print 'Version %s of repository dependency %s owned by %s was last tested more than 20 hours ago.' % \
+ ( changeset_revision, name, owner )
# Inspect the tool_test_results_dict for the last test run to see if it has not yet been populated.
if len( tool_test_results_dicts ) == 0:
tool_test_results_dict = {}
@@ -916,9 +917,9 @@
repository_dependencies_dict,
params,
can_update_tool_shed )
- log.debug( 'Result of inserting tool_test_results for revision %s of repository %s owned by %s:\n%s' % \
- ( changeset_revision, name, owner, str( response_dict ) ) )
- log.debug('\n=============================================================\n' )
+ print 'Result of inserting tool_test_results for revision %s of repository %s owned by %s:\n%s' % \
+ ( changeset_revision, name, owner, str( response_dict ) )
+ print'============================================================='
else:
# The required repository's installation failed.
tool_test_results_dict[ 'installation_errors' ][ 'current_repository' ] = str( required_repository.error_message )
@@ -930,16 +931,62 @@
repository_dependencies_dict,
params,
can_update_tool_shed )
- log.debug( 'Result of inserting tool_test_results for revision %s of repository %s owned by %s:\n%s' % \
- ( changeset_revision, name, owner, str( response_dict ) ) )
- log.debug('\n=============================================================\n' )
+ print 'Result of inserting tool_test_results for revision %s of repository %s owned by %s:\n%s' % \
+ ( changeset_revision, name, owner, str( response_dict ) )
+ print'============================================================='
else:
- log.debug( 'Cannot retrieve revision %s of required repository %s owned by %s from the database ' % \
- ( changeset_revision, name, owner ) )
- log.debug( 'so tool_test_results cannot be saved at this time.' )
- log.debug( 'The attributes used to retrieve the record are:' )
- log.debug( 'tool_shed: %s name: %s owner: %s changeset_revision: %s' % \
- ( cleaned_tool_shed_url, name, owner, changeset_revision ) )
+ print 'Cannot retrieve revision %s of required repository %s owned by %s from the database ' % \
+ ( changeset_revision, name, owner )
+ print 'so tool_test_results cannot be saved at this time.'
+ print 'The attributes used to retrieve the record are:'
+ print 'tool_shed: %s name: %s owner: %s changeset_revision: %s' % \
+ ( cleaned_tool_shed_url, name, owner, changeset_revision )
+
+def print_install_and_test_results( install_stage_type, install_and_test_statistics_dict, error_message ):
+ if error_message:
+ print "Error returned from install_and_test_repositories:"
+ print error_message
+ elif isinstance ( install_and_test_statistics_dict, dict ):
+ all_tests_passed = install_and_test_statistics_dict.get( 'all_tests_passed', None )
+ at_least_one_test_failed = install_and_test_statistics_dict.get( 'at_least_one_test_failed', None )
+ repositories_with_installation_error = \
+ install_and_test_statistics_dict.get( 'repositories_with_installation_error', None )
+ successful_repository_installations = \
+ install_and_test_statistics_dict.get( 'successful_repository_installations', None )
+ successful_tool_dependency_installations = \
+ install_and_test_statistics_dict.get( 'successful_tool_dependency_installations', None )
+ tool_dependencies_with_installation_error = \
+ install_and_test_statistics_dict.get( 'tool_dependencies_with_installation_error', None )
+ total_repositories_processed = install_and_test_statistics_dict.get( 'total_repositories_processed', None )
+ now = time.strftime( "%Y-%m-%d %H:%M:%S" )
+ print "####################################################################################"
+ print "# %s - installation script for %s completed." % ( now, install_stage_type )
+ print "# Repository revisions processed: %s" % str( total_repositories_processed )
+ if successful_repository_installations is not None:
+ print "# ----------------------------------------------------------------------------------"
+ print "# The following %d revisions were successfully installed:" % len( successful_repository_installations )
+ display_repositories_by_owner( successful_repository_installations )
+ if repositories_with_installation_error is not None:
+ print "# ----------------------------------------------------------------------------------"
+ print "# The following %d revisions have installation errors:" % len( repositories_with_installation_error )
+ display_repositories_by_owner( repositories_with_installation_error )
+ if successful_tool_dependency_installations is not None:
+ print "# ----------------------------------------------------------------------------------"
+ print "# The following %d tool dependencies were successfully installed:" % len( successful_tool_dependency_installations )
+ display_tool_dependencies_by_name( successful_tool_dependency_installations )
+ if tool_dependencies_with_installation_error is not None:
+ print "# ----------------------------------------------------------------------------------"
+ print "# The following %d tool dependencies have installation errors:" % len( tool_dependencies_with_installation_error )
+ display_tool_dependencies_by_name( tool_dependencies_with_installation_error )
+ if all_tests_passed is not None:
+ print '# ----------------------------------------------------------------------------------'
+ print "# The following %d revisions successfully passed all functional tests:" % len( all_tests_passed )
+ display_repositories_by_owner( all_tests_passed )
+ if at_least_one_test_failed is not None:
+ print '# ----------------------------------------------------------------------------------'
+ print "# The following %d revisions failed at least 1 functional test:" % len( at_least_one_test_failed )
+ display_repositories_by_owner( at_least_one_test_failed )
+ print "####################################################################################"
def run_tests( test_config ):
loader = nose.loader.TestLoader( config=test_config )
@@ -971,22 +1018,22 @@
owner = repository_dict.get( 'owner', None )
changeset_revision = repository_dict.get( 'changeset_revision', None )
if name is None or owner is None or changeset_revision is None:
- log.debug( 'Entries for name, owner or changeset_revision missing from repository_dict %s' % str( repository_dict ) )
+ print 'Entries for name, owner or changeset_revision missing from repository_dict %s' % repository_dict
return {}
name = str( name )
owner = str( owner )
changeset_revision = str( changeset_revision )
- log.debug('\n=============================================================\n' )
- log.debug( 'Inserting the following into tool_test_results for revision %s of repository %s owned by %s:\n%s' % \
- ( changeset_revision, name, owner, str( tool_test_results_dict ) ) )
- log.debug( 'Updating tool_test_results for repository_metadata id %s.' % str( metadata_revision_id ) )
+ print '============================================================='
+ print 'Inserting the following into tool_test_results for revision %s of repository %s owned by %s:\n%s' % \
+ ( changeset_revision, name, owner, str( tool_test_results_dict ) )
+ print 'Updating tool_test_results for repository_metadata id %s.' % metadata_revision_id
tool_test_results_dicts.insert( 0, tool_test_results_dict )
params[ 'tool_test_results' ] = tool_test_results_dicts
# Set the time_last_tested entry so that the repository_metadata.time_last_tested will be set in the tool shed.
params[ 'time_last_tested' ] = 'This entry will result in this value being set via the Tool Shed API.'
url = '%s' % ( suc.url_join( galaxy_tool_shed_url,'api', 'repository_revisions', str( metadata_revision_id ) ) )
- log.debug( 'url: %s' % str( url ) )
- log.debug( 'params: %s' % str( params ) )
+ print 'url: ', url
+ print 'params: ', params
try:
return update( tool_shed_api_key, url, params, return_formatted=False )
except Exception, e:
diff -r 3133b1ad1afc97875f0764f87a60552a2ac6df72 -r 85a5461ef02d692b4893c16a2a878fa844ebd697 test/install_and_test_tool_shed_repositories/repositories_with_tools/functional_tests.py
--- a/test/install_and_test_tool_shed_repositories/repositories_with_tools/functional_tests.py
+++ b/test/install_and_test_tool_shed_repositories/repositories_with_tools/functional_tests.py
@@ -149,16 +149,16 @@
if error_message:
return None, error_message
# Handle repositories not to be tested.
- log.debug( 'The exclude list file is defined as %s' % str( exclude_list_file ) )
+ print 'The exclude list file is defined as %s' % exclude_list_file
if os.path.exists( exclude_list_file ):
- log.debug( 'Loading the list of repositories excluded from testing from the file %s...' % str( exclude_list_file ) )
+ print 'Loading the list of repositories excluded from testing from the file %s...' % exclude_list_file
# The following exclude_list will look something like this:
# [{ 'reason': The default reason or the reason specified in this section,
# 'repositories': [( name, owner, changeset_revision if changeset_revision else None ),
# ( name, owner, changeset_revision if changeset_revision else None )]}]
exclude_list_dicts = install_and_test_base_util.parse_exclude_list( exclude_list_file )
else:
- log.debug( 'The exclude list file %s does not exist, so no repositories will be excluded from testing.' % str( exclude_list_file ) )
+ print 'The exclude list file %s does not exist, so no repositories will be excluded from testing.' % exclude_list_file
exclude_list_dicts = []
# Generate a test method that will use Twill to install each repository into the embedded Galaxy application that was
# started up, installing repository and tool dependencies. Upon successful installation, generate a test case for each
@@ -170,18 +170,18 @@
# Add the URL for the tool shed we're installing from, so the automated installation methods go to the right place.
repository_dict[ 'tool_shed_url' ] = install_and_test_base_util.galaxy_tool_shed_url
# Get the name and owner out of the repository info dict.
- name = str( repository_dict[ 'name' ] )
- owner = str( repository_dict[ 'owner' ] )
- changeset_revision = str( repository_dict[ 'changeset_revision' ] )
- log.debug( "Processing revision %s of repository %s owned by %s..." % ( changeset_revision, name, owner ) )
+ name = str( repository_dict.get( 'name', '' ) )
+ owner = str( repository_dict.get( 'owner', '' ) )
+ changeset_revision = str( repository_dict.get( 'changeset_revision', '' ) )
+ print "Processing revision %s of repository %s owned by %s..." % ( changeset_revision, name, owner )
repository_identifier_dict = dict( name=name, owner=owner, changeset_revision=changeset_revision )
# Retrieve the stored list of tool_test_results_dicts.
tool_test_results_dicts, error_message = \
install_and_test_base_util.get_tool_test_results_dicts( install_and_test_base_util.galaxy_tool_shed_url,
encoded_repository_metadata_id )
if error_message:
- log.debug( 'Cannot install version %s of repository %s owned by %s due to the following error getting tool_test_results:\n%s' % \
- ( changeset_revision, name, owner, str( error_message ) ) )
+ print 'Cannot install version %s of repository %s owned by %s due to the following error getting tool_test_results:\n%s' % \
+ ( changeset_revision, name, owner, str( error_message ) )
else:
tool_test_results_dict = install_and_test_base_util.get_tool_test_results_dict( tool_test_results_dicts )
is_excluded, reason = install_and_test_base_util.is_excluded( exclude_list_dicts,
@@ -190,8 +190,8 @@
changeset_revision,
encoded_repository_metadata_id )
if is_excluded:
- log.debug( "Not testing revision %s of repository %s owned by %s because it is in the exclude list for this test run." % \
- ( changeset_revision, name, owner ) )
+ print "Not testing revision %s of repository %s owned by %s because it is in the exclude list for this test run." % \
+ ( changeset_revision, name, owner )
# If this repository is being skipped, register the reason.
tool_test_results_dict[ 'not_tested' ] = dict( reason=reason )
params = dict( do_not_test=False )
@@ -202,9 +202,9 @@
repository_dict,
params,
can_update_tool_shed )
- log.debug( 'Result of inserting tool_test_results for revision %s of repository %s owned by %s:\n%s' % \
- ( changeset_revision, name, owner, str( response_dict ) ) )
- log.debug('\n=============================================================\n' )
+ print 'Result of inserting tool_test_results for revision %s of repository %s owned by %s:\n%s' % \
+ ( changeset_revision, name, owner, str( response_dict ) )
+ print '============================================================='
else:
# See if the repository was installed in a previous test.
repository = install_and_test_base_util.get_repository( name, owner, changeset_revision )
@@ -215,7 +215,7 @@
install_and_test_statistics_dict[ 'total_repositories_processed' ] += 1
if error_message:
# The repository installation failed.
- log.debug( 'Installation failed for revision %s of repository %s owned by %s.' % ( changeset_revision, name, owner ) )
+ print 'Installation failed for revision %s of repository %s owned by %s.' % ( changeset_revision, name, owner )
install_and_test_statistics_dict[ 'repositories_with_installation_error' ].append( repository_identifier_dict )
tool_test_results_dict[ 'installation_errors' ][ 'current_repository' ] = error_message
params = dict( test_install_error=True,
@@ -227,13 +227,13 @@
repository_dict,
params,
can_update_tool_shed )
- log.debug( 'Result of inserting tool_test_results for revision %s of repository %s owned by %s:\n%s' % \
- ( changeset_revision, name, owner, str( response_dict ) ) )
- log.debug('\n=============================================================\n' )
+ print 'Result of inserting tool_test_results for revision %s of repository %s owned by %s:\n%s' % \
+ ( changeset_revision, name, owner, str( response_dict ) )
+ print '============================================================='
else:
# The repository was successfully installed.
- log.debug( 'Installation succeeded for revision %s of repository %s owned by %s.' % \
- ( changeset_revision, name, owner ) )
+ print 'Installation succeeded for revision %s of repository %s owned by %s.' % \
+ ( changeset_revision, name, owner )
# Add an empty 'missing_test_results' entry if it is missing from the tool_test_results_dict. The
# ~/tool_shed/scripts/check_repositories_for_functional_tests.py will have entered information in the
# 'missing_test_components' entry of the tool_test_results_dict dictionary for repositories that are
@@ -260,12 +260,12 @@
missing_repository_dependencies = install_and_test_base_util.get_missing_repository_dependencies( repository )
missing_tool_dependencies = install_and_test_base_util.get_missing_tool_dependencies( repository )
if missing_repository_dependencies or missing_tool_dependencies:
- log.debug( 'Cannot execute tests for tools in revision %s of repository %s owned by %s ' % \
- ( changeset_revision, name, owner ) )
- log.debug( 'because one or more dependencies has installation errors.' )
+ print 'Cannot execute tests for tools in revision %s of repository %s owned by %s ' % \
+ ( changeset_revision, name, owner )
+ print 'because one or more dependencies has installation errors.'
else:
- log.debug( 'Revision %s of repository %s owned by %s installed successfully, so running tool tests.' % \
- ( changeset_revision, name, owner ) )
+ print 'Revision %s of repository %s owned by %s installed successfully, so running tool tests.' % \
+ ( changeset_revision, name, owner )
# Generate the shed_tools_dict that specifies the location of test data contained within this repository.
# and configure and run functional tests for this repository. This is equivalent to
# sh run_functional_tests.sh -installed
@@ -277,8 +277,7 @@
# If the repository has a test-data directory we write the generated shed_tools_dict to a temporary
# file so the functional test framework can find it.
file( galaxy_shed_tools_dict, 'w' ).write( to_json_string( shed_tools_dict ) )
- log.debug( 'Saved generated shed_tools_dict to %s\nContents: %s' % ( str( galaxy_shed_tools_dict ),
- str( shed_tools_dict ) ) )
+ print 'Saved generated shed_tools_dict to %s\nContents: %s' % ( galaxy_shed_tools_dict, shed_tools_dict )
try:
install_and_test_statistics_dict = test_repository_tools( app,
repository,
@@ -300,13 +299,13 @@
repository_dict,
params,
can_update_tool_shed )
- log.debug( 'Result of inserting tool_test_results for revision %s of repository %s owned by %s:\n%s' % \
- ( changeset_revision, name, owner, str( response_dict ) ) )
- log.debug('\n=============================================================\n' )
+ print 'Result of inserting tool_test_results for revision %s of repository %s owned by %s:\n%s' % \
+ ( changeset_revision, name, owner, str( response_dict ) )
+ print '============================================================='
else:
- log.debug( 'Skipped attempt to install revision %s of repository %s owned by %s because ' % \
- ( changeset_revision, name, owner ) )
- log.debug( 'it was previously installed and currently has status %s' % str( repository.status ) )
+ print 'Skipped attempt to install revision %s of repository %s owned by %s because ' % \
+ ( changeset_revision, name, owner )
+ print 'it was previously installed and currently has status %s' % str( repository.status )
return install_and_test_statistics_dict, error_message
def main():
@@ -520,47 +519,12 @@
if not can_update_tool_shed:
print "# This run will not update the Tool Shed database."
print "####################################################################################"
- install_and_test_statistics_dict, error_message = \
- install_and_test_repositories( app, galaxy_shed_tools_dict, galaxy_shed_tool_conf_file )
- if error_message:
- log.debug( error_message )
- else:
- total_repositories_processed = install_and_test_statistics_dict[ 'total_repositories_processed' ]
- all_tests_passed = install_and_test_statistics_dict[ 'all_tests_passed' ]
- at_least_one_test_failed = install_and_test_statistics_dict[ 'at_least_one_test_failed' ]
- successful_repository_installations = install_and_test_statistics_dict[ 'successful_repository_installations' ]
- successful_tool_dependency_installations = install_and_test_statistics_dict[ 'successful_tool_dependency_installations' ]
- repositories_with_installation_error = install_and_test_statistics_dict[ 'repositories_with_installation_error' ]
- tool_dependencies_with_installation_error = install_and_test_statistics_dict[ 'tool_dependencies_with_installation_error' ]
- now = time.strftime( "%Y-%m-%d %H:%M:%S" )
- print "####################################################################################"
- print "# %s - installation and test script for repositories containing tools completed." % now
- print "# Repository revisions processed: %s" % str( total_repositories_processed )
- if successful_repository_installations:
- print "# ----------------------------------------------------------------------------------"
- print "# The following %d revisions were successfully installed:" % len( successful_repository_installations )
- install_and_test_base_util.display_repositories_by_owner( successful_repository_installations )
- if all_tests_passed:
- print '# ----------------------------------------------------------------------------------'
- print "# The following %d revisions successfully passed all functional tests:" % len( all_tests_passed )
- install_and_test_base_util.display_repositories_by_owner( all_tests_passed )
- if at_least_one_test_failed:
- print '# ----------------------------------------------------------------------------------'
- print "# The following %d revisions failed at least 1 functional test:" % len( at_least_one_test_failed )
- install_and_test_base_util.display_repositories_by_owner( at_least_one_test_failed )
- if repositories_with_installation_error:
- print '# ----------------------------------------------------------------------------------'
- print "# The following %d revisions have installation errors:" % len( repositories_with_installation_error )
- install_and_test_base_util.display_repositories_by_owner( repositories_with_installation_error )
- if successful_tool_dependency_installations:
- print "# ----------------------------------------------------------------------------------"
- print "# The following %d tool dependencies were successfully installed:" % len( successful_tool_dependency_installations )
- install_and_test_base_util.display_tool_dependencies_by_name( successful_tool_dependency_installations )
- if tool_dependencies_with_installation_error:
- print "# ----------------------------------------------------------------------------------"
- print "# The following %d tool dependencies have installation errors:" % len( tool_dependencies_with_installation_error )
- install_and_test_base_util.display_tool_dependencies_by_name( tool_dependencies_with_installation_error )
- print "####################################################################################"
+ install_and_test_statistics_dict, error_message = install_and_test_repositories( app,
+ galaxy_shed_tools_dict,
+ galaxy_shed_tool_conf_file )
+ install_and_test_base_util.print_install_and_test_results( 'repositories with tools',
+ install_and_test_statistics_dict,
+ error_message )
log.debug( "Shutting down..." )
# Gracefully shut down the embedded web server and UniverseApplication.
if server:
@@ -637,8 +601,8 @@
if result.wasSuccessful():
# This repository's tools passed all functional tests. Use the ReportResults nose plugin to get a list
# of tests that passed.
- log.debug( 'Revision %s of repository %s owned by %s installed and passed functional tests.' % \
- ( changeset_revision, name, owner ) )
+ print 'Revision %s of repository %s owned by %s installed and passed functional tests.' % \
+ ( changeset_revision, name, owner )
for plugin in test_plugins:
if hasattr( plugin, 'getTestStatus' ):
test_identifier = '%s/%s' % ( owner, name )
@@ -666,13 +630,13 @@
repository_dict,
params,
can_update_tool_shed )
- log.debug( 'Result of inserting tool_test_results for revision %s of repository %s owned by %s:\n%s' % \
- ( changeset_revision, name, owner, str( response_dict ) ) )
- log.debug('\n=============================================================\n' )
+ print 'Result of inserting tool_test_results for revision %s of repository %s owned by %s:\n%s' % \
+ ( changeset_revision, name, owner, str( response_dict ) )
+ print '============================================================='
else:
# The get_failed_test_dicts() method returns a list.
- log.debug( 'Revision %s of repository %s owned by %s installed successfully but did not pass functional tests.' % \
- ( changeset_revision, name, owner ) )
+ print 'Revision %s of repository %s owned by %s installed successfully but did not pass functional tests.' % \
+ ( changeset_revision, name, owner )
failed_test_dicts = get_failed_test_dicts( result, from_tool_test=True )
tool_test_results_dict[ 'failed_tests' ] = failed_test_dicts
failed_repository_dict = repository_identifier_dict
@@ -681,9 +645,9 @@
install_and_test_base_util.is_latest_downloadable_revision( install_and_test_base_util.galaxy_tool_shed_url,
repository_dict )
if is_latest_downloadable_revision is None or error_message:
- log.debug( 'Error attempting to determine if revision %s of repository %s owned by %s ' % \
- ( changeset_revision, name, owner ) )
- log.debug( 'is the latest downloadable revision: %s' % str( error_message ) )
+ print 'Error attempting to determine if revision %s of repository %s owned by %s ' % \
+ ( changeset_revision, name, owner )
+ print 'is the latest downloadable revision: %s' % error_message
set_do_not_test = False
else:
set_do_not_test = not is_latest_downloadable_revision
@@ -697,9 +661,9 @@
repository_dict,
params,
can_update_tool_shed )
- log.debug( 'Result of inserting tool_test_results for revision %s of repository %s owned by %s:\n%s' % \
- ( changeset_revision, name, owner, str( response_dict ) ) )
- log.debug('\n=============================================================\n' )
+ print 'Result of inserting tool_test_results for revision %s of repository %s owned by %s:\n%s' % \
+ ( changeset_revision, name, owner, str( response_dict ) )
+ print '============================================================='
# Remove the just-executed tests so twill will not find and re-test them along with the tools
# contained in the next repository.
remove_tests( app )
diff -r 3133b1ad1afc97875f0764f87a60552a2ac6df72 -r 85a5461ef02d692b4893c16a2a878fa844ebd697 test/install_and_test_tool_shed_repositories/tool_dependency_definitions/functional_tests.py
--- a/test/install_and_test_tool_shed_repositories/tool_dependency_definitions/functional_tests.py
+++ b/test/install_and_test_tool_shed_repositories/tool_dependency_definitions/functional_tests.py
@@ -83,16 +83,16 @@
install_and_test_base_util.get_repositories_to_install( install_and_test_base_util.galaxy_tool_shed_url, test_framework )
if error_message:
return None, error_message
- log.debug( 'The exclude list file is defined as %s' % str( exclude_list_file ) )
+ print 'The exclude list file is defined as %s' % exclude_list_file
if os.path.exists( exclude_list_file ):
- log.debug( 'Loading the list of repositories excluded from testing from the file %s...' % str( exclude_list_file ) )
+ print 'Loading the list of repositories excluded from testing from the file %s...' % exclude_list_file
# The following exclude_list will look something like this:
# [{ 'reason': The default reason or the reason specified in this section,
# 'repositories': [( name, owner, changeset_revision if changeset_revision else None ),
# ( name, owner, changeset_revision if changeset_revision else None )]}]
exclude_list_dicts = install_and_test_base_util.parse_exclude_list( exclude_list_file )
else:
- log.debug( 'The exclude list file %s does not exist, so no repositories will be excluded from testing.' % str( exclude_list_file ) )
+ print 'The exclude list file %s does not exist, so no repositories will be excluded from testing.' % exclude_list_file
exclude_list_dicts = []
# Generate a test method that will use Twill to install each repository into the embedded Galaxy application that was
# started up, installing repository and tool dependencies. Upon successful installation, generate a test case for each
@@ -104,18 +104,18 @@
# Add the URL for the tool shed we're installing from, so the automated installation methods go to the right place.
repository_dict[ 'tool_shed_url' ] = install_and_test_base_util.galaxy_tool_shed_url
# Get the name and owner out of the repository info dict.
- name = str( repository_dict[ 'name' ] )
- owner = str( repository_dict[ 'owner' ] )
- changeset_revision = str( repository_dict[ 'changeset_revision' ] )
- log.debug( "Processing revision %s of repository %s owned by %s..." % ( changeset_revision, name, owner ) )
+ name = str( repository_dict.get( 'name', '' ) )
+ owner = str( repository_dict.get( 'owner', '' ) )
+ changeset_revision = str( repository_dict.get( 'changeset_revision', '' ) )
+ print "Processing revision %s of repository %s owned by %s..." % ( changeset_revision, name, owner )
repository_identifier_dict = dict( name=name, owner=owner, changeset_revision=changeset_revision )
# Retrieve the stored list of tool_test_results_dicts.
tool_test_results_dicts, error_message = \
install_and_test_base_util.get_tool_test_results_dicts( install_and_test_base_util.galaxy_tool_shed_url,
encoded_repository_metadata_id )
if error_message:
- log.debug( 'Cannot install version %s of repository %s owned by %s due to the following error getting tool_test_results:\n%s' % \
- ( changeset_revision, name, owner, str( error_message ) ) )
+ print 'Cannot install version %s of repository %s owned by %s due to the following error getting tool_test_results:\n%s' % \
+ ( changeset_revision, name, owner, str( error_message ) )
else:
tool_test_results_dict = install_and_test_base_util.get_tool_test_results_dict( tool_test_results_dicts )
is_excluded, reason = install_and_test_base_util.is_excluded( exclude_list_dicts,
@@ -125,8 +125,8 @@
encoded_repository_metadata_id )
if is_excluded:
# If this repository is being skipped, register the reason.
- log.debug( "Not testing revision %s of repository %s owned by %s because it is in the exclude list for this test run." % \
- ( changeset_revision, name, owner ) )
+ print "Not testing revision %s of repository %s owned by %s because it is in the exclude list for this test run." % \
+ ( changeset_revision, name, owner )
tool_test_results_dict[ 'not_tested' ] = dict( reason=reason )
params = dict( do_not_test=False )
response_dict = \
@@ -136,9 +136,9 @@
repository_dict,
params,
can_update_tool_shed )
- log.debug( 'Result of inserting tool_test_results for revision %s of repository %s owned by %s:\n%s' % \
- ( changeset_revision, name, owner, str( response_dict ) ) )
- log.debug('\n=============================================================\n' )
+ print 'Result of inserting tool_test_results for revision %s of repository %s owned by %s:\n%s' % \
+ ( changeset_revision, name, owner, str( response_dict ) )
+ print '============================================================='
else:
# See if the repository was installed in a previous test.
repository = install_and_test_base_util.get_repository( name, owner, changeset_revision )
@@ -149,7 +149,7 @@
install_and_test_statistics_dict[ 'total_repositories_processed' ] += 1
if error_message:
# The repository installation failed.
- log.debug( 'Installation failed for revision %s of repository %s owned by %s.' % ( changeset_revision, name, owner ) )
+ print 'Installation failed for revision %s of repository %s owned by %s.' % ( changeset_revision, name, owner )
install_and_test_statistics_dict[ 'repositories_with_installation_error' ].append( repository_identifier_dict )
tool_test_results_dict[ 'installation_errors' ][ 'current_repository' ] = error_message
params = dict( test_install_error=True,
@@ -161,13 +161,13 @@
repository_dict,
params,
can_update_tool_shed )
- log.debug( 'Result of inserting tool_test_results for revision %s of repository %s owned by %s:\n%s' % \
- ( changeset_revision, name, owner, str( response_dict ) ) )
- log.debug('\n=============================================================\n' )
+ print 'Result of inserting tool_test_results for revision %s of repository %s owned by %s:\n%s' % \
+ ( changeset_revision, name, owner, str( response_dict ) )
+ print '============================================================='
else:
# The repository was successfully installed.
- log.debug( 'Installation succeeded for revision %s of repository %s owned by %s.' % \
- ( changeset_revision, name, owner ) )
+ print 'Installation succeeded for revision %s of repository %s owned by %s.' % \
+ ( changeset_revision, name, owner )
# Populate the installation containers (success and error) for the repository's immediate dependencies
# (the entire dependency tree is not handled here).
params, install_and_test_statistics_dict, tool_test_results_dict = \
@@ -183,9 +183,9 @@
repository_dict,
params,
can_update_tool_shed )
- log.debug( 'Result of inserting tool_test_results for revision %s of repository %s owned by %s:\n%s' % \
- ( changeset_revision, name, owner, str( response_dict ) ) )
- log.debug('\n=============================================================\n' )
+ print 'Result of inserting tool_test_results for revision %s of repository %s owned by %s:\n%s' % \
+ ( changeset_revision, name, owner, str( response_dict ) )
+ print '============================================================='
# Populate the installation containers (success or error) for the repository's immediate repository
# dependencies whose containers are not yet populated.
install_and_test_base_util.populate_install_containers_for_repository_dependencies( app,
@@ -194,9 +194,9 @@
install_and_test_statistics_dict,
can_update_tool_shed )
else:
- log.debug( 'Skipped attempt to install revision %s of repository %s owned by %s because ' % \
- ( changeset_revision, name, owner ) )
- log.debug( 'it was previously installed and currently has status %s' % str( repository.status ) )
+ print 'Skipped attempt to install revision %s of repository %s owned by %s because ' % \
+ ( changeset_revision, name, owner )
+ print 'it was previously installed and currently has status %s' % repository.status
return install_and_test_statistics_dict, error_message
def main():
@@ -394,9 +394,9 @@
time.sleep( 0.1 )
else:
raise Exception( "Test HTTP server did not return '200 OK' after 10 tries" )
- log.debug( "Embedded galaxy web server started..." )
- log.debug( "The embedded Galaxy application is running on %s:%s" % ( str( galaxy_test_host ), str( galaxy_test_port ) ) )
- log.debug( "Repositories will be installed from the tool shed at %s" % str( install_and_test_base_util.galaxy_tool_shed_url ) )
+ print "Embedded galaxy web server started..."
+ print "The embedded Galaxy application is running on %s:%s" % ( galaxy_test_host, galaxy_test_port )
+ print "Repositories will be installed from the tool shed at %s" % install_and_test_base_util.galaxy_tool_shed_url
# If a tool_data_table_conf.test.xml file was found, add the entries from it into the app's tool data tables.
if install_and_test_base_util.additional_tool_data_tables:
app.tool_data_tables.add_new_entries_from_config_file( config_filename=install_and_test_base_util.additional_tool_data_tables,
@@ -409,37 +409,12 @@
if not can_update_tool_shed:
print "# This run will not update the Tool Shed database."
print "####################################################################################"
- install_and_test_statistics_dict, error_message = \
- install_and_test_repositories( app, galaxy_shed_tools_dict, galaxy_shed_tool_conf_file )
- if error_message:
- log.debug( error_message )
- else:
- total_repositories_processed = install_and_test_statistics_dict[ 'total_repositories_processed' ]
- successful_repository_installations = install_and_test_statistics_dict[ 'successful_repository_installations' ]
- successful_tool_dependency_installations = install_and_test_statistics_dict[ 'successful_tool_dependency_installations' ]
- repositories_with_installation_error = install_and_test_statistics_dict[ 'repositories_with_installation_error' ]
- tool_dependencies_with_installation_error = install_and_test_statistics_dict[ 'tool_dependencies_with_installation_error' ]
- now = time.strftime( "%Y-%m-%d %H:%M:%S" )
- print "####################################################################################"
- print "# %s - installation script for repositories of type tool_dependency_definition completed." % now
- print "# Repository revisions processed: %s" % str( total_repositories_processed )
- if successful_repository_installations:
- print "# ----------------------------------------------------------------------------------"
- print "# The following %d revisions were successfully installed:" % len( successful_repository_installations )
- install_and_test_base_util.display_repositories_by_owner( successful_repository_installations )
- if repositories_with_installation_error:
- print "# ----------------------------------------------------------------------------------"
- print "# The following %d revisions have installation errors:" % len( repositories_with_installation_error )
- install_and_test_base_util.successful_repository_installations( repositories_with_installation_error )
- if successful_tool_dependency_installations:
- print "# ----------------------------------------------------------------------------------"
- print "# The following %d tool dependencies were successfully installed:" % len( successful_tool_dependency_installations )
- install_and_test_base_util.display_tool_dependencies_by_name( successful_tool_dependency_installations )
- if tool_dependencies_with_installation_error:
- print "# ----------------------------------------------------------------------------------"
- print "# The following %d tool dependencies have installation errors:" % len( tool_dependencies_with_installation_error )
- install_and_test_base_util.display_tool_dependencies_by_name( tool_dependencies_with_installation_error )
- print "####################################################################################"
+ install_and_test_statistics_dict, error_message = install_and_test_repositories( app,
+ galaxy_shed_tools_dict,
+ galaxy_shed_tool_conf_file )
+ install_and_test_base_util.print_install_and_test_results( 'tool dependency definitions',
+ install_and_test_statistics_dict,
+ error_message )
log.debug( "Shutting down..." )
# Gracefully shut down the embedded web server and UniverseApplication.
if server:
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/329f9ac7c327/
Changeset: 329f9ac7c327
Branch: admin_toolshed_static
User: BjoernGruening
Date: 2014-01-21 15:42:35
Summary: In case of proxy-prefix configuration the $PATH_TO_IMAGES is not correctly converted. Removing the beginning Slash solves it for proxy-prefix configurations and other are not affected.
Affected #: 1 file
diff -r f04a1c3c060ed6bd4febfdd9e86ed3cc74cb810e -r 329f9ac7c327341ed6552d981a686499349e5067 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
@@ -1712,7 +1712,7 @@
"""
if text:
if app.name == 'galaxy':
- route_to_images = '/admin_toolshed/static/images/%s' % encoded_repository_id
+ route_to_images = 'admin_toolshed/static/images/%s' % encoded_repository_id
else:
# We're in the tool shed.
route_to_images = '/repository/static/images/%s' % encoded_repository_id
https://bitbucket.org/galaxy/galaxy-central/commits/3133b1ad1afc/
Changeset: 3133b1ad1afc
User: greg
Date: 2014-01-21 15:59:14
Summary: Merged in BjoernGruening/galaxy-central-bgruening/admin_toolshed_static (pull request #302)
In case of proxy-prefix configuration the $PATH_TO_IMAGES is not correctly converted. Removing the beginning Slash solves it for proxy-prefix configurations and other are not affected.
Affected #: 1 file
diff -r f04a1c3c060ed6bd4febfdd9e86ed3cc74cb810e -r 3133b1ad1afc97875f0764f87a60552a2ac6df72 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
@@ -1712,7 +1712,7 @@
"""
if text:
if app.name == 'galaxy':
- route_to_images = '/admin_toolshed/static/images/%s' % encoded_repository_id
+ route_to_images = 'admin_toolshed/static/images/%s' % encoded_repository_id
else:
# We're in the tool shed.
route_to_images = '/repository/static/images/%s' % encoded_repository_id
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: guerler: Upload: Make sure that history is available
by commits-noreply@bitbucket.org 20 Jan '14
by commits-noreply@bitbucket.org 20 Jan '14
20 Jan '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/f04a1c3c060e/
Changeset: f04a1c3c060e
User: guerler
Date: 2014-01-21 04:02:56
Summary: Upload: Make sure that history is available
Affected #: 2 files
diff -r e88d6af9389682335e8d51e105e5b4a79eccb1f9 -r f04a1c3c060ed6bd4febfdd9e86ed3cc74cb810e static/scripts/mvc/upload/upload-view.js
--- a/static/scripts/mvc/upload/upload-view.js
+++ b/static/scripts/mvc/upload/upload-view.js
@@ -152,7 +152,7 @@
var self = this;
// wait for galaxy history panel (workaround due to the use of iframes)
- if (!Galaxy.currHistoryPanel)
+ if (!Galaxy.currHistoryPanel || !Galaxy.currHistoryPanel.model)
{
window.setTimeout(function() { self.initialize() }, 500)
return;
diff -r e88d6af9389682335e8d51e105e5b4a79eccb1f9 -r f04a1c3c060ed6bd4febfdd9e86ed3cc74cb810e static/scripts/packed/mvc/upload/upload-view.js
--- a/static/scripts/packed/mvc/upload/upload-view.js
+++ b/static/scripts/packed/mvc/upload/upload-view.js
@@ -1,1 +1,1 @@
-define(["galaxy.modal","utils/utils","mvc/upload/upload-model","mvc/upload/upload-row","mvc/ui","utils/uploadbox"],function(c,f,e,d){var b=Backbone.Model.extend({defaults:{percentage:0,icon:"fa-circle",label:"",status:""}});var a=Backbone.View.extend({model:null,initialize:function(h){var g=this;this.model=h;this.options=this.model.attributes;this.setElement(this._template(this.options));$(this.el).on("click",this.options.onclick);if(this.options.tooltip){$(this.el).tooltip({title:this.options.tooltip,placement:"bottom"})}this.model.on("change:percentage",function(){g._percentage(g.model.get("percentage"))});this.model.on("change:status",function(){g._status(g.model.get("status"))});var g=this;$(window).on("beforeunload",function(){var i="";if(g.options.onunload){i=g.options.onunload()}if(i!=""){return i}})},_status:function(h){var g=this.$el.find(".progress-bar");g.removeClass();g.addClass("progress-bar");g.addClass("progress-bar-notransition");if(h!=""){g.addClass("progress-bar-"+h)}},_percentage:function(h){var g=this.$el.find(".progress-bar");g.css({width:h+"%"})},_template:function(g){return'<div class="progress-button"><div class="progress"><div class="progress-bar"></div></div><div id="label" class="label" style="position: absolute; top: 0px; width: inherit; text-align: center;"><div class="fa '+g.icon+'"></div> '+g.label+"</div></div>"}});return Backbone.View.extend({modal:null,button_show:null,uploadbox:null,current_history:null,upload_size:0,select_extension:[["Auto-detect","auto"]],select_genome:[["Unspecified (?)","?"]],collection:new e.Collection(),counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},options:{nginx_upload_path:""},initialize:function(h){var g=this;if(!Galaxy.currHistoryPanel){window.setTimeout(function(){g.initialize()},500);return}if(!Galaxy.currUser.get("id")){return}this.button_show=new b({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(i){if(i){g._eventShow(i)}},onunload:function(){if(g.counter.running>0){return"Several uploads are still processing."}}});$("#left .unified-panel-header-inner").append((new a(this.button_show)).$el);var g=this;f.jsonFromUrl(galaxy_config.root+"api/datatypes",function(i){for(key in i){g.select_extension.push([i[key],i[key]])}});f.jsonFromUrl(galaxy_config.root+"api/genomes",function(i){var j=g.select_genome[0];g.select_genome=[];for(key in i){if(i[key].length>1){if(i[key][1]!==j[1]){g.select_genome.push(i[key])}}}g.select_genome.sort(function(l,k){return l[0]>k[0]?1:l[0]<k[0]?-1:0});g.select_genome.unshift(j)});if(h){this.options=_.defaults(h,this.options)}this.collection.on("remove",function(i){g._eventRemove(i)});this.collection.on("change:genome",function(j){var i=j.get("genome");g.collection.each(function(k){if(k.get("status")=="init"&&k.get("genome")=="?"){k.set("genome",i)}})})},_eventShow:function(h){h.preventDefault();h.stopPropagation();if(!this.modal){var g=this;this.modal=new c.GalaxyModal({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose files":function(){g.uploadbox.select()},"Create file":function(){g._eventCreate()},Start:function(){g._eventStart()},Pause:function(){g._eventStop()},Reset:function(){g._eventReset()},Close:function(){g.modal.hide()},},height:"400",width:"900",bindClosingEvents:true,bindEscKey:false});this.setElement("#upload-box");var g=this;this.uploadbox=this.$el.uploadbox({announce:function(i,j,k){g._eventAnnounce(i,j,k)},initialize:function(i,j,k){return g._eventInitialize(i,j,k)},progress:function(i,j,k){g._eventProgress(i,j,k)},success:function(i,j,k){g._eventSuccess(i,j,k)},error:function(i,j,k){g._eventError(i,j,k)},complete:function(){g._eventComplete()}});this._updateScreen()}this.modal.show()},_eventRemove:function(h){var g=h.get("status");if(g=="success"){this.counter.success--}else{if(g=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(h.id)},_eventAnnounce:function(g,h,j){this.counter.announce++;this._updateScreen();var i=new d(this,{id:g,file_name:h.name,file_size:h.size});this.collection.add(i.model);$(this.el).find("tbody:last").append(i.$el);i.render()},_eventInitialize:function(k,g,o){var i=this.collection.get(k);i.set("status","running");var h=i.get("extension");var l=i.get("file_name");var n=i.get("genome");var m=i.get("url_paste");var j=i.get("space_to_tabs");if(!m&&!(g.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path,paramname:"files_0|file_data"});tool_input={};tool_input.dbkey=n;tool_input.file_type=h;tool_input["files_0|NAME"]=l;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|url_paste"]=m;tool_input.space_to_tabs=j;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(h,i,g){var j=this.collection.get(h);j.set("percentage",g);this.button_show.set("percentage",this._upload_percentage(g,i.size))},_eventSuccess:function(h,i,k){var j=this.collection.get(h);j.set("status","success");var g=j.get("file_size");this.button_show.set("percentage",this._upload_percentage(100,g));this.upload_completed+=g*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshHdas()},_eventError:function(g,h,j){var i=this.collection.get(g);i.set("status","error");i.set("info",j);this.button_show.set("percentage",this._upload_percentage(100,h.size));this.button_show.set("status","danger");this.upload_completed+=h.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(g){if(g.get("status")=="queued"){g.set("status","init")}});this.counter.running=0;this._updateScreen()},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:-1}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0){return}var g=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(h){if(h.get("status")=="init"){h.set("status","queued");g.upload_size+=h.get("file_size")}});this.button_show.set("percentage",0);this.button_show.set("status","success");this.current_history=Galaxy.currHistoryPanel.model.get("id");this.counter.running=this.counter.announce;this._updateScreen();this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0){return}this.button_show.set("status","info");this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){if(this.counter.running==0){this.collection.reset();this.counter.reset();this._updateScreen();this.uploadbox.reset();this.button_show.set("percentage",0)}},_updateScreen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="You can Drag & Drop files into this box."}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Start")}else{this.modal.disableButton("Start")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Choose files");this.modal.enableButton("Create file")}else{this.modal.disableButton("Choose files");this.modal.disableButton("Create file")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("table").show()}else{$(this.el).find("table").hide()}},_upload_percentage:function(g,h){return(this.upload_completed+(g*h))/this.upload_size},_template:function(h,g){return'<div id="'+h+'" class="upload-box"><table class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Space→Tab</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+g+'" class="upload-info"></h6>'}})});
\ No newline at end of file
+define(["galaxy.modal","utils/utils","mvc/upload/upload-model","mvc/upload/upload-row","mvc/ui","utils/uploadbox"],function(c,f,e,d){var b=Backbone.Model.extend({defaults:{percentage:0,icon:"fa-circle",label:"",status:""}});var a=Backbone.View.extend({model:null,initialize:function(h){var g=this;this.model=h;this.options=this.model.attributes;this.setElement(this._template(this.options));$(this.el).on("click",this.options.onclick);if(this.options.tooltip){$(this.el).tooltip({title:this.options.tooltip,placement:"bottom"})}this.model.on("change:percentage",function(){g._percentage(g.model.get("percentage"))});this.model.on("change:status",function(){g._status(g.model.get("status"))});var g=this;$(window).on("beforeunload",function(){var i="";if(g.options.onunload){i=g.options.onunload()}if(i!=""){return i}})},_status:function(h){var g=this.$el.find(".progress-bar");g.removeClass();g.addClass("progress-bar");g.addClass("progress-bar-notransition");if(h!=""){g.addClass("progress-bar-"+h)}},_percentage:function(h){var g=this.$el.find(".progress-bar");g.css({width:h+"%"})},_template:function(g){return'<div class="progress-button"><div class="progress"><div class="progress-bar"></div></div><div id="label" class="label" style="position: absolute; top: 0px; width: inherit; text-align: center;"><div class="fa '+g.icon+'"></div> '+g.label+"</div></div>"}});return Backbone.View.extend({modal:null,button_show:null,uploadbox:null,current_history:null,upload_size:0,select_extension:[["Auto-detect","auto"]],select_genome:[["Unspecified (?)","?"]],collection:new e.Collection(),counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},options:{nginx_upload_path:""},initialize:function(h){var g=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){g.initialize()},500);return}if(!Galaxy.currUser.get("id")){return}this.button_show=new b({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(i){if(i){g._eventShow(i)}},onunload:function(){if(g.counter.running>0){return"Several uploads are still processing."}}});$("#left .unified-panel-header-inner").append((new a(this.button_show)).$el);var g=this;f.jsonFromUrl(galaxy_config.root+"api/datatypes",function(i){for(key in i){g.select_extension.push([i[key],i[key]])}});f.jsonFromUrl(galaxy_config.root+"api/genomes",function(i){var j=g.select_genome[0];g.select_genome=[];for(key in i){if(i[key].length>1){if(i[key][1]!==j[1]){g.select_genome.push(i[key])}}}g.select_genome.sort(function(l,k){return l[0]>k[0]?1:l[0]<k[0]?-1:0});g.select_genome.unshift(j)});if(h){this.options=_.defaults(h,this.options)}this.collection.on("remove",function(i){g._eventRemove(i)});this.collection.on("change:genome",function(j){var i=j.get("genome");g.collection.each(function(k){if(k.get("status")=="init"&&k.get("genome")=="?"){k.set("genome",i)}})})},_eventShow:function(h){h.preventDefault();h.stopPropagation();if(!this.modal){var g=this;this.modal=new c.GalaxyModal({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose files":function(){g.uploadbox.select()},"Create file":function(){g._eventCreate()},Start:function(){g._eventStart()},Pause:function(){g._eventStop()},Reset:function(){g._eventReset()},Close:function(){g.modal.hide()},},height:"400",width:"900",bindClosingEvents:true,bindEscKey:false});this.setElement("#upload-box");var g=this;this.uploadbox=this.$el.uploadbox({announce:function(i,j,k){g._eventAnnounce(i,j,k)},initialize:function(i,j,k){return g._eventInitialize(i,j,k)},progress:function(i,j,k){g._eventProgress(i,j,k)},success:function(i,j,k){g._eventSuccess(i,j,k)},error:function(i,j,k){g._eventError(i,j,k)},complete:function(){g._eventComplete()}});this._updateScreen()}this.modal.show()},_eventRemove:function(h){var g=h.get("status");if(g=="success"){this.counter.success--}else{if(g=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(h.id)},_eventAnnounce:function(g,h,j){this.counter.announce++;this._updateScreen();var i=new d(this,{id:g,file_name:h.name,file_size:h.size});this.collection.add(i.model);$(this.el).find("tbody:last").append(i.$el);i.render()},_eventInitialize:function(k,g,o){var i=this.collection.get(k);i.set("status","running");var h=i.get("extension");var l=i.get("file_name");var n=i.get("genome");var m=i.get("url_paste");var j=i.get("space_to_tabs");if(!m&&!(g.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path,paramname:"files_0|file_data"});tool_input={};tool_input.dbkey=n;tool_input.file_type=h;tool_input["files_0|NAME"]=l;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|url_paste"]=m;tool_input.space_to_tabs=j;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(h,i,g){var j=this.collection.get(h);j.set("percentage",g);this.button_show.set("percentage",this._upload_percentage(g,i.size))},_eventSuccess:function(h,i,k){var j=this.collection.get(h);j.set("status","success");var g=j.get("file_size");this.button_show.set("percentage",this._upload_percentage(100,g));this.upload_completed+=g*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshHdas()},_eventError:function(g,h,j){var i=this.collection.get(g);i.set("status","error");i.set("info",j);this.button_show.set("percentage",this._upload_percentage(100,h.size));this.button_show.set("status","danger");this.upload_completed+=h.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(g){if(g.get("status")=="queued"){g.set("status","init")}});this.counter.running=0;this._updateScreen()},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:-1}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0){return}var g=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(h){if(h.get("status")=="init"){h.set("status","queued");g.upload_size+=h.get("file_size")}});this.button_show.set("percentage",0);this.button_show.set("status","success");this.current_history=Galaxy.currHistoryPanel.model.get("id");this.counter.running=this.counter.announce;this._updateScreen();this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0){return}this.button_show.set("status","info");this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){if(this.counter.running==0){this.collection.reset();this.counter.reset();this._updateScreen();this.uploadbox.reset();this.button_show.set("percentage",0)}},_updateScreen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="You can Drag & Drop files into this box."}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Start")}else{this.modal.disableButton("Start")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Choose files");this.modal.enableButton("Create file")}else{this.modal.disableButton("Choose files");this.modal.disableButton("Create file")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("table").show()}else{$(this.el).find("table").hide()}},_upload_percentage:function(g,h){return(this.upload_completed+(g*h))/this.upload_size},_template:function(h,g){return'<div id="'+h+'" class="upload-box"><table class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Space→Tab</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+g+'" class="upload-info"></h6>'}})});
\ No newline at end of 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: guerler: Modals: Update closing events triggers
by commits-noreply@bitbucket.org 20 Jan '14
by commits-noreply@bitbucket.org 20 Jan '14
20 Jan '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/e88d6af93896/
Changeset: e88d6af93896
User: guerler
Date: 2014-01-21 03:50:36
Summary: Modals: Update closing events triggers
Affected #: 4 files
diff -r ecdf7d468014e38739a054ef4d01b194a6ea681e -r e88d6af9389682335e8d51e105e5b4a79eccb1f9 static/scripts/galaxy.library.js
--- a/static/scripts/galaxy.library.js
+++ b/static/scripts/galaxy.library.js
@@ -455,15 +455,15 @@
var template = _.template(this.templateDatasetModal(), { item : item, size : size });
// make modal
var self = this;
- this.modal = new mod_modal.GalaxyModal({
- destructible : true,
- bindClosingEvents: true,
- title : 'Dataset Details',
- body : template,
- buttons : {
- 'Import' : function() { self.importCurrentIntoHistory() },
- 'Download' : function() { self.downloadCurrent() },
- 'Close' : function() { self.modal.hideOrDestroy() }
+ this.modal = Galaxy.modal;
+ this.modal.show({
+ closing_events : true,
+ title : 'Dataset Details',
+ body : template,
+ buttons : {
+ 'Import' : function() { self.importCurrentIntoHistory() },
+ 'Download' : function() { self.downloadCurrent() },
+ 'Close' : function() { self.modal.hide() }
}
});
@@ -477,8 +477,7 @@
if (self.lastSelectedHistory.length > 0) {
$(this.modal.elMain).find('#dataset_import_single').val(self.lastSelectedHistory);
}
- }
- this.modal.show();
+ }
},
// download dataset shown currently in modal
@@ -612,17 +611,16 @@
success: function (histories){
// make modal
var history_modal_tmpl = _.template(self.templateBulkImportInModal(), {histories : histories.models});
- self.modal = new mod_modal.GalaxyModal({
- destructible : true,
- bindClosingEvents: true,
- title : 'Import into History',
- body : history_modal_tmpl,
- buttons : {
- 'Import' : function() {self.importAllIntoHistory()},
- 'Close' : function() {self.modal.hideOrDestroy();}
+ self.modal = Galaxy.modal;
+ self.modal.show({
+ closing_events : true,
+ title : 'Import into History',
+ body : history_modal_tmpl,
+ buttons : {
+ 'Import' : function() {self.importAllIntoHistory()},
+ 'Close' : function() {self.modal.hide();}
}
});
- self.modal.show();
},
error: function(){
mod_toastr.error('An error occured :(');
@@ -672,7 +670,7 @@
var popped_item = history_item_set.pop();
if (typeof popped_item === "undefined") {
mod_toastr.success('All datasets imported');
- this.modal.hideOrDestroy();
+ this.modal.hide();
return
}
var promise = $.when(popped_item.save({content: popped_item.content, source: popped_item.source})).done(function(a1){
@@ -735,18 +733,17 @@
event.stopPropagation();
// create modal
- var self = this;
- this.modal = new mod_modal.GalaxyModal({
- destructible : true,
- bindClosingEvents: true,
- title : 'Create New Folder',
- body : this.templateNewFolderInModal(),
- buttons : {
- 'Create' : function() {self.create_new_folder_event()},
- 'Close' : function() {self.modal.hideOrDestroy(); self.modal = null;}
- }
- });
- this.modal.show();
+ var self = this;
+ this.modal = Galaxy.modal;
+ this.modal.show({
+ closing_events : true,
+ title : 'Create New Folder',
+ body : this.templateNewFolderInModal(),
+ buttons : {
+ 'Create' : function() {self.create_new_folder_event()},
+ 'Close' : function() {self.modal.hide(); self.modal = null;}
+ }
+ });
},
// create the new folder from modal
@@ -762,7 +759,7 @@
var self = this;
folder.save(folderDetails, {
success: function (folder) {
- self.modal.hideOrDestroy();
+ self.modal.hide();
mod_toastr.success('Folder created');
self.render({id: current_folder_id});
},
@@ -892,18 +889,17 @@
event.stopPropagation();
// create modal
- var self = this;
- this.modal = new mod_modal.GalaxyModal({
- destructible : true,
- bindClosingEvents: true,
- title : 'Create New Library',
- body : this.templateNewLibraryInModal(),
- buttons : {
- 'Create' : function() {self.create_new_library_event()},
- 'Close' : function() {self.modal.hideOrDestroy();}
- }
- });
- this.modal.show();
+ var self = this;
+ this.modal = Galaxy.modal;
+ this.modal.show({
+ closing_events : true,
+ title : 'Create New Library',
+ body : this.templateNewLibraryInModal(),
+ buttons : {
+ 'Create' : function() {self.create_new_library_event()},
+ 'Close' : function() {self.modal.hide();}
+ }
+ });
},
// create the new library from modal
@@ -914,7 +910,7 @@
var self = this;
library.save(libraryDetails, {
success: function (library) {
- self.modal.hideOrDestroy();
+ self.modal.hide();
self.clear_library_modal();
self.render();
mod_toastr.success('Library created');
diff -r ecdf7d468014e38739a054ef4d01b194a6ea681e -r e88d6af9389682335e8d51e105e5b4a79eccb1f9 static/scripts/galaxy.modal.js
--- a/static/scripts/galaxy.modal.js
+++ b/static/scripts/galaxy.modal.js
@@ -1,8 +1,7 @@
-
// dependencies
define([], function() {
-// frame manager
+// modal
var GalaxyModal = Backbone.View.extend(
{
// base element
@@ -10,93 +9,24 @@
// defaults options
optionsDefault: {
- title : "galaxy-modal",
- body : "",
- backdrop : true,
- height : null,
- width : null
+ title : "galaxy-modal",
+ body : "",
+ backdrop : true,
+ height : null,
+ width : null,
+ closing_events : false
},
- // flag whether the closing events are bound
- eventsBound: false,
-
- // options
- options : {
- // by default the modal cannot be removed by the self.destroy() method
- // but only hidden through self.hide()
- destructible: false,
+ // button list
+ buttonList: {},
- // by default don't bind the events
- bindClosingEvents: false,
- // set false to ommit binding ESC key
- bindEscKey: true,
+ // initialize
+ initialize : function(options) {
+ if (options){
+ this._create(options);
+ }
},
- // initialize
- initialize : function(options) {
- self = this;
- if (options){
- this.create(options);
- }
- },
-
- hideOrDestroy: function(){
- self.visible = false;
-
- //unbinds event for ALL modals?
- self.unbindEvents();
-
- if (self.options.destructible){
- self.$el.remove(); // destroy
- } else {
- self.hide();
- }
- },
-
- // hide modal, shouldn't be called directly but through hideOrDestroy()
- // however hide() remains for backwards compatibility
- hide: function(){
- this.visible = false;
- this.$el.fadeOut('fast');
- },
-
- bindEvents: function() {
- if (self.options.bindEscKey){
- // bind the ESC key to hideOrDestroy() function
- $(document).on('keyup', function(event){
- if (event.keyCode == 27) {
- self.hideOrDestroy()
- }
- })
- }
- // bind the 'click anywhere' to hideOrDestroy() function...
- $('html').on('click', self.hideOrDestroy)
- // ...but don't hide if the click is on modal content
- $('.modal-content').on('click', function(event){
- event.stopPropagation();
- })
-
- self.eventsBound = true;
- },
-
- unbindEvents: function(){
- // unbind the ESC key to hideOrDestroy() function
- $(document).off('keyup', function(event){
- if (event.keyCode == 27) {
- self.hideOrDestroy()
- }
- })
- // unbind the 'click anywhere' to hideOrDestroy() function...
- $('html').off('click', function(event){
- self.hideOrDestroy()
- })
- $('.modal-content').off('click', function(event){
- event.stopPropagation();
- })
-
- self.eventsBound = false;
- },
-
// adds and displays a new frame/window
show: function(options) {
// create
@@ -114,20 +44,58 @@
if (this.options.width){
this.$dialog.css('width', this.options.width);
}
-
+
// show
- if (this.visible){
+ if (this.visible) {
this.$el.show();
} else {
this.$el.fadeIn('fast');
}
-
- // set flag
+
+ // set visible flag
this.visible = true;
},
+
+ // hide
+ hide: function() {
+ this.visible = false;
+ this.$el.fadeOut('fast');
+ },
+
+ // enable buttons
+ enableButton: function(name) {
+ var button_id = this.buttonList[name];
+ this.$buttons.find('#' + button_id).prop('disabled', false);
+ },
+
+ // disable buttons
+ disableButton: function(name) {
+ var button_id = this.buttonList[name];
+ this.$buttons.find('#' + button_id).prop('disabled', true);
+ },
+ // show buttons
+ showButton: function(name) {
+ var button_id = this.buttonList[name];
+ this.$buttons.find('#' + button_id).show();
+ },
+
+ // hide buttons
+ hideButton: function(name) {
+ var button_id = this.buttonList[name];
+ this.$buttons.find('#' + button_id).hide();
+ },
+
+ // returns scroll top for body element
+ scrollTop: function() {
+ return this.$body.scrollTop();
+ },
+
// create
- create: function(options) {
+ _create: function(options) {
+ // link this
+ var self = this;
+
// configure options
this.options = _.defaults(options, this.optionsDefault);
@@ -137,12 +105,16 @@
}
// remove former element
- if (this.$el){
+ if (this.$el) {
+ // remove element
this.$el.remove();
+
+ // remove escape event
+ $(document).off('keyup');
}
// create new element
- this.setElement(this.template(this.options.title));
+ this.setElement(this._template(this.options.title));
// link elements
this.$dialog = (this.$el).find('.modal-dialog');
@@ -161,54 +133,38 @@
// append buttons
if (this.options.buttons) {
- // link functions
- var self = this;
+ // reset button list
+ this.buttonList = {};
+ var counter = 0;
$.each(this.options.buttons, function(name, value) {
- self.$buttons.append($('<button id="' + String(name).toLowerCase() + '"></button>').text(name).click(value)).append(" ");
+ var button_id = 'button-' + counter++;
+ self.$buttons.append($('<button id="' + button_id + '"></button>').text(name).click(value)).append(" ");
+ self.buttonList[name] = button_id;
});
- } else
+ } else {
// hide footer
this.$footer.hide();
+ }
// append to main element
$(this.elMain).append($(this.el));
- if (this.options.bindClosingEvents && !this.eventsBound){
- this.bindEvents();
+ // bind additional closing events
+ if (this.options.closing_events) {
+ // bind the ESC key to hide() function
+ $(document).on('keyup', function(e) {
+ if (e.keyCode == 27) {
+ self.hide();
+ }
+ });
+
+ // hide modal if background is clicked
+ this.$el.find('.modal-backdrop').on('click', function() { self.hide(); });
}
},
- // enable buttons
- enableButton: function(name) {
- this.$buttons.find('#' + String(name).toLowerCase()).prop('disabled', false);
- },
-
- // disable buttons
- disableButton: function(name) {
- this.$buttons.find('#' + String(name).toLowerCase()).prop('disabled', true);
- },
-
- // hide buttons
- hideButton: function(name) {
- this.$buttons.find('#' + String(name).toLowerCase()).hide();
- },
- // show buttons
- showButton: function(name) {
- this.$buttons.find('#' + String(name).toLowerCase()).show();
- },
-
- // returns scroll top for body element
- scrollTop: function()
- {
- return this.$body.scrollTop();
- },
-
- /*
- HTML TEMPLATES
- */
-
// fill regular modal template
- template: function(title) {
+ _template: function(title) {
return '<div class="modal">' +
'<div class="modal-backdrop fade in" style="z-index: -1;"></div>' +
'<div class="modal-dialog">' +
@@ -227,9 +183,8 @@
}
});
-// return
return {
- GalaxyModal: GalaxyModal
-};
+ GalaxyModal : GalaxyModal
+}
});
diff -r ecdf7d468014e38739a054ef4d01b194a6ea681e -r e88d6af9389682335e8d51e105e5b4a79eccb1f9 static/scripts/packed/galaxy.library.js
--- a/static/scripts/packed/galaxy.library.js
+++ b/static/scripts/packed/galaxy.library.js
@@ -1,1 +1,1 @@
-var view=null;var library_router=null;var responses=[];define(["galaxy.modal","galaxy.masthead","utils/utils","libs/toastr"],function(k,l,h,n){var f=Backbone.Model.extend({urlRoot:"/api/libraries"});var c=Backbone.Model.extend({urlRoot:"/api/folders"});var o=Backbone.Collection.extend({url:"/api/libraries",model:f});var i=Backbone.Model.extend({urlRoot:"/api/libraries/datasets"});var d=Backbone.Collection.extend({model:i});var e=Backbone.Model.extend({defaults:{folder:new d(),full_path:"unknown",urlRoot:"/api/folders/",id:"unknown"},parse:function(r){this.full_path=r[0].full_path;this.get("folder").reset(r[1].folder_contents);return r}});var b=Backbone.Model.extend({urlRoot:"/api/histories/"});var j=Backbone.Model.extend({url:"/api/histories/"});var p=Backbone.Collection.extend({url:"/api/histories",model:j});var q=Backbone.Router.extend({routes:{"":"libraries","folders/:id":"folder_content","folders/:folder_id/download/:format":"download"}});var m=Backbone.View.extend({el:"#center",progress:0,progressStep:1,lastSelectedHistory:"",modal:null,folders:null,initialize:function(){this.folders=[];this.queue=jQuery.Deferred();this.queue.resolve()},templateFolder:function(){var r=[];r.push('<div id="library_container" style="width: 90%; margin: auto; margin-top: 2em; ">');r.push('<h3>Data Libraries Beta Test. This is work in progress. Please report problems & ideas via <a href="mailto:galaxy-bugs@bx.psu.edu?Subject=DataLibrariesBeta_Feedback" target="_blank">email</a> and <a href="https://trello.com/c/nwYQNFPK/56-data-library-ui-progressive-display-of-fol…" target="_blank">Trello</a>.</h3>');r.push('<div id="library_folder_toolbar" >');r.push(' <button title="Create New Folder" id="toolbtn_create_folder" class="btn btn-primary" type="button"><span class="fa fa-plus"></span><span class="fa fa-folder-close"></span> folder</button>');r.push(' <button id="toolbtn_bulk_import" class="btn btn-primary" style="display: none; margin-left: 0.5em;" type="button"><span class="fa fa-external-link"></span> to history</button>');r.push(' <div id="toolbtn_dl" class="btn-group" style="margin-left: 0.5em; display: none; ">');r.push(' <button id="drop_toggle" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">');r.push(' <span class="fa fa-download"></span> download <span class="caret"></span>');r.push(" </button>");r.push(' <ul class="dropdown-menu" role="menu">');r.push(' <li><a href="#/folders/<%= id %>/download/tgz">.tar.gz</a></li>');r.push(' <li><a href="#/folders/<%= id %>/download/tbz">.tar.bz</a></li>');r.push(' <li><a href="#/folders/<%= id %>/download/zip">.zip</a></li>');r.push(" </ul>");r.push(" </div>");r.push("</div>");r.push('<div class="library_breadcrumb">');r.push('<a title="Return to the list of libraries" href="#">Libraries</a><b>|</b> ');r.push("<% _.each(path, function(path_item) { %>");r.push("<% if (path_item[0] != id) { %>");r.push('<a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a><b>|</b> ');r.push("<% } else { %>");r.push('<span title="You are in this folder"><%- path_item[1] %></span>');r.push("<% } %>");r.push("<% }); %>");r.push("</div>");r.push('<table id="folder_table" class="table table-condensed">');r.push(" <thead>");r.push(' <th style="text-align: center; width: 20px; "><input id="select-all-checkboxes" style="margin: 0;" type="checkbox"></th>');r.push(' <th class="button_heading">view</th>');r.push(" <th>name</th>");r.push(" <th>data type</th>");r.push(" <th>size</th>");r.push(" <th>date (UTC)</th>");r.push(" </thead>");r.push(" <tbody>");r.push(" <td></td>");r.push(' <td><button title="Go to parent folder" type="button" data-id="<%- upper_folder_id %>" class="btn_open_folder btn btn-default btn-xs">');r.push(' <span class="fa fa-arrow-up"></span> .. go up</td>');r.push(" <td></td>");r.push(" <td></td>");r.push(" <td></td>");r.push(" <td></td>");r.push(" </tr>");r.push(" <% _.each(items, function(content_item) { %>");r.push(' <tr class="folder_row light" id="<%- content_item.id %>">');r.push(' <% if (content_item.get("type") === "folder") { %>');r.push(" <td></td>");r.push(' <td><button title="Open this folder" type="button" data-id="<%- content_item.id %>" class="btn_open_folder btn btn-default btn-xs">');r.push(' <span class="fa fa-folder-open"></span> browse</td>');r.push(' <td><%- content_item.get("name") %>');r.push(' <% if (content_item.get("item_count") === 0) { %>');r.push(' <span class="muted">(empty folder)</span>');r.push(" <% } %>");r.push(" </td>");r.push(" <td>folder</td>");r.push(' <td><%= _.escape(content_item.get("item_count")) %> item(s)</td>');r.push(" <% } else { %>");r.push(' <td style="text-align: center; "><input style="margin: 0;" type="checkbox"></td>');r.push(" <td>");r.push(' <button title="See details of this dataset" type="button" class="library-dataset btn btn-default btn-xs">');r.push(' <span class="fa fa-eye"></span> details');r.push(" </button>");r.push(" </td>");r.push(' <td><%- content_item.get("name") %></td>');r.push(' <td><%= _.escape(content_item.get("data_type")) %></td>');r.push(' <td><%= _.escape(content_item.get("readable_size")) %></td>');r.push(" <% } %> ");r.push(' <td><%= _.escape(content_item.get("time_updated")) %></td>');r.push(" </tr>");r.push(" <% }); %>");r.push(" ");r.push(" </tbody>");r.push("</table>");r.push("</div>");return r.join("")},templateDatasetModal:function(){var r=[];r.push('<div id="dataset_info_modal">');r.push(' <table class="table table-striped table-condensed">');r.push(" <tr>");r.push(' <th scope="row" id="id_row" data-id="<%= _.escape(item.get("ldda_id")) %>">Name</th>');r.push(' <td><%= _.escape(item.get("name")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Data type</th>');r.push(' <td><%= _.escape(item.get("data_type")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Genome build</th>');r.push(' <td><%= _.escape(item.get("genome_build")) %></td>');r.push(" </tr>");r.push(' <th scope="row">Size</th>');r.push(" <td><%= _.escape(size) %></td>");r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Date uploaded (UTC)</th>');r.push(' <td><%= _.escape(item.get("date_uploaded")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Uploaded by</th>');r.push(' <td><%= _.escape(item.get("uploaded_by")) %></td>');r.push(" </tr>");r.push(' <tr scope="row">');r.push(' <th scope="row">Data Lines</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_data_lines")) %></td>');r.push(" </tr>");r.push(' <th scope="row">Comment Lines</th>');r.push(' <% if (item.get("metadata_comment_lines") === "") { %>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_comment_lines")) %></td>');r.push(" <% } else { %>");r.push(' <td scope="row">unknown</td>');r.push(" <% } %>");r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Number of Columns</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_columns")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Column Types</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_column_types")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Miscellaneous information</th>');r.push(' <td scope="row"><%= _.escape(item.get("misc_blurb")) %></td>');r.push(" </tr>");r.push(" </table>");r.push(' <pre class="peek">');r.push(" </pre>");r.push("</div>");return r.join("")},templateHistorySelectInModal:function(){var r=[];r.push('<span id="history_modal_combo" style="width:90%; margin-left: 1em; margin-right: 1em; ">');r.push("Select history: ");r.push('<select id="dataset_import_single" name="dataset_import_single" style="width:50%; margin-bottom: 1em; "> ');r.push(" <% _.each(histories, function(history) { %>");r.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');r.push(" <% }); %>");r.push("</select>");r.push("</span>");return r.join("")},templateBulkImportInModal:function(){var r=[];r.push('<span id="history_modal_combo_bulk" style="width:90%; margin-left: 1em; margin-right: 1em; ">');r.push("Select history: ");r.push('<select id="dataset_import_bulk" name="dataset_import_bulk" style="width:50%; margin-bottom: 1em; "> ');r.push(" <% _.each(histories, function(history) { %>");r.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');r.push(" <% }); %>");r.push("</select>");r.push("</span>");return r.join("")},templateProgressBar:function(){var r=[];r.push('<div class="import_text">');r.push("Importing selected datasets to history <b><%= _.escape(history_name) %></b>");r.push("</div>");r.push('<div class="progress">');r.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');r.push(' <span class="completion_span">0% Complete</span>');r.push(" </div>");r.push("</div>");r.push("");return r.join("")},templateNewFolderInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_folder_modal">');tmpl_array.push("<form>");tmpl_array.push('<input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push('<input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push("</form>");tmpl_array.push("</div>");return tmpl_array.join("")},events:{"click #select-all-checkboxes":"selectAll","click .folder_row":"selectClickedRow","click #toolbtn_bulk_import":"modalBulkImport","click #toolbtn_dl":"bulkDownload","click .library-dataset":"showDatasetDetails","click #toolbtn_create_folder":"createFolderFromModal","click .btn_open_folder":"navigateToFolder"},render:function(r){$("#center").css("overflow","auto");view=this;var t=this;var s=new e({id:r.id});s.url=s.attributes.urlRoot+r.id+"/contents";s.fetch({success:function(u){for(var w=0;w<s.attributes.folder.models.length;w++){var v=s.attributes.folder.models[w];if(v.get("type")==="file"){v.set("readable_size",t.size_to_string(v.get("file_size")))}}var y=s.full_path;var z;if(y.length===1){z=0}else{z=y[y.length-2][0]}var x=_.template(t.templateFolder(),{path:s.full_path,items:s.attributes.folder.models,id:r.id,upper_folder_id:z});t.$el.html(x)},error:function(){n.error("An error occured :(")}})},size_to_string:function(r){var s="";if(r>=100000000000){r=r/100000000000;s="TB"}else{if(r>=100000000){r=r/100000000;s="GB"}else{if(r>=100000){r=r/100000;s="MB"}else{if(r>=100){r=r/100;s="KB"}else{r=r*10;s="b"}}}}return(Math.round(r)/10)+s},navigateToFolder:function(s){var r=$(s.target).attr("data-id");if(typeof r==="undefined"){return false}else{if(r==="0"){library_router.navigate("/",{trigger:true,replace:false})}else{library_router.navigate("folders/"+r,{trigger:true,replace:false})}}},showDatasetDetails:function(u){u.preventDefault();var v=$(u.target).parent().parent().attr("id");var t=new i();var s=new p();t.id=v;var r=this;t.fetch({success:function(w){s.fetch({success:function(x){r.renderModalAfterFetch(w,x)},error:function(){n.error("An error occured during fetching histories:(");r.renderModalAfterFetch(w)}})},error:function(){n.error("An error occured during loading dataset details :(")}})},renderModalAfterFetch:function(w,t){var u=this.size_to_string(w.get("file_size"));var v=_.template(this.templateDatasetModal(),{item:w,size:u});var s=this;this.modal=new k.GalaxyModal({destructible:true,bindClosingEvents:true,title:"Dataset Details",body:v,buttons:{Import:function(){s.importCurrentIntoHistory()},Download:function(){s.downloadCurrent()},Close:function(){s.modal.hideOrDestroy()}}});$(".peek").html(w.get("peek"));if(typeof history.models!==undefined){var r=_.template(this.templateHistorySelectInModal(),{histories:t.models});$(this.modal.elMain).find(".buttons").prepend(r);if(s.lastSelectedHistory.length>0){$(this.modal.elMain).find("#dataset_import_single").val(s.lastSelectedHistory)}}this.modal.show()},downloadCurrent:function(){this.modal.disableButton("Import");this.modal.disableButton("Download");var r=[];r.push($("#id_row").attr("data-id"));var s="/api/libraries/datasets/download/uncompressed";var t={ldda_ids:r};folderContentView.processDownload(s,t);this.modal.enableButton("Import");this.modal.enableButton("Download")},importCurrentIntoHistory:function(){this.modal.disableButton("Import");this.modal.disableButton("Download");var t=$(this.modal.elMain).find("select[name=dataset_import_single] option:selected").val();this.lastSelectedHistory=t;var r=$("#id_row").attr("data-id");var u=new b();var s=this;u.url=u.urlRoot+t+"/contents";u.save({content:r,source:"library"},{success:function(){n.success("Dataset imported");s.modal.enableButton("Import");s.modal.enableButton("Download")},error:function(){n.error("An error occured! Dataset not imported. Please try again.");s.modal.enableButton("Import");s.modal.enableButton("Download")}})},selectAll:function(s){var r=s.target.checked;that=this;$(":checkbox").each(function(){this.checked=r;$row=$(this.parentElement.parentElement);(r)?that.makeDarkRow($row):that.makeWhiteRow($row)});this.checkTools()},selectClickedRow:function(s){var u="";var r;var t;if(s.target.localName==="input"){u=s.target;r=$(s.target.parentElement.parentElement);t="input"}else{if(s.target.localName==="td"){u=$("#"+s.target.parentElement.id).find(":checkbox")[0];r=$(s.target.parentElement);t="td"}}if(u===""){s.stopPropagation();return}if(u===undefined){s.stopPropagation();return}if(u.checked){if(t==="td"){u.checked="";this.makeWhiteRow(r)}else{if(t==="input"){this.makeDarkRow(r)}}}else{if(t==="td"){u.checked="selected";this.makeDarkRow(r)}else{if(t==="input"){this.makeWhiteRow(r)}}}this.checkTools()},makeDarkRow:function(r){r.removeClass("light");r.find("a").removeClass("light");r.addClass("dark");r.find("a").addClass("dark")},makeWhiteRow:function(r){r.removeClass("dark");r.find("a").removeClass("dark");r.addClass("light");r.find("a").addClass("light")},checkTools:function(){var r=$("#folder_table").find(":checked");if(r.length>0){$("#toolbtn_bulk_import").show();$("#toolbtn_dl").show()}else{$("#toolbtn_bulk_import").hide();$("#toolbtn_dl").hide()}},modalBulkImport:function(){var s=this;var r=new p();r.fetch({success:function(t){var u=_.template(s.templateBulkImportInModal(),{histories:t.models});s.modal=new k.GalaxyModal({destructible:true,bindClosingEvents:true,title:"Import into History",body:u,buttons:{Import:function(){s.importAllIntoHistory()},Close:function(){s.modal.hideOrDestroy()}}});s.modal.show()},error:function(){n.error("An error occured :(")}})},importAllIntoHistory:function(){this.modal.disableButton("Import");var t=$("select[name=dataset_import_bulk] option:selected").val();var x=$("select[name=dataset_import_bulk] option:selected").text();var z=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!=""){z.push(this.parentElement.parentElement.id)}});var y=_.template(this.templateProgressBar(),{history_name:x});$(this.modal.elMain).find(".modal-body").html(y);var u=100/z.length;this.initProgress(u);var r=[];for(var s=z.length-1;s>=0;s--){library_dataset_id=z[s];var v=new b();var w=this;v.url=v.urlRoot+t+"/contents";v.content=library_dataset_id;v.source="library";r.push(v)}this.chainCall(r)},chainCall:function(s){var r=this;var t=s.pop();if(typeof t==="undefined"){n.success("All datasets imported");this.modal.hideOrDestroy();return}var u=$.when(t.save({content:t.content,source:t.source})).done(function(v){r.updateProgress();responses.push(v);r.chainCall(s)})},initProgress:function(r){this.progress=0;this.progressStep=r},updateProgress:function(){this.progress+=this.progressStep;$(".progress-bar-import").width(Math.round(this.progress)+"%");txt_representation=Math.round(this.progress)+"% Complete";$(".completion_span").text(txt_representation)},download:function(r,v){var t=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!=""){t.push(this.parentElement.parentElement.id)}});var s="/api/libraries/datasets/download/"+v;var u={ldda_ids:t};this.processDownload(s,u,"get")},processDownload:function(s,t,u){if(s&&t){t=typeof t=="string"?t:$.param(t);var r="";$.each(t.split("&"),function(){var v=this.split("=");r+='<input type="hidden" name="'+v[0]+'" value="'+v[1]+'" />'});$('<form action="'+s+'" method="'+(u||"post")+'">'+r+"</form>").appendTo("body").submit().remove();n.info("Your download will begin soon")}},createFolderFromModal:function(){event.preventDefault();event.stopPropagation();var r=this;this.modal=new k.GalaxyModal({destructible:true,bindClosingEvents:true,title:"Create New Folder",body:this.templateNewFolderInModal(),buttons:{Create:function(){r.create_new_folder_event()},Close:function(){r.modal.hideOrDestroy();r.modal=null}}});this.modal.show()},create_new_folder_event:function(){var r=this.serialize_new_folder();if(this.validate_new_folder(r)){var t=new c();url_items=Backbone.history.fragment.split("/");current_folder_id=url_items[url_items.length-1];t.url=t.urlRoot+"/"+current_folder_id;var s=this;t.save(r,{success:function(u){s.modal.hideOrDestroy();n.success("Folder created");s.render({id:current_folder_id})},error:function(){n.error("An error occured :(")}})}else{n.error("Folder's name is missing")}return false},serialize_new_folder:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val()}},validate_new_folder:function(r){return r.name!==""}});var a=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"show_library_modal"},initialize:function(){},templateLibraryList:function(){tmpl_array=[];tmpl_array.push('<div id="library_container" style="width: 90%; margin: auto; margin-top: 2em; overflow: auto !important; ">');tmpl_array.push("");tmpl_array.push('<h3>Data Libraries Beta Test. This is work in progress. Please report problems & ideas via <a href="mailto:galaxy-bugs@bx.psu.edu?Subject=DataLibrariesBeta_Feedback" target="_blank">email</a> and <a href="https://trello.com/c/nwYQNFPK/56-data-library-ui-progressive-display-of-fol…" target="_blank">Trello</a>.</h3>');tmpl_array.push('<a href="" id="create_new_library_btn" class="btn btn-primary file ">New Library</a>');tmpl_array.push('<table class="table table-condensed">');tmpl_array.push(" <thead>");tmpl_array.push(' <th class="button_heading"></th>');tmpl_array.push(" <th>name</th>");tmpl_array.push(" <th>description</th>");tmpl_array.push(" <th>synopsis</th> ");tmpl_array.push(" <th>model type</th> ");tmpl_array.push(" </thead>");tmpl_array.push(" <tbody>");tmpl_array.push(" <% _.each(libraries, function(library) { %>");tmpl_array.push(" <tr>");tmpl_array.push(' <td><button title="Open this library" type="button" data-id="<%- library.get("root_folder_id") %>" class="btn_open_folder btn btn-default btn-xs">');tmpl_array.push(' <span class="fa fa-folder-open"></span> browse</td>');tmpl_array.push(' <td><%- library.get("name") %></td>');tmpl_array.push(' <td><%= _.escape(library.get("description")) %></td>');tmpl_array.push(' <td><%= _.escape(library.get("synopsis")) %></td>');tmpl_array.push(' <td><%= _.escape(library.get("model_class")) %></td>');tmpl_array.push(" </tr>");tmpl_array.push(" <% }); %>");tmpl_array.push(" </tbody>");tmpl_array.push("</table>");tmpl_array.push("</div>");return tmpl_array.join("")},templateNewLibraryInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_library_modal">');tmpl_array.push(" <form>");tmpl_array.push(' <input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push(' <input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push(' <input type="text" name="Synopsis" value="" placeholder="Synopsis">');tmpl_array.push(" </form>");tmpl_array.push("</div>");return tmpl_array.join("")},render:function(){$("#center").css("overflow","auto");var r=this;libraries=new o();libraries.fetch({success:function(s){var t=_.template(r.templateLibraryList(),{libraries:s.models});r.$el.html(t)},error:function(t,s){if(s.statusCode().status===403){n.info("Please log in first. Redirecting to login page in 3s.");setTimeout(r.redirectToLogin,3000)}else{n.error("An error occured. Please try again.")}}})},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},modal:null,show_library_modal:function(s){s.preventDefault();s.stopPropagation();var r=this;this.modal=new k.GalaxyModal({destructible:true,bindClosingEvents:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){r.create_new_library_event()},Close:function(){r.modal.hideOrDestroy()}}});this.modal.show()},create_new_library_event:function(){var t=this.serialize_new_library();if(this.validate_new_library(t)){var s=new f();var r=this;s.save(t,{success:function(u){r.modal.hideOrDestroy();r.clear_library_modal();r.render();n.success("Library created")},error:function(){n.error("An error occured :(")}})}else{n.error("Library's name is missing")}return false},clear_library_modal:function(){$("input[name='Name']").val("");$("input[name='Description']").val("");$("input[name='Synopsis']").val("")},serialize_new_library:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val(),synopsis:$("input[name='Synopsis']").val()}},validate_new_library:function(r){return r.name!==""}});var g=Backbone.View.extend({folderContentView:null,galaxyLibraryview:null,initialize:function(){folderContentView=new m();galaxyLibraryview=new a();library_router=new q();library_router.on("route:libraries",function(){galaxyLibraryview.render()});library_router.on("route:folder_content",function(r){folderContentView.render({id:r})});library_router.on("route:download",function(r,s){if($("#center").find(":checked").length===0){library_router.navigate("folders/"+r,{trigger:true,replace:true})}else{folderContentView.download(r,s);library_router.navigate("folders/"+r,{trigger:false,replace:true})}});Backbone.history.start({pushState:false})}});return{GalaxyApp:g}});
\ No newline at end of file
+var view=null;var library_router=null;var responses=[];define(["galaxy.modal","galaxy.masthead","utils/utils","libs/toastr"],function(k,l,h,n){var f=Backbone.Model.extend({urlRoot:"/api/libraries"});var c=Backbone.Model.extend({urlRoot:"/api/folders"});var o=Backbone.Collection.extend({url:"/api/libraries",model:f});var i=Backbone.Model.extend({urlRoot:"/api/libraries/datasets"});var d=Backbone.Collection.extend({model:i});var e=Backbone.Model.extend({defaults:{folder:new d(),full_path:"unknown",urlRoot:"/api/folders/",id:"unknown"},parse:function(r){this.full_path=r[0].full_path;this.get("folder").reset(r[1].folder_contents);return r}});var b=Backbone.Model.extend({urlRoot:"/api/histories/"});var j=Backbone.Model.extend({url:"/api/histories/"});var p=Backbone.Collection.extend({url:"/api/histories",model:j});var q=Backbone.Router.extend({routes:{"":"libraries","folders/:id":"folder_content","folders/:folder_id/download/:format":"download"}});var m=Backbone.View.extend({el:"#center",progress:0,progressStep:1,lastSelectedHistory:"",modal:null,folders:null,initialize:function(){this.folders=[];this.queue=jQuery.Deferred();this.queue.resolve()},templateFolder:function(){var r=[];r.push('<div id="library_container" style="width: 90%; margin: auto; margin-top: 2em; ">');r.push('<h3>Data Libraries Beta Test. This is work in progress. Please report problems & ideas via <a href="mailto:galaxy-bugs@bx.psu.edu?Subject=DataLibrariesBeta_Feedback" target="_blank">email</a> and <a href="https://trello.com/c/nwYQNFPK/56-data-library-ui-progressive-display-of-fol…" target="_blank">Trello</a>.</h3>');r.push('<div id="library_folder_toolbar" >');r.push(' <button title="Create New Folder" id="toolbtn_create_folder" class="btn btn-primary" type="button"><span class="fa fa-plus"></span><span class="fa fa-folder-close"></span> folder</button>');r.push(' <button id="toolbtn_bulk_import" class="btn btn-primary" style="display: none; margin-left: 0.5em;" type="button"><span class="fa fa-external-link"></span> to history</button>');r.push(' <div id="toolbtn_dl" class="btn-group" style="margin-left: 0.5em; display: none; ">');r.push(' <button id="drop_toggle" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">');r.push(' <span class="fa fa-download"></span> download <span class="caret"></span>');r.push(" </button>");r.push(' <ul class="dropdown-menu" role="menu">');r.push(' <li><a href="#/folders/<%= id %>/download/tgz">.tar.gz</a></li>');r.push(' <li><a href="#/folders/<%= id %>/download/tbz">.tar.bz</a></li>');r.push(' <li><a href="#/folders/<%= id %>/download/zip">.zip</a></li>');r.push(" </ul>");r.push(" </div>");r.push("</div>");r.push('<div class="library_breadcrumb">');r.push('<a title="Return to the list of libraries" href="#">Libraries</a><b>|</b> ');r.push("<% _.each(path, function(path_item) { %>");r.push("<% if (path_item[0] != id) { %>");r.push('<a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a><b>|</b> ');r.push("<% } else { %>");r.push('<span title="You are in this folder"><%- path_item[1] %></span>');r.push("<% } %>");r.push("<% }); %>");r.push("</div>");r.push('<table id="folder_table" class="table table-condensed">');r.push(" <thead>");r.push(' <th style="text-align: center; width: 20px; "><input id="select-all-checkboxes" style="margin: 0;" type="checkbox"></th>');r.push(' <th class="button_heading">view</th>');r.push(" <th>name</th>");r.push(" <th>data type</th>");r.push(" <th>size</th>");r.push(" <th>date (UTC)</th>");r.push(" </thead>");r.push(" <tbody>");r.push(" <td></td>");r.push(' <td><button title="Go to parent folder" type="button" data-id="<%- upper_folder_id %>" class="btn_open_folder btn btn-default btn-xs">');r.push(' <span class="fa fa-arrow-up"></span> .. go up</td>');r.push(" <td></td>");r.push(" <td></td>");r.push(" <td></td>");r.push(" <td></td>");r.push(" </tr>");r.push(" <% _.each(items, function(content_item) { %>");r.push(' <tr class="folder_row light" id="<%- content_item.id %>">');r.push(' <% if (content_item.get("type") === "folder") { %>');r.push(" <td></td>");r.push(' <td><button title="Open this folder" type="button" data-id="<%- content_item.id %>" class="btn_open_folder btn btn-default btn-xs">');r.push(' <span class="fa fa-folder-open"></span> browse</td>');r.push(' <td><%- content_item.get("name") %>');r.push(' <% if (content_item.get("item_count") === 0) { %>');r.push(' <span class="muted">(empty folder)</span>');r.push(" <% } %>");r.push(" </td>");r.push(" <td>folder</td>");r.push(' <td><%= _.escape(content_item.get("item_count")) %> item(s)</td>');r.push(" <% } else { %>");r.push(' <td style="text-align: center; "><input style="margin: 0;" type="checkbox"></td>');r.push(" <td>");r.push(' <button title="See details of this dataset" type="button" class="library-dataset btn btn-default btn-xs">');r.push(' <span class="fa fa-eye"></span> details');r.push(" </button>");r.push(" </td>");r.push(' <td><%- content_item.get("name") %></td>');r.push(' <td><%= _.escape(content_item.get("data_type")) %></td>');r.push(' <td><%= _.escape(content_item.get("readable_size")) %></td>');r.push(" <% } %> ");r.push(' <td><%= _.escape(content_item.get("time_updated")) %></td>');r.push(" </tr>");r.push(" <% }); %>");r.push(" ");r.push(" </tbody>");r.push("</table>");r.push("</div>");return r.join("")},templateDatasetModal:function(){var r=[];r.push('<div id="dataset_info_modal">');r.push(' <table class="table table-striped table-condensed">');r.push(" <tr>");r.push(' <th scope="row" id="id_row" data-id="<%= _.escape(item.get("ldda_id")) %>">Name</th>');r.push(' <td><%= _.escape(item.get("name")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Data type</th>');r.push(' <td><%= _.escape(item.get("data_type")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Genome build</th>');r.push(' <td><%= _.escape(item.get("genome_build")) %></td>');r.push(" </tr>");r.push(' <th scope="row">Size</th>');r.push(" <td><%= _.escape(size) %></td>");r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Date uploaded (UTC)</th>');r.push(' <td><%= _.escape(item.get("date_uploaded")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Uploaded by</th>');r.push(' <td><%= _.escape(item.get("uploaded_by")) %></td>');r.push(" </tr>");r.push(' <tr scope="row">');r.push(' <th scope="row">Data Lines</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_data_lines")) %></td>');r.push(" </tr>");r.push(' <th scope="row">Comment Lines</th>');r.push(' <% if (item.get("metadata_comment_lines") === "") { %>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_comment_lines")) %></td>');r.push(" <% } else { %>");r.push(' <td scope="row">unknown</td>');r.push(" <% } %>");r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Number of Columns</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_columns")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Column Types</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_column_types")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Miscellaneous information</th>');r.push(' <td scope="row"><%= _.escape(item.get("misc_blurb")) %></td>');r.push(" </tr>");r.push(" </table>");r.push(' <pre class="peek">');r.push(" </pre>");r.push("</div>");return r.join("")},templateHistorySelectInModal:function(){var r=[];r.push('<span id="history_modal_combo" style="width:90%; margin-left: 1em; margin-right: 1em; ">');r.push("Select history: ");r.push('<select id="dataset_import_single" name="dataset_import_single" style="width:50%; margin-bottom: 1em; "> ');r.push(" <% _.each(histories, function(history) { %>");r.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');r.push(" <% }); %>");r.push("</select>");r.push("</span>");return r.join("")},templateBulkImportInModal:function(){var r=[];r.push('<span id="history_modal_combo_bulk" style="width:90%; margin-left: 1em; margin-right: 1em; ">');r.push("Select history: ");r.push('<select id="dataset_import_bulk" name="dataset_import_bulk" style="width:50%; margin-bottom: 1em; "> ');r.push(" <% _.each(histories, function(history) { %>");r.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');r.push(" <% }); %>");r.push("</select>");r.push("</span>");return r.join("")},templateProgressBar:function(){var r=[];r.push('<div class="import_text">');r.push("Importing selected datasets to history <b><%= _.escape(history_name) %></b>");r.push("</div>");r.push('<div class="progress">');r.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');r.push(' <span class="completion_span">0% Complete</span>');r.push(" </div>");r.push("</div>");r.push("");return r.join("")},templateNewFolderInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_folder_modal">');tmpl_array.push("<form>");tmpl_array.push('<input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push('<input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push("</form>");tmpl_array.push("</div>");return tmpl_array.join("")},events:{"click #select-all-checkboxes":"selectAll","click .folder_row":"selectClickedRow","click #toolbtn_bulk_import":"modalBulkImport","click #toolbtn_dl":"bulkDownload","click .library-dataset":"showDatasetDetails","click #toolbtn_create_folder":"createFolderFromModal","click .btn_open_folder":"navigateToFolder"},render:function(r){$("#center").css("overflow","auto");view=this;var t=this;var s=new e({id:r.id});s.url=s.attributes.urlRoot+r.id+"/contents";s.fetch({success:function(u){for(var w=0;w<s.attributes.folder.models.length;w++){var v=s.attributes.folder.models[w];if(v.get("type")==="file"){v.set("readable_size",t.size_to_string(v.get("file_size")))}}var y=s.full_path;var z;if(y.length===1){z=0}else{z=y[y.length-2][0]}var x=_.template(t.templateFolder(),{path:s.full_path,items:s.attributes.folder.models,id:r.id,upper_folder_id:z});t.$el.html(x)},error:function(){n.error("An error occured :(")}})},size_to_string:function(r){var s="";if(r>=100000000000){r=r/100000000000;s="TB"}else{if(r>=100000000){r=r/100000000;s="GB"}else{if(r>=100000){r=r/100000;s="MB"}else{if(r>=100){r=r/100;s="KB"}else{r=r*10;s="b"}}}}return(Math.round(r)/10)+s},navigateToFolder:function(s){var r=$(s.target).attr("data-id");if(typeof r==="undefined"){return false}else{if(r==="0"){library_router.navigate("/",{trigger:true,replace:false})}else{library_router.navigate("folders/"+r,{trigger:true,replace:false})}}},showDatasetDetails:function(u){u.preventDefault();var v=$(u.target).parent().parent().attr("id");var t=new i();var s=new p();t.id=v;var r=this;t.fetch({success:function(w){s.fetch({success:function(x){r.renderModalAfterFetch(w,x)},error:function(){n.error("An error occured during fetching histories:(");r.renderModalAfterFetch(w)}})},error:function(){n.error("An error occured during loading dataset details :(")}})},renderModalAfterFetch:function(w,t){var u=this.size_to_string(w.get("file_size"));var v=_.template(this.templateDatasetModal(),{item:w,size:u});var s=this;this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Dataset Details",body:v,buttons:{Import:function(){s.importCurrentIntoHistory()},Download:function(){s.downloadCurrent()},Close:function(){s.modal.hide()}}});$(".peek").html(w.get("peek"));if(typeof history.models!==undefined){var r=_.template(this.templateHistorySelectInModal(),{histories:t.models});$(this.modal.elMain).find(".buttons").prepend(r);if(s.lastSelectedHistory.length>0){$(this.modal.elMain).find("#dataset_import_single").val(s.lastSelectedHistory)}}},downloadCurrent:function(){this.modal.disableButton("Import");this.modal.disableButton("Download");var r=[];r.push($("#id_row").attr("data-id"));var s="/api/libraries/datasets/download/uncompressed";var t={ldda_ids:r};folderContentView.processDownload(s,t);this.modal.enableButton("Import");this.modal.enableButton("Download")},importCurrentIntoHistory:function(){this.modal.disableButton("Import");this.modal.disableButton("Download");var t=$(this.modal.elMain).find("select[name=dataset_import_single] option:selected").val();this.lastSelectedHistory=t;var r=$("#id_row").attr("data-id");var u=new b();var s=this;u.url=u.urlRoot+t+"/contents";u.save({content:r,source:"library"},{success:function(){n.success("Dataset imported");s.modal.enableButton("Import");s.modal.enableButton("Download")},error:function(){n.error("An error occured! Dataset not imported. Please try again.");s.modal.enableButton("Import");s.modal.enableButton("Download")}})},selectAll:function(s){var r=s.target.checked;that=this;$(":checkbox").each(function(){this.checked=r;$row=$(this.parentElement.parentElement);(r)?that.makeDarkRow($row):that.makeWhiteRow($row)});this.checkTools()},selectClickedRow:function(s){var u="";var r;var t;if(s.target.localName==="input"){u=s.target;r=$(s.target.parentElement.parentElement);t="input"}else{if(s.target.localName==="td"){u=$("#"+s.target.parentElement.id).find(":checkbox")[0];r=$(s.target.parentElement);t="td"}}if(u===""){s.stopPropagation();return}if(u===undefined){s.stopPropagation();return}if(u.checked){if(t==="td"){u.checked="";this.makeWhiteRow(r)}else{if(t==="input"){this.makeDarkRow(r)}}}else{if(t==="td"){u.checked="selected";this.makeDarkRow(r)}else{if(t==="input"){this.makeWhiteRow(r)}}}this.checkTools()},makeDarkRow:function(r){r.removeClass("light");r.find("a").removeClass("light");r.addClass("dark");r.find("a").addClass("dark")},makeWhiteRow:function(r){r.removeClass("dark");r.find("a").removeClass("dark");r.addClass("light");r.find("a").addClass("light")},checkTools:function(){var r=$("#folder_table").find(":checked");if(r.length>0){$("#toolbtn_bulk_import").show();$("#toolbtn_dl").show()}else{$("#toolbtn_bulk_import").hide();$("#toolbtn_dl").hide()}},modalBulkImport:function(){var s=this;var r=new p();r.fetch({success:function(t){var u=_.template(s.templateBulkImportInModal(),{histories:t.models});s.modal=Galaxy.modal;s.modal.show({closing_events:true,title:"Import into History",body:u,buttons:{Import:function(){s.importAllIntoHistory()},Close:function(){s.modal.hide()}}})},error:function(){n.error("An error occured :(")}})},importAllIntoHistory:function(){this.modal.disableButton("Import");var t=$("select[name=dataset_import_bulk] option:selected").val();var x=$("select[name=dataset_import_bulk] option:selected").text();var z=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!=""){z.push(this.parentElement.parentElement.id)}});var y=_.template(this.templateProgressBar(),{history_name:x});$(this.modal.elMain).find(".modal-body").html(y);var u=100/z.length;this.initProgress(u);var r=[];for(var s=z.length-1;s>=0;s--){library_dataset_id=z[s];var v=new b();var w=this;v.url=v.urlRoot+t+"/contents";v.content=library_dataset_id;v.source="library";r.push(v)}this.chainCall(r)},chainCall:function(s){var r=this;var t=s.pop();if(typeof t==="undefined"){n.success("All datasets imported");this.modal.hide();return}var u=$.when(t.save({content:t.content,source:t.source})).done(function(v){r.updateProgress();responses.push(v);r.chainCall(s)})},initProgress:function(r){this.progress=0;this.progressStep=r},updateProgress:function(){this.progress+=this.progressStep;$(".progress-bar-import").width(Math.round(this.progress)+"%");txt_representation=Math.round(this.progress)+"% Complete";$(".completion_span").text(txt_representation)},download:function(r,v){var t=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!=""){t.push(this.parentElement.parentElement.id)}});var s="/api/libraries/datasets/download/"+v;var u={ldda_ids:t};this.processDownload(s,u,"get")},processDownload:function(s,t,u){if(s&&t){t=typeof t=="string"?t:$.param(t);var r="";$.each(t.split("&"),function(){var v=this.split("=");r+='<input type="hidden" name="'+v[0]+'" value="'+v[1]+'" />'});$('<form action="'+s+'" method="'+(u||"post")+'">'+r+"</form>").appendTo("body").submit().remove();n.info("Your download will begin soon")}},createFolderFromModal:function(){event.preventDefault();event.stopPropagation();var r=this;this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Folder",body:this.templateNewFolderInModal(),buttons:{Create:function(){r.create_new_folder_event()},Close:function(){r.modal.hide();r.modal=null}}})},create_new_folder_event:function(){var r=this.serialize_new_folder();if(this.validate_new_folder(r)){var t=new c();url_items=Backbone.history.fragment.split("/");current_folder_id=url_items[url_items.length-1];t.url=t.urlRoot+"/"+current_folder_id;var s=this;t.save(r,{success:function(u){s.modal.hide();n.success("Folder created");s.render({id:current_folder_id})},error:function(){n.error("An error occured :(")}})}else{n.error("Folder's name is missing")}return false},serialize_new_folder:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val()}},validate_new_folder:function(r){return r.name!==""}});var a=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"show_library_modal"},initialize:function(){},templateLibraryList:function(){tmpl_array=[];tmpl_array.push('<div id="library_container" style="width: 90%; margin: auto; margin-top: 2em; overflow: auto !important; ">');tmpl_array.push("");tmpl_array.push('<h3>Data Libraries Beta Test. This is work in progress. Please report problems & ideas via <a href="mailto:galaxy-bugs@bx.psu.edu?Subject=DataLibrariesBeta_Feedback" target="_blank">email</a> and <a href="https://trello.com/c/nwYQNFPK/56-data-library-ui-progressive-display-of-fol…" target="_blank">Trello</a>.</h3>');tmpl_array.push('<a href="" id="create_new_library_btn" class="btn btn-primary file ">New Library</a>');tmpl_array.push('<table class="table table-condensed">');tmpl_array.push(" <thead>");tmpl_array.push(' <th class="button_heading"></th>');tmpl_array.push(" <th>name</th>");tmpl_array.push(" <th>description</th>");tmpl_array.push(" <th>synopsis</th> ");tmpl_array.push(" <th>model type</th> ");tmpl_array.push(" </thead>");tmpl_array.push(" <tbody>");tmpl_array.push(" <% _.each(libraries, function(library) { %>");tmpl_array.push(" <tr>");tmpl_array.push(' <td><button title="Open this library" type="button" data-id="<%- library.get("root_folder_id") %>" class="btn_open_folder btn btn-default btn-xs">');tmpl_array.push(' <span class="fa fa-folder-open"></span> browse</td>');tmpl_array.push(' <td><%- library.get("name") %></td>');tmpl_array.push(' <td><%= _.escape(library.get("description")) %></td>');tmpl_array.push(' <td><%= _.escape(library.get("synopsis")) %></td>');tmpl_array.push(' <td><%= _.escape(library.get("model_class")) %></td>');tmpl_array.push(" </tr>");tmpl_array.push(" <% }); %>");tmpl_array.push(" </tbody>");tmpl_array.push("</table>");tmpl_array.push("</div>");return tmpl_array.join("")},templateNewLibraryInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_library_modal">');tmpl_array.push(" <form>");tmpl_array.push(' <input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push(' <input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push(' <input type="text" name="Synopsis" value="" placeholder="Synopsis">');tmpl_array.push(" </form>");tmpl_array.push("</div>");return tmpl_array.join("")},render:function(){$("#center").css("overflow","auto");var r=this;libraries=new o();libraries.fetch({success:function(s){var t=_.template(r.templateLibraryList(),{libraries:s.models});r.$el.html(t)},error:function(t,s){if(s.statusCode().status===403){n.info("Please log in first. Redirecting to login page in 3s.");setTimeout(r.redirectToLogin,3000)}else{n.error("An error occured. Please try again.")}}})},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},modal:null,show_library_modal:function(s){s.preventDefault();s.stopPropagation();var r=this;this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){r.create_new_library_event()},Close:function(){r.modal.hide()}}})},create_new_library_event:function(){var t=this.serialize_new_library();if(this.validate_new_library(t)){var s=new f();var r=this;s.save(t,{success:function(u){r.modal.hide();r.clear_library_modal();r.render();n.success("Library created")},error:function(){n.error("An error occured :(")}})}else{n.error("Library's name is missing")}return false},clear_library_modal:function(){$("input[name='Name']").val("");$("input[name='Description']").val("");$("input[name='Synopsis']").val("")},serialize_new_library:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val(),synopsis:$("input[name='Synopsis']").val()}},validate_new_library:function(r){return r.name!==""}});var g=Backbone.View.extend({folderContentView:null,galaxyLibraryview:null,initialize:function(){folderContentView=new m();galaxyLibraryview=new a();library_router=new q();library_router.on("route:libraries",function(){galaxyLibraryview.render()});library_router.on("route:folder_content",function(r){folderContentView.render({id:r})});library_router.on("route:download",function(r,s){if($("#center").find(":checked").length===0){library_router.navigate("folders/"+r,{trigger:true,replace:true})}else{folderContentView.download(r,s);library_router.navigate("folders/"+r,{trigger:false,replace:true})}});Backbone.history.start({pushState:false})}});return{GalaxyApp:g}});
\ No newline at end of file
diff -r ecdf7d468014e38739a054ef4d01b194a6ea681e -r e88d6af9389682335e8d51e105e5b4a79eccb1f9 static/scripts/packed/galaxy.modal.js
--- a/static/scripts/packed/galaxy.modal.js
+++ b/static/scripts/packed/galaxy.modal.js
@@ -1,1 +1,1 @@
-define([],function(){var a=Backbone.View.extend({elMain:"#everything",optionsDefault:{title:"galaxy-modal",body:"",backdrop:true,height:null,width:null},eventsBound:false,options:{destructible:false,bindClosingEvents:false,bindEscKey:true,},initialize:function(b){self=this;if(b){this.create(b)}},hideOrDestroy:function(){self.visible=false;self.unbindEvents();if(self.options.destructible){self.$el.remove()}else{self.hide()}},hide:function(){this.visible=false;this.$el.fadeOut("fast")},bindEvents:function(){if(self.options.bindEscKey){$(document).on("keyup",function(b){if(b.keyCode==27){self.hideOrDestroy()}})}$("html").on("click",self.hideOrDestroy);$(".modal-content").on("click",function(b){b.stopPropagation()});self.eventsBound=true},unbindEvents:function(){$(document).off("keyup",function(b){if(b.keyCode==27){self.hideOrDestroy()}});$("html").off("click",function(b){self.hideOrDestroy()});$(".modal-content").off("click",function(b){b.stopPropagation()});self.eventsBound=false},show:function(b){this.initialize(b);if(this.options.height){this.$body.css("height",this.options.height);this.$body.css("overflow","hidden")}else{this.$body.css("max-height",$(window).height()/2)}if(this.options.width){this.$dialog.css("width",this.options.width)}if(this.visible){this.$el.show()}else{this.$el.fadeIn("fast")}this.visible=true},create:function(c){this.options=_.defaults(c,this.optionsDefault);if(this.options.body=="progress"){this.options.body=$('<div class="progress progress-striped active"><div class="progress-bar progress-bar-info" style="width:100%"></div></div>')}if(this.$el){this.$el.remove()}this.setElement(this.template(this.options.title));this.$dialog=(this.$el).find(".modal-dialog");this.$body=(this.$el).find(".modal-body");this.$footer=(this.$el).find(".modal-footer");this.$buttons=(this.$el).find(".buttons");this.$backdrop=(this.$el).find(".modal-backdrop");this.$body.html(this.options.body);if(!this.options.backdrop){this.$backdrop.removeClass("in")}if(this.options.buttons){var b=this;$.each(this.options.buttons,function(d,e){b.$buttons.append($('<button id="'+String(d).toLowerCase()+'"></button>').text(d).click(e)).append(" ")})}else{this.$footer.hide()}$(this.elMain).append($(this.el));if(this.options.bindClosingEvents&&!this.eventsBound){this.bindEvents()}},enableButton:function(b){this.$buttons.find("#"+String(b).toLowerCase()).prop("disabled",false)},disableButton:function(b){this.$buttons.find("#"+String(b).toLowerCase()).prop("disabled",true)},hideButton:function(b){this.$buttons.find("#"+String(b).toLowerCase()).hide()},showButton:function(b){this.$buttons.find("#"+String(b).toLowerCase()).show()},scrollTop:function(){return this.$body.scrollTop()},template:function(b){return'<div class="modal"><div class="modal-backdrop fade in" style="z-index: -1;"></div><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" style="display: none;">×</button><h4 class="title">'+b+'</h4></div><div class="modal-body"></div><div class="modal-footer"><div class="buttons" style="float: right;"></div></div></div</div></div>'}});return{GalaxyModal:a}});
\ No newline at end of file
+define([],function(){var a=Backbone.View.extend({elMain:"#everything",optionsDefault:{title:"galaxy-modal",body:"",backdrop:true,height:null,width:null,closing_events:false},buttonList:{},initialize:function(b){if(b){this._create(b)}},show:function(b){this.initialize(b);if(this.options.height){this.$body.css("height",this.options.height);this.$body.css("overflow","hidden")}else{this.$body.css("max-height",$(window).height()/2)}if(this.options.width){this.$dialog.css("width",this.options.width)}if(this.visible){this.$el.show()}else{this.$el.fadeIn("fast")}this.visible=true},hide:function(){this.visible=false;this.$el.fadeOut("fast")},enableButton:function(b){var c=this.buttonList[b];this.$buttons.find("#"+c).prop("disabled",false)},disableButton:function(b){var c=this.buttonList[b];this.$buttons.find("#"+c).prop("disabled",true)},showButton:function(b){var c=this.buttonList[b];this.$buttons.find("#"+c).show()},hideButton:function(b){var c=this.buttonList[b];this.$buttons.find("#"+c).hide()},scrollTop:function(){return this.$body.scrollTop()},_create:function(d){var c=this;this.options=_.defaults(d,this.optionsDefault);if(this.options.body=="progress"){this.options.body=$('<div class="progress progress-striped active"><div class="progress-bar progress-bar-info" style="width:100%"></div></div>')}if(this.$el){this.$el.remove();$(document).off("keyup")}this.setElement(this._template(this.options.title));this.$dialog=(this.$el).find(".modal-dialog");this.$body=(this.$el).find(".modal-body");this.$footer=(this.$el).find(".modal-footer");this.$buttons=(this.$el).find(".buttons");this.$backdrop=(this.$el).find(".modal-backdrop");this.$body.html(this.options.body);if(!this.options.backdrop){this.$backdrop.removeClass("in")}if(this.options.buttons){this.buttonList={};var b=0;$.each(this.options.buttons,function(e,g){var f="button-"+b++;c.$buttons.append($('<button id="'+f+'"></button>').text(e).click(g)).append(" ");c.buttonList[e]=f})}else{this.$footer.hide()}$(this.elMain).append($(this.el));if(this.options.closing_events){$(document).on("keyup",function(f){if(f.keyCode==27){c.hide()}});this.$el.find(".modal-backdrop").on("click",function(){c.hide()})}},_template:function(b){return'<div class="modal"><div class="modal-backdrop fade in" style="z-index: -1;"></div><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" style="display: none;">×</button><h4 class="title">'+b+'</h4></div><div class="modal-body"></div><div class="modal-footer"><div class="buttons" style="float: right;"></div></div></div</div></div>'}});return{GalaxyModal:a}});
\ No newline at end of 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: greg: Eliminate the recently introduced restriction on uninstalling repositories that are dependencies of other installed items, but keep the beneficial feature that displays dependent items that will be affected if a repository is uninstalled.
by commits-noreply@bitbucket.org 20 Jan '14
by commits-noreply@bitbucket.org 20 Jan '14
20 Jan '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/ecdf7d468014/
Changeset: ecdf7d468014
User: greg
Date: 2014-01-20 22:07:08
Summary: Eliminate the recently introduced restriction on uninstalling repositories that are dependencies of other installed items, but keep the beneficial feature that displays dependent items that will be affected if a repository is uninstalled.
Affected #: 4 files
diff -r cef51275f59d72529d17769cfac6af572aeea679 -r ecdf7d468014e38739a054ef4d01b194a6ea681e lib/galaxy/model/tool_shed_install/__init__.py
--- a/lib/galaxy/model/tool_shed_install/__init__.py
+++ b/lib/galaxy/model/tool_shed_install/__init__.py
@@ -61,53 +61,9 @@
def can_reset_metadata( self ):
return self.status == self.installation_status.INSTALLED
- def can_uninstall( self, app ):
- # An installed repository cannot be uninstalled if other installed repositories or installed repository
- # contents (i.e., tool dependencies) require it.
- if self.status == self.installation_status.UNINSTALLED:
- return False
- this_repository_tup = ( str( self.tool_shed ),
- str( self.name ),
- str( self.owner ),
- str( self.installed_changeset_revision ) )
- irm = app.installed_repository_manager
- # See if this repository's current dependencies are restricted to a single circular relationship. This
- # means that this repository has a single repository dependency which itself depends upon this repository.
- # The repository dependency may have other repository dependencies, but that is not relevant here.
- single_repository_dependency_tup = None
- installed_repository_dependency_tups = \
- irm.installed_repository_dependencies_of_installed_repositories.get( this_repository_tup, [] )
- # If this repository defines a circular relationship to another repository, then the list of tuples
- # defining installed repository dependencies will include itself.
- if len( installed_repository_dependency_tups ) == 2:
- if this_repository_tup in installed_repository_dependency_tups:
- # We have a single circular dependency definition, so get the other repository.
- for installed_repository_dependency_tup in installed_repository_dependency_tups:
- if installed_repository_dependency_tup != this_repository_tup:
- single_repository_dependency_tup = installed_repository_dependency_tup
- break
- if single_repository_dependency_tup is not None:
- installed_repository_dependency_tups = \
- irm.installed_repository_dependencies_of_installed_repositories.get( this_repository_tup, [] )
- if this_repository_tup in installed_repository_dependency_tups:
- # This repository is a dependency of the single repository upon which it depends, so we have
- # a single circular relationship and this repository can be uninstalled.
- return True
- # Find other installed repositories that require this repository.
- installed_dependent_repositories = \
- irm.installed_dependent_repositories_of_installed_repositories.get( this_repository_tup, [] )
- if installed_dependent_repositories:
- # This repository cannot be uninstalled because other installed repositories require it.
- return False
- # Find installed tool dependencies that require this repository's installed tool dependencies.
- installed_tool_dependencies = irm.installed_tool_dependencies_of_installed_repositories.get( this_repository_tup, [] )
- for td_tup in installed_tool_dependencies:
- installed_dependent_td_tups = irm.installed_runtime_dependent_tool_dependencies_of_installed_tool_dependencies.get( td_tup, [] )
- if installed_dependent_td_tups:
- # This repository cannot be uninstalled because it contains installed tool dependencies that
- # are required at run time by other installed tool dependencies.
- return False
- return True
+ @property
+ def can_uninstall( self ):
+ return self.status != self.installation_status.UNINSTALLED
@property
def can_deactivate( self ):
@@ -564,9 +520,7 @@
@property
def can_uninstall( self ):
- # A tool dependency can be uninstalled only if it is currently in an error state. Only the containing
- # repository can be uninstalled if a tool dependency is properly installed.
- return self.status in [ self.installation_status.ERROR ]
+ return self.status in [ self.installation_status.ERROR, self.installation_status.INSTALLED ]
@property
def can_update( self ):
diff -r cef51275f59d72529d17769cfac6af572aeea679 -r ecdf7d468014e38739a054ef4d01b194a6ea681e lib/tool_shed/galaxy_install/grids/admin_toolshed_grids.py
--- a/lib/tool_shed/galaxy_install/grids/admin_toolshed_grids.py
+++ b/lib/tool_shed/galaxy_install/grids/admin_toolshed_grids.py
@@ -31,13 +31,6 @@
latest_revision_tip_str = ''
return '<img src="%s/june_2007_style/blue/ok_small.png" %s/>' % ( url_for( '/static' ), latest_revision_tip_str )
-def generate_repository_can_be_uninstalled_img_str( include_mouse_over=False ):
- if include_mouse_over:
- can_be_uninstalled_tip_str = 'class="icon-button" title="This repository can be uninstalled"'
- else:
- can_be_uninstalled_tip_str = ''
- return '<img src="%s/images/fugue/toggle-bw.png" %s/>' % ( url_for( '/static' ), can_be_uninstalled_tip_str )
-
def generate_revision_updates_img_str( include_mouse_over=False ):
if include_mouse_over:
revision_updates_tip_str = 'class="icon-button" title="Updates are available in the Tool Shed for this revision"'
@@ -80,8 +73,6 @@
tool_shed_status_str += generate_includes_workflows_img_str( include_mouse_over=True )
else:
tool_shed_status_str = generate_unknown_img_str( include_mouse_over=True )
- if tool_shed_repository.can_uninstall( trans.app ):
- tool_shed_status_str += generate_repository_can_be_uninstalled_img_str( include_mouse_over=True )
return tool_shed_status_str
@@ -245,7 +236,6 @@
legend_str += '%s This repository is deprecated in the Tool Shed<br/>' % generate_deprecated_repository_img_str()
legend_str += '%s This repository contains exported workflows<br/>' % generate_includes_workflows_img_str()
legend_str += '%s Unable to get information from the Tool Shed<br/>' % generate_unknown_img_str()
- legend_str += '%s This repository can be uninstalled<br/>' % generate_repository_can_be_uninstalled_img_str()
return legend_str
diff -r cef51275f59d72529d17769cfac6af572aeea679 -r ecdf7d468014e38739a054ef4d01b194a6ea681e templates/admin/tool_shed_repository/deactivate_or_uninstall_repository.mako
--- a/templates/admin/tool_shed_repository/deactivate_or_uninstall_repository.mako
+++ b/templates/admin/tool_shed_repository/deactivate_or_uninstall_repository.mako
@@ -38,21 +38,76 @@
<div class="form-row"><%
can_deactivate_repository = repository.can_deactivate
- can_uninstall_repository = repository.can_uninstall( trans.app )
+ can_uninstall_repository = repository.can_uninstall
%>
- %if can_deactivate_repository and can_uninstall_repository:
- <% deactivate_uninstall_button_text = "Deactivate or Uninstall" %>
- ${remove_from_disk_check_box.get_html()}
- <label for="repository" style="display: inline;font-weight:normal;">Check to uninstall or leave blank to deactivate</label>
- <br/><br/>
- %elif can_deactivate_repository:
- <% deactivate_uninstall_button_text = "Deactivate" %>
- %else:
- <% deactivate_uninstall_button_text = "Uninstall" %>
- ##hack to mimic check box
- <input type="hidden" name="remove_from_disk" value="true"/><input type="hidden" name="remove_from_disk" value="true"/>
+ %if can_deactivate_repository:
+ <table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td bgcolor="#D8D8D8">
+ <label>Deactivating this repository will result in the following:</label>
+ </td>
+ </tr>
+ </table>
+ <div class="toolParamHelp" style="clear: both;">
+ * The repository and all of it's contents will remain on disk and can still be used by dependent items.
+ </div>
+ %if repository.includes_tools_for_display_in_tool_panel:
+ <div class="toolParamHelp" style="clear: both;">
+ * The repository's tools will not be loaded into the tool panel.
+ </div>
+ %endif
+ %if repository.includes_tool_dependencies:
+ <div class="toolParamHelp" style="clear: both;">
+ * The repository's installed tool dependencies will remain on disk.
+ </div>
+ %endif
+ %if repository.includes_datatypes:
+ <div class="toolParamHelp" style="clear: both;">
+ * The repository's datatypes, datatype converters and display applications will be eliminated from the datatypes registry.
+ </div>
+ %endif
+ <div class="toolParamHelp" style="clear: both;">
+ * The repository record's deleted column in the tool_shed_repository database table will be set to True.
+ </div>
+ <br/>
%endif
- %if not can_uninstall_repository:
+ %if can_uninstall_repository:
+ <table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td bgcolor="#D8D8D8">
+ <label>Uninstalling this repository will result in the following:</label>
+ </td>
+ </tr>
+ </table>
+ <div class="toolParamHelp" style="clear: both;">
+ * The repository and all of it's contents will be removed from disk and can no longer be used by dependent items.
+ </div>
+ %if repository.includes_tools_for_display_in_tool_panel:
+ <div class="toolParamHelp" style="clear: both;">
+ * The repository's tool tag sets will be removed from the tool config file in which they are defined.
+ </div>
+ %endif
+ %if repository.includes_tool_dependencies:
+ <div class="toolParamHelp" style="clear: both;">
+ * The repository's installed tool dependencies will be removed from disk and can no longer be used by dependent items.
+ </div>
+ <div class="toolParamHelp" style="clear: both;">
+ * Each associated tool dependency record's status column in the tool_dependency database table will be set to 'Uninstalled'.
+ </div>
+ %endif
+ %if repository.includes_datatypes:
+ <div class="toolParamHelp" style="clear: both;">
+ * The repository's datatypes, datatype converters and display applications will be eliminated from the datatypes registry.
+ </div>
+ %endif
+ <div class="toolParamHelp" style="clear: both;">
+ * The repository record's deleted column in the tool_shed_repository database table will be set to True.
+ </div>
+ <div class="toolParamHelp" style="clear: both;">
+ * The repository record's uninstalled column in the tool_shed_repository database table will be set to True.
+ </div>
+ <div style="clear: both"></div>
+ <br/><%
from tool_shed.util.repository_dependency_util import get_repository_tuple_for_installed_repository_manager
from tool_shed.util.tool_dependency_util import get_tool_dependency_tuple_for_installed_repository_manager
@@ -80,7 +135,7 @@
<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td bgcolor="#D8D8D8">
- <label>This repository cannot be uninstalled because it is required by the following installed items:</label>
+ <label>Uninstalling this repository will affect the following dependent items:</label></td></tr></table>
@@ -116,77 +171,24 @@
<br/>
%endif
%endif
- %if can_deactivate_repository:
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td bgcolor="#D8D8D8">
- <label>Deactivating this repository will result in the following:</label>
- </td>
- </tr>
- </table>
- <div class="toolParamHelp" style="clear: both;">
- * The repository and all of it's contents will remain on disk.
- </div>
- %if repository.includes_tools_for_display_in_tool_panel:
- <div class="toolParamHelp" style="clear: both;">
- * The repository's tools will not be loaded into the tool panel.
- </div>
- %endif
- %if repository.includes_tool_dependencies:
- <div class="toolParamHelp" style="clear: both;">
- * The repository's installed tool dependencies will remain on disk.
- </div>
- %endif
- %if repository.includes_datatypes:
- <div class="toolParamHelp" style="clear: both;">
- * The repository's datatypes, datatype converters and display applications will be eliminated from the datatypes registry.
- </div>
- %endif
- <div class="toolParamHelp" style="clear: both;">
- * The repository record's deleted column in the tool_shed_repository database table will be set to True.
- </div>
- <br/>
- %endif
- %if can_uninstall_repository:
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td bgcolor="#D8D8D8">
- <label>Uninstalling this repository will result in the following:</label>
- </td>
- </tr>
- </table>
- <div class="toolParamHelp" style="clear: both;">
- * The repository and all of it's contents will be removed from disk.
- </div>
- %if repository.includes_tools_for_display_in_tool_panel:
- <div class="toolParamHelp" style="clear: both;">
- * The repository's tool tag sets will be removed from the tool config file in which they are defined.
- </div>
- %endif
- %if repository.includes_tool_dependencies:
- <div class="toolParamHelp" style="clear: both;">
- * The repository's installed tool dependencies will be removed from disk.
- </div>
- <div class="toolParamHelp" style="clear: both;">
- * Each associated tool dependency record's status column in the tool_dependency database table will be set to 'Uninstalled'.
- </div>
- %endif
- %if repository.includes_datatypes:
- <div class="toolParamHelp" style="clear: both;">
- * The repository's datatypes, datatype converters and display applications will be eliminated from the datatypes registry.
- </div>
- %endif
- <div class="toolParamHelp" style="clear: both;">
- * The repository record's deleted column in the tool_shed_repository database table will be set to True.
- </div>
- <div class="toolParamHelp" style="clear: both;">
- * The repository record's uninstalled column in the tool_shed_repository database table will be set to True.
- </div>
- <div style="clear: both"></div>
- <br/>
- %endif
</div><div class="form-row">
+ <%
+ can_deactivate_repository = repository.can_deactivate
+ can_uninstall_repository = repository.can_uninstall
+ %>
+ %if can_deactivate_repository and can_uninstall_repository:
+ <% deactivate_uninstall_button_text = "Deactivate or Uninstall" %>
+ ${remove_from_disk_check_box.get_html()}
+ <label for="repository" style="display: inline;font-weight:normal;">Check to uninstall or leave blank to deactivate</label>
+ <br/><br/>
+ %elif can_deactivate_repository:
+ <% deactivate_uninstall_button_text = "Deactivate" %>
+ %else:
+ <% deactivate_uninstall_button_text = "Uninstall" %>
+ ##hack to mimic check box
+ <input type="hidden" name="remove_from_disk" value="true"/><input type="hidden" name="remove_from_disk" value="true"/>
+ %endif
<input type="submit" name="deactivate_or_uninstall_repository_button" value="${deactivate_uninstall_button_text}"/></div></form>
diff -r cef51275f59d72529d17769cfac6af572aeea679 -r ecdf7d468014e38739a054ef4d01b194a6ea681e test/tool_shed/functional/test_1430_repair_installed_repository.py
--- a/test/tool_shed/functional/test_1430_repair_installed_repository.py
+++ b/test/tool_shed/functional/test_1430_repair_installed_repository.py
@@ -144,11 +144,11 @@
This is step 2 - Uninstall the filter_1430 repository.
'''
installed_repository = self.test_db_util.get_installed_repository_by_name_owner( 'filter_1430', common.test_user_1_name )
- strings_displayed = [ 'This repository cannot be uninstalled' ]
- strings_not_displayed = [ 'Check to uninstall' ]
- self.deactivate_repository( installed_repository,
- strings_displayed=strings_displayed,
- strings_not_displayed=strings_not_displayed )
+ strings_displayed = [ 'Uninstalling this repository will affect the following dependent items' ]
+ strings_not_displayed = []
+ self.uninstall_repository( installed_repository,
+ strings_displayed=strings_displayed,
+ strings_not_displayed=strings_not_displayed )
strings_not_displayed = [ 'filter_1430',
"Galaxy's filter tool for test 1430",
installed_repository.installed_changeset_revision ]
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: martenson: added option to omit ESC key binding in modal config, rephrased upload modal
by commits-noreply@bitbucket.org 20 Jan '14
by commits-noreply@bitbucket.org 20 Jan '14
20 Jan '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/cef51275f59d/
Changeset: cef51275f59d
User: martenson
Date: 2014-01-20 21:02:19
Summary: added option to omit ESC key binding in modal config, rephrased upload modal
Affected #: 4 files
diff -r df1029a34ad693954a0db452d57dfe6aeb563f86 -r cef51275f59d72529d17769cfac6af572aeea679 static/scripts/galaxy.modal.js
--- a/static/scripts/galaxy.modal.js
+++ b/static/scripts/galaxy.modal.js
@@ -25,8 +25,11 @@
// by default the modal cannot be removed by the self.destroy() method
// but only hidden through self.hide()
destructible: false,
+
// by default don't bind the events
- bindClosingEvents: false
+ bindClosingEvents: false,
+ // set false to ommit binding ESC key
+ bindEscKey: true,
},
// initialize
@@ -57,14 +60,15 @@
this.$el.fadeOut('fast');
},
- // bind the click-to-hide function
bindEvents: function() {
- // bind the ESC key to hideOrDestroy() function
- $(document).on('keyup', function(event){
- if (event.keyCode == 27) {
- self.hideOrDestroy()
- }
- })
+ if (self.options.bindEscKey){
+ // bind the ESC key to hideOrDestroy() function
+ $(document).on('keyup', function(event){
+ if (event.keyCode == 27) {
+ self.hideOrDestroy()
+ }
+ })
+ }
// bind the 'click anywhere' to hideOrDestroy() function...
$('html').on('click', self.hideOrDestroy)
// ...but don't hide if the click is on modal content
@@ -75,7 +79,6 @@
self.eventsBound = true;
},
- // unbind the click-to-hide function
unbindEvents: function(){
// unbind the ESC key to hideOrDestroy() function
$(document).off('keyup', function(event){
diff -r df1029a34ad693954a0db452d57dfe6aeb563f86 -r cef51275f59d72529d17769cfac6af572aeea679 static/scripts/mvc/upload/upload-view.js
--- a/static/scripts/mvc/upload/upload-view.js
+++ b/static/scripts/mvc/upload/upload-view.js
@@ -253,16 +253,17 @@
title : 'Download data directly from web or upload files from your disk',
body : this._template('upload-box', 'upload-info'),
buttons : {
- 'Choose file' : function() {self.uploadbox.select()},
- 'from URL' : function() {self._eventCreate()},
- 'Start' : function() {self._eventStart()},
- 'Pause' : function() {self._eventStop()},
- 'Reset' : function() {self._eventReset()},
- 'Close' : function() {self.modal.hide()},
+ 'Choose files' : function() {self.uploadbox.select()},
+ 'Create file' : function() {self._eventCreate()},
+ 'Start' : function() {self._eventStart()},
+ 'Pause' : function() {self._eventStop()},
+ 'Reset' : function() {self._eventReset()},
+ 'Close' : function() {self.modal.hide()},
},
- height : '400',
- width : '900',
- bindClosingEvents: true
+ height : '400',
+ width : '900',
+ bindClosingEvents : true,
+ bindEscKey : false
});
// set element
@@ -595,11 +596,11 @@
// select upload button
if (this.counter.running == 0)
{
- this.modal.enableButton('Choose file');
- this.modal.enableButton('from URL');
+ this.modal.enableButton('Choose files');
+ this.modal.enableButton('Create file');
} else {
- this.modal.disableButton('Choose file');
- this.modal.disableButton('from URL');
+ this.modal.disableButton('Choose files');
+ this.modal.disableButton('Create file');
}
// table visibility
diff -r df1029a34ad693954a0db452d57dfe6aeb563f86 -r cef51275f59d72529d17769cfac6af572aeea679 static/scripts/packed/galaxy.modal.js
--- a/static/scripts/packed/galaxy.modal.js
+++ b/static/scripts/packed/galaxy.modal.js
@@ -1,1 +1,1 @@
-define([],function(){var a=Backbone.View.extend({elMain:"#everything",optionsDefault:{title:"galaxy-modal",body:"",backdrop:true,height:null,width:null},eventsBound:false,options:{destructible:false,bindClosingEvents:false},initialize:function(b){self=this;if(b){this.create(b)}},hideOrDestroy:function(){self.visible=false;self.unbindEvents();if(self.options.destructible){self.$el.remove()}else{self.hide()}},hide:function(){this.visible=false;this.$el.fadeOut("fast")},bindEvents:function(){$(document).on("keyup",function(b){if(b.keyCode==27){self.hideOrDestroy()}});$("html").on("click",self.hideOrDestroy);$(".modal-content").on("click",function(b){b.stopPropagation()});self.eventsBound=true},unbindEvents:function(){$(document).off("keyup",function(b){if(b.keyCode==27){self.hideOrDestroy()}});$("html").off("click",function(b){self.hideOrDestroy()});$(".modal-content").off("click",function(b){b.stopPropagation()});self.eventsBound=false},show:function(b){this.initialize(b);if(this.options.height){this.$body.css("height",this.options.height);this.$body.css("overflow","hidden")}else{this.$body.css("max-height",$(window).height()/2)}if(this.options.width){this.$dialog.css("width",this.options.width)}if(this.visible){this.$el.show()}else{this.$el.fadeIn("fast")}this.visible=true},create:function(c){this.options=_.defaults(c,this.optionsDefault);if(this.options.body=="progress"){this.options.body=$('<div class="progress progress-striped active"><div class="progress-bar progress-bar-info" style="width:100%"></div></div>')}if(this.$el){this.$el.remove()}this.setElement(this.template(this.options.title));this.$dialog=(this.$el).find(".modal-dialog");this.$body=(this.$el).find(".modal-body");this.$footer=(this.$el).find(".modal-footer");this.$buttons=(this.$el).find(".buttons");this.$backdrop=(this.$el).find(".modal-backdrop");this.$body.html(this.options.body);if(!this.options.backdrop){this.$backdrop.removeClass("in")}if(this.options.buttons){var b=this;$.each(this.options.buttons,function(d,e){b.$buttons.append($('<button id="'+String(d).toLowerCase()+'"></button>').text(d).click(e)).append(" ")})}else{this.$footer.hide()}$(this.elMain).append($(this.el));if(this.options.bindClosingEvents&&!this.eventsBound){this.bindEvents()}},enableButton:function(b){this.$buttons.find("#"+String(b).toLowerCase()).prop("disabled",false)},disableButton:function(b){this.$buttons.find("#"+String(b).toLowerCase()).prop("disabled",true)},hideButton:function(b){this.$buttons.find("#"+String(b).toLowerCase()).hide()},showButton:function(b){this.$buttons.find("#"+String(b).toLowerCase()).show()},scrollTop:function(){return this.$body.scrollTop()},template:function(b){return'<div class="modal"><div class="modal-backdrop fade in" style="z-index: -1;"></div><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" style="display: none;">×</button><h4 class="title">'+b+'</h4></div><div class="modal-body"></div><div class="modal-footer"><div class="buttons" style="float: right;"></div></div></div</div></div>'}});return{GalaxyModal:a}});
\ No newline at end of file
+define([],function(){var a=Backbone.View.extend({elMain:"#everything",optionsDefault:{title:"galaxy-modal",body:"",backdrop:true,height:null,width:null},eventsBound:false,options:{destructible:false,bindClosingEvents:false,bindEscKey:true,},initialize:function(b){self=this;if(b){this.create(b)}},hideOrDestroy:function(){self.visible=false;self.unbindEvents();if(self.options.destructible){self.$el.remove()}else{self.hide()}},hide:function(){this.visible=false;this.$el.fadeOut("fast")},bindEvents:function(){if(self.options.bindEscKey){$(document).on("keyup",function(b){if(b.keyCode==27){self.hideOrDestroy()}})}$("html").on("click",self.hideOrDestroy);$(".modal-content").on("click",function(b){b.stopPropagation()});self.eventsBound=true},unbindEvents:function(){$(document).off("keyup",function(b){if(b.keyCode==27){self.hideOrDestroy()}});$("html").off("click",function(b){self.hideOrDestroy()});$(".modal-content").off("click",function(b){b.stopPropagation()});self.eventsBound=false},show:function(b){this.initialize(b);if(this.options.height){this.$body.css("height",this.options.height);this.$body.css("overflow","hidden")}else{this.$body.css("max-height",$(window).height()/2)}if(this.options.width){this.$dialog.css("width",this.options.width)}if(this.visible){this.$el.show()}else{this.$el.fadeIn("fast")}this.visible=true},create:function(c){this.options=_.defaults(c,this.optionsDefault);if(this.options.body=="progress"){this.options.body=$('<div class="progress progress-striped active"><div class="progress-bar progress-bar-info" style="width:100%"></div></div>')}if(this.$el){this.$el.remove()}this.setElement(this.template(this.options.title));this.$dialog=(this.$el).find(".modal-dialog");this.$body=(this.$el).find(".modal-body");this.$footer=(this.$el).find(".modal-footer");this.$buttons=(this.$el).find(".buttons");this.$backdrop=(this.$el).find(".modal-backdrop");this.$body.html(this.options.body);if(!this.options.backdrop){this.$backdrop.removeClass("in")}if(this.options.buttons){var b=this;$.each(this.options.buttons,function(d,e){b.$buttons.append($('<button id="'+String(d).toLowerCase()+'"></button>').text(d).click(e)).append(" ")})}else{this.$footer.hide()}$(this.elMain).append($(this.el));if(this.options.bindClosingEvents&&!this.eventsBound){this.bindEvents()}},enableButton:function(b){this.$buttons.find("#"+String(b).toLowerCase()).prop("disabled",false)},disableButton:function(b){this.$buttons.find("#"+String(b).toLowerCase()).prop("disabled",true)},hideButton:function(b){this.$buttons.find("#"+String(b).toLowerCase()).hide()},showButton:function(b){this.$buttons.find("#"+String(b).toLowerCase()).show()},scrollTop:function(){return this.$body.scrollTop()},template:function(b){return'<div class="modal"><div class="modal-backdrop fade in" style="z-index: -1;"></div><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" style="display: none;">×</button><h4 class="title">'+b+'</h4></div><div class="modal-body"></div><div class="modal-footer"><div class="buttons" style="float: right;"></div></div></div</div></div>'}});return{GalaxyModal:a}});
\ No newline at end of file
diff -r df1029a34ad693954a0db452d57dfe6aeb563f86 -r cef51275f59d72529d17769cfac6af572aeea679 static/scripts/packed/mvc/upload/upload-view.js
--- a/static/scripts/packed/mvc/upload/upload-view.js
+++ b/static/scripts/packed/mvc/upload/upload-view.js
@@ -1,1 +1,1 @@
-define(["galaxy.modal","utils/utils","mvc/upload/upload-model","mvc/upload/upload-row","mvc/ui","utils/uploadbox"],function(c,f,e,d){var b=Backbone.Model.extend({defaults:{percentage:0,icon:"fa-circle",label:"",status:""}});var a=Backbone.View.extend({model:null,initialize:function(h){var g=this;this.model=h;this.options=this.model.attributes;this.setElement(this._template(this.options));$(this.el).on("click",this.options.onclick);if(this.options.tooltip){$(this.el).tooltip({title:this.options.tooltip,placement:"bottom"})}this.model.on("change:percentage",function(){g._percentage(g.model.get("percentage"))});this.model.on("change:status",function(){g._status(g.model.get("status"))});var g=this;$(window).on("beforeunload",function(){var i="";if(g.options.onunload){i=g.options.onunload()}if(i!=""){return i}})},_status:function(h){var g=this.$el.find(".progress-bar");g.removeClass();g.addClass("progress-bar");g.addClass("progress-bar-notransition");if(h!=""){g.addClass("progress-bar-"+h)}},_percentage:function(h){var g=this.$el.find(".progress-bar");g.css({width:h+"%"})},_template:function(g){return'<div class="progress-button"><div class="progress"><div class="progress-bar"></div></div><div id="label" class="label" style="position: absolute; top: 0px; width: inherit; text-align: center;"><div class="fa '+g.icon+'"></div> '+g.label+"</div></div>"}});return Backbone.View.extend({modal:null,button_show:null,uploadbox:null,current_history:null,upload_size:0,select_extension:[["Auto-detect","auto"]],select_genome:[["Unspecified (?)","?"]],collection:new e.Collection(),counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},options:{nginx_upload_path:""},initialize:function(h){var g=this;if(!Galaxy.currHistoryPanel){window.setTimeout(function(){g.initialize()},500);return}if(!Galaxy.currUser.get("id")){return}this.button_show=new b({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(i){if(i){g._eventShow(i)}},onunload:function(){if(g.counter.running>0){return"Several uploads are still processing."}}});$("#left .unified-panel-header-inner").append((new a(this.button_show)).$el);var g=this;f.jsonFromUrl(galaxy_config.root+"api/datatypes",function(i){for(key in i){g.select_extension.push([i[key],i[key]])}});f.jsonFromUrl(galaxy_config.root+"api/genomes",function(i){var j=g.select_genome[0];g.select_genome=[];for(key in i){if(i[key].length>1){if(i[key][1]!==j[1]){g.select_genome.push(i[key])}}}g.select_genome.sort(function(l,k){return l[0]>k[0]?1:l[0]<k[0]?-1:0});g.select_genome.unshift(j)});if(h){this.options=_.defaults(h,this.options)}this.collection.on("remove",function(i){g._eventRemove(i)});this.collection.on("change:genome",function(j){var i=j.get("genome");g.collection.each(function(k){if(k.get("status")=="init"&&k.get("genome")=="?"){k.set("genome",i)}})})},_eventShow:function(h){h.preventDefault();h.stopPropagation();if(!this.modal){var g=this;this.modal=new c.GalaxyModal({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose file":function(){g.uploadbox.select()},"from URL":function(){g._eventCreate()},Start:function(){g._eventStart()},Pause:function(){g._eventStop()},Reset:function(){g._eventReset()},Close:function(){g.modal.hide()},},height:"400",width:"900",bindClosingEvents:true});this.setElement("#upload-box");var g=this;this.uploadbox=this.$el.uploadbox({announce:function(i,j,k){g._eventAnnounce(i,j,k)},initialize:function(i,j,k){return g._eventInitialize(i,j,k)},progress:function(i,j,k){g._eventProgress(i,j,k)},success:function(i,j,k){g._eventSuccess(i,j,k)},error:function(i,j,k){g._eventError(i,j,k)},complete:function(){g._eventComplete()}});this._updateScreen()}this.modal.show()},_eventRemove:function(h){var g=h.get("status");if(g=="success"){this.counter.success--}else{if(g=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(h.id)},_eventAnnounce:function(g,h,j){this.counter.announce++;this._updateScreen();var i=new d(this,{id:g,file_name:h.name,file_size:h.size});this.collection.add(i.model);$(this.el).find("tbody:last").append(i.$el);i.render()},_eventInitialize:function(k,g,o){var i=this.collection.get(k);i.set("status","running");var h=i.get("extension");var l=i.get("file_name");var n=i.get("genome");var m=i.get("url_paste");var j=i.get("space_to_tabs");if(!m&&!(g.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path,paramname:"files_0|file_data"});tool_input={};tool_input.dbkey=n;tool_input.file_type=h;tool_input["files_0|NAME"]=l;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|url_paste"]=m;tool_input.space_to_tabs=j;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(h,i,g){var j=this.collection.get(h);j.set("percentage",g);this.button_show.set("percentage",this._upload_percentage(g,i.size))},_eventSuccess:function(h,i,k){var j=this.collection.get(h);j.set("status","success");var g=j.get("file_size");this.button_show.set("percentage",this._upload_percentage(100,g));this.upload_completed+=g*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshHdas()},_eventError:function(g,h,j){var i=this.collection.get(g);i.set("status","error");i.set("info",j);this.button_show.set("percentage",this._upload_percentage(100,h.size));this.button_show.set("status","danger");this.upload_completed+=h.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(g){if(g.get("status")=="queued"){g.set("status","init")}});this.counter.running=0;this._updateScreen()},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:-1}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0){return}var g=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(h){if(h.get("status")=="init"){h.set("status","queued");g.upload_size+=h.get("file_size")}});this.button_show.set("percentage",0);this.button_show.set("status","success");this.current_history=Galaxy.currHistoryPanel.model.get("id");this.counter.running=this.counter.announce;this._updateScreen();this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0){return}this.button_show.set("status","info");this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){if(this.counter.running==0){this.collection.reset();this.counter.reset();this._updateScreen();this.uploadbox.reset();this.button_show.set("percentage",0)}},_updateScreen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="You can Drag & Drop files into this box."}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Start")}else{this.modal.disableButton("Start")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Choose file");this.modal.enableButton("from URL")}else{this.modal.disableButton("Choose file");this.modal.disableButton("from URL")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("table").show()}else{$(this.el).find("table").hide()}},_upload_percentage:function(g,h){return(this.upload_completed+(g*h))/this.upload_size},_template:function(h,g){return'<div id="'+h+'" class="upload-box"><table class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Space→Tab</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+g+'" class="upload-info"></h6>'}})});
\ No newline at end of file
+define(["galaxy.modal","utils/utils","mvc/upload/upload-model","mvc/upload/upload-row","mvc/ui","utils/uploadbox"],function(c,f,e,d){var b=Backbone.Model.extend({defaults:{percentage:0,icon:"fa-circle",label:"",status:""}});var a=Backbone.View.extend({model:null,initialize:function(h){var g=this;this.model=h;this.options=this.model.attributes;this.setElement(this._template(this.options));$(this.el).on("click",this.options.onclick);if(this.options.tooltip){$(this.el).tooltip({title:this.options.tooltip,placement:"bottom"})}this.model.on("change:percentage",function(){g._percentage(g.model.get("percentage"))});this.model.on("change:status",function(){g._status(g.model.get("status"))});var g=this;$(window).on("beforeunload",function(){var i="";if(g.options.onunload){i=g.options.onunload()}if(i!=""){return i}})},_status:function(h){var g=this.$el.find(".progress-bar");g.removeClass();g.addClass("progress-bar");g.addClass("progress-bar-notransition");if(h!=""){g.addClass("progress-bar-"+h)}},_percentage:function(h){var g=this.$el.find(".progress-bar");g.css({width:h+"%"})},_template:function(g){return'<div class="progress-button"><div class="progress"><div class="progress-bar"></div></div><div id="label" class="label" style="position: absolute; top: 0px; width: inherit; text-align: center;"><div class="fa '+g.icon+'"></div> '+g.label+"</div></div>"}});return Backbone.View.extend({modal:null,button_show:null,uploadbox:null,current_history:null,upload_size:0,select_extension:[["Auto-detect","auto"]],select_genome:[["Unspecified (?)","?"]],collection:new e.Collection(),counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},options:{nginx_upload_path:""},initialize:function(h){var g=this;if(!Galaxy.currHistoryPanel){window.setTimeout(function(){g.initialize()},500);return}if(!Galaxy.currUser.get("id")){return}this.button_show=new b({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(i){if(i){g._eventShow(i)}},onunload:function(){if(g.counter.running>0){return"Several uploads are still processing."}}});$("#left .unified-panel-header-inner").append((new a(this.button_show)).$el);var g=this;f.jsonFromUrl(galaxy_config.root+"api/datatypes",function(i){for(key in i){g.select_extension.push([i[key],i[key]])}});f.jsonFromUrl(galaxy_config.root+"api/genomes",function(i){var j=g.select_genome[0];g.select_genome=[];for(key in i){if(i[key].length>1){if(i[key][1]!==j[1]){g.select_genome.push(i[key])}}}g.select_genome.sort(function(l,k){return l[0]>k[0]?1:l[0]<k[0]?-1:0});g.select_genome.unshift(j)});if(h){this.options=_.defaults(h,this.options)}this.collection.on("remove",function(i){g._eventRemove(i)});this.collection.on("change:genome",function(j){var i=j.get("genome");g.collection.each(function(k){if(k.get("status")=="init"&&k.get("genome")=="?"){k.set("genome",i)}})})},_eventShow:function(h){h.preventDefault();h.stopPropagation();if(!this.modal){var g=this;this.modal=new c.GalaxyModal({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose files":function(){g.uploadbox.select()},"Create file":function(){g._eventCreate()},Start:function(){g._eventStart()},Pause:function(){g._eventStop()},Reset:function(){g._eventReset()},Close:function(){g.modal.hide()},},height:"400",width:"900",bindClosingEvents:true,bindEscKey:false});this.setElement("#upload-box");var g=this;this.uploadbox=this.$el.uploadbox({announce:function(i,j,k){g._eventAnnounce(i,j,k)},initialize:function(i,j,k){return g._eventInitialize(i,j,k)},progress:function(i,j,k){g._eventProgress(i,j,k)},success:function(i,j,k){g._eventSuccess(i,j,k)},error:function(i,j,k){g._eventError(i,j,k)},complete:function(){g._eventComplete()}});this._updateScreen()}this.modal.show()},_eventRemove:function(h){var g=h.get("status");if(g=="success"){this.counter.success--}else{if(g=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(h.id)},_eventAnnounce:function(g,h,j){this.counter.announce++;this._updateScreen();var i=new d(this,{id:g,file_name:h.name,file_size:h.size});this.collection.add(i.model);$(this.el).find("tbody:last").append(i.$el);i.render()},_eventInitialize:function(k,g,o){var i=this.collection.get(k);i.set("status","running");var h=i.get("extension");var l=i.get("file_name");var n=i.get("genome");var m=i.get("url_paste");var j=i.get("space_to_tabs");if(!m&&!(g.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path,paramname:"files_0|file_data"});tool_input={};tool_input.dbkey=n;tool_input.file_type=h;tool_input["files_0|NAME"]=l;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|url_paste"]=m;tool_input.space_to_tabs=j;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(h,i,g){var j=this.collection.get(h);j.set("percentage",g);this.button_show.set("percentage",this._upload_percentage(g,i.size))},_eventSuccess:function(h,i,k){var j=this.collection.get(h);j.set("status","success");var g=j.get("file_size");this.button_show.set("percentage",this._upload_percentage(100,g));this.upload_completed+=g*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshHdas()},_eventError:function(g,h,j){var i=this.collection.get(g);i.set("status","error");i.set("info",j);this.button_show.set("percentage",this._upload_percentage(100,h.size));this.button_show.set("status","danger");this.upload_completed+=h.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(g){if(g.get("status")=="queued"){g.set("status","init")}});this.counter.running=0;this._updateScreen()},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:-1}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0){return}var g=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(h){if(h.get("status")=="init"){h.set("status","queued");g.upload_size+=h.get("file_size")}});this.button_show.set("percentage",0);this.button_show.set("status","success");this.current_history=Galaxy.currHistoryPanel.model.get("id");this.counter.running=this.counter.announce;this._updateScreen();this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0){return}this.button_show.set("status","info");this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){if(this.counter.running==0){this.collection.reset();this.counter.reset();this._updateScreen();this.uploadbox.reset();this.button_show.set("percentage",0)}},_updateScreen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="You can Drag & Drop files into this box."}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Start")}else{this.modal.disableButton("Start")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Choose files");this.modal.enableButton("Create file")}else{this.modal.disableButton("Choose files");this.modal.disableButton("Create file")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("table").show()}else{$(this.el).find("table").hide()}},_upload_percentage:function(g,h){return(this.upload_completed+(g*h))/this.upload_size},_template:function(h,g){return'<div id="'+h+'" class="upload-box"><table class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Space→Tab</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+g+'" class="upload-info"></h6>'}})});
\ No newline at end of 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: martenson: upload button and modal tweaks, mostly labels, binding of closing events
by commits-noreply@bitbucket.org 20 Jan '14
by commits-noreply@bitbucket.org 20 Jan '14
20 Jan '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/df1029a34ad6/
Changeset: df1029a34ad6
User: martenson
Date: 2014-01-20 20:19:48
Summary: upload button and modal tweaks, mostly labels, binding of closing events
Affected #: 7 files
diff -r 99f5d55b02a26e2e3af2936888820fcd91f7c945 -r df1029a34ad693954a0db452d57dfe6aeb563f86 static/scripts/mvc/upload/upload-row.js
--- a/static/scripts/mvc/upload/upload-row.js
+++ b/static/scripts/mvc/upload/upload-row.js
@@ -238,7 +238,7 @@
'<div style="position: relative;">' +
'<div id="title" class="title"></div>' +
'<div id="text" class="text">' +
- '<div class="text-info">You may specify a list of URLs (one per line) or paste the contents of a file.</div>' +
+ '<div class="text-info">You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.</div>' +
'<textarea id="text-content" class="text-content form-control"></textarea>' +
'</div>' +
'</div>' +
diff -r 99f5d55b02a26e2e3af2936888820fcd91f7c945 -r df1029a34ad693954a0db452d57dfe6aeb563f86 static/scripts/mvc/upload/upload-view.js
--- a/static/scripts/mvc/upload/upload-view.js
+++ b/static/scripts/mvc/upload/upload-view.js
@@ -165,8 +165,8 @@
// create model
this.button_show = new ProgressButtonModel({
icon : 'fa-upload',
- tooltip : 'Upload files',
- label : 'Upload',
+ tooltip : 'Download from URL or upload files from disk',
+ label : 'Load Data',
onclick : function(e) {
if (e) {
self._eventShow(e)
@@ -240,6 +240,8 @@
{
// prevent default
e.preventDefault();
+ // stop propagation of event (for click-outside-of-modal-to-close functionality)
+ e.stopPropagation();
// create modal
if (!this.modal)
@@ -248,18 +250,19 @@
var self = this;
this.modal = new Modal.GalaxyModal(
{
- title : 'Upload files from your local drive',
+ title : 'Download data directly from web or upload files from your disk',
body : this._template('upload-box', 'upload-info'),
buttons : {
- 'Select' : function() {self.uploadbox.select()},
- 'Create' : function() {self._eventCreate()},
- 'Upload' : function() {self._eventStart()},
+ 'Choose file' : function() {self.uploadbox.select()},
+ 'from URL' : function() {self._eventCreate()},
+ 'Start' : function() {self._eventStart()},
'Pause' : function() {self._eventStop()},
'Reset' : function() {self._eventReset()},
'Close' : function() {self.modal.hide()},
},
height : '400',
- width : '900'
+ width : '900',
+ bindClosingEvents: true
});
// set element
@@ -554,12 +557,12 @@
if(this.counter.announce == 0)
{
if (this.uploadbox.compatible())
- message = 'Drag&drop files into this box or click \'Select\' to select files!';
+ message = 'You can Drag & Drop files into this box.';
else
- message = 'Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Please upgrade to i.e. Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+.'
+ message = 'Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+.'
} else {
if (this.counter.running == 0)
- message = 'You added ' + this.counter.announce + ' file(s) to the queue. Add more files or click \'Upload\' to proceed.';
+ message = 'You added ' + this.counter.announce + ' file(s) to the queue. Add more files or click \'Start\' to proceed.';
else
message = 'Please wait...' + this.counter.announce + ' out of ' + this.counter.running + ' remaining.';
}
@@ -579,9 +582,9 @@
// update upload button
if (this.counter.running == 0 && this.counter.announce > 0)
- this.modal.enableButton('Upload');
+ this.modal.enableButton('Start');
else
- this.modal.disableButton('Upload');
+ this.modal.disableButton('Start');
// pause upload button
if (this.counter.running > 0)
@@ -592,11 +595,11 @@
// select upload button
if (this.counter.running == 0)
{
- this.modal.enableButton('Select');
- this.modal.enableButton('Create');
+ this.modal.enableButton('Choose file');
+ this.modal.enableButton('from URL');
} else {
- this.modal.disableButton('Select');
- this.modal.disableButton('Create');
+ this.modal.disableButton('Choose file');
+ this.modal.disableButton('from URL');
}
// table visibility
diff -r 99f5d55b02a26e2e3af2936888820fcd91f7c945 -r df1029a34ad693954a0db452d57dfe6aeb563f86 static/scripts/packed/galaxy.masthead.js
--- a/static/scripts/packed/galaxy.masthead.js
+++ b/static/scripts/packed/galaxy.masthead.js
@@ -1,1 +1,1 @@
-define([],function(){var a=Backbone.View.extend({el_masthead:"#everything",options:null,$background:null,list:[],initialize:function(e){this.options=e;$("body").off();this.setElement($(this._template(e)));$(this.el_masthead).append($(this.el));this.$background=$(this.el).find("#masthead-background");var d=this;$(window).on("beforeunload",function(){var g="";for(key in d.list){if(d.list[key].options.onunload){var f=d.list[key].options.onunload();if(f){g+=f+" "}}}if(g!=""){return g}})},events:{click:"_click",mousedown:function(d){d.preventDefault()}},append:function(d){return this._add(d,true)},prepend:function(d){return this._add(d,false)},highlight:function(e){var d=$(this.el).find("#"+e+"> li");if(d){d.addClass("active")}},_add:function(g,e){var d=$(this.el).find("#"+g.location);if(d){var f=$(g.el);f.addClass("masthead-item");if(e){d.append(f)}else{d.prepend(f)}this.list.push(g)}return null},_click:function(g){var f=$(this.el).find(".popup");if(f){f.hide()}var d=$(g.target).closest(".masthead-item").find(".popup");if($(g.target).hasClass("head")){d.show();this.$background.show()}else{this.$background.hide()}},_template:function(d){return'<div><div id="masthead" class="navbar navbar-fixed-top navbar-inverse"><div style="position: relative; right: -50%; float: left;"><div id="navbar" style="display: block; position: relative; right: 50%;"></div></div><div class="navbar-brand"><a href="'+d.logo_url+'"><img border="0" src="'+galaxy_config.root+'static/images/galaxyIcon_noText.png"><span id="brand"> Galaxy '+d.brand+'</span></a></div><div class="quota-meter-container"></div><div id="iconbar" class="iconbar"></div></div><div id="masthead-background" style="display: none; position: absolute; top: 33px; width: 100%; height: 100%; z-index: 1010"></div></div>'}});var b=Backbone.View.extend({options:{id:"",icon:"fa-cog",tooltip:"",with_number:false,onclick:function(){alert("clicked")},onunload:null,visible:true},location:"iconbar",initialize:function(e){if(e){this.options=_.defaults(e,this.options)}this.setElement($(this._template(this.options)));var d=this;$(this.el).find(".icon").tooltip({title:this.options.tooltip,placement:"bottom"}).on("mouseup",d.options.onclick);if(!this.options.visible){this.hide()}},show:function(){$(this.el).css({visibility:"visible"})},hide:function(){$(this.el).css({visibility:"hidden"})},icon:function(d){$(this.el).find(".icon").removeClass(this.options.icon).addClass(d);this.options.icon=d},toggle:function(){$(this.el).addClass("toggle")},untoggle:function(){$(this.el).removeClass("toggle")},number:function(d){$(this.el).find(".number").text(d)},_template:function(e){var d='<div id="'+e.id+'" class="symbol"><div class="icon fa fa-2x '+e.icon+'"></div>';if(e.with_number){d+='<div class="number"></div>'}d+="</div>";return d}});var c=Backbone.View.extend({options:{id:"",title:"",target:"_parent",content:"",type:"url",scratchbook:false,onunload:null,visible:true,disabled:false,title_attribute:""},location:"navbar",$menu:null,events:{"click .head":"_head"},initialize:function(d){if(d){this.options=_.defaults(d,this.options)}if(this.options.content&&this.options.content.indexOf("//")===-1){this.options.content=galaxy_config.root+this.options.content}this.setElement($(this._template(this.options)));if(this.options.disabled){$(this.el).find(".root").addClass("disabled");this._attachPopover()}if(!this.options.visible){this.hide()}},show:function(){$(this.el).css({visibility:"visible"})},hide:function(){$(this.el).css({visibility:"hidden"})},add:function(f){var g={title:"Title",content:"",type:"url",target:"_parent",scratchbook:false,divider:false};if(f){g=_.defaults(f,g)}if(g.content&&g.content.indexOf("//")===-1){g.content=galaxy_config.root+g.content}if(!this.$menu){$(this.el).find(".root").append(this._templateMenu());$(this.el).find(".symbol").addClass("caret");this.$menu=$(this.el).find(".popup")}var e=$(this._templateMenuItem(g));this.$menu.append(e);var d=this;e.on("click",function(h){h.preventDefault();if(d.options.target==="_blank"){return true}Galaxy.frame.add(f)});if(g.divider){this.$menu.append($(this._templateDivider()))}},_head:function(d){d.preventDefault();if(this.options.disabled){return}if(!this.$menu){Galaxy.frame.add(this.options)}},_attachPopover:function(){var d=$(this.el).find(".head");d.popover({html:true,content:'Please <a href="/user/login">log in</a> or <a href="/user/create">register</a> to use this feature.',placement:"bottom"}).on("shown.bs.popover",function(){setTimeout(function(){d.popover("hide")},5000)})},_templateMenuItem:function(d){return'<li><a href="'+d.content+'" target="'+d.target+'">'+d.title+"</a></li>"},_templateMenu:function(){return'<ul class="popup dropdown-menu"></ul>'},_templateDivider:function(){return'<li class="divider"></li>'},_template:function(e){var d='<ul id="'+e.id+'" class="nav navbar-nav" border="0" cellspacing="0"><li class="root dropdown" style=""><a class="head dropdown-toggle" data-toggle="dropdown" target="'+e.target+'" href="'+e.content+'" title="'+e.title_attribute+'">'+e.title+'<b class="symbol"></b></a></li></ul>';return d}});return{GalaxyMasthead:a,GalaxyMastheadTab:c,GalaxyMastheadIcon:b}});
\ No newline at end of file
+define([],function(){var a=Backbone.View.extend({el_masthead:"#everything",options:null,$background:null,list:[],initialize:function(e){this.options=e;$("body").off();this.setElement($(this._template(e)));$(this.el_masthead).append($(this.el));this.$background=$(this.el).find("#masthead-background");var d=this;$(window).on("beforeunload",function(){var g="";for(key in d.list){if(d.list[key].options.onunload){var f=d.list[key].options.onunload();if(f){g+=f+" "}}}if(g!=""){return g}})},events:{click:"_click",mousedown:function(d){d.preventDefault()}},append:function(d){return this._add(d,true)},prepend:function(d){return this._add(d,false)},highlight:function(e){var d=$(this.el).find("#"+e+"> li");if(d){d.addClass("active")}},_add:function(g,e){var d=$(this.el).find("#"+g.location);if(d){var f=$(g.el);f.addClass("masthead-item");if(e){d.append(f)}else{d.prepend(f)}this.list.push(g)}return null},_click:function(g){var f=$(this.el).find(".popup");if(f){f.hide()}var d=$(g.target).closest(".masthead-item").find(".popup");if($(g.target).hasClass("head")){d.show();this.$background.show()}else{this.$background.hide()}},_template:function(d){var e=d.brand?("/ "+d.brand):"";return'<div><div id="masthead" class="navbar navbar-fixed-top navbar-inverse"><div style="position: relative; right: -50%; float: left;"><div id="navbar" style="display: block; position: relative; right: 50%;"></div></div><div class="navbar-brand"><a href="'+d.logo_url+'"><img border="0" src="'+galaxy_config.root+'static/images/galaxyIcon_noText.png"><span id="brand"> Galaxy '+e+'</span></a></div><div class="quota-meter-container"></div><div id="iconbar" class="iconbar"></div></div><div id="masthead-background" style="display: none; position: absolute; top: 33px; width: 100%; height: 100%; z-index: 1010"></div></div>'}});var b=Backbone.View.extend({options:{id:"",icon:"fa-cog",tooltip:"",with_number:false,onclick:function(){alert("clicked")},onunload:null,visible:true},location:"iconbar",initialize:function(e){if(e){this.options=_.defaults(e,this.options)}this.setElement($(this._template(this.options)));var d=this;$(this.el).find(".icon").tooltip({title:this.options.tooltip,placement:"bottom"}).on("mouseup",d.options.onclick);if(!this.options.visible){this.hide()}},show:function(){$(this.el).css({visibility:"visible"})},hide:function(){$(this.el).css({visibility:"hidden"})},icon:function(d){$(this.el).find(".icon").removeClass(this.options.icon).addClass(d);this.options.icon=d},toggle:function(){$(this.el).addClass("toggle")},untoggle:function(){$(this.el).removeClass("toggle")},number:function(d){$(this.el).find(".number").text(d)},_template:function(e){var d='<div id="'+e.id+'" class="symbol"><div class="icon fa fa-2x '+e.icon+'"></div>';if(e.with_number){d+='<div class="number"></div>'}d+="</div>";return d}});var c=Backbone.View.extend({options:{id:"",title:"",target:"_parent",content:"",type:"url",scratchbook:false,onunload:null,visible:true,disabled:false,title_attribute:""},location:"navbar",$menu:null,events:{"click .head":"_head"},initialize:function(d){if(d){this.options=_.defaults(d,this.options)}if(this.options.content&&this.options.content.indexOf("//")===-1){this.options.content=galaxy_config.root+this.options.content}this.setElement($(this._template(this.options)));if(this.options.disabled){$(this.el).find(".root").addClass("disabled");this._attachPopover()}if(!this.options.visible){this.hide()}},show:function(){$(this.el).css({visibility:"visible"})},hide:function(){$(this.el).css({visibility:"hidden"})},add:function(f){var g={title:"Title",content:"",type:"url",target:"_parent",scratchbook:false,divider:false};if(f){g=_.defaults(f,g)}if(g.content&&g.content.indexOf("//")===-1){g.content=galaxy_config.root+g.content}if(!this.$menu){$(this.el).find(".root").append(this._templateMenu());$(this.el).find(".symbol").addClass("caret");this.$menu=$(this.el).find(".popup")}var e=$(this._templateMenuItem(g));this.$menu.append(e);var d=this;e.on("click",function(h){h.preventDefault();if(d.options.target==="_blank"){return true}Galaxy.frame.add(f)});if(g.divider){this.$menu.append($(this._templateDivider()))}},_head:function(d){d.preventDefault();if(this.options.disabled){return}if(!this.$menu){Galaxy.frame.add(this.options)}},_attachPopover:function(){var d=$(this.el).find(".head");d.popover({html:true,content:'Please <a href="/user/login">log in</a> or <a href="/user/create">register</a> to use this feature.',placement:"bottom"}).on("shown.bs.popover",function(){setTimeout(function(){d.popover("hide")},5000)})},_templateMenuItem:function(d){return'<li><a href="'+d.content+'" target="'+d.target+'">'+d.title+"</a></li>"},_templateMenu:function(){return'<ul class="popup dropdown-menu"></ul>'},_templateDivider:function(){return'<li class="divider"></li>'},_template:function(e){var d='<ul id="'+e.id+'" class="nav navbar-nav" border="0" cellspacing="0"><li class="root dropdown" style=""><a class="head dropdown-toggle" data-toggle="dropdown" target="'+e.target+'" href="'+e.content+'" title="'+e.title_attribute+'">'+e.title+'<b class="symbol"></b></a></li></ul>';return d}});return{GalaxyMasthead:a,GalaxyMastheadTab:c,GalaxyMastheadIcon:b}});
\ No newline at end of file
diff -r 99f5d55b02a26e2e3af2936888820fcd91f7c945 -r df1029a34ad693954a0db452d57dfe6aeb563f86 static/scripts/packed/mvc/upload/upload-row.js
--- a/static/scripts/packed/mvc/upload/upload-row.js
+++ b/static/scripts/packed/mvc/upload/upload-row.js
@@ -1,1 +1,1 @@
-define(["mvc/upload/upload-model"],function(a){return Backbone.View.extend({options:{padding:8},status_classes:{init:"symbol fa fa-trash-o",queued:"symbol fa fa-spinner fa-spin",running:"symbol fa fa-spinner fa-spin",success:"symbol fa fa-check",error:"symbol fa fa-exclamation-triangle"},initialize:function(e,c){this.app=e;var b=this;this.model=new a.Model(c);this.setElement(this._template(c));var d=this.$el;d.find("#symbol").on("click",function(){var f=b.model.get("status");if(f=="init"||f=="success"||f=="error"){b.app.collection.remove(b.model)}});d.find("#text-content").on("keyup",function(){var f=d.find("#text-content");var h=f.val();var g=h.length;d.find("#size").html(b._formatSize(g));b.model.set("url_paste",h);b.model.set("file_size",g)});d.find("#genome").on("change",function(f){b.model.set("genome",$(f.target).val())});d.find("#extension").on("change",function(f){b.model.set("extension",$(f.target).val())});d.find("#space_to_tabs").on("change",function(f){b.model.set("space_to_tabs",$(f.target).prop("checked"))});this.model.on("change:percentage",function(){b._refreshPercentage()});this.model.on("change:status",function(){b._refreshStatus()});this.model.on("change:info",function(){b._refreshInfo()});this.model.on("change:genome",function(){b._refreshGenome()});this.model.on("remove",function(){b.remove()});this.app.collection.on("reset",function(){b.remove()})},render:function(){var h=this.model.get("file_name");var c=this.model.get("file_size");var e=this.$el;e.find("#title").html(h);e.find("#size").html(this._formatSize(c));if(c==-1){var g=e.find("#text");var f=this.options.padding;var d=e.width()-2*f;var b=e.height()-f;g.css("width",d+"px");g.css("top",b+"px");e.height(b+g.height()+2*f);g.show()}},_refreshGenome:function(){var b=this.model.get("genome");this.$el.find("#genome").val(b)},_refreshInfo:function(){var b=this.model.get("info");if(b){this.$el.find("#info").html("<strong>Failed: </strong>"+b).show()}else{this.$el.find("#info").hide()}},_refreshPercentage:function(){var b=parseInt(this.model.get("percentage"));this.$el.find(".progress-bar").css({width:b+"%"});if(b!=100){this.$el.find("#percentage").html(b+"%")}else{this.$el.find("#percentage").html("Adding to history...")}},_refreshStatus:function(){var c=this.$el;var b=this.model.get("status");var e=this.status_classes[b];var d=this.$el.find("#symbol");d.removeClass();d.addClass(e);if(b=="init"){c.find("#text-content").attr("disabled",false);c.find("#genome").attr("disabled",false);c.find("#extension").attr("disabled",false);c.find("#space_to_tabs").attr("disabled",false)}else{c.find("#text-content").attr("disabled",true);c.find("#genome").attr("disabled",true);c.find("#extension").attr("disabled",true);c.find("#space_to_tabs").attr("disabled",true)}if(b=="success"){c.addClass("success");c.find("#percentage").html("100%")}if(b=="error"){c.addClass("danger");c.find(".progress").remove()}},_formatSize:function(b){var c="";if(b>=100000000000){b=b/100000000000;c="TB"}else{if(b>=100000000){b=b/100000000;c="GB"}else{if(b>=100000){b=b/100000;c="MB"}else{if(b>=100){b=b/100;c="KB"}else{if(b>0){b=b*10;c="b"}else{return"<strong>-</strong>"}}}}}return"<strong>"+(Math.round(b)/10)+"</strong> "+c},_template:function(d){var c=this;var b='<tr id="upload-item-'+d.id+'" class="upload-item"><td><div style="position: relative;"><div id="title" class="title"></div><div id="text" class="text"><div class="text-info">You may specify a list of URLs (one per line) or paste the contents of a file.</div><textarea id="text-content" class="text-content form-control"></textarea></div></div></td><td><div id="size" class="size"></div></td>';b+='<td><select id="extension" class="extension">';for(key in c.app.select_extension){b+='<option value="'+c.app.select_extension[key][1]+'">'+c.app.select_extension[key][0]+"</option>"}b+="</select></td>";b+='<td><select id="genome" class="genome">';for(key in c.app.select_genome){b+='<option value="'+c.app.select_genome[key][1]+'">'+c.app.select_genome[key][0]+"</option>"}b+="</select></td>";b+='<td><input id="space_to_tabs" type="checkbox"></input></td><td><div id="info" class="info"><div class="progress"><div class="progress-bar progress-bar-success"></div><div id="percentage" class="percentage">0%</div></div></div></td><td><div id="symbol" class="'+this.status_classes.init+'"></div></td></tr>';return b}})});
\ No newline at end of file
+define(["mvc/upload/upload-model"],function(a){return Backbone.View.extend({options:{padding:8},status_classes:{init:"symbol fa fa-trash-o",queued:"symbol fa fa-spinner fa-spin",running:"symbol fa fa-spinner fa-spin",success:"symbol fa fa-check",error:"symbol fa fa-exclamation-triangle"},initialize:function(e,c){this.app=e;var b=this;this.model=new a.Model(c);this.setElement(this._template(c));var d=this.$el;d.find("#symbol").on("click",function(){var f=b.model.get("status");if(f=="init"||f=="success"||f=="error"){b.app.collection.remove(b.model)}});d.find("#text-content").on("keyup",function(){var f=d.find("#text-content");var h=f.val();var g=h.length;d.find("#size").html(b._formatSize(g));b.model.set("url_paste",h);b.model.set("file_size",g)});d.find("#genome").on("change",function(f){b.model.set("genome",$(f.target).val())});d.find("#extension").on("change",function(f){b.model.set("extension",$(f.target).val())});d.find("#space_to_tabs").on("change",function(f){b.model.set("space_to_tabs",$(f.target).prop("checked"))});this.model.on("change:percentage",function(){b._refreshPercentage()});this.model.on("change:status",function(){b._refreshStatus()});this.model.on("change:info",function(){b._refreshInfo()});this.model.on("change:genome",function(){b._refreshGenome()});this.model.on("remove",function(){b.remove()});this.app.collection.on("reset",function(){b.remove()})},render:function(){var h=this.model.get("file_name");var c=this.model.get("file_size");var e=this.$el;e.find("#title").html(h);e.find("#size").html(this._formatSize(c));if(c==-1){var g=e.find("#text");var f=this.options.padding;var d=e.width()-2*f;var b=e.height()-f;g.css("width",d+"px");g.css("top",b+"px");e.height(b+g.height()+2*f);g.show()}},_refreshGenome:function(){var b=this.model.get("genome");this.$el.find("#genome").val(b)},_refreshInfo:function(){var b=this.model.get("info");if(b){this.$el.find("#info").html("<strong>Failed: </strong>"+b).show()}else{this.$el.find("#info").hide()}},_refreshPercentage:function(){var b=parseInt(this.model.get("percentage"));this.$el.find(".progress-bar").css({width:b+"%"});if(b!=100){this.$el.find("#percentage").html(b+"%")}else{this.$el.find("#percentage").html("Adding to history...")}},_refreshStatus:function(){var c=this.$el;var b=this.model.get("status");var e=this.status_classes[b];var d=this.$el.find("#symbol");d.removeClass();d.addClass(e);if(b=="init"){c.find("#text-content").attr("disabled",false);c.find("#genome").attr("disabled",false);c.find("#extension").attr("disabled",false);c.find("#space_to_tabs").attr("disabled",false)}else{c.find("#text-content").attr("disabled",true);c.find("#genome").attr("disabled",true);c.find("#extension").attr("disabled",true);c.find("#space_to_tabs").attr("disabled",true)}if(b=="success"){c.addClass("success");c.find("#percentage").html("100%")}if(b=="error"){c.addClass("danger");c.find(".progress").remove()}},_formatSize:function(b){var c="";if(b>=100000000000){b=b/100000000000;c="TB"}else{if(b>=100000000){b=b/100000000;c="GB"}else{if(b>=100000){b=b/100000;c="MB"}else{if(b>=100){b=b/100;c="KB"}else{if(b>0){b=b*10;c="b"}else{return"<strong>-</strong>"}}}}}return"<strong>"+(Math.round(b)/10)+"</strong> "+c},_template:function(d){var c=this;var b='<tr id="upload-item-'+d.id+'" class="upload-item"><td><div style="position: relative;"><div id="title" class="title"></div><div id="text" class="text"><div class="text-info">You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.</div><textarea id="text-content" class="text-content form-control"></textarea></div></div></td><td><div id="size" class="size"></div></td>';b+='<td><select id="extension" class="extension">';for(key in c.app.select_extension){b+='<option value="'+c.app.select_extension[key][1]+'">'+c.app.select_extension[key][0]+"</option>"}b+="</select></td>";b+='<td><select id="genome" class="genome">';for(key in c.app.select_genome){b+='<option value="'+c.app.select_genome[key][1]+'">'+c.app.select_genome[key][0]+"</option>"}b+="</select></td>";b+='<td><input id="space_to_tabs" type="checkbox"></input></td><td><div id="info" class="info"><div class="progress"><div class="progress-bar progress-bar-success"></div><div id="percentage" class="percentage">0%</div></div></div></td><td><div id="symbol" class="'+this.status_classes.init+'"></div></td></tr>';return b}})});
\ No newline at end of file
diff -r 99f5d55b02a26e2e3af2936888820fcd91f7c945 -r df1029a34ad693954a0db452d57dfe6aeb563f86 static/scripts/packed/mvc/upload/upload-view.js
--- a/static/scripts/packed/mvc/upload/upload-view.js
+++ b/static/scripts/packed/mvc/upload/upload-view.js
@@ -1,1 +1,1 @@
-define(["galaxy.modal","utils/utils","mvc/upload/upload-model","mvc/upload/upload-row","mvc/ui","utils/uploadbox"],function(c,f,e,d){var b=Backbone.Model.extend({defaults:{percentage:0,icon:"fa-circle",label:"",status:""}});var a=Backbone.View.extend({model:null,initialize:function(h){var g=this;this.model=h;this.options=this.model.attributes;this.setElement(this._template(this.options));$(this.el).on("click",this.options.onclick);if(this.options.tooltip){$(this.el).tooltip({title:this.options.tooltip,placement:"bottom"})}this.model.on("change:percentage",function(){g._percentage(g.model.get("percentage"))});this.model.on("change:status",function(){g._status(g.model.get("status"))});var g=this;$(window).on("beforeunload",function(){var i="";if(g.options.onunload){i=g.options.onunload()}if(i!=""){return i}})},_status:function(h){var g=this.$el.find(".progress-bar");g.removeClass();g.addClass("progress-bar");g.addClass("progress-bar-notransition");if(h!=""){g.addClass("progress-bar-"+h)}},_percentage:function(h){var g=this.$el.find(".progress-bar");g.css({width:h+"%"})},_template:function(g){return'<div class="progress-button"><div class="progress"><div class="progress-bar"></div></div><div id="label" class="label" style="position: absolute; top: 0px; width: inherit; text-align: center;"><div class="fa '+g.icon+'"></div> '+g.label+"</div></div>"}});return Backbone.View.extend({modal:null,button_show:null,uploadbox:null,current_history:null,upload_size:0,select_extension:[["Auto-detect","auto"]],select_genome:[["Unspecified (?)","?"]],collection:new e.Collection(),counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},options:{nginx_upload_path:""},initialize:function(h){var g=this;if(!Galaxy.currHistoryPanel){window.setTimeout(function(){g.initialize()},500);return}if(!Galaxy.currUser.get("id")){return}this.button_show=new b({icon:"fa-upload",tooltip:"Upload files",label:"Upload",onclick:function(i){if(i){g._eventShow(i)}},onunload:function(){if(g.counter.running>0){return"Several uploads are still processing."}}});$("#left .unified-panel-header-inner").append((new a(this.button_show)).$el);var g=this;f.jsonFromUrl(galaxy_config.root+"api/datatypes",function(i){for(key in i){g.select_extension.push([i[key],i[key]])}});f.jsonFromUrl(galaxy_config.root+"api/genomes",function(i){var j=g.select_genome[0];g.select_genome=[];for(key in i){if(i[key].length>1){if(i[key][1]!==j[1]){g.select_genome.push(i[key])}}}g.select_genome.sort(function(l,k){return l[0]>k[0]?1:l[0]<k[0]?-1:0});g.select_genome.unshift(j)});if(h){this.options=_.defaults(h,this.options)}this.collection.on("remove",function(i){g._eventRemove(i)});this.collection.on("change:genome",function(j){var i=j.get("genome");g.collection.each(function(k){if(k.get("status")=="init"&&k.get("genome")=="?"){k.set("genome",i)}})})},_eventShow:function(h){h.preventDefault();if(!this.modal){var g=this;this.modal=new c.GalaxyModal({title:"Upload files from your local drive",body:this._template("upload-box","upload-info"),buttons:{Select:function(){g.uploadbox.select()},Create:function(){g._eventCreate()},Upload:function(){g._eventStart()},Pause:function(){g._eventStop()},Reset:function(){g._eventReset()},Close:function(){g.modal.hide()},},height:"400",width:"900"});this.setElement("#upload-box");var g=this;this.uploadbox=this.$el.uploadbox({announce:function(i,j,k){g._eventAnnounce(i,j,k)},initialize:function(i,j,k){return g._eventInitialize(i,j,k)},progress:function(i,j,k){g._eventProgress(i,j,k)},success:function(i,j,k){g._eventSuccess(i,j,k)},error:function(i,j,k){g._eventError(i,j,k)},complete:function(){g._eventComplete()}});this._updateScreen()}this.modal.show()},_eventRemove:function(h){var g=h.get("status");if(g=="success"){this.counter.success--}else{if(g=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(h.id)},_eventAnnounce:function(g,h,j){this.counter.announce++;this._updateScreen();var i=new d(this,{id:g,file_name:h.name,file_size:h.size});this.collection.add(i.model);$(this.el).find("tbody:last").append(i.$el);i.render()},_eventInitialize:function(k,g,o){var i=this.collection.get(k);i.set("status","running");var h=i.get("extension");var l=i.get("file_name");var n=i.get("genome");var m=i.get("url_paste");var j=i.get("space_to_tabs");if(!m&&!(g.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path,paramname:"files_0|file_data"});tool_input={};tool_input.dbkey=n;tool_input.file_type=h;tool_input["files_0|NAME"]=l;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|url_paste"]=m;tool_input.space_to_tabs=j;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(h,i,g){var j=this.collection.get(h);j.set("percentage",g);this.button_show.set("percentage",this._upload_percentage(g,i.size))},_eventSuccess:function(h,i,k){var j=this.collection.get(h);j.set("status","success");var g=j.get("file_size");this.button_show.set("percentage",this._upload_percentage(100,g));this.upload_completed+=g*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshHdas()},_eventError:function(g,h,j){var i=this.collection.get(g);i.set("status","error");i.set("info",j);this.button_show.set("percentage",this._upload_percentage(100,h.size));this.button_show.set("status","danger");this.upload_completed+=h.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(g){if(g.get("status")=="queued"){g.set("status","init")}});this.counter.running=0;this._updateScreen()},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:-1}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0){return}var g=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(h){if(h.get("status")=="init"){h.set("status","queued");g.upload_size+=h.get("file_size")}});this.button_show.set("percentage",0);this.button_show.set("status","success");this.current_history=Galaxy.currHistoryPanel.model.get("id");this.counter.running=this.counter.announce;this._updateScreen();this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0){return}this.button_show.set("status","info");this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){if(this.counter.running==0){this.collection.reset();this.counter.reset();this._updateScreen();this.uploadbox.reset();this.button_show.set("percentage",0)}},_updateScreen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="Drag&drop files into this box or click 'Select' to select files!"}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Please upgrade to i.e. Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Upload' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Upload")}else{this.modal.disableButton("Upload")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Select");this.modal.enableButton("Create")}else{this.modal.disableButton("Select");this.modal.disableButton("Create")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("table").show()}else{$(this.el).find("table").hide()}},_upload_percentage:function(g,h){return(this.upload_completed+(g*h))/this.upload_size},_template:function(h,g){return'<div id="'+h+'" class="upload-box"><table class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Space→Tab</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+g+'" class="upload-info"></h6>'}})});
\ No newline at end of file
+define(["galaxy.modal","utils/utils","mvc/upload/upload-model","mvc/upload/upload-row","mvc/ui","utils/uploadbox"],function(c,f,e,d){var b=Backbone.Model.extend({defaults:{percentage:0,icon:"fa-circle",label:"",status:""}});var a=Backbone.View.extend({model:null,initialize:function(h){var g=this;this.model=h;this.options=this.model.attributes;this.setElement(this._template(this.options));$(this.el).on("click",this.options.onclick);if(this.options.tooltip){$(this.el).tooltip({title:this.options.tooltip,placement:"bottom"})}this.model.on("change:percentage",function(){g._percentage(g.model.get("percentage"))});this.model.on("change:status",function(){g._status(g.model.get("status"))});var g=this;$(window).on("beforeunload",function(){var i="";if(g.options.onunload){i=g.options.onunload()}if(i!=""){return i}})},_status:function(h){var g=this.$el.find(".progress-bar");g.removeClass();g.addClass("progress-bar");g.addClass("progress-bar-notransition");if(h!=""){g.addClass("progress-bar-"+h)}},_percentage:function(h){var g=this.$el.find(".progress-bar");g.css({width:h+"%"})},_template:function(g){return'<div class="progress-button"><div class="progress"><div class="progress-bar"></div></div><div id="label" class="label" style="position: absolute; top: 0px; width: inherit; text-align: center;"><div class="fa '+g.icon+'"></div> '+g.label+"</div></div>"}});return Backbone.View.extend({modal:null,button_show:null,uploadbox:null,current_history:null,upload_size:0,select_extension:[["Auto-detect","auto"]],select_genome:[["Unspecified (?)","?"]],collection:new e.Collection(),counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},options:{nginx_upload_path:""},initialize:function(h){var g=this;if(!Galaxy.currHistoryPanel){window.setTimeout(function(){g.initialize()},500);return}if(!Galaxy.currUser.get("id")){return}this.button_show=new b({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(i){if(i){g._eventShow(i)}},onunload:function(){if(g.counter.running>0){return"Several uploads are still processing."}}});$("#left .unified-panel-header-inner").append((new a(this.button_show)).$el);var g=this;f.jsonFromUrl(galaxy_config.root+"api/datatypes",function(i){for(key in i){g.select_extension.push([i[key],i[key]])}});f.jsonFromUrl(galaxy_config.root+"api/genomes",function(i){var j=g.select_genome[0];g.select_genome=[];for(key in i){if(i[key].length>1){if(i[key][1]!==j[1]){g.select_genome.push(i[key])}}}g.select_genome.sort(function(l,k){return l[0]>k[0]?1:l[0]<k[0]?-1:0});g.select_genome.unshift(j)});if(h){this.options=_.defaults(h,this.options)}this.collection.on("remove",function(i){g._eventRemove(i)});this.collection.on("change:genome",function(j){var i=j.get("genome");g.collection.each(function(k){if(k.get("status")=="init"&&k.get("genome")=="?"){k.set("genome",i)}})})},_eventShow:function(h){h.preventDefault();h.stopPropagation();if(!this.modal){var g=this;this.modal=new c.GalaxyModal({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose file":function(){g.uploadbox.select()},"from URL":function(){g._eventCreate()},Start:function(){g._eventStart()},Pause:function(){g._eventStop()},Reset:function(){g._eventReset()},Close:function(){g.modal.hide()},},height:"400",width:"900",bindClosingEvents:true});this.setElement("#upload-box");var g=this;this.uploadbox=this.$el.uploadbox({announce:function(i,j,k){g._eventAnnounce(i,j,k)},initialize:function(i,j,k){return g._eventInitialize(i,j,k)},progress:function(i,j,k){g._eventProgress(i,j,k)},success:function(i,j,k){g._eventSuccess(i,j,k)},error:function(i,j,k){g._eventError(i,j,k)},complete:function(){g._eventComplete()}});this._updateScreen()}this.modal.show()},_eventRemove:function(h){var g=h.get("status");if(g=="success"){this.counter.success--}else{if(g=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(h.id)},_eventAnnounce:function(g,h,j){this.counter.announce++;this._updateScreen();var i=new d(this,{id:g,file_name:h.name,file_size:h.size});this.collection.add(i.model);$(this.el).find("tbody:last").append(i.$el);i.render()},_eventInitialize:function(k,g,o){var i=this.collection.get(k);i.set("status","running");var h=i.get("extension");var l=i.get("file_name");var n=i.get("genome");var m=i.get("url_paste");var j=i.get("space_to_tabs");if(!m&&!(g.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path,paramname:"files_0|file_data"});tool_input={};tool_input.dbkey=n;tool_input.file_type=h;tool_input["files_0|NAME"]=l;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|url_paste"]=m;tool_input.space_to_tabs=j;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(h,i,g){var j=this.collection.get(h);j.set("percentage",g);this.button_show.set("percentage",this._upload_percentage(g,i.size))},_eventSuccess:function(h,i,k){var j=this.collection.get(h);j.set("status","success");var g=j.get("file_size");this.button_show.set("percentage",this._upload_percentage(100,g));this.upload_completed+=g*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshHdas()},_eventError:function(g,h,j){var i=this.collection.get(g);i.set("status","error");i.set("info",j);this.button_show.set("percentage",this._upload_percentage(100,h.size));this.button_show.set("status","danger");this.upload_completed+=h.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(g){if(g.get("status")=="queued"){g.set("status","init")}});this.counter.running=0;this._updateScreen()},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:-1}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0){return}var g=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(h){if(h.get("status")=="init"){h.set("status","queued");g.upload_size+=h.get("file_size")}});this.button_show.set("percentage",0);this.button_show.set("status","success");this.current_history=Galaxy.currHistoryPanel.model.get("id");this.counter.running=this.counter.announce;this._updateScreen();this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0){return}this.button_show.set("status","info");this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){if(this.counter.running==0){this.collection.reset();this.counter.reset();this._updateScreen();this.uploadbox.reset();this.button_show.set("percentage",0)}},_updateScreen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="You can Drag & Drop files into this box."}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Start")}else{this.modal.disableButton("Start")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Choose file");this.modal.enableButton("from URL")}else{this.modal.disableButton("Choose file");this.modal.disableButton("from URL")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("table").show()}else{$(this.el).find("table").hide()}},_upload_percentage:function(g,h){return(this.upload_completed+(g*h))/this.upload_size},_template:function(h,g){return'<div id="'+h+'" class="upload-box"><table class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Space→Tab</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+g+'" class="upload-info"></h6>'}})});
\ No newline at end of file
diff -r 99f5d55b02a26e2e3af2936888820fcd91f7c945 -r df1029a34ad693954a0db452d57dfe6aeb563f86 static/style/blue/base.css
--- a/static/style/blue/base.css
+++ b/static/style/blue/base.css
@@ -1260,7 +1260,7 @@
.upload-box .table td{margin:0px;paddign:0px}
.upload-box .title{width:130px;word-wrap:break-word;font-size:11px}
.upload-box .text{position:absolute;display:none}.upload-box .text .text-content{font-size:11px;width:100%;height:50px;resize:none;background:inherit;color:#000}
-.upload-box .text .text-info{font-size:11px;color:#999}
+.upload-box .text .text-info{font-size:11px}
.upload-box .extension{width:100px;font-size:11px}
.upload-box .genome{width:150px;font-size:11px}
.upload-box .size{width:60px;white-space:nowrap}
diff -r 99f5d55b02a26e2e3af2936888820fcd91f7c945 -r df1029a34ad693954a0db452d57dfe6aeb563f86 static/style/src/less/upload.less
--- a/static/style/src/less/upload.less
+++ b/static/style/src/less/upload.less
@@ -85,7 +85,7 @@
.text-info {
font-size : @font-size-small;
- color : @gray-light;
+ // color : @gray-light;
}
}
@@ -133,4 +133,4 @@
font-size: 1.2em;
cursor: pointer;
}
-}
\ No newline at end of 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: jmchilton: Small refactor to ToolDataParameter.
by commits-noreply@bitbucket.org 20 Jan '14
by commits-noreply@bitbucket.org 20 Jan '14
20 Jan '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/99f5d55b02a2/
Changeset: 99f5d55b02a2
User: jmchilton
Date: 2014-01-20 19:39:50
Summary: Small refactor to ToolDataParameter.
Break out logic for computing and asserting existence of history - simplifies get_html_field, get_initial_value_from_history_prevent_repeat, reduces code duplication, and eases some downstream merges changes I making.
Affected #: 1 file
diff -r b3171af94dccffaa6e8a5b9b8bda1fd39479643c -r 99f5d55b02a26e2e3af2936888820fcd91f7c945 lib/galaxy/tools/parameters/basic.py
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -1611,9 +1611,7 @@
filter_value = self.options.get_options( trans, other_values )[0][0]
except IndexError:
pass # no valid options
- assert trans is not None, "DataToolParameter requires a trans"
- history = trans.get_history()
- assert history is not None, "DataToolParameter requires a history"
+ history = self._get_history( trans )
if value is not None:
if type( value ) != list:
value = [ value ]
@@ -1683,10 +1681,7 @@
# Can't look at history in workflow mode. Tool shed has no histories.
if trans is None or trans.workflow_building_mode or trans.webapp.name == 'tool_shed':
return DummyDataset()
- assert trans is not None, "DataToolParameter requires a trans"
- if history is None:
- history = trans.get_history()
- assert history is not None, "DataToolParameter requires a history"
+ history = self._get_history( trans, history )
if self.optional:
return None
most_recent_dataset = []
@@ -1860,6 +1855,14 @@
ref = ref()
return ref
+ def _get_history( self, trans, history=None ):
+ class_name = self.__class__.__name__
+ assert trans is not None, "%s requires a trans" % class_name
+ if history is None:
+ history = trans.get_history()
+ assert history is not None, "%s requires a history" % class_name
+ return history
+
class HiddenDataToolParameter( HiddenToolParameter, DataToolParameter ):
"""
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