1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/d3dff45bbb05/
Changeset: d3dff45bbb05
User: dannon
Date: 2015-01-12 12:02:23+00:00
Summary: Merged in nsoranzo/galaxy-central (pull request #628)
PEP-8 fixes and API doc ehnancements to libraries API
Affected #: 2 files
diff -r eb61b02da1866c4a7da0f2fa357ce43e6c62b57c -r d3dff45bbb0554150da4491eb2d2031d11f90063 lib/galaxy/webapps/galaxy/api/libraries.py
--- a/lib/galaxy/webapps/galaxy/api/libraries.py
+++ b/lib/galaxy/webapps/galaxy/api/libraries.py
@@ -6,10 +6,7 @@
from galaxy.managers import libraries, folders, roles
from galaxy.web import _future_expose_api as expose_api
from galaxy.web import _future_expose_api_anonymous as expose_api_anonymous
-from galaxy.model.orm import and_, not_, or_
from galaxy.web.base.controller import BaseAPIController
-from sqlalchemy.orm.exc import MultipleResultsFound
-from sqlalchemy.orm.exc import NoResultFound
import logging
log = logging.getLogger( __name__ )
@@ -48,7 +45,7 @@
def __decode_id( self, trans, encoded_id, object_name=None ):
"""
- Try to decode the id.
+ Try to decode the id.
:param object_name: Name of the object the id belongs to. (optional)
:type object_name: str
@@ -149,7 +146,7 @@
synopsis = payload.get( 'synopsis', None )
else:
raise exceptions.RequestParameterMissingException( "You did not specify any payload." )
- updated_library = self.library_manager.update( trans, library, name, description, synopsis )
+ updated_library = self.library_manager.update( trans, library, name, description, synopsis )
library_dict = self.library_manager.get_library_dict( trans, updated_library )
return library_dict
@@ -248,20 +245,20 @@
*POST /api/libraries/{encoded_library_id}/permissions
:param encoded_library_id: the encoded id of the library to set the permissions of
- :type encoded_library_id: an encoded id string
+ :type encoded_library_id: an encoded id string
:param action: (required) describes what action should be performed
available actions: remove_restrictions, set_permissions
- :type action: string
+ :type action: string
:param access_ids[]: list of Role.id defining roles that should have access permission on the library
- :type access_ids[]: string or list
+ :type access_ids[]: string or list
:param add_ids[]: list of Role.id defining roles that should have add item permission on the library
- :type add_ids[]: string or list
+ :type add_ids[]: string or list
:param manage_ids[]: list of Role.id defining roles that should have manage permission on the library
- :type manage_ids[]: string or list
+ :type manage_ids[]: string or list
:param modify_ids[]: list of Role.id defining roles that should have modify permission on the library
- :type modify_ids[]: string or list
+ :type modify_ids[]: string or list
:rtype: dictionary
:returns: dict of current roles for all available permission types
@@ -306,7 +303,7 @@
else:
invalid_access_roles_names.append( role_id )
if len( invalid_access_roles_names ) > 0:
- log.warning( "The following roles could not be added to the library access permission: " + str( invalid_access_roles_names ) )
+ log.warning( "The following roles could not be added to the library access permission: " + str( invalid_access_roles_names ) )
# ADD TO LIBRARY ROLES
valid_add_roles = []
@@ -319,8 +316,8 @@
else:
invalid_add_roles_names.append( role_id )
if len( invalid_add_roles_names ) > 0:
- log.warning( "The following roles could not be added to the add library item permission: " + str( invalid_add_roles_names ) )
-
+ log.warning( "The following roles could not be added to the add library item permission: " + str( invalid_add_roles_names ) )
+
# MANAGE LIBRARY ROLES
valid_manage_roles = []
invalid_manage_roles_names = []
@@ -332,8 +329,8 @@
else:
invalid_manage_roles_names.append( role_id )
if len( invalid_manage_roles_names ) > 0:
- log.warning( "The following roles could not be added to the manage library permission: " + str( invalid_manage_roles_names ) )
-
+ log.warning( "The following roles could not be added to the manage library permission: " + str( invalid_manage_roles_names ) )
+
# MODIFY LIBRARY ROLES
valid_modify_roles = []
invalid_modify_roles_names = []
@@ -345,7 +342,7 @@
else:
invalid_modify_roles_names.append( role_id )
if len( invalid_modify_roles_names ) > 0:
- log.warning( "The following roles could not be added to the modify library permission: " + str( invalid_modify_roles_names ) )
+ log.warning( "The following roles could not be added to the modify library permission: " + str( invalid_modify_roles_names ) )
permissions = { trans.app.security_agent.permitted_actions.LIBRARY_ACCESS : valid_access_roles }
permissions.update( { trans.app.security_agent.permitted_actions.LIBRARY_ADD : valid_add_roles } )
@@ -357,7 +354,7 @@
# Copy the permissions to the root folder
trans.app.security_agent.copy_library_permissions( trans, library, library.root_folder )
else:
- raise exceptions.RequestParameterInvalidException( 'The mandatory parameter "action" has an invalid value.'
+ raise exceptions.RequestParameterInvalidException( 'The mandatory parameter "action" has an invalid value.'
'Allowed values are: "remove_restrictions", set_permissions"' )
roles = self.library_manager.get_current_roles( trans, library )
return roles
@@ -369,18 +366,16 @@
POST /api/libraries/{encoded_library_id}/permissions
Updates the library permissions.
"""
- import galaxy.util
- params = galaxy.util.Params( payload )
+ params = util.Params( payload )
permissions = {}
for k, v in trans.app.model.Library.permitted_actions.items():
role_params = params.get( k + '_in', [] )
- in_roles = [ trans.sa_session.query( trans.app.model.Role ).get( trans.security.decode_id( x ) ) for x in galaxy.util.listify( role_params ) ]
+ in_roles = [ trans.sa_session.query( trans.app.model.Role ).get( trans.security.decode_id( x ) ) for x in util.listify( role_params ) ]
permissions[ trans.app.security_agent.get_action( v.action ) ] = in_roles
trans.app.security_agent.set_all_library_permissions( trans, library, permissions )
trans.sa_session.refresh( library )
# Copy the permissions to the root folder
trans.app.security_agent.copy_library_permissions( trans, library, library.root_folder )
- message = "Permissions updated for library '%s'." % library.name
item = library.to_dict( view='element', value_mapper={ 'id' : trans.security.encode_id , 'root_folder_id' : trans.security.encode_id } )
return item
diff -r eb61b02da1866c4a7da0f2fa357ce43e6c62b57c -r d3dff45bbb0554150da4491eb2d2031d11f90063 lib/galaxy/webapps/galaxy/api/library_contents.py
--- a/lib/galaxy/webapps/galaxy/api/library_contents.py
+++ b/lib/galaxy/webapps/galaxy/api/library_contents.py
@@ -29,12 +29,12 @@
.. note:: May be slow! Returns all content traversing recursively through all folders.
.. seealso:: :class:`galaxy.webapps.galaxy.api.FolderContentsController.index` for a non-recursive solution
- :param library_id: encoded id string of the library
- :type library_id: string
+ :param library_id: the encoded id of the library
+ :type library_id: str
:returns: list of dictionaries of the form:
* id: the encoded id of the library item
- * name: the 'libary path'
+ * name: the 'library path'
or relationship of the library item to the root
* type: 'file' or 'folder'
* url: the url to get detailed information on the library item
@@ -109,7 +109,7 @@
:param id: the encoded id of the library item to return
:type id: str
- :param library_id: encoded id string of the library that contains this item
+ :param library_id: the encoded id of the library that contains this item
:type library_id: str
:returns: detailed library item information
@@ -119,7 +119,7 @@
:func:`galaxy.model.LibraryDataset.to_dict` and
:attr:`galaxy.model.LibraryFolder.dict_element_visible_keys`
"""
- class_name, content_id = self.__decode_library_content_id( trans, id )
+ class_name, content_id = self.__decode_library_content_id( id )
if class_name == 'LibraryFolder':
content = self.get_library_folder( trans, content_id, check_ownership=False, check_accessible=True )
rval = content.to_dict( view='element', value_mapper={ 'id': trans.security.encode_id } )
@@ -146,27 +146,39 @@
the HDA's encoded id in ``from_hda_id`` (and optionally ``ldda_message``).
:type library_id: str
- :param library_id: encoded id string of the library where to create the new item
+ :param library_id: the encoded id of the library where to create the new item
:type payload: dict
:param payload: dictionary structure containing:
- * folder_id: the parent folder of the new item
+ * folder_id: the encoded id of the parent folder of the new item
* create_type: the type of item to create ('file', 'folder' or 'collection')
- * from_hda_id: (optional) the id of an accessible HDA to copy into the
- library
+ * from_hda_id: (optional, only if create_type is 'file') the
+ encoded id of an accessible HDA to copy into the library
* ldda_message: (optional) the new message attribute of the LDDA created
* extended_metadata: (optional) dub-dictionary containing any extended
metadata to associate with the item
- * link_data_only: (optional) either 'copy_files' (default) or 'link_to_files'
* upload_option: (optional) one of 'upload_file' (default), 'upload_directory' or 'upload_paths'
- * server_dir: (optional) only if upload_option is 'upload_directory'
- * filesystem_paths: (optional) only if upload_option is 'upload_paths' and the user is an admin
+ * server_dir: (optional, only if upload_option is
+ 'upload_directory') relative path of the subdirectory of Galaxy
+ ``library_import_dir`` to upload. All and only the files (i.e.
+ no subdirectories) contained in the specified directory will be
+ uploaded.
+ * filesystem_paths: (optional, only if upload_option is
+ 'upload_paths' and the user is an admin) file paths on the
+ Galaxy server to upload to the library, one file per line
+ * link_data_only: (optional, only when upload_option is
+ 'upload_directory' or 'upload_paths') either 'copy_files'
+ (default) or 'link_to_files'. Setting to 'link_to_files'
+ symlinks instead of copying the files
+ * name: (optional, only if create_type is 'folder') name of the
+ folder to create
+ * description: (optional, only if create_type is 'folder')
+ description of the folder to create
:rtype: dict
:returns: a dictionary containing the id, name,
and 'show' url of the new item
"""
- create_type = None
if 'create_type' not in payload:
trans.response.status = 400
return "Missing required 'create_type' parameter."
@@ -178,10 +190,10 @@
if 'folder_id' not in payload:
trans.response.status = 400
- return "Missing requred 'folder_id' parameter."
+ return "Missing required 'folder_id' parameter."
else:
folder_id = payload.pop( 'folder_id' )
- class_name, folder_id = self.__decode_library_content_id( trans, folder_id )
+ class_name, folder_id = self.__decode_library_content_id( folder_id )
try:
# security is checked in the downstream controller
parent = self.get_library_folder( trans, folder_id, check_ownership=False, check_accessible=False )
@@ -198,9 +210,7 @@
#check for extended metadata, store it and pop it out of the param
#otherwise sanitize_param will have a fit
- ex_meta_payload = None
- if 'extended_metadata' in payload:
- ex_meta_payload = payload.pop('extended_metadata')
+ ex_meta_payload = payload.pop('extended_metadata', None)
# Now create the desired content object, either file or folder.
if create_type == 'file':
@@ -272,7 +282,7 @@
def _copy_hda_to_library_folder( self, trans, from_hda_id, library_id, folder_id, ldda_message='' ):
"""
- Copies hda ``from_hda_id`` to library folder ``library_folder_id`` optionally
+ Copies hda ``from_hda_id`` to library folder ``folder_id``, optionally
adding ``ldda_message`` to the new ldda's ``message``.
``library_contents.create`` will branch to this if called with 'from_hda_id'
@@ -325,7 +335,7 @@
:type id: str
:param id: the encoded id of the library item to return
:type library_id: str
- :param library_id: encoded id string of the library that contains this item
+ :param library_id: the encoded id of the library that contains this item
:type payload: dict
:param payload: dictionary structure containing::
'converted_dataset_id':
@@ -344,7 +354,7 @@
trans.sa_session.add( assoc )
trans.sa_session.flush()
- def __decode_library_content_id( self, trans, content_id ):
+ def __decode_library_content_id( self, content_id ):
if len( content_id ) % 16 == 0:
return 'LibraryDataset', content_id
elif content_id.startswith( 'F' ):
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.
3 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/841deccfb359/
Changeset: 841deccfb359
User: nsoranzo
Date: 2015-01-08 13:00:50+00:00
Summary: PEP-8 and style fixes.
Affected #: 2 files
diff -r 5c33270710123171734e5c822dfbb430a4234e37 -r 841deccfb359c7722eeeb6f5101caa4b5925fb6e lib/galaxy/webapps/galaxy/api/libraries.py
--- a/lib/galaxy/webapps/galaxy/api/libraries.py
+++ b/lib/galaxy/webapps/galaxy/api/libraries.py
@@ -6,10 +6,7 @@
from galaxy.managers import libraries, folders, roles
from galaxy.web import _future_expose_api as expose_api
from galaxy.web import _future_expose_api_anonymous as expose_api_anonymous
-from galaxy.model.orm import and_, not_, or_
from galaxy.web.base.controller import BaseAPIController
-from sqlalchemy.orm.exc import MultipleResultsFound
-from sqlalchemy.orm.exc import NoResultFound
import logging
log = logging.getLogger( __name__ )
@@ -48,7 +45,7 @@
def __decode_id( self, trans, encoded_id, object_name=None ):
"""
- Try to decode the id.
+ Try to decode the id.
:param object_name: Name of the object the id belongs to. (optional)
:type object_name: str
@@ -149,7 +146,7 @@
synopsis = payload.get( 'synopsis', None )
else:
raise exceptions.RequestParameterMissingException( "You did not specify any payload." )
- updated_library = self.library_manager.update( trans, library, name, description, synopsis )
+ updated_library = self.library_manager.update( trans, library, name, description, synopsis )
library_dict = self.library_manager.get_library_dict( trans, updated_library )
return library_dict
@@ -248,20 +245,20 @@
*POST /api/libraries/{encoded_library_id}/permissions
:param encoded_library_id: the encoded id of the library to set the permissions of
- :type encoded_library_id: an encoded id string
+ :type encoded_library_id: an encoded id string
:param action: (required) describes what action should be performed
available actions: remove_restrictions, set_permissions
- :type action: string
+ :type action: string
:param access_ids[]: list of Role.id defining roles that should have access permission on the library
- :type access_ids[]: string or list
+ :type access_ids[]: string or list
:param add_ids[]: list of Role.id defining roles that should have add item permission on the library
- :type add_ids[]: string or list
+ :type add_ids[]: string or list
:param manage_ids[]: list of Role.id defining roles that should have manage permission on the library
- :type manage_ids[]: string or list
+ :type manage_ids[]: string or list
:param modify_ids[]: list of Role.id defining roles that should have modify permission on the library
- :type modify_ids[]: string or list
+ :type modify_ids[]: string or list
:rtype: dictionary
:returns: dict of current roles for all available permission types
@@ -306,7 +303,7 @@
else:
invalid_access_roles_names.append( role_id )
if len( invalid_access_roles_names ) > 0:
- log.warning( "The following roles could not be added to the library access permission: " + str( invalid_access_roles_names ) )
+ log.warning( "The following roles could not be added to the library access permission: " + str( invalid_access_roles_names ) )
# ADD TO LIBRARY ROLES
valid_add_roles = []
@@ -319,8 +316,8 @@
else:
invalid_add_roles_names.append( role_id )
if len( invalid_add_roles_names ) > 0:
- log.warning( "The following roles could not be added to the add library item permission: " + str( invalid_add_roles_names ) )
-
+ log.warning( "The following roles could not be added to the add library item permission: " + str( invalid_add_roles_names ) )
+
# MANAGE LIBRARY ROLES
valid_manage_roles = []
invalid_manage_roles_names = []
@@ -332,8 +329,8 @@
else:
invalid_manage_roles_names.append( role_id )
if len( invalid_manage_roles_names ) > 0:
- log.warning( "The following roles could not be added to the manage library permission: " + str( invalid_manage_roles_names ) )
-
+ log.warning( "The following roles could not be added to the manage library permission: " + str( invalid_manage_roles_names ) )
+
# MODIFY LIBRARY ROLES
valid_modify_roles = []
invalid_modify_roles_names = []
@@ -345,7 +342,7 @@
else:
invalid_modify_roles_names.append( role_id )
if len( invalid_modify_roles_names ) > 0:
- log.warning( "The following roles could not be added to the modify library permission: " + str( invalid_modify_roles_names ) )
+ log.warning( "The following roles could not be added to the modify library permission: " + str( invalid_modify_roles_names ) )
permissions = { trans.app.security_agent.permitted_actions.LIBRARY_ACCESS : valid_access_roles }
permissions.update( { trans.app.security_agent.permitted_actions.LIBRARY_ADD : valid_add_roles } )
@@ -357,7 +354,7 @@
# Copy the permissions to the root folder
trans.app.security_agent.copy_library_permissions( trans, library, library.root_folder )
else:
- raise exceptions.RequestParameterInvalidException( 'The mandatory parameter "action" has an invalid value.'
+ raise exceptions.RequestParameterInvalidException( 'The mandatory parameter "action" has an invalid value.'
'Allowed values are: "remove_restrictions", set_permissions"' )
roles = self.library_manager.get_current_roles( trans, library )
return roles
@@ -369,18 +366,16 @@
POST /api/libraries/{encoded_library_id}/permissions
Updates the library permissions.
"""
- import galaxy.util
- params = galaxy.util.Params( payload )
+ params = util.Params( payload )
permissions = {}
for k, v in trans.app.model.Library.permitted_actions.items():
role_params = params.get( k + '_in', [] )
- in_roles = [ trans.sa_session.query( trans.app.model.Role ).get( trans.security.decode_id( x ) ) for x in galaxy.util.listify( role_params ) ]
+ in_roles = [ trans.sa_session.query( trans.app.model.Role ).get( trans.security.decode_id( x ) ) for x in util.listify( role_params ) ]
permissions[ trans.app.security_agent.get_action( v.action ) ] = in_roles
trans.app.security_agent.set_all_library_permissions( trans, library, permissions )
trans.sa_session.refresh( library )
# Copy the permissions to the root folder
trans.app.security_agent.copy_library_permissions( trans, library, library.root_folder )
- message = "Permissions updated for library '%s'." % library.name
item = library.to_dict( view='element', value_mapper={ 'id' : trans.security.encode_id , 'root_folder_id' : trans.security.encode_id } )
return item
diff -r 5c33270710123171734e5c822dfbb430a4234e37 -r 841deccfb359c7722eeeb6f5101caa4b5925fb6e lib/galaxy/webapps/galaxy/api/library_contents.py
--- a/lib/galaxy/webapps/galaxy/api/library_contents.py
+++ b/lib/galaxy/webapps/galaxy/api/library_contents.py
@@ -119,7 +119,7 @@
:func:`galaxy.model.LibraryDataset.to_dict` and
:attr:`galaxy.model.LibraryFolder.dict_element_visible_keys`
"""
- class_name, content_id = self.__decode_library_content_id( trans, id )
+ class_name, content_id = self.__decode_library_content_id( id )
if class_name == 'LibraryFolder':
content = self.get_library_folder( trans, content_id, check_ownership=False, check_accessible=True )
rval = content.to_dict( view='element', value_mapper={ 'id': trans.security.encode_id } )
@@ -166,7 +166,6 @@
:returns: a dictionary containing the id, name,
and 'show' url of the new item
"""
- create_type = None
if 'create_type' not in payload:
trans.response.status = 400
return "Missing required 'create_type' parameter."
@@ -178,10 +177,10 @@
if 'folder_id' not in payload:
trans.response.status = 400
- return "Missing requred 'folder_id' parameter."
+ return "Missing required 'folder_id' parameter."
else:
folder_id = payload.pop( 'folder_id' )
- class_name, folder_id = self.__decode_library_content_id( trans, folder_id )
+ class_name, folder_id = self.__decode_library_content_id( folder_id )
try:
# security is checked in the downstream controller
parent = self.get_library_folder( trans, folder_id, check_ownership=False, check_accessible=False )
@@ -198,9 +197,7 @@
#check for extended metadata, store it and pop it out of the param
#otherwise sanitize_param will have a fit
- ex_meta_payload = None
- if 'extended_metadata' in payload:
- ex_meta_payload = payload.pop('extended_metadata')
+ ex_meta_payload = payload.pop('extended_metadata', None)
# Now create the desired content object, either file or folder.
if create_type == 'file':
@@ -344,7 +341,7 @@
trans.sa_session.add( assoc )
trans.sa_session.flush()
- def __decode_library_content_id( self, trans, content_id ):
+ def __decode_library_content_id( self, content_id ):
if len( content_id ) % 16 == 0:
return 'LibraryDataset', content_id
elif content_id.startswith( 'F' ):
https://bitbucket.org/galaxy/galaxy-central/commits/dbdc660f2a86/
Changeset: dbdc660f2a86
User: nsoranzo
Date: 2015-01-09 22:57:23+00:00
Summary: API doc enhancements.
Affected #: 1 file
diff -r 841deccfb359c7722eeeb6f5101caa4b5925fb6e -r dbdc660f2a86cfe46ac9518793b128196dfe9788 lib/galaxy/webapps/galaxy/api/library_contents.py
--- a/lib/galaxy/webapps/galaxy/api/library_contents.py
+++ b/lib/galaxy/webapps/galaxy/api/library_contents.py
@@ -29,12 +29,12 @@
.. note:: May be slow! Returns all content traversing recursively through all folders.
.. seealso:: :class:`galaxy.webapps.galaxy.api.FolderContentsController.index` for a non-recursive solution
- :param library_id: encoded id string of the library
- :type library_id: string
+ :param library_id: the encoded id of the library
+ :type library_id: str
:returns: list of dictionaries of the form:
* id: the encoded id of the library item
- * name: the 'libary path'
+ * name: the 'library path'
or relationship of the library item to the root
* type: 'file' or 'folder'
* url: the url to get detailed information on the library item
@@ -109,7 +109,7 @@
:param id: the encoded id of the library item to return
:type id: str
- :param library_id: encoded id string of the library that contains this item
+ :param library_id: the encoded id of the library that contains this item
:type library_id: str
:returns: detailed library item information
@@ -146,21 +146,34 @@
the HDA's encoded id in ``from_hda_id`` (and optionally ``ldda_message``).
:type library_id: str
- :param library_id: encoded id string of the library where to create the new item
+ :param library_id: the encoded id of the library where to create the new item
:type payload: dict
:param payload: dictionary structure containing:
- * folder_id: the parent folder of the new item
+ * folder_id: the encoded id of the parent folder of the new item
* create_type: the type of item to create ('file', 'folder' or 'collection')
- * from_hda_id: (optional) the id of an accessible HDA to copy into the
- library
+ * from_hda_id: (optional, only if create_type is 'file') the
+ encoded id of an accessible HDA to copy into the library
* ldda_message: (optional) the new message attribute of the LDDA created
* extended_metadata: (optional) dub-dictionary containing any extended
metadata to associate with the item
- * link_data_only: (optional) either 'copy_files' (default) or 'link_to_files'
* upload_option: (optional) one of 'upload_file' (default), 'upload_directory' or 'upload_paths'
- * server_dir: (optional) only if upload_option is 'upload_directory'
- * filesystem_paths: (optional) only if upload_option is 'upload_paths' and the user is an admin
+ * server_dir: (optional, only if upload_option is
+ 'upload_directory') relative path of the subdirectory of Galaxy
+ ``library_import_dir`` to upload. All and only the files (i.e.
+ no subdirectories) contained in the specified directory will be
+ uploaded.
+ * filesystem_paths: (optional, only if upload_option is
+ 'upload_paths' and the user is an admin) file paths on the
+ Galaxy server to upload to the library, one file per line
+ * link_data_only: (optional, only when upload_option is
+ 'upload_directory' or 'upload_paths') either 'copy_files'
+ (default) or 'link_to_files'. Setting to 'link_to_files'
+ symlinks instead of copying the files
+ * name: (optional, only if create_type is 'folder') name of the
+ folder to create
+ * description: (optional, only if create_type is 'folder')
+ description of the folder to create
:rtype: dict
:returns: a dictionary containing the id, name,
@@ -269,7 +282,7 @@
def _copy_hda_to_library_folder( self, trans, from_hda_id, library_id, folder_id, ldda_message='' ):
"""
- Copies hda ``from_hda_id`` to library folder ``library_folder_id`` optionally
+ Copies hda ``from_hda_id`` to library folder ``folder_id``, optionally
adding ``ldda_message`` to the new ldda's ``message``.
``library_contents.create`` will branch to this if called with 'from_hda_id'
@@ -322,7 +335,7 @@
:type id: str
:param id: the encoded id of the library item to return
:type library_id: str
- :param library_id: encoded id string of the library that contains this item
+ :param library_id: the encoded id of the library that contains this item
:type payload: dict
:param payload: dictionary structure containing::
'converted_dataset_id':
https://bitbucket.org/galaxy/galaxy-central/commits/d3dff45bbb05/
Changeset: d3dff45bbb05
User: dannon
Date: 2015-01-12 12:02:23+00:00
Summary: Merged in nsoranzo/galaxy-central (pull request #628)
PEP-8 fixes and API doc ehnancements to libraries API
Affected #: 2 files
diff -r eb61b02da1866c4a7da0f2fa357ce43e6c62b57c -r d3dff45bbb0554150da4491eb2d2031d11f90063 lib/galaxy/webapps/galaxy/api/libraries.py
--- a/lib/galaxy/webapps/galaxy/api/libraries.py
+++ b/lib/galaxy/webapps/galaxy/api/libraries.py
@@ -6,10 +6,7 @@
from galaxy.managers import libraries, folders, roles
from galaxy.web import _future_expose_api as expose_api
from galaxy.web import _future_expose_api_anonymous as expose_api_anonymous
-from galaxy.model.orm import and_, not_, or_
from galaxy.web.base.controller import BaseAPIController
-from sqlalchemy.orm.exc import MultipleResultsFound
-from sqlalchemy.orm.exc import NoResultFound
import logging
log = logging.getLogger( __name__ )
@@ -48,7 +45,7 @@
def __decode_id( self, trans, encoded_id, object_name=None ):
"""
- Try to decode the id.
+ Try to decode the id.
:param object_name: Name of the object the id belongs to. (optional)
:type object_name: str
@@ -149,7 +146,7 @@
synopsis = payload.get( 'synopsis', None )
else:
raise exceptions.RequestParameterMissingException( "You did not specify any payload." )
- updated_library = self.library_manager.update( trans, library, name, description, synopsis )
+ updated_library = self.library_manager.update( trans, library, name, description, synopsis )
library_dict = self.library_manager.get_library_dict( trans, updated_library )
return library_dict
@@ -248,20 +245,20 @@
*POST /api/libraries/{encoded_library_id}/permissions
:param encoded_library_id: the encoded id of the library to set the permissions of
- :type encoded_library_id: an encoded id string
+ :type encoded_library_id: an encoded id string
:param action: (required) describes what action should be performed
available actions: remove_restrictions, set_permissions
- :type action: string
+ :type action: string
:param access_ids[]: list of Role.id defining roles that should have access permission on the library
- :type access_ids[]: string or list
+ :type access_ids[]: string or list
:param add_ids[]: list of Role.id defining roles that should have add item permission on the library
- :type add_ids[]: string or list
+ :type add_ids[]: string or list
:param manage_ids[]: list of Role.id defining roles that should have manage permission on the library
- :type manage_ids[]: string or list
+ :type manage_ids[]: string or list
:param modify_ids[]: list of Role.id defining roles that should have modify permission on the library
- :type modify_ids[]: string or list
+ :type modify_ids[]: string or list
:rtype: dictionary
:returns: dict of current roles for all available permission types
@@ -306,7 +303,7 @@
else:
invalid_access_roles_names.append( role_id )
if len( invalid_access_roles_names ) > 0:
- log.warning( "The following roles could not be added to the library access permission: " + str( invalid_access_roles_names ) )
+ log.warning( "The following roles could not be added to the library access permission: " + str( invalid_access_roles_names ) )
# ADD TO LIBRARY ROLES
valid_add_roles = []
@@ -319,8 +316,8 @@
else:
invalid_add_roles_names.append( role_id )
if len( invalid_add_roles_names ) > 0:
- log.warning( "The following roles could not be added to the add library item permission: " + str( invalid_add_roles_names ) )
-
+ log.warning( "The following roles could not be added to the add library item permission: " + str( invalid_add_roles_names ) )
+
# MANAGE LIBRARY ROLES
valid_manage_roles = []
invalid_manage_roles_names = []
@@ -332,8 +329,8 @@
else:
invalid_manage_roles_names.append( role_id )
if len( invalid_manage_roles_names ) > 0:
- log.warning( "The following roles could not be added to the manage library permission: " + str( invalid_manage_roles_names ) )
-
+ log.warning( "The following roles could not be added to the manage library permission: " + str( invalid_manage_roles_names ) )
+
# MODIFY LIBRARY ROLES
valid_modify_roles = []
invalid_modify_roles_names = []
@@ -345,7 +342,7 @@
else:
invalid_modify_roles_names.append( role_id )
if len( invalid_modify_roles_names ) > 0:
- log.warning( "The following roles could not be added to the modify library permission: " + str( invalid_modify_roles_names ) )
+ log.warning( "The following roles could not be added to the modify library permission: " + str( invalid_modify_roles_names ) )
permissions = { trans.app.security_agent.permitted_actions.LIBRARY_ACCESS : valid_access_roles }
permissions.update( { trans.app.security_agent.permitted_actions.LIBRARY_ADD : valid_add_roles } )
@@ -357,7 +354,7 @@
# Copy the permissions to the root folder
trans.app.security_agent.copy_library_permissions( trans, library, library.root_folder )
else:
- raise exceptions.RequestParameterInvalidException( 'The mandatory parameter "action" has an invalid value.'
+ raise exceptions.RequestParameterInvalidException( 'The mandatory parameter "action" has an invalid value.'
'Allowed values are: "remove_restrictions", set_permissions"' )
roles = self.library_manager.get_current_roles( trans, library )
return roles
@@ -369,18 +366,16 @@
POST /api/libraries/{encoded_library_id}/permissions
Updates the library permissions.
"""
- import galaxy.util
- params = galaxy.util.Params( payload )
+ params = util.Params( payload )
permissions = {}
for k, v in trans.app.model.Library.permitted_actions.items():
role_params = params.get( k + '_in', [] )
- in_roles = [ trans.sa_session.query( trans.app.model.Role ).get( trans.security.decode_id( x ) ) for x in galaxy.util.listify( role_params ) ]
+ in_roles = [ trans.sa_session.query( trans.app.model.Role ).get( trans.security.decode_id( x ) ) for x in util.listify( role_params ) ]
permissions[ trans.app.security_agent.get_action( v.action ) ] = in_roles
trans.app.security_agent.set_all_library_permissions( trans, library, permissions )
trans.sa_session.refresh( library )
# Copy the permissions to the root folder
trans.app.security_agent.copy_library_permissions( trans, library, library.root_folder )
- message = "Permissions updated for library '%s'." % library.name
item = library.to_dict( view='element', value_mapper={ 'id' : trans.security.encode_id , 'root_folder_id' : trans.security.encode_id } )
return item
diff -r eb61b02da1866c4a7da0f2fa357ce43e6c62b57c -r d3dff45bbb0554150da4491eb2d2031d11f90063 lib/galaxy/webapps/galaxy/api/library_contents.py
--- a/lib/galaxy/webapps/galaxy/api/library_contents.py
+++ b/lib/galaxy/webapps/galaxy/api/library_contents.py
@@ -29,12 +29,12 @@
.. note:: May be slow! Returns all content traversing recursively through all folders.
.. seealso:: :class:`galaxy.webapps.galaxy.api.FolderContentsController.index` for a non-recursive solution
- :param library_id: encoded id string of the library
- :type library_id: string
+ :param library_id: the encoded id of the library
+ :type library_id: str
:returns: list of dictionaries of the form:
* id: the encoded id of the library item
- * name: the 'libary path'
+ * name: the 'library path'
or relationship of the library item to the root
* type: 'file' or 'folder'
* url: the url to get detailed information on the library item
@@ -109,7 +109,7 @@
:param id: the encoded id of the library item to return
:type id: str
- :param library_id: encoded id string of the library that contains this item
+ :param library_id: the encoded id of the library that contains this item
:type library_id: str
:returns: detailed library item information
@@ -119,7 +119,7 @@
:func:`galaxy.model.LibraryDataset.to_dict` and
:attr:`galaxy.model.LibraryFolder.dict_element_visible_keys`
"""
- class_name, content_id = self.__decode_library_content_id( trans, id )
+ class_name, content_id = self.__decode_library_content_id( id )
if class_name == 'LibraryFolder':
content = self.get_library_folder( trans, content_id, check_ownership=False, check_accessible=True )
rval = content.to_dict( view='element', value_mapper={ 'id': trans.security.encode_id } )
@@ -146,27 +146,39 @@
the HDA's encoded id in ``from_hda_id`` (and optionally ``ldda_message``).
:type library_id: str
- :param library_id: encoded id string of the library where to create the new item
+ :param library_id: the encoded id of the library where to create the new item
:type payload: dict
:param payload: dictionary structure containing:
- * folder_id: the parent folder of the new item
+ * folder_id: the encoded id of the parent folder of the new item
* create_type: the type of item to create ('file', 'folder' or 'collection')
- * from_hda_id: (optional) the id of an accessible HDA to copy into the
- library
+ * from_hda_id: (optional, only if create_type is 'file') the
+ encoded id of an accessible HDA to copy into the library
* ldda_message: (optional) the new message attribute of the LDDA created
* extended_metadata: (optional) dub-dictionary containing any extended
metadata to associate with the item
- * link_data_only: (optional) either 'copy_files' (default) or 'link_to_files'
* upload_option: (optional) one of 'upload_file' (default), 'upload_directory' or 'upload_paths'
- * server_dir: (optional) only if upload_option is 'upload_directory'
- * filesystem_paths: (optional) only if upload_option is 'upload_paths' and the user is an admin
+ * server_dir: (optional, only if upload_option is
+ 'upload_directory') relative path of the subdirectory of Galaxy
+ ``library_import_dir`` to upload. All and only the files (i.e.
+ no subdirectories) contained in the specified directory will be
+ uploaded.
+ * filesystem_paths: (optional, only if upload_option is
+ 'upload_paths' and the user is an admin) file paths on the
+ Galaxy server to upload to the library, one file per line
+ * link_data_only: (optional, only when upload_option is
+ 'upload_directory' or 'upload_paths') either 'copy_files'
+ (default) or 'link_to_files'. Setting to 'link_to_files'
+ symlinks instead of copying the files
+ * name: (optional, only if create_type is 'folder') name of the
+ folder to create
+ * description: (optional, only if create_type is 'folder')
+ description of the folder to create
:rtype: dict
:returns: a dictionary containing the id, name,
and 'show' url of the new item
"""
- create_type = None
if 'create_type' not in payload:
trans.response.status = 400
return "Missing required 'create_type' parameter."
@@ -178,10 +190,10 @@
if 'folder_id' not in payload:
trans.response.status = 400
- return "Missing requred 'folder_id' parameter."
+ return "Missing required 'folder_id' parameter."
else:
folder_id = payload.pop( 'folder_id' )
- class_name, folder_id = self.__decode_library_content_id( trans, folder_id )
+ class_name, folder_id = self.__decode_library_content_id( folder_id )
try:
# security is checked in the downstream controller
parent = self.get_library_folder( trans, folder_id, check_ownership=False, check_accessible=False )
@@ -198,9 +210,7 @@
#check for extended metadata, store it and pop it out of the param
#otherwise sanitize_param will have a fit
- ex_meta_payload = None
- if 'extended_metadata' in payload:
- ex_meta_payload = payload.pop('extended_metadata')
+ ex_meta_payload = payload.pop('extended_metadata', None)
# Now create the desired content object, either file or folder.
if create_type == 'file':
@@ -272,7 +282,7 @@
def _copy_hda_to_library_folder( self, trans, from_hda_id, library_id, folder_id, ldda_message='' ):
"""
- Copies hda ``from_hda_id`` to library folder ``library_folder_id`` optionally
+ Copies hda ``from_hda_id`` to library folder ``folder_id``, optionally
adding ``ldda_message`` to the new ldda's ``message``.
``library_contents.create`` will branch to this if called with 'from_hda_id'
@@ -325,7 +335,7 @@
:type id: str
:param id: the encoded id of the library item to return
:type library_id: str
- :param library_id: encoded id string of the library that contains this item
+ :param library_id: the encoded id of the library that contains this item
:type payload: dict
:param payload: dictionary structure containing::
'converted_dataset_id':
@@ -344,7 +354,7 @@
trans.sa_session.add( assoc )
trans.sa_session.flush()
- def __decode_library_content_id( self, trans, content_id ):
+ def __decode_library_content_id( self, content_id ):
if len( content_id ) % 16 == 0:
return 'LibraryDataset', content_id
elif content_id.startswith( 'F' ):
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 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/eb61b02da186/
Changeset: eb61b02da186
User: jmchilton
Date: 2015-01-12 02:43:13+00:00
Summary: Source the common startup script for run_tests.sh.
Fixes planemo #50.
Affected #: 1 file
diff -r ff4e9117b39ddaff106d1c44792eb6fbcc7c0256 -r eb61b02da1866c4a7da0f2fa357ce43e6c62b57c run_tests.sh
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -1,5 +1,7 @@
#!/bin/sh
+./scripts/common_startup.sh
+
# A good place to look for nose info: http://somethingaboutorange.com/mrl/projects/nose/
rm -f run_functional_tests.log
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 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/ff4e9117b39d/
Changeset: ff4e9117b39d
User: jmchilton
Date: 2015-01-12 02:32:50+00:00
Summary: Tool Tests - Only set library import dir if it exists.
Fixes planemo #41 (https://github.com/galaxyproject/planemo/issues/41).
Affected #: 1 file
diff -r 796f3129e903e164e72ce9ec4db0158eb427ccac -r ff4e9117b39ddaff106d1c44792eb6fbcc7c0256 scripts/functional_tests.py
--- a/scripts/functional_tests.py
+++ b/scripts/functional_tests.py
@@ -225,7 +225,11 @@
if not os.path.isabs( galaxy_test_file_dir ):
galaxy_test_file_dir = os.path.join( os.getcwd(), galaxy_test_file_dir )
library_import_dir = galaxy_test_file_dir
- user_library_import_dir = os.path.join( galaxy_test_file_dir, 'users' )
+ import_dir = os.path.join( galaxy_test_file_dir, 'users' )
+ if os.path.exists(import_dir):
+ user_library_import_dir = import_dir
+ else:
+ user_library_import_dir = None
ignore_files = ()
start_server = 'GALAXY_TEST_EXTERNAL' not in os.environ
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 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/7833db9748f1/
Changeset: 7833db9748f1
User: guerler
Date: 2015-01-11 17:59:43+00:00
Summary: Upload: Show upload button only in analysis view
Affected #: 4 files
diff -r 41bad82393f1790013b09851afd6f8914500f7e2 -r 7833db9748f17c88f458976471e3aa64cb6e8d8b client/galaxy/scripts/mvc/upload/upload-view.js
--- a/client/galaxy/scripts/mvc/upload/upload-view.js
+++ b/client/galaxy/scripts/mvc/upload/upload-view.js
@@ -104,7 +104,7 @@
});
// define location
- $('#left .unified-panel-header-inner').append((new UploadButton.View(this.ui_button)).$el);
+ $('.with-upload-button').append((new UploadButton.View(this.ui_button)).$el);
// load extension
var self = this;
diff -r 41bad82393f1790013b09851afd6f8914500f7e2 -r 7833db9748f17c88f458976471e3aa64cb6e8d8b static/scripts/mvc/upload/upload-view.js
--- a/static/scripts/mvc/upload/upload-view.js
+++ b/static/scripts/mvc/upload/upload-view.js
@@ -104,7 +104,7 @@
});
// define location
- $('#left .unified-panel-header-inner').append((new UploadButton.View(this.ui_button)).$el);
+ $('.with-upload-button').append((new UploadButton.View(this.ui_button)).$el);
// load extension
var self = this;
diff -r 41bad82393f1790013b09851afd6f8914500f7e2 -r 7833db9748f17c88f458976471e3aa64cb6e8d8b 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(["utils/utils","mvc/upload/upload-button","mvc/upload/upload-model","mvc/upload/upload-row","mvc/upload/upload-ftp","mvc/ui/ui-popover","mvc/ui/ui-modal","utils/uploadbox"],function(f,e,c,b,g,d,a){return Backbone.View.extend({options:{nginx_upload_path:""},modal:null,ui_button:null,uploadbox:null,current_history:null,upload_size:0,list_extensions:[],list_genomes:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},collection:new c.Collection(),ftp:null,counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(i){var h=this;if(i){this.options=_.defaults(i,this.options)}this.ui_button=new e.Model({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(j){if(j){j.preventDefault();h.show()}},onunload:function(){if(h.counter.running>0){return"Several uploads are still processing."}}});$("#left .unified-panel-header-inner").append((new e.View(this.ui_button)).$el);var h=this;f.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(j){for(key in j){h.list_extensions.push({id:j[key].extension,text:j[key].extension,description:j[key].description,description_url:j[key].description_url})}h.list_extensions.sort(function(l,k){return l.id>k.id?1:l.id<k.id?-1:0});if(!h.options.datatypes_disable_auto){h.list_extensions.unshift(h.auto)}}});f.get({url:galaxy_config.root+"api/genomes",success:function(j){for(key in j){h.list_genomes.push({id:j[key][1],text:j[key][0]})}h.list_genomes.sort(function(l,k){return l.id>k.id?1:l.id<k.id?-1:0})}});this.collection.on("remove",function(j){h._eventRemove(j)});this.collection.on("change:genome",function(k){var j=k.get("genome");h.collection.each(function(l){if(l.get("status")=="init"&&l.get("genome")=="?"){l.set("genome",j)}})})},show:function(){var h=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){h.show()},500);return}if(!this.modal){var h=this;this.modal=new a.View({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose local file":function(){h.uploadbox.select()},"Choose FTP file":function(){h._eventFtp()},"Paste/Fetch data":function(){h._eventCreate()},Start:function(){h._eventStart()},Pause:function(){h._eventStop()},Reset:function(){h._eventReset()},Close:function(){h.modal.hide()},},height:"400",width:"900",closing_events:true});this.setElement("#upload-box");var h=this;this.uploadbox=this.$el.uploadbox({announce:function(j,k,l){h._eventAnnounce(j,k,l)},initialize:function(j,k,l){return h._eventInitialize(j,k,l)},progress:function(j,k,l){h._eventProgress(j,k,l)},success:function(j,k,l){h._eventSuccess(j,k,l)},error:function(j,k,l){h._eventError(j,k,l)},complete:function(){h._eventComplete()}});var i=this.modal.getButton("Choose FTP file");this.ftp=new d.View({title:"FTP files",container:i})}this.modal.show();this._updateUser();this._updateScreen()},_eventRemove:function(i){var h=i.get("status");if(h=="success"){this.counter.success--}else{if(h=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(i.id)},_eventAnnounce:function(h,i,k){this.counter.announce++;this._updateScreen();var j=new b(this,{id:h,file_name:i.name,file_size:i.size,file_mode:i.mode,file_path:i.path});this.collection.add(j.model);$(this.el).find("tbody:first").append(j.$el);j.render()},_eventInitialize:function(m,j,s){var k=this.collection.get(m);k.set("status","running");var o=k.get("file_name");var n=k.get("file_path");var h=k.get("file_mode");var p=k.get("extension");var r=k.get("genome");var q=k.get("url_paste");var l=k.get("space_to_tabs");var i=k.get("to_posix_lines");if(!q&&!(j.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path});if(h=="local"){this.uploadbox.configure({paramname:"files_0|file_data"})}else{this.uploadbox.configure({paramname:null})}tool_input={};if(h=="new"){tool_input["files_0|url_paste"]=q}if(h=="ftp"){tool_input["files_0|ftp_files"]=n}tool_input.dbkey=r;tool_input.file_type=p;tool_input["files_0|type"]="upload_dataset";tool_input.space_to_tabs=l;tool_input.to_posix_lines=i;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(i,j,h){var k=this.collection.get(i);k.set("percentage",h);this.ui_button.set("percentage",this._upload_percentage(h,j.size))},_eventSuccess:function(i,j,l){var k=this.collection.get(i);k.set("percentage",100);k.set("status","success");var h=k.get("file_size");this.ui_button.set("percentage",this._upload_percentage(100,h));this.upload_completed+=h*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshContents()},_eventError:function(h,i,k){var j=this.collection.get(h);j.set("percentage",100);j.set("status","error");j.set("info",k);this.ui_button.set("percentage",this._upload_percentage(100,i.size));this.ui_button.set("status","danger");this.upload_completed+=i.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(h){if(h.get("status")=="queued"){h.set("status","init")}});this.counter.running=0;this._updateScreen()},_eventFtp:function(){if(!this.ftp.visible){this.ftp.empty();this.ftp.append((new g(this)).$el);this.ftp.show()}else{this.ftp.hide()}},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:0,mode:"new"}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0){return}var h=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(i){if(i.get("status")=="init"){i.set("status","queued");h.upload_size+=i.get("file_size")}});this.ui_button.set("percentage",0);this.ui_button.set("status","success");this.counter.running=this.counter.announce;this._updateScreen();this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0){return}this.ui_button.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.ui_button.set("percentage",0)}},_updateUser:function(){this.current_user=Galaxy.currUser.get("id");this.current_history=null;if(this.current_user){this.current_history=Galaxy.currHistoryPanel.model.get("id")}},_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 local file");this.modal.enableButton("Choose FTP file");this.modal.enableButton("Paste/Fetch data")}else{this.modal.disableButton("Choose local file");this.modal.disableButton("Choose FTP file");this.modal.disableButton("Paste/Fetch data")}if(this.current_user&&this.options.ftp_upload_dir&&this.options.ftp_upload_site){this.modal.showButton("Choose FTP file")}else{this.modal.hideButton("Choose FTP file")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("#upload-table").show()}else{$(this.el).find("#upload-table").hide()}},_upload_percentage:function(h,i){return(this.upload_completed+(h*i))/this.upload_size},_template:function(i,h){return'<div id="'+i+'" class="upload-box"><table id="upload-table" class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Settings</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+h+'" class="upload-info"></h6>'}})});
\ No newline at end of file
+define(["utils/utils","mvc/upload/upload-button","mvc/upload/upload-model","mvc/upload/upload-row","mvc/upload/upload-ftp","mvc/ui/ui-popover","mvc/ui/ui-modal","utils/uploadbox"],function(f,e,c,b,g,d,a){return Backbone.View.extend({options:{nginx_upload_path:""},modal:null,ui_button:null,uploadbox:null,current_history:null,upload_size:0,list_extensions:[],list_genomes:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},collection:new c.Collection(),ftp:null,counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(i){var h=this;if(i){this.options=_.defaults(i,this.options)}this.ui_button=new e.Model({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(j){if(j){j.preventDefault();h.show()}},onunload:function(){if(h.counter.running>0){return"Several uploads are still processing."}}});$(".with-upload-button").append((new e.View(this.ui_button)).$el);var h=this;f.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(j){for(key in j){h.list_extensions.push({id:j[key].extension,text:j[key].extension,description:j[key].description,description_url:j[key].description_url})}h.list_extensions.sort(function(l,k){return l.id>k.id?1:l.id<k.id?-1:0});if(!h.options.datatypes_disable_auto){h.list_extensions.unshift(h.auto)}}});f.get({url:galaxy_config.root+"api/genomes",success:function(j){for(key in j){h.list_genomes.push({id:j[key][1],text:j[key][0]})}h.list_genomes.sort(function(l,k){return l.id>k.id?1:l.id<k.id?-1:0})}});this.collection.on("remove",function(j){h._eventRemove(j)});this.collection.on("change:genome",function(k){var j=k.get("genome");h.collection.each(function(l){if(l.get("status")=="init"&&l.get("genome")=="?"){l.set("genome",j)}})})},show:function(){var h=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){h.show()},500);return}if(!this.modal){var h=this;this.modal=new a.View({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose local file":function(){h.uploadbox.select()},"Choose FTP file":function(){h._eventFtp()},"Paste/Fetch data":function(){h._eventCreate()},Start:function(){h._eventStart()},Pause:function(){h._eventStop()},Reset:function(){h._eventReset()},Close:function(){h.modal.hide()},},height:"400",width:"900",closing_events:true});this.setElement("#upload-box");var h=this;this.uploadbox=this.$el.uploadbox({announce:function(j,k,l){h._eventAnnounce(j,k,l)},initialize:function(j,k,l){return h._eventInitialize(j,k,l)},progress:function(j,k,l){h._eventProgress(j,k,l)},success:function(j,k,l){h._eventSuccess(j,k,l)},error:function(j,k,l){h._eventError(j,k,l)},complete:function(){h._eventComplete()}});var i=this.modal.getButton("Choose FTP file");this.ftp=new d.View({title:"FTP files",container:i})}this.modal.show();this._updateUser();this._updateScreen()},_eventRemove:function(i){var h=i.get("status");if(h=="success"){this.counter.success--}else{if(h=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(i.id)},_eventAnnounce:function(h,i,k){this.counter.announce++;this._updateScreen();var j=new b(this,{id:h,file_name:i.name,file_size:i.size,file_mode:i.mode,file_path:i.path});this.collection.add(j.model);$(this.el).find("tbody:first").append(j.$el);j.render()},_eventInitialize:function(m,j,s){var k=this.collection.get(m);k.set("status","running");var o=k.get("file_name");var n=k.get("file_path");var h=k.get("file_mode");var p=k.get("extension");var r=k.get("genome");var q=k.get("url_paste");var l=k.get("space_to_tabs");var i=k.get("to_posix_lines");if(!q&&!(j.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path});if(h=="local"){this.uploadbox.configure({paramname:"files_0|file_data"})}else{this.uploadbox.configure({paramname:null})}tool_input={};if(h=="new"){tool_input["files_0|url_paste"]=q}if(h=="ftp"){tool_input["files_0|ftp_files"]=n}tool_input.dbkey=r;tool_input.file_type=p;tool_input["files_0|type"]="upload_dataset";tool_input.space_to_tabs=l;tool_input.to_posix_lines=i;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(i,j,h){var k=this.collection.get(i);k.set("percentage",h);this.ui_button.set("percentage",this._upload_percentage(h,j.size))},_eventSuccess:function(i,j,l){var k=this.collection.get(i);k.set("percentage",100);k.set("status","success");var h=k.get("file_size");this.ui_button.set("percentage",this._upload_percentage(100,h));this.upload_completed+=h*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshContents()},_eventError:function(h,i,k){var j=this.collection.get(h);j.set("percentage",100);j.set("status","error");j.set("info",k);this.ui_button.set("percentage",this._upload_percentage(100,i.size));this.ui_button.set("status","danger");this.upload_completed+=i.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(h){if(h.get("status")=="queued"){h.set("status","init")}});this.counter.running=0;this._updateScreen()},_eventFtp:function(){if(!this.ftp.visible){this.ftp.empty();this.ftp.append((new g(this)).$el);this.ftp.show()}else{this.ftp.hide()}},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:0,mode:"new"}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0){return}var h=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(i){if(i.get("status")=="init"){i.set("status","queued");h.upload_size+=i.get("file_size")}});this.ui_button.set("percentage",0);this.ui_button.set("status","success");this.counter.running=this.counter.announce;this._updateScreen();this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0){return}this.ui_button.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.ui_button.set("percentage",0)}},_updateUser:function(){this.current_user=Galaxy.currUser.get("id");this.current_history=null;if(this.current_user){this.current_history=Galaxy.currHistoryPanel.model.get("id")}},_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 local file");this.modal.enableButton("Choose FTP file");this.modal.enableButton("Paste/Fetch data")}else{this.modal.disableButton("Choose local file");this.modal.disableButton("Choose FTP file");this.modal.disableButton("Paste/Fetch data")}if(this.current_user&&this.options.ftp_upload_dir&&this.options.ftp_upload_site){this.modal.showButton("Choose FTP file")}else{this.modal.hideButton("Choose FTP file")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("#upload-table").show()}else{$(this.el).find("#upload-table").hide()}},_upload_percentage:function(h,i){return(this.upload_completed+(h*i))/this.upload_size},_template:function(i,h){return'<div id="'+i+'" class="upload-box"><table id="upload-table" class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Settings</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+h+'" class="upload-info"></h6>'}})});
\ No newline at end of file
diff -r 41bad82393f1790013b09851afd6f8914500f7e2 -r 7833db9748f17c88f458976471e3aa64cb6e8d8b templates/webapps/galaxy/root/index.mako
--- a/templates/webapps/galaxy/root/index.mako
+++ b/templates/webapps/galaxy/root/index.mako
@@ -58,7 +58,7 @@
<%def name="left_panel()"><div class="unified-panel-header" unselectable="on">
- <div class='unified-panel-header-inner'>
+ <div class='unified-panel-header-inner with-upload-button'>
${n_('Tools')}
</div></div>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.