4 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/edc187004292/ Changeset: edc187004292 User: dannon Date: 2014-09-04 01:38:44 Summary: Add is_uuid to lib/galaxy/util Affected #: 1 file diff -r 6070f4fbb38f88eb98cf65f0477924ffea9bc10c -r edc1870042923f32dfeb9dadcc13e1915edff825 lib/galaxy/util/__init__.py --- a/lib/galaxy/util/__init__.py +++ b/lib/galaxy/util/__init__.py @@ -98,6 +98,21 @@ return False +def is_uuid( value ): + """ + This method returns True if value is a UUID, otherwise False. + >>> is_uuid( "123e4567-e89b-12d3-a456-426655440000" ) + True + >>> is_uuid( "0x3242340298902834" ) + False + """ + uuid_re = re.compile( "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" ) + if re.match( uuid_re, str( value ) ): + return True + else: + return False + + def get_charset_from_http_headers( headers, default=None ): rval = headers.get('content-type', None ) if rval and 'charset=' in rval: https://bitbucket.org/galaxy/galaxy-central/commits/8a93d99fccfa/ Changeset: 8a93d99fccfa User: dannon Date: 2014-09-04 01:49:05 Summary: pep8 prior to modifications / whitespace and comment spacing. Affected #: 1 file diff -r edc1870042923f32dfeb9dadcc13e1915edff825 -r 8a93d99fccfa452786836a568976b5ebb50cddf7 lib/galaxy/webapps/galaxy/api/workflows.py --- a/lib/galaxy/webapps/galaxy/api/workflows.py +++ b/lib/galaxy/webapps/galaxy/api/workflows.py @@ -439,17 +439,17 @@ stored_workflow = query.get( workflow_id ) except Exception: try: - #see if they have passed in the UUID for a workflow that is attached to a stored workflow + # see if they have passed in the UUID for a workflow that is attached to a stored workflow workflow_uuid = uuid.UUID(workflow_id) stored_workflow = trans.sa_session.query(trans.app.model.StoredWorkflow).filter( and_( trans.app.model.StoredWorkflow.latest_workflow_id == trans.app.model.Workflow.id, trans.app.model.Workflow.uuid == workflow_uuid - )).first() + )).first() if stored_workflow is None: raise exceptions.ObjectNotFound( "Workflow not found: %s" % workflow_id ) return stored_workflow except: - pass #let the outer raise exception happen + pass # let the outer raise exception happen raise exceptions.ObjectNotFound( "No such workflow found - invalid workflow identifier." ) if stored_workflow is None: raise exceptions.ObjectNotFound( "No such workflow found." ) https://bitbucket.org/galaxy/galaxy-central/commits/75709a2361b1/ Changeset: 75709a2361b1 User: dannon Date: 2014-09-04 16:59:44 Summary: Adjust __get_stored_workflow (by uuid) logic to detect UUIDs and switch accordingly. Affected #: 1 file diff -r 8a93d99fccfa452786836a568976b5ebb50cddf7 -r 75709a2361b15ba5fd393b0ff2333a81b6ddff87 lib/galaxy/webapps/galaxy/api/workflows.py --- a/lib/galaxy/webapps/galaxy/api/workflows.py +++ b/lib/galaxy/webapps/galaxy/api/workflows.py @@ -433,24 +433,19 @@ return stored_workflow def __get_stored_workflow( self, trans, workflow_id ): - try: + if util.is_uuid(workflow_id): + # see if they have passed in the UUID for a workflow that is attached to a stored workflow + workflow_uuid = uuid.UUID(workflow_id) + stored_workflow = trans.sa_session.query(trans.app.model.StoredWorkflow).filter( and_( + trans.app.model.StoredWorkflow.latest_workflow_id == trans.app.model.Workflow.id, + trans.app.model.Workflow.uuid == workflow_uuid + )).first() + if stored_workflow is None: + raise exceptions.ObjectNotFound( "Workflow not found: %s" % workflow_id ) + else: workflow_id = self.__decode_id( trans, workflow_id ) query = trans.sa_session.query( trans.app.model.StoredWorkflow ) stored_workflow = query.get( workflow_id ) - except Exception: - try: - # see if they have passed in the UUID for a workflow that is attached to a stored workflow - workflow_uuid = uuid.UUID(workflow_id) - stored_workflow = trans.sa_session.query(trans.app.model.StoredWorkflow).filter( and_( - trans.app.model.StoredWorkflow.latest_workflow_id == trans.app.model.Workflow.id, - trans.app.model.Workflow.uuid == workflow_uuid - )).first() - if stored_workflow is None: - raise exceptions.ObjectNotFound( "Workflow not found: %s" % workflow_id ) - return stored_workflow - except: - pass # let the outer raise exception happen - raise exceptions.ObjectNotFound( "No such workflow found - invalid workflow identifier." ) if stored_workflow is None: raise exceptions.ObjectNotFound( "No such workflow found." ) return stored_workflow https://bitbucket.org/galaxy/galaxy-central/commits/9fdca7477f44/ Changeset: 9fdca7477f44 User: dannon Date: 2014-09-04 16:59:59 Summary: Merge. Affected #: 11 files diff -r 75709a2361b15ba5fd393b0ff2333a81b6ddff87 -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf .hgtags --- a/.hgtags +++ b/.hgtags @@ -18,4 +18,4 @@ 81fbe25bd02edcd53065e8e4476dd1dfb5a72cf2 latest_2013.11.04 2a756ca2cb1826db7796018e77d12e2dd7b67603 latest_2014.02.10 ca45b78adb4152fc6e7395514d46eba6b7d0b838 release_2014.08.11 -ea12550fbc34260ae70bde38db59a4024f35f988 latest_2014.08.11 +20f4fdf1735aeff23a6e7ab00389781fe3f3142c latest_2014.08.11 diff -r 75709a2361b15ba5fd393b0ff2333a81b6ddff87 -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf lib/galaxy/model/__init__.py --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -2466,6 +2466,7 @@ val = getattr( ldda.datatype, name ) rval['metadata_' + name] = val return rval + def get_template_widgets( self, trans, get_contents=True ): # See if we have any associated templatesThe get_contents # param is passed by callers that are inheriting a template - these @@ -2492,6 +2493,7 @@ else: return template.get_widgets( trans.user ) return [] + def templates_dict( self, use_name=False ): """ Returns a dict of template info @@ -2510,6 +2512,7 @@ tmp_dict[ name ] = content.get( field[ 'name' ] ) template_data[template.name] = tmp_dict return template_data + def templates_json( self, use_name=False ): return json.dumps( self.templates_dict( use_name=use_name ) ) @@ -2533,6 +2536,7 @@ self.info = info self.inheritable = inheritable + class LibraryFolderInfoAssociation( object ): def __init__( self, folder, form_definition, info, inheritable=False ): self.folder = folder @@ -2540,15 +2544,18 @@ self.info = info self.inheritable = inheritable + class LibraryDatasetDatasetInfoAssociation( object ): def __init__( self, library_dataset_dataset_association, form_definition, info ): # TODO: need to figure out if this should be inheritable to the associated LibraryDataset self.library_dataset_dataset_association = library_dataset_dataset_association self.template = form_definition self.info = info + @property def inheritable( self ): - return True #always allow inheriting, used for replacement + return True # always allow inheriting, used for replacement + class ValidationError( object ): def __init__( self, message=None, err_type=None, attributes=None ): @@ -2556,42 +2563,47 @@ self.err_type = err_type self.attributes = attributes + class DatasetToValidationErrorAssociation( object ): def __init__( self, dataset, validation_error ): self.dataset = dataset self.validation_error = validation_error + class ImplicitlyConvertedDatasetAssociation( object ): - def __init__( self, id = None, parent = None, dataset = None, file_type = None, deleted = False, purged = False, metadata_safe = True ): + + def __init__( self, id=None, parent=None, dataset=None, file_type=None, deleted=False, purged=False, metadata_safe=True ): self.id = id if isinstance(dataset, HistoryDatasetAssociation): self.dataset = dataset elif isinstance(dataset, LibraryDatasetDatasetAssociation): self.dataset_ldda = dataset else: - raise AttributeError, 'Unknown dataset type provided for dataset: %s' % type( dataset ) + raise AttributeError( 'Unknown dataset type provided for dataset: %s' % type( dataset ) ) if isinstance(parent, HistoryDatasetAssociation): self.parent_hda = parent elif isinstance(parent, LibraryDatasetDatasetAssociation): self.parent_ldda = parent else: - raise AttributeError, 'Unknown dataset type provided for parent: %s' % type( parent ) + raise AttributeError( 'Unknown dataset type provided for parent: %s' % type( parent ) ) self.type = file_type self.deleted = deleted self.purged = purged self.metadata_safe = metadata_safe - def clear( self, purge = False, delete_dataset = True ): + def clear( self, purge=False, delete_dataset=True ): self.deleted = True if self.dataset: if delete_dataset: self.dataset.deleted = True if purge: self.dataset.purged = True - if purge and self.dataset.deleted: #do something with purging + if purge and self.dataset.deleted: # do something with purging self.purged = True - try: os.unlink( self.file_name ) - except Exception, e: print "Failed to purge associated file (%s) from disk: %s" % ( self.file_name, e ) + try: + os.unlink( self.file_name ) + except Exception, e: + print "Failed to purge associated file (%s) from disk: %s" % ( self.file_name, e ) DEFAULT_COLLECTION_NAME = "Unnamed Collection" @@ -2903,6 +2915,7 @@ self.tool_id = None self.message = message + class GalaxySession( object ): def __init__( self, id=None, @@ -2924,24 +2937,29 @@ self.is_valid = is_valid self.prev_session_id = prev_session_id self.histories = [] + def add_history( self, history, association=None ): if association is None: self.histories.append( GalaxySessionToHistoryAssociation( self, history ) ) else: self.histories.append( association ) + def get_disk_usage( self ): if self.disk_usage is None: return 0 return self.disk_usage + def set_disk_usage( self, bytes ): self.disk_usage = bytes total_disk_usage = property( get_disk_usage, set_disk_usage ) + class GalaxySessionToHistoryAssociation( object ): def __init__( self, galaxy_session, history ): self.galaxy_session = galaxy_session self.history = history + class UCI( object ): def __init__( self ): self.id = None @@ -2962,14 +2980,14 @@ self.latest_workflow_id = None self.workflows = [] - def copy_tags_from(self,target_user,source_workflow): + def copy_tags_from(self, target_user, source_workflow): for src_swta in source_workflow.owner_tags: new_swta = src_swta.copy() new_swta.user = target_user self.tags.append(new_swta) - def to_dict( self, view='collection', value_mapper = None ): - rval = super( StoredWorkflow, self ).to_dict( view=view, value_mapper = value_mapper ) + def to_dict( self, view='collection', value_mapper=None ): + rval = super( StoredWorkflow, self ).to_dict( view=view, value_mapper=value_mapper ) tags_str_list = [] for tag in self.tags: tag_str = tag.user_tname @@ -3007,12 +3025,11 @@ return False def to_dict( self, view='collection', value_mapper=None): - rval = super( Workflow, self ).to_dict( view=view, value_mapper = value_mapper ) - rval['uuid'] = ( lambda uuid: str( uuid ) if uuid else None )( self.uuid ) + rval = super( Workflow, self ).to_dict( view=view, value_mapper=value_mapper ) + rval['uuid'] = ( lambda uuid: str( uuid ) if uuid else None )( self.uuid ) return rval - class WorkflowStep( object ): def __init__( self ): @@ -3061,7 +3078,7 @@ dict_collection_visible_keys = ( 'id', 'update_time', 'workflow_id' ) dict_element_visible_keys = ( 'id', 'update_time', 'workflow_id' ) - def to_dict( self, view='collection', value_mapper = None ): + def to_dict( self, view='collection', value_mapper=None ): rval = super( WorkflowInvocation, self ).to_dict( view=view, value_mapper=value_mapper ) if view == 'element': steps = {} @@ -3072,12 +3089,12 @@ inputs = {} for step in self.steps: - if step.workflow_step.type =='tool': + if step.workflow_step.type == 'tool': for step_input in step.workflow_step.input_connections: if step_input.output_step.type == 'data_input': for job_input in step.job.input_datasets: if job_input.name == step_input.input_name: - inputs[str(step_input.output_step.order_index)] = { "id" : job_input.dataset_id, "src" : "hda"} + inputs[str(step_input.output_step.order_index)] = { "id": job_input.dataset_id, "src": "hda"} rval['inputs'] = inputs return rval @@ -3086,19 +3103,20 @@ dict_collection_visible_keys = ( 'id', 'update_time', 'job_id', 'workflow_step_id' ) dict_element_visible_keys = ( 'id', 'update_time', 'job_id', 'workflow_step_id' ) - def to_dict( self, view='collection', value_mapper = None ): + def to_dict( self, view='collection', value_mapper=None ): rval = super( WorkflowInvocationStep, self ).to_dict( view=view, value_mapper=value_mapper ) rval['order_index'] = self.workflow_step.order_index return rval class MetadataFile( object ): - def __init__( self, dataset = None, name = None ): + def __init__( self, dataset=None, name=None ): if isinstance( dataset, HistoryDatasetAssociation ): self.history_dataset = dataset elif isinstance( dataset, LibraryDatasetDatasetAssociation ): self.library_dataset = dataset self.name = name + @property def file_name( self ): assert self.id is not None, "ID must be set before filename used (commit the object)" @@ -3129,14 +3147,15 @@ class FormDefinition( object, Dictifiable ): # The following form_builder classes are supported by the FormDefinition class. supported_field_types = [ AddressField, CheckboxField, PasswordField, SelectField, TextArea, TextField, WorkflowField, WorkflowMappingField, HistoryField ] - types = Bunch( REQUEST = 'Sequencing Request Form', - SAMPLE = 'Sequencing Sample Form', - EXTERNAL_SERVICE = 'External Service Information Form', - RUN_DETAILS_TEMPLATE = 'Sample run details template', - LIBRARY_INFO_TEMPLATE = 'Library information template', - USER_INFO = 'User Information' ) + types = Bunch( REQUEST='Sequencing Request Form', + SAMPLE='Sequencing Sample Form', + EXTERNAL_SERVICE='External Service Information Form', + RUN_DETAILS_TEMPLATE='Sample run details template', + LIBRARY_INFO_TEMPLATE='Library information template', + USER_INFO='User Information' ) dict_collection_visible_keys = ( 'id', 'name' ) dict_element_visible_keys = ( 'id', 'name', 'desc', 'form_definition_current_id', 'fields', 'layout' ) + def __init__( self, name=None, desc=None, fields=[], form_definition_current=None, form_type=None, layout=None ): self.name = name self.desc = desc @@ -3144,6 +3163,7 @@ self.form_definition_current = form_definition_current self.type = form_type self.layout = layout + def grid_fields( self, grid_index ): # Returns a dictionary whose keys are integers corresponding to field positions # on the grid and whose values are the field. @@ -3152,6 +3172,7 @@ if str( f[ 'layout' ] ) == str( grid_index ): gridfields[i] = f return gridfields + def get_widgets( self, user, contents={}, **kwd ): ''' Return the list of widgets that comprise a form definition, @@ -3213,24 +3234,28 @@ field_widget.params = params elif field_type == 'SelectField': for option in field[ 'selectlist' ]: + if option == value: field_widget.add_option( option, option, selected=True ) else: field_widget.add_option( option, option ) elif field_type == 'CheckboxField': + field_widget.set_checked( value ) if field[ 'required' ] == 'required': req = 'Required' else: req = 'Optional' if field[ 'helptext' ]: - helptext='%s (%s)' % ( field[ 'helptext' ], req ) + helptext = '%s (%s)' % ( field[ 'helptext' ], req ) else: helptext = '(%s)' % req widgets.append( dict( label=field[ 'label' ], + widget=field_widget, helptext=helptext ) ) return widgets + def field_as_html( self, field ): """Generates disabled html for a field""" type = field[ 'type' ] @@ -3245,21 +3270,25 @@ # Return None if unsupported field type return None + class FormDefinitionCurrent( object ): def __init__(self, form_definition=None): self.latest_form = form_definition + class FormValues( object ): def __init__(self, form_def=None, content=None): self.form_definition = form_def self.content = content + class Request( object, Dictifiable ): - states = Bunch( NEW = 'New', - SUBMITTED = 'In Progress', - REJECTED = 'Rejected', - COMPLETE = 'Complete' ) + states = Bunch( NEW='New', + SUBMITTED='In Progress', + REJECTED='Rejected', + COMPLETE='Complete' ) dict_collection_visible_keys = ( 'id', 'name', 'state' ) + def __init__( self, name=None, desc=None, request_type=None, user=None, form_values=None, notification=None ): self.name = name self.desc = desc @@ -3268,17 +3297,20 @@ self.user = user self.notification = notification self.samples_list = [] + @property def state( self ): latest_event = self.latest_event if latest_event: return latest_event.state return None + @property def latest_event( self ): if self.events: return self.events[0] return None + @property def samples_have_common_state( self ): """ @@ -3294,6 +3326,7 @@ if s.state.id != state_for_comparison.id: return False return state_for_comparison + @property def last_comment( self ): latest_event = self.latest_event @@ -3302,26 +3335,34 @@ return latest_event.comment return '' return 'No comment' + def get_sample( self, sample_name ): for sample in self.samples: if sample.name == sample_name: return sample return None + @property def is_unsubmitted( self ): return self.state in [ self.states.REJECTED, self.states.NEW ] + @property def is_rejected( self ): return self.state == self.states.REJECTED + @property def is_submitted( self ): return self.state == self.states.SUBMITTED + @property def is_new( self ): + return self.state == self.states.NEW + @property def is_complete( self ): return self.state == self.states.COMPLETE + @property def samples_without_library_destinations( self ): # Return all samples that are not associated with a library @@ -3330,6 +3371,7 @@ if not sample.library: samples.append( sample ) return samples + @property def samples_with_bar_code( self ): # Return all samples that have associated bar code @@ -3338,6 +3380,7 @@ if sample.bar_code: samples.append( sample ) return samples + def send_email_notification( self, trans, common_state, final_state=False ): # Check if an email notification is configured to be sent when the samples # are in this state @@ -3390,7 +3433,7 @@ try: send_mail( frm, to, subject, body, trans.app.config ) comments = "Email notification sent to %s." % ", ".join( to ).strip().strip( ',' ) - except Exception,e: + except Exception, e: comments = "Email notification failed. (%s)" % str(e) # update the request history with the email notification event elif not trans.app.config.smtp_server: @@ -3401,16 +3444,19 @@ trans.sa_session.flush() return comments + class RequestEvent( object ): def __init__(self, request=None, request_state=None, comment=''): self.request = request self.state = request_state self.comment = comment + class ExternalService( object ): - data_transfer_protocol = Bunch( HTTP = 'http', - HTTPS = 'https', - SCP = 'scp' ) + data_transfer_protocol = Bunch( HTTP='http', + HTTPS='https', + SCP='scp' ) + def __init__( self, name=None, description=None, external_service_type_id=None, version=None, form_definition_id=None, form_values_id=None, deleted=None ): self.name = name self.description = description @@ -3419,9 +3465,11 @@ self.form_definition_id = form_definition_id self.form_values_id = form_values_id self.deleted = deleted - self.label = None # Used in the request_type controller's __build_external_service_select_field() method + self.label = None # Used in the request_type controller's __build_external_service_select_field() method + def get_external_service_type( self, trans ): return trans.app.external_service_types.all_external_service_types[ self.external_service_type_id ] + def load_data_transfer_settings( self, trans ): trans.app.external_service_types.reload( self.external_service_type_id ) self.data_transfer = {} @@ -3442,33 +3490,39 @@ automatic_transfer = data_transfer_obj.config.get( 'automatic_transfer', 'false' ) http_configs[ 'automatic_transfer' ] = galaxy.util.string_as_bool( automatic_transfer ) self.data_transfer[ self.data_transfer_protocol.HTTP ] = http_configs + def populate_actions( self, trans, item, param_dict=None ): return self.get_external_service_type( trans ).actions.populate( self, item, param_dict=param_dict ) + class RequestType( object, Dictifiable ): dict_collection_visible_keys = ( 'id', 'name', 'desc' ) dict_element_visible_keys = ( 'id', 'name', 'desc', 'request_form_id', 'sample_form_id' ) - rename_dataset_options = Bunch( NO = 'Do not rename', - SAMPLE_NAME = 'Preprend sample name', - EXPERIMENT_NAME = 'Prepend experiment name', - EXPERIMENT_AND_SAMPLE_NAME = 'Prepend experiment and sample name') + rename_dataset_options = Bunch( NO='Do not rename', + SAMPLE_NAME='Preprend sample name', + EXPERIMENT_NAME='Prepend experiment name', + EXPERIMENT_AND_SAMPLE_NAME='Prepend experiment and sample name') permitted_actions = get_permitted_actions( filter='REQUEST_TYPE' ) + def __init__( self, name=None, desc=None, request_form=None, sample_form=None ): self.name = name self.desc = desc self.request_form = request_form self.sample_form = sample_form + @property def external_services( self ): external_services = [] for rtesa in self.external_service_associations: external_services.append( rtesa.external_service ) return external_services + def get_external_service( self, external_service_type_id ): for rtesa in self.external_service_associations: if rtesa.external_service.external_service_type_id == external_service_type_id: return rtesa.external_service return None + def get_external_services_for_manual_data_transfer( self, trans ): '''Returns all external services that use manual data transfer''' external_services = [] @@ -3481,6 +3535,7 @@ if not transfer_type_settings[ 'automatic_transfer' ]: external_services.append( external_service ) return external_services + def delete_external_service_associations( self, trans ): '''Deletes all external service associations.''' flush_needed = False @@ -3489,20 +3544,24 @@ flush_needed = True if flush_needed: trans.sa_session.flush() + def add_external_service_association( self, trans, external_service ): rtesa = trans.model.RequestTypeExternalServiceAssociation( self, external_service ) trans.sa_session.add( rtesa ) trans.sa_session.flush() + @property def final_sample_state( self ): # The states mapper for this object orders ascending return self.states[-1] + @property def run_details( self ): if self.run: # self.run[0] is [RequestTypeRunAssociation] return self.run[0] return None + def get_template_widgets( self, trans, get_contents=True ): # See if we have any associated templates. The get_contents param # is passed by callers that are inheriting a template - these are @@ -3520,23 +3579,27 @@ return template.get_widgets( trans.user ) return [] + class RequestTypeExternalServiceAssociation( object ): def __init__( self, request_type, external_service ): self.request_type = request_type self.external_service = external_service + class RequestTypePermissions( object ): def __init__( self, action, request_type, role ): self.action = action self.request_type = request_type self.role = role + class Sample( object, Dictifiable ): # The following form_builder classes are supported by the Sample class. supported_field_types = [ CheckboxField, SelectField, TextField, WorkflowField, WorkflowMappingField, HistoryField ] - bulk_operations = Bunch( CHANGE_STATE = 'Change state', - SELECT_LIBRARY = 'Select data library and folder' ) + bulk_operations = Bunch( CHANGE_STATE='Change state', + SELECT_LIBRARY='Select data library and folder' ) dict_collection_visible_keys = ( 'id', 'name' ) + def __init__(self, name=None, desc=None, request=None, form_values=None, bar_code=None, library=None, folder=None, workflow=None, history=None): self.name = name self.desc = desc @@ -3547,17 +3610,20 @@ self.folder = folder self.history = history self.workflow = workflow + @property def state( self ): latest_event = self.latest_event if latest_event: return latest_event.state return None + @property def latest_event( self ): if self.events: return self.events[0] return None + @property def adding_to_library_dataset_files( self ): adding_to_library_datasets = [] @@ -3565,6 +3631,7 @@ if dataset.status == SampleDataset.transfer_status.ADD_TO_LIBRARY: adding_to_library_datasets.append( dataset ) return adding_to_library_datasets + @property def inprogress_dataset_files( self ): inprogress_datasets = [] @@ -3572,6 +3639,7 @@ if dataset.status not in [ SampleDataset.transfer_status.NOT_STARTED, SampleDataset.transfer_status.COMPLETE ]: inprogress_datasets.append( dataset ) return inprogress_datasets + @property def queued_dataset_files( self ): queued_datasets = [] @@ -3579,6 +3647,7 @@ if dataset.status == SampleDataset.transfer_status.IN_QUEUE: queued_datasets.append( dataset ) return queued_datasets + @property def transfer_error_dataset_files( self ): transfer_error_datasets = [] @@ -3586,6 +3655,7 @@ if dataset.status == SampleDataset.transfer_status.ERROR: transfer_error_datasets.append( dataset ) return transfer_error_datasets + @property def transferred_dataset_files( self ): transferred_datasets = [] @@ -3593,6 +3663,7 @@ if dataset.status == SampleDataset.transfer_status.COMPLETE: transferred_datasets.append( dataset ) return transferred_datasets + @property def transferring_dataset_files( self ): transferring_datasets = [] @@ -3600,6 +3671,7 @@ if dataset.status == SampleDataset.transfer_status.TRANSFERRING: transferring_datasets.append( dataset ) return transferring_datasets + @property def untransferred_dataset_files( self ): untransferred_datasets = [] @@ -3607,6 +3679,7 @@ if dataset.status != SampleDataset.transfer_status.COMPLETE: untransferred_datasets.append( dataset ) return untransferred_datasets + def get_untransferred_dataset_size( self, filepath, scp_configs ): def print_ticks( d ): pass diff -r 75709a2361b15ba5fd393b0ff2333a81b6ddff87 -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -2130,6 +2130,8 @@ elif isinstance( value, basestring ): if value.startswith( "dce:" ): rval = trans.sa_session.query( trans.app.model.DatasetCollectionElement ).get( value[ len( "dce:"): ] ) + elif value.startswith( "hdca:" ): + rval = trans.sa_session.query( trans.app.model.HistoryDatasetCollectionAssociation ).get( value[ len( "hdca:"): ] ) else: rval = trans.sa_session.query( trans.app.model.HistoryDatasetCollectionAssociation ).get( value ) if rval and isinstance( rval, trans.app.model.HistoryDatasetCollectionAssociation ): diff -r 75709a2361b15ba5fd393b0ff2333a81b6ddff87 -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf static/scripts/mvc/tools/tools-section.js --- a/static/scripts/mvc/tools/tools-section.js +++ b/static/scripts/mvc/tools/tools-section.js @@ -336,7 +336,14 @@ id : 'field-' + id, data : options, value : options[0].value, + multiple : input_def.multiple, onchange : function(value) { + // pick the first dataset if multiple might be selected + // TODO: iterate over all datasets and filter common/consistent columns + if (input_def.multiple) { + value = value[0]; + } + // get referenced columns var column_list = self.app.tree.findReferences(id, 'data_column'); @@ -437,18 +444,16 @@ // column selection field _field_column : function (input_def) { return new Ui.Select.View({ - id : 'field-' + input_def.id + id : 'field-' + input_def.id, + multiple: input_def.multiple }); }, // text input field _field_text : function(input_def) { - var TextClass = Ui.Input; - if (input_def.area) { - TextClass = Ui.Textarea; - } - return new TextClass({ - id : 'field-' + input_def.id + return new Ui.Input({ + id : 'field-' + input_def.id, + area : input_def.area }); }, diff -r 75709a2361b15ba5fd393b0ff2333a81b6ddff87 -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf static/scripts/mvc/ui/ui-misc.js --- a/static/scripts/mvc/ui/ui-misc.js +++ b/static/scripts/mvc/ui/ui-misc.js @@ -312,7 +312,8 @@ placeholder : '', disabled : false, visible : true, - cls : '' + cls : '', + area : false }, // initialize @@ -352,60 +353,11 @@ // element _template: function(options) { - return '<input id="' + options.id + '" type="' + options.type + '" value="' + options.value + '" placeholder="' + options.placeholder + '" class="ui-input ' + options.cls + '">'; - } -}); - -// plugin -var Textarea = Backbone.View.extend({ - // options - optionsDefault: { - value : '', - type : 'text', - placeholder : '', - disabled : false, - visible : true, - cls : '' - }, - - // initialize - initialize : function(options) { - // configure options - this.options = Utils.merge(options, this.optionsDefault); - - // create new element - this.setElement(this._template(this.options)); - - // disable input field - if (this.options.disabled) { - this.$el.prop('disabled', true); + if (options.area) { + return '<textarea id="' + options.id + '" class="ui-textarea ' + options.cls + '"></textarea>'; + } else { + return '<input id="' + options.id + '" type="' + options.type + '" value="' + options.value + '" placeholder="' + options.placeholder + '" class="ui-input ' + options.cls + '">'; } - - // hide input field - if (!this.options.visible) { - this.$el.hide(); - } - - // onchange event handler. fires on user activity. - var self = this; - this.$el.on('input', function() { - if (self.options.onchange) { - self.options.onchange(self.$el.val()); - } - }); - }, - - // value - value : function (new_val) { - if (new_val !== undefined) { - this.$el.val(new_val); - } - return this.$el.val(); - }, - - // element - _template: function(options) { - return '<textarea id="' + options.id + '" class="ui-textarea ' + options.cls + '"></textarea>'; } }); @@ -455,7 +407,6 @@ Checkbox : Checkbox, Searchbox : Searchbox, Select : Select, - Textarea : Textarea, Hidden : Hidden, Slider : Slider } diff -r 75709a2361b15ba5fd393b0ff2333a81b6ddff87 -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf static/scripts/mvc/ui/ui-select-default.js --- a/static/scripts/mvc/ui/ui-select-default.js +++ b/static/scripts/mvc/ui/ui-select-default.js @@ -7,24 +7,19 @@ var View = Backbone.View.extend({ // options optionsDefault : { - id : '', - cls : '', - empty : 'No data available', - visible : true, - wait : false + id : '', + cls : '', + empty : 'No data available', + visible : true, + wait : false, + multiple : false }, - // value - selected : null, - // initialize initialize : function(options) { // configure options this.options = Utils.merge(options, this.optionsDefault); - // initial value - this.selected = this.options.value; - // create new element this.setElement(this._template(this.options)); @@ -32,21 +27,17 @@ this.$select = this.$el.find('#select'); this.$icon = this.$el.find('#icon'); - // add change event. fires only on user activity - var self = this; - this.$select.on('change', function() { - self.value(self.$select.val()); - }); - - // add change event. fires on trigger - this.on('change', function() { - if (self.options.onchange) { - self.options.onchange(self.value()); - } - }); + // configure multiple + if (this.options.multiple) { + this.$select.prop('multiple', true); + this.$select.addClass('ui-select-multiple'); + this.$icon.remove(); + } else { + this.$el.addClass('ui-select'); + } // refresh - this._refresh(); + this.update(this.options.data); // show/hide if (!this.options.visible) { @@ -59,31 +50,25 @@ } else { this.show(); } + + // add change event. fires only on user activity + var self = this; + this.$select.on('change', function() { + self._change(); + }); + + // add change event. fires on trigger + this.on('change', function() { + self._change(); + }); }, // value value : function (new_value) { - - // get current id/value - var before = this.selected; - - // check if new_value is defined if (new_value !== undefined) { - this.selected = new_value; this.$select.val(new_value); } - - // get current id/value - var after = this.selected; - if (after) { - // fire onchange - if (after != before && this.options.onchange) { - this.options.onchange(after); - } - } - - // return - return after; + return this.$select.val(); }, // first @@ -157,6 +142,9 @@ // render update: function(options) { + // backup current value + var current = this.$select.val(); + // remove all options this.$select.find('option').remove(); @@ -167,6 +155,14 @@ // refresh this._refresh(); + + // set previous value + this.$select.val(current); + + // check if any value was set + if (!this.$select.val()) { + this.$select.val(this.first()); + } }, // set on change event @@ -179,6 +175,13 @@ return this.$select.find('option[value=' + value + ']').length > 0; }, + // change + _change: function() { + if (this.options.onchange) { + this.options.onchange(this.$select.val()); + } + }, + // refresh _refresh: function() { // remove placeholder @@ -196,41 +199,21 @@ // enable select field this.enable(); } - - // update value - if (this.selected) { - this.$select.val(this.selected); - } }, - // option + // template option _templateOption: function(options) { return '<option value="' + options.value + '">' + options.label + '</option>'; }, - // element + // template _template: function(options) { - var tmpl = '<div id="' + options.id + '" class="ui-select">' + - '<div class="button">' + - '<i id="icon"/>' + - '</div>' + - '<select id="select" class="select ' + options.cls + ' ' + options.id + '">'; - for (key in options.data) { - // options - var item = options.data[key]; - - // identify selected value - var tag = ''; - if (item.value == options.value || item.value == '') { - tag = 'selected'; - } - - // add template string - tmpl += '<option value="' + item.value + '" ' + tag + '>' + item.label + '</option>'; - } - tmpl += '</select>' + - '</div>'; - return tmpl; + return '<div id="' + options.id + '">' + + '<div class="button">' + + '<i id="icon"/>' + + '</div>' + + '<select id="select" class="select ' + options.cls + ' ' + options.id + '"></select>' + + '</div>'; } }); diff -r 75709a2361b15ba5fd393b0ff2333a81b6ddff87 -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf static/scripts/packed/mvc/tools/tools-section.js --- a/static/scripts/packed/mvc/tools/tools-section.js +++ b/static/scripts/packed/mvc/tools/tools-section.js @@ -1,1 +1,1 @@ -define(["utils/utils","mvc/ui/ui-table","mvc/ui/ui-misc","mvc/ui/ui-tabs"],function(c,b,e,a){var d=Backbone.View.extend({initialize:function(g,f){this.app=g;this.inputs=f.inputs;f.cls_tr="section-row";this.table=new b.View(f);this.setElement(this.table.$el);this.render()},render:function(){this.table.delAll();for(var f in this.inputs){this._add(this.inputs[f])}},_add:function(h){var g=this;var f=jQuery.extend(true,{},h);f.id=c.uuid();this.app.input_list[f.id]=f;var i=f.type;switch(i){case"conditional":this._addConditional(f);break;case"repeat":this._addRepeat(f);break;default:this._addRow(i,f)}},_addConditional:function(f){f.label=f.test_param.label;f.value=f.test_param.value;this._addRow("conditional",f);for(var h in f.cases){var g=f.id+"-section-"+h;var j=new d(this.app,{inputs:f.cases[h].inputs,cls:"ui-table-plain"});this.table.add("");this.table.add(j.$el);this.table.append(g)}},_addRepeat:function(f){var g=this;var k=new a.View({title_new:"Add "+f.title,max:f.max,onnew:function(){var i=f.id+"-section-"+c.uuid();var m=new d(g.app,{inputs:f.inputs,cls:"ui-table-plain"});k.add({id:i,title:f.title,$el:m.$el,ondel:function(){k.del(i);k.retitle(f.title);g.app.refresh()}});k.retitle(f.title);k.show(i);g.app.refresh()}});for(var j=0;j<f.min;j++){var h=f.id+"-section-"+c.uuid();var l=new d(g.app,{inputs:f.inputs,cls:"ui-table-plain"});k.add({id:h,title:f.title,$el:l.$el})}k.retitle(f.title);this.table.add("");this.table.add(k.$el);this.table.append(f.id)},_addRow:function(h,f){var j=f.id;var g=null;switch(h){case"text":g=this._field_text(f);break;case"select":g=this._field_select(f);break;case"data":g=this._field_data(f);break;case"data_column":g=this._field_column(f);break;case"conditional":g=this._field_conditional(f);break;case"hidden":g=this._field_hidden(f);break;case"integer":g=this._field_slider(f);break;case"float":g=this._field_slider(f);break;case"boolean":g=this._field_boolean(f);break;default:g=this._field_text(f);console.debug("tools-form::_addRow() : Unmatched field type ("+h+").")}if(f.value!==undefined){g.value(f.value)}this.app.field_list[j]=g;var i=$("<div/>");i.append(g.$el);if(f.help){i.append('<div class="ui-table-form-info">'+f.help+"</div>")}this.table.add('<span class="ui-table-form-title">'+f.label+"</span>","20%");this.table.add(i);this.table.append(j)},_field_conditional:function(f){var g=this;var h=[];for(var j in f.test_param.options){var k=f.test_param.options[j];h.push({label:k[0],value:k[1]})}return new e.Select.View({id:"field-"+f.id,data:h,onchange:function(s){for(var q in f.cases){var m=f.cases[q];var p=f.id+"-section-"+q;var l=g.table.get(p);var o=false;for(var n in m.inputs){var r=m.inputs[n].type;if(r&&r!=="hidden"){o=true;break}}if(m.value==s&&o){l.fadeIn("fast")}else{l.hide()}}}})},_field_data:function(f){var g=this;var l=f.id;var k=this.app.datasets.filterType();var h=[];for(var j in k){h.push({label:k[j].get("name"),value:k[j].get("id")})}return new e.Select.View({id:"field-"+l,data:h,value:h[0].value,onchange:function(u){var s=g.app.tree.findReferences(l,"data_column");var n=g.app.datasets.filter(u);if(n&&s.length>0){console.debug("tool-form::field_data() - Selected dataset "+u+".");var w=n.get("metadata_column_types");if(!w){console.debug("tool-form::field_data() - FAILED: Could not find metadata for dataset "+u+".")}for(var p in s){var q=g.app.input_list[s[p]];var r=g.app.field_list[s[p]];if(!q||!r){console.debug("tool-form::field_data() - FAILED: Column not found.")}var o=q.numerical;var m=[];for(var v in w){var t=w[v];if(t=="int"||t=="float"||!o){m.push({label:"Column: "+(parseInt(v)+1)+" ["+w[v]+"]",value:v})}}if(r){r.update(m);if(!r.exists(r.value())){r.value(r.first())}}}}else{console.debug("tool-form::field_data() - FAILED: Could not find dataset "+u+".")}}})},_field_select:function(f){var g=[];for(var h in f.options){var j=f.options[h];g.push({label:j[0],value:j[1]})}var k=e.Select;switch(f.display){case"checkboxes":k=e.Checkbox;break;case"radio":k=e.RadioButton;break}if(f.multiple){k=e.Checkbox}return new k.View({id:"field-"+f.id,data:g})},_field_column:function(f){return new e.Select.View({id:"field-"+f.id})},_field_text:function(g){var f=e.Input;if(g.area){f=e.Textarea}return new f({id:"field-"+g.id})},_field_slider:function(f){return new e.Slider.View({id:"field-"+f.id,min:f.min||0,max:f.max||1000,decimal:f.type=="float"})},_field_hidden:function(f){return new e.Hidden({id:"field-"+f.id})},_field_boolean:function(f){return new e.RadioButton.View({id:"field-"+f.id,data:[{label:"Yes",value:true},{label:"No",value:false}]})}});return{View:d}}); \ No newline at end of file +define(["utils/utils","mvc/ui/ui-table","mvc/ui/ui-misc","mvc/ui/ui-tabs"],function(c,b,e,a){var d=Backbone.View.extend({initialize:function(g,f){this.app=g;this.inputs=f.inputs;f.cls_tr="section-row";this.table=new b.View(f);this.setElement(this.table.$el);this.render()},render:function(){this.table.delAll();for(var f in this.inputs){this._add(this.inputs[f])}},_add:function(h){var g=this;var f=jQuery.extend(true,{},h);f.id=c.uuid();this.app.input_list[f.id]=f;var i=f.type;switch(i){case"conditional":this._addConditional(f);break;case"repeat":this._addRepeat(f);break;default:this._addRow(i,f)}},_addConditional:function(f){f.label=f.test_param.label;f.value=f.test_param.value;this._addRow("conditional",f);for(var h in f.cases){var g=f.id+"-section-"+h;var j=new d(this.app,{inputs:f.cases[h].inputs,cls:"ui-table-plain"});this.table.add("");this.table.add(j.$el);this.table.append(g)}},_addRepeat:function(f){var g=this;var k=new a.View({title_new:"Add "+f.title,max:f.max,onnew:function(){var i=f.id+"-section-"+c.uuid();var m=new d(g.app,{inputs:f.inputs,cls:"ui-table-plain"});k.add({id:i,title:f.title,$el:m.$el,ondel:function(){k.del(i);k.retitle(f.title);g.app.refresh()}});k.retitle(f.title);k.show(i);g.app.refresh()}});for(var j=0;j<f.min;j++){var h=f.id+"-section-"+c.uuid();var l=new d(g.app,{inputs:f.inputs,cls:"ui-table-plain"});k.add({id:h,title:f.title,$el:l.$el})}k.retitle(f.title);this.table.add("");this.table.add(k.$el);this.table.append(f.id)},_addRow:function(h,f){var j=f.id;var g=null;switch(h){case"text":g=this._field_text(f);break;case"select":g=this._field_select(f);break;case"data":g=this._field_data(f);break;case"data_column":g=this._field_column(f);break;case"conditional":g=this._field_conditional(f);break;case"hidden":g=this._field_hidden(f);break;case"integer":g=this._field_slider(f);break;case"float":g=this._field_slider(f);break;case"boolean":g=this._field_boolean(f);break;default:g=this._field_text(f);console.debug("tools-form::_addRow() : Unmatched field type ("+h+").")}if(f.value!==undefined){g.value(f.value)}this.app.field_list[j]=g;var i=$("<div/>");i.append(g.$el);if(f.help){i.append('<div class="ui-table-form-info">'+f.help+"</div>")}this.table.add('<span class="ui-table-form-title">'+f.label+"</span>","20%");this.table.add(i);this.table.append(j)},_field_conditional:function(f){var g=this;var h=[];for(var j in f.test_param.options){var k=f.test_param.options[j];h.push({label:k[0],value:k[1]})}return new e.Select.View({id:"field-"+f.id,data:h,onchange:function(s){for(var q in f.cases){var m=f.cases[q];var p=f.id+"-section-"+q;var l=g.table.get(p);var o=false;for(var n in m.inputs){var r=m.inputs[n].type;if(r&&r!=="hidden"){o=true;break}}if(m.value==s&&o){l.fadeIn("fast")}else{l.hide()}}}})},_field_data:function(f){var g=this;var l=f.id;var k=this.app.datasets.filterType();var h=[];for(var j in k){h.push({label:k[j].get("name"),value:k[j].get("id")})}return new e.Select.View({id:"field-"+l,data:h,value:h[0].value,onchange:function(u){var s=g.app.tree.findReferences(l,"data_column");var n=g.app.datasets.filter(u);if(n&&s.length>0){console.debug("tool-form::field_data() - Selected dataset "+u+".");var w=n.get("metadata_column_types");if(!w){console.debug("tool-form::field_data() - FAILED: Could not find metadata for dataset "+u+".")}for(var p in s){var q=g.app.input_list[s[p]];var r=g.app.field_list[s[p]];if(!q||!r){console.debug("tool-form::field_data() - FAILED: Column not found.")}var o=q.numerical;var m=[];for(var v in w){var t=w[v];if(t=="int"||t=="float"||!o){m.push({label:"Column: "+(parseInt(v)+1)+" ["+w[v]+"]",value:v})}}if(r){r.update(m);if(!r.exists(r.value())){r.value(r.first())}}}}else{console.debug("tool-form::field_data() - FAILED: Could not find dataset "+u+".")}}})},_field_select:function(f){var g=[];for(var h in f.options){var j=f.options[h];g.push({label:j[0],value:j[1]})}var k=e.Select;switch(f.display){case"checkboxes":k=e.Checkbox;break;case"radio":k=e.RadioButton;break}if(f.multiple){k=e.Checkbox}return new k.View({id:"field-"+f.id,data:g})},_field_column:function(f){return new e.Select.View({id:"field-"+f.id,multiple:f.multiple})},_field_text:function(f){return new e.Input({id:"field-"+f.id,area:f.area})},_field_slider:function(f){return new e.Slider.View({id:"field-"+f.id,min:f.min||0,max:f.max||1000,decimal:f.type=="float"})},_field_hidden:function(f){return new e.Hidden({id:"field-"+f.id})},_field_boolean:function(f){return new e.RadioButton.View({id:"field-"+f.id,data:[{label:"Yes",value:true},{label:"No",value:false}]})}});return{View:d}}); \ No newline at end of file diff -r 75709a2361b15ba5fd393b0ff2333a81b6ddff87 -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf static/scripts/packed/mvc/ui/ui-misc.js --- a/static/scripts/packed/mvc/ui/ui-misc.js +++ b/static/scripts/packed/mvc/ui/ui-misc.js @@ -1,1 +1,1 @@ -define(["utils/utils","mvc/ui/ui-select-default","mvc/ui/ui-slider","mvc/ui/ui-checkbox","mvc/ui/ui-radiobutton","mvc/ui/ui-button-menu","mvc/ui/ui-modal"],function(e,h,k,i,b,r,c){var q=Backbone.View.extend({optionsDefault:{url:"",cls:""},initialize:function(s){this.options=e.merge(s,this.optionsDefault);this.setElement(this._template(this.options))},_template:function(s){return'<img class="ui-image '+s.cls+'" src="'+s.url+'"/>'}});var l=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(s){this.options=e.merge(s,this.optionsDefault);this.setElement(this._template(this.options))},title:function(s){this.$el.html(s)},_template:function(s){return'<label class="ui-label '+s.cls+'">'+s.title+"</label>"},value:function(){return options.title}});var d=Backbone.View.extend({optionsDefault:{floating:"right",icon:"",tooltip:"",placement:"bottom",title:"",cls:""},initialize:function(s){this.options=e.merge(s,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).tooltip({title:s.tooltip,placement:"bottom"})},_template:function(s){return'<div><span class="fa '+s.icon+'" class="ui-icon"/> '+s.title+"</div>"}});var g=Backbone.View.extend({optionsDefault:{id:null,title:"",floating:"right",cls:"btn btn-default",icon:""},initialize:function(s){this.options=e.merge(s,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).on("click",s.onclick);$(this.el).tooltip({title:s.tooltip,placement:"bottom"})},_template:function(s){var t='<button id="'+s.id+'" type="submit" style="float: '+s.floating+';" type="button" class="ui-button '+s.cls+'">';if(s.icon){t+='<i class="icon fa '+s.icon+'"></i> '}t+=s.title+"</button>";return t}});var o=Backbone.View.extend({optionsDefault:{id:null,title:"",floating:"right",cls:"icon-btn",icon:"",tooltip:"",onclick:null},initialize:function(s){this.options=e.merge(s,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).on("click",s.onclick);$(this.el).tooltip({title:s.tooltip,placement:"bottom"})},_template:function(s){var t="";if(s.title){t="width: auto;"}var u='<div id="'+s.id+'" style="float: '+s.floating+"; "+t+'" class="ui-button-icon '+s.cls+'">';if(s.title){u+='<div class="button"><i class="icon fa '+s.icon+'"/> <span class="title">'+s.title+"</span></div>"}else{u+='<i class="icon fa '+s.icon+'"/>'}u+="</div>";return u}});var p=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(s){this.options=e.merge(s,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).on("click",s.onclick)},_template:function(s){return'<div><a href="javascript:void(0)" class="ui-anchor '+s.cls+'">'+s.title+"</a></div>"}});var a=Backbone.View.extend({optionsDefault:{message:"",status:"info",persistent:false},initialize:function(s){this.options=e.merge(s,this.optionsDefault);this.setElement("<div></div>")},update:function(t){this.options=e.merge(t,this.optionsDefault);if(t.message!=""){this.$el.html(this._template(this.options));this.$el.find(".alert").append(t.message);this.$el.fadeIn();if(!t.persistent){var s=this;window.setTimeout(function(){if(s.$el.is(":visible")){s.$el.fadeOut()}else{s.$el.hide()}},3000)}}else{this.$el.fadeOut()}},_template:function(s){return'<div class="ui-message alert alert-'+s.status+'"/>'}});var f=Backbone.View.extend({optionsDefault:{onclick:null,searchword:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault);this.setElement(this._template(this.options));var s=this;if(this.options.onclick){this.$el.on("submit",function(v){var u=s.$el.find("#search");s.options.onclick(u.val())})}},_template:function(s){return'<div class="ui-search"><form onsubmit="return false;"><input id="search" class="form-control input-sm" type="text" name="search" placeholder="Search..." value="'+s.searchword+'"><button type="submit" class="btn search-btn"><i class="fa fa-search"></i></button></form></div>'}});var n=Backbone.View.extend({optionsDefault:{value:"",type:"text",placeholder:"",disabled:false,visible:true,cls:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault);this.setElement(this._template(this.options));if(this.options.disabled){this.$el.prop("disabled",true)}if(!this.options.visible){this.$el.hide()}var s=this;this.$el.on("input",function(){if(s.options.onchange){s.options.onchange(s.$el.val())}})},value:function(s){if(s!==undefined){this.$el.val(s)}return this.$el.val()},_template:function(s){return'<input id="'+s.id+'" type="'+s.type+'" value="'+s.value+'" placeholder="'+s.placeholder+'" class="ui-input '+s.cls+'">'}});var j=Backbone.View.extend({optionsDefault:{value:"",type:"text",placeholder:"",disabled:false,visible:true,cls:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault);this.setElement(this._template(this.options));if(this.options.disabled){this.$el.prop("disabled",true)}if(!this.options.visible){this.$el.hide()}var s=this;this.$el.on("input",function(){if(s.options.onchange){s.options.onchange(s.$el.val())}})},value:function(s){if(s!==undefined){this.$el.val(s)}return this.$el.val()},_template:function(s){return'<textarea id="'+s.id+'" class="ui-textarea '+s.cls+'"></textarea>'}});var m=Backbone.View.extend({optionsDefault:{value:""},initialize:function(s){this.options=e.merge(s,this.optionsDefault);this.setElement(this._template(this.options))},value:function(s){if(s!==undefined){this.$el.val(s)}return this.$el.val()},_template:function(s){return'<hidden id="'+s.id+'" value="'+s.value+'"/>'}});return{Anchor:p,Button:g,ButtonIcon:o,ButtonMenu:r,Icon:d,Image:q,Input:n,Label:l,Message:a,Modal:c,RadioButton:b,Checkbox:i,Searchbox:f,Select:h,Textarea:j,Hidden:m,Slider:k}}); \ No newline at end of file +define(["utils/utils","mvc/ui/ui-select-default","mvc/ui/ui-slider","mvc/ui/ui-checkbox","mvc/ui/ui-radiobutton","mvc/ui/ui-button-menu","mvc/ui/ui-modal"],function(l,b,f,e,m,q,n){var d=Backbone.View.extend({optionsDefault:{url:"",cls:""},initialize:function(r){this.options=l.merge(r,this.optionsDefault);this.setElement(this._template(this.options))},_template:function(r){return'<img class="ui-image '+r.cls+'" src="'+r.url+'"/>'}});var k=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(r){this.options=l.merge(r,this.optionsDefault);this.setElement(this._template(this.options))},title:function(r){this.$el.html(r)},_template:function(r){return'<label class="ui-label '+r.cls+'">'+r.title+"</label>"},value:function(){return options.title}});var c=Backbone.View.extend({optionsDefault:{floating:"right",icon:"",tooltip:"",placement:"bottom",title:"",cls:""},initialize:function(r){this.options=l.merge(r,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).tooltip({title:r.tooltip,placement:"bottom"})},_template:function(r){return'<div><span class="fa '+r.icon+'" class="ui-icon"/> '+r.title+"</div>"}});var h=Backbone.View.extend({optionsDefault:{id:null,title:"",floating:"right",cls:"btn btn-default",icon:""},initialize:function(r){this.options=l.merge(r,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).on("click",r.onclick);$(this.el).tooltip({title:r.tooltip,placement:"bottom"})},_template:function(r){var s='<button id="'+r.id+'" type="submit" style="float: '+r.floating+';" type="button" class="ui-button '+r.cls+'">';if(r.icon){s+='<i class="icon fa '+r.icon+'"></i> '}s+=r.title+"</button>";return s}});var i=Backbone.View.extend({optionsDefault:{id:null,title:"",floating:"right",cls:"icon-btn",icon:"",tooltip:"",onclick:null},initialize:function(r){this.options=l.merge(r,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).on("click",r.onclick);$(this.el).tooltip({title:r.tooltip,placement:"bottom"})},_template:function(r){var s="";if(r.title){s="width: auto;"}var t='<div id="'+r.id+'" style="float: '+r.floating+"; "+s+'" class="ui-button-icon '+r.cls+'">';if(r.title){t+='<div class="button"><i class="icon fa '+r.icon+'"/> <span class="title">'+r.title+"</span></div>"}else{t+='<i class="icon fa '+r.icon+'"/>'}t+="</div>";return t}});var g=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(r){this.options=l.merge(r,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).on("click",r.onclick)},_template:function(r){return'<div><a href="javascript:void(0)" class="ui-anchor '+r.cls+'">'+r.title+"</a></div>"}});var o=Backbone.View.extend({optionsDefault:{message:"",status:"info",persistent:false},initialize:function(r){this.options=l.merge(r,this.optionsDefault);this.setElement("<div></div>")},update:function(s){this.options=l.merge(s,this.optionsDefault);if(s.message!=""){this.$el.html(this._template(this.options));this.$el.find(".alert").append(s.message);this.$el.fadeIn();if(!s.persistent){var r=this;window.setTimeout(function(){if(r.$el.is(":visible")){r.$el.fadeOut()}else{r.$el.hide()}},3000)}}else{this.$el.fadeOut()}},_template:function(r){return'<div class="ui-message alert alert-'+r.status+'"/>'}});var a=Backbone.View.extend({optionsDefault:{onclick:null,searchword:""},initialize:function(s){this.options=l.merge(s,this.optionsDefault);this.setElement(this._template(this.options));var r=this;if(this.options.onclick){this.$el.on("submit",function(u){var t=r.$el.find("#search");r.options.onclick(t.val())})}},_template:function(r){return'<div class="ui-search"><form onsubmit="return false;"><input id="search" class="form-control input-sm" type="text" name="search" placeholder="Search..." value="'+r.searchword+'"><button type="submit" class="btn search-btn"><i class="fa fa-search"></i></button></form></div>'}});var j=Backbone.View.extend({optionsDefault:{value:"",type:"text",placeholder:"",disabled:false,visible:true,cls:"",area:false},initialize:function(s){this.options=l.merge(s,this.optionsDefault);this.setElement(this._template(this.options));if(this.options.disabled){this.$el.prop("disabled",true)}if(!this.options.visible){this.$el.hide()}var r=this;this.$el.on("input",function(){if(r.options.onchange){r.options.onchange(r.$el.val())}})},value:function(r){if(r!==undefined){this.$el.val(r)}return this.$el.val()},_template:function(r){if(r.area){return'<textarea id="'+r.id+'" class="ui-textarea '+r.cls+'"></textarea>'}else{return'<input id="'+r.id+'" type="'+r.type+'" value="'+r.value+'" placeholder="'+r.placeholder+'" class="ui-input '+r.cls+'">'}}});var p=Backbone.View.extend({optionsDefault:{value:""},initialize:function(r){this.options=l.merge(r,this.optionsDefault);this.setElement(this._template(this.options))},value:function(r){if(r!==undefined){this.$el.val(r)}return this.$el.val()},_template:function(r){return'<hidden id="'+r.id+'" value="'+r.value+'"/>'}});return{Anchor:g,Button:h,ButtonIcon:i,ButtonMenu:q,Icon:c,Image:d,Input:j,Label:k,Message:o,Modal:n,RadioButton:m,Checkbox:e,Searchbox:a,Select:b,Hidden:p,Slider:f}}); \ No newline at end of file diff -r 75709a2361b15ba5fd393b0ff2333a81b6ddff87 -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf static/scripts/packed/mvc/ui/ui-select-default.js --- a/static/scripts/packed/mvc/ui/ui-select-default.js +++ b/static/scripts/packed/mvc/ui/ui-select-default.js @@ -1,1 +1,1 @@ -define(["utils/utils"],function(a){var b=Backbone.View.extend({optionsDefault:{id:"",cls:"",empty:"No data available",visible:true,wait:false},selected:null,initialize:function(d){this.options=a.merge(d,this.optionsDefault);this.selected=this.options.value;this.setElement(this._template(this.options));this.$select=this.$el.find("#select");this.$icon=this.$el.find("#icon");var c=this;this.$select.on("change",function(){c.value(c.$select.val())});this.on("change",function(){if(c.options.onchange){c.options.onchange(c.value())}});this._refresh();if(!this.options.visible){this.hide()}if(this.options.wait){this.wait()}else{this.show()}},value:function(c){var d=this.selected;if(c!==undefined){this.selected=c;this.$select.val(c)}var e=this.selected;if(e){if(e!=d&&this.options.onchange){this.options.onchange(e)}}return e},first:function(){var c=this.$select.find("option");if(c.length>0){return c.val()}else{return undefined}},text:function(){return this.$select.find("option:selected").text()},show:function(){this.$icon.removeClass();this.$icon.addClass("fa fa-caret-down");this.$select.show();this.$el.show()},hide:function(){this.$el.hide()},wait:function(){this.$icon.removeClass();this.$icon.addClass("fa fa-spinner fa-spin");this.$select.hide()},disabled:function(){return this.$select.is(":disabled")},enable:function(){this.$select.prop("disabled",false)},disable:function(){this.$select.prop("disabled",true)},add:function(c){this.$select.append(this._templateOption(c));this._refresh()},del:function(c){this.$select.find("option[value="+c+"]").remove();this.$select.trigger("change");this._refresh()},update:function(c){this.$select.find("option").remove();for(var d in c){this.$select.append(this._templateOption(c[d]))}this._refresh()},setOnChange:function(c){this.options.onchange=c},exists:function(c){return this.$select.find("option[value="+c+"]").length>0},_refresh:function(){this.$select.find("option[value=null]").remove();var c=this.$select.find("option").length;if(c==0){this.disable();this.$select.append(this._templateOption({value:"null",label:this.options.empty}))}else{this.enable()}if(this.selected){this.$select.val(this.selected)}},_templateOption:function(c){return'<option value="'+c.value+'">'+c.label+"</option>"},_template:function(e){var d='<div id="'+e.id+'" class="ui-select"><div class="button"><i id="icon"/></div><select id="select" class="select '+e.cls+" "+e.id+'">';for(key in e.data){var f=e.data[key];var c="";if(f.value==e.value||f.value==""){c="selected"}d+='<option value="'+f.value+'" '+c+">"+f.label+"</option>"}d+="</select></div>";return d}});return{View:b}}); \ No newline at end of file +define(["utils/utils"],function(a){var b=Backbone.View.extend({optionsDefault:{id:"",cls:"",empty:"No data available",visible:true,wait:false,multiple:false},initialize:function(d){this.options=a.merge(d,this.optionsDefault);this.setElement(this._template(this.options));this.$select=this.$el.find("#select");this.$icon=this.$el.find("#icon");if(this.options.multiple){this.$select.prop("multiple",true);this.$select.addClass("ui-select-multiple");this.$icon.remove()}else{this.$el.addClass("ui-select")}this.update(this.options.data);if(!this.options.visible){this.hide()}if(this.options.wait){this.wait()}else{this.show()}var c=this;this.$select.on("change",function(){c._change()});this.on("change",function(){c._change()})},value:function(c){if(c!==undefined){this.$select.val(c)}return this.$select.val()},first:function(){var c=this.$select.find("option");if(c.length>0){return c.val()}else{return undefined}},text:function(){return this.$select.find("option:selected").text()},show:function(){this.$icon.removeClass();this.$icon.addClass("fa fa-caret-down");this.$select.show();this.$el.show()},hide:function(){this.$el.hide()},wait:function(){this.$icon.removeClass();this.$icon.addClass("fa fa-spinner fa-spin");this.$select.hide()},disabled:function(){return this.$select.is(":disabled")},enable:function(){this.$select.prop("disabled",false)},disable:function(){this.$select.prop("disabled",true)},add:function(c){this.$select.append(this._templateOption(c));this._refresh()},del:function(c){this.$select.find("option[value="+c+"]").remove();this.$select.trigger("change");this._refresh()},update:function(c){var e=this.$select.val();this.$select.find("option").remove();for(var d in c){this.$select.append(this._templateOption(c[d]))}this._refresh();this.$select.val(e);if(!this.$select.val()){this.$select.val(this.first())}},setOnChange:function(c){this.options.onchange=c},exists:function(c){return this.$select.find("option[value="+c+"]").length>0},_change:function(){if(this.options.onchange){this.options.onchange(this.$select.val())}},_refresh:function(){this.$select.find("option[value=null]").remove();var c=this.$select.find("option").length;if(c==0){this.disable();this.$select.append(this._templateOption({value:"null",label:this.options.empty}))}else{this.enable()}},_templateOption:function(c){return'<option value="'+c.value+'">'+c.label+"</option>"},_template:function(c){return'<div id="'+c.id+'"><div class="button"><i id="icon"/></div><select id="select" class="select '+c.cls+" "+c.id+'"></select></div>'}});return{View:b}}); \ No newline at end of file diff -r 75709a2361b15ba5fd393b0ff2333a81b6ddff87 -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf static/style/blue/base.css --- a/static/style/blue/base.css +++ b/static/style/blue/base.css @@ -1282,6 +1282,7 @@ .ui-table tbody{cursor:pointer} .ui-table-plain tbody td{padding:5px 0px 5px 5px !important;border:none !important} .ui-table-plain tbody{cursor:auto !important} +.ui-table-form-info{clear:both !important} .ui-table-form-separator{font-weight:bold;font-size:0.9em} .ui-label{font-weight:bold} .ui-message{padding:2px 2px 2px 10px} @@ -1299,8 +1300,9 @@ .ui-portlet .no-scroll{height:calc(100% - 80px)} .ui-popover{max-width:700px;display:none}.ui-popover .popover-close{position:absolute;right:10px;top:7px;font-size:1.2em;cursor:pointer} .ui-popover .popover-title{padding:4px 10px} -.ui-select{position:relative;height:27px;overflow:hidden;border:1px solid #bfbfbf;-moz-border-radius:3px;border-radius:3px}.ui-select .button{position:relative;width:25px;height:100%;float:right;border-left:1px solid #bfbfbf;padding-left:9px;padding-top:4px;background:#f2f2f2} +.ui-select,.ui-select-multiple{position:relative;height:27px;overflow:hidden;border:1px solid #bfbfbf;-moz-border-radius:3px;border-radius:3px}.ui-select .button{position:relative;width:25px;height:100%;float:right;border-left:1px solid #bfbfbf;padding-left:9px;padding-top:4px;background:#f2f2f2} .ui-select select{position:absolute;top:0px;height:100%;width:100%;padding-left:5px;cursor:pointer;background:transparent;border:0;border-radius:0;-webkit-appearance:none} +.ui-select-multiple{height:100% !important;width:100% !important} .libraryRow{background-color:#ebd9b2} .datasetHighlighted{background-color:#f9f9f9} .libraryItemDeleted-True{font-style:italic} diff -r 75709a2361b15ba5fd393b0ff2333a81b6ddff87 -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf static/style/src/less/ui.less --- a/static/style/src/less/ui.less +++ b/static/style/src/less/ui.less @@ -32,6 +32,7 @@ .ui-table-form-info { &:extend(.toolParamHelp); + clear: both !important; } .ui-table-form-separator { @@ -208,4 +209,10 @@ border-radius: 0; -webkit-appearance: none; } +} + +.ui-select-multiple { + &:extend(.ui-select); + height: 100% !important; + width: 100% !important; } \ 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.