commit/galaxy-central: greg: Fixes for transferring sample datasets and viewing . managing transferred sample datasets.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/7273e1405094/ changeset: 7273e1405094 user: greg date: 2012-03-29 16:17:51 summary: Fixes for transferring sample datasets and viewing . managing transferred sample datasets. affected #: 7 files diff -r 9f5750e19c1ea88fa0c694bb42642589659b0750 -r 7273e1405094e931b4dc39f646cf4cd83a5bbc5d lib/galaxy/web/controllers/requests_admin.py --- a/lib/galaxy/web/controllers/requests_admin.py +++ b/lib/galaxy/web/controllers/requests_admin.py @@ -493,6 +493,7 @@ return trans.response.send_redirect( web.url_for( controller='requests_admin', action='select_datasets_to_transfer', request_id=trans.security.encode_id( request.id ), + external_service_id=trans.security.encode_id( external_service.id ), status=status, message=message ) ) def __create_sample_datasets( self, trans, sample, selected_datasets_to_transfer, external_service ): diff -r 9f5750e19c1ea88fa0c694bb42642589659b0750 -r 7273e1405094e931b4dc39f646cf4cd83a5bbc5d lib/galaxy/web/controllers/requests_common.py --- a/lib/galaxy/web/controllers/requests_common.py +++ b/lib/galaxy/web/controllers/requests_common.py @@ -1011,6 +1011,8 @@ sample = trans.sa_session.query( trans.model.Sample ).get( trans.security.decode_id( sample_id ) ) except: return invalid_id_redirect( trans, cntrller, sample_id, 'sample' ) + external_service_id = params.get( 'external_service_id', None ) + external_service = trans.sa_session.query( trans.model.ExternalService ).get( trans.security.decode_id( external_service_id ) ) # See if a library and folder have been set for this sample. if is_admin and not sample.library or not sample.folder: status = 'error' @@ -1043,6 +1045,7 @@ return trans.fill_template( '/requests/common/view_sample_datasets.mako', cntrller=cntrller, title=title, + external_service=external_service, sample=sample, sample_datasets=sample_datasets, transfer_status=transfer_status, diff -r 9f5750e19c1ea88fa0c694bb42642589659b0750 -r 7273e1405094e931b4dc39f646cf4cd83a5bbc5d templates/requests/common/common.mako --- a/templates/requests/common/common.mako +++ b/templates/requests/common/common.mako @@ -298,9 +298,14 @@ ## This link will direct the admin to a page allowing them to manage datasets. <a id="sampleDatasets-${sample.id}" href="${h.url_for( controller='requests_admin', action='manage_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.datasets )}</a> %elif sample.datasets: + <% + # Get an external_service from one of the sample datasets. This assumes all sample datasets are associated with + # the same external service - hopefully this is a good assumption. + external_service = sample.datasets[0].external_service + %> ## Since this is a regular user, only display a link if there is at least 1 ## selected dataset for the sample. - <a id="sampleDatasets-${sample.id}" href="${h.url_for( controller='requests_common', action='view_sample_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.datasets )}</a> + <a id="sampleDatasets-${sample.id}" href="${h.url_for( controller='requests_common', action='view_sample_datasets', cntrller=cntrller, external_service_id=trans.security.encode_id( external_service.id ), sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.datasets )}</a> %else: ## Since this is a regular user, do not display a link if there are no datasets. <a id="sampleDatasets-${sample.id}">${len( sample.datasets )}</a> @@ -424,8 +429,13 @@ %endif %if sample.datasets and len( sample.datasets ) > len( transferred_dataset_files ) and sample.library and sample.folder: <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='manage_datasets', sample_id=trans.security.encode_id( sample.id ) )}">Manage selected datasets</a></li> - %elif sample.datasets and len(sample.datasets ) == len( transferred_dataset_files ): - <li><a class="action-button" href="${h.url_for( controller='requests_common', action='view_sample_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ), transfer_status=trans.model.SampleDataset.transfer_status.COMPLETE )}">View transferred datasets</a></li> + %elif sample.datasets and len( sample.datasets ) == len( transferred_dataset_files ): + <% + # Get an external_service from one of the sample datasets. This assumes all sample datasets are associated with + # the same external service - hopefully this is a good assumption. + external_service = sample.datasets[0].external_service + %> + <li><a class="action-button" href="${h.url_for( controller='requests_common', action='view_sample_datasets', cntrller=cntrller, external_service_id=trans.security.encode_id( external_service.id ), sample_id=trans.security.encode_id( sample.id ), transfer_status=trans.model.SampleDataset.transfer_status.COMPLETE )}">View transferred datasets</a></li> %endif </div> %else: @@ -483,6 +493,11 @@ ## This link will direct the admin to a page allowing them to manage datasets. <a id="sampleDatasets-${sample.id}" href="${h.url_for( controller='requests_admin', action='manage_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.datasets )}</a> %elif sample.library and sample.datasets: + <% + # Get an external_service from one of the sample datasets. This assumes all sample datasets are associated with + # the same external service - hopefully this is a good assumption. + external_service = sample.datasets[0].external_service + %> ## Since this is a regular user, only display a link if there is at least 1 ## selected dataset for the sample. <a id="sampleDatasets-${sample.id}" href="${h.url_for( controller='requests_common', action='view_sample_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.datasets )}</a> diff -r 9f5750e19c1ea88fa0c694bb42642589659b0750 -r 7273e1405094e931b4dc39f646cf4cd83a5bbc5d templates/requests/common/find_samples.mako --- a/templates/requests/common/find_samples.mako +++ b/templates/requests/common/find_samples.mako @@ -78,7 +78,12 @@ %else: State: ${sample.state.name}<br/> %endif - Datasets: <a href="${h.url_for( controller='requests_common', action='view_sample_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.datasets )}</a><br/> + <% + # Get an external_service from one of the sample datasets. This assumes all sample datasets are associated with + # the same external service - hopefully this is a good assumption. + external_service = sample.datasets[0].external_service + %> + Datasets: <a href="${h.url_for( controller='requests_common', action='view_sample_datasets', cntrller=cntrller, external_service_id=trans.security.encode_id( external_service.id ), sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.datasets )}</a><br/> %if is_admin: <i>User: ${sample.request.user.email}</i> %endif diff -r 9f5750e19c1ea88fa0c694bb42642589659b0750 -r 7273e1405094e931b4dc39f646cf4cd83a5bbc5d templates/requests/common/view_sample_datasets.mako --- a/templates/requests/common/view_sample_datasets.mako +++ b/templates/requests/common/view_sample_datasets.mako @@ -25,7 +25,7 @@ <li><a class="action-button" id="sample-${sample.id}-popup" class="menubutton">Dataset Actions</a></li><div popupmenu="sample-${sample.id}-popup"> %if can_select_datasets: - <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='select_datasets_to_transfer', cntrller=cntrller, request_id=trans.security.encode_id( sample.request.id ), sample_id=trans.security.encode_id( sample.id ) )}">Select more datasets</a></li> + <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='select_datasets_to_transfer', cntrller=cntrller, external_service_id=trans.security.encode_id( external_service.id ), request_id=trans.security.encode_id( sample.request.id ), sample_id=trans.security.encode_id( sample.id ) )}">Select more datasets</a></li> %endif <li><a class="action-button" href="${h.url_for( controller='library_common', action='browse_library', cntrller=cntrller, id=trans.security.encode_id( sample.library.id ) )}">View target Data Library</a></li><li><a class="action-button" href="${h.url_for( controller='requests_common', action='view_request', cntrller=cntrller, id=trans.security.encode_id( sample.request.id ) )}">Browse this request</a></li> diff -r 9f5750e19c1ea88fa0c694bb42642589659b0750 -r 7273e1405094e931b4dc39f646cf4cd83a5bbc5d test/base/twilltestcase.py --- a/test/base/twilltestcase.py +++ b/test/base/twilltestcase.py @@ -13,6 +13,7 @@ from elementtree import ElementTree from galaxy.web import security from galaxy.web.framework.helpers import iff +from galaxy.util.json import from_json_string from base.asserts import verify_assertions buffer = StringIO.StringIO() @@ -34,7 +35,14 @@ self.host = os.environ.get( 'GALAXY_TEST_HOST' ) self.port = os.environ.get( 'GALAXY_TEST_PORT' ) self.url = "http://%s:%s" % ( self.host, self.port ) - self.file_dir = os.environ.get( 'GALAXY_TEST_FILE_DIR' ) + self.file_dir = os.environ.get( 'GALAXY_TEST_FILE_DIR', None ) + self.migrated_tools_file = os.environ.get( 'GALAXY_MIGRATED_TOOLS_FILE', None ) + if self.migrated_tools_file: + f = open( self.migrated_tools_file, 'r' ) + self.migrated_tools_dict = from_json_string( f.readlines() ) + f.close() + else: + self.migrated_tools_dict = {} self.keepOutdir = os.environ.get( 'GALAXY_TEST_SAVE', '' ) if self.keepOutdir > '': try: @@ -1792,9 +1800,10 @@ tc.submit( "save_samples_button" ) for check_str in strings_displayed_after_submit: self.check_page_for_string( check_str ) - def add_datasets_to_sample( self, request_id, sample_id, sample_datasets, strings_displayed=[], strings_displayed_after_submit=[] ): + def add_datasets_to_sample( self, request_id, sample_id, external_service_id, sample_datasets, strings_displayed=[], strings_displayed_after_submit=[] ): # visit the dataset selection page - url = "%s/requests_admin/select_datasets_to_transfer?cntrller=requests_admin&sample_id=%s&request_id=%s" % ( self.url, sample_id, request_id ) + url = "%s/requests_admin/select_datasets_to_transfer?cntrller=requests_admin&sample_id=%s&request_id=%s&external_service_id=%s" % \ + ( self.url, sample_id, request_id, external_service_id ) self.visit_url( url ) for check_str in strings_displayed: self.check_page_for_string( check_str ) diff -r 9f5750e19c1ea88fa0c694bb42642589659b0750 -r 7273e1405094e931b4dc39f646cf4cd83a5bbc5d test/functional/test_sample_tracking.py --- a/test/functional/test_sample_tracking.py +++ b/test/functional/test_sample_tracking.py @@ -800,11 +800,13 @@ sample_dataset_file_names = [ dataset.split( '/' )[-1] for dataset in sample_datasets ] global request1_sample1 request1_sample1 = request1.get_sample( 'Sample1_renamed' ) + external_service = request1_sample1.external_service strings_displayed_after_submit = [ 'Datasets (%s) have been selected for sample (%s)' % \ ( str( sample_dataset_file_names )[1:-1].replace( "'", "" ), request1_sample1.name ) ] strings_displayed = [ 'Select datasets to transfer from data directory configured for the sequencer' ] self.add_datasets_to_sample( request_id=self.security.encode_id( request2.id ), sample_id= self.security.encode_id( request1_sample1.id ), + external_service_id=self.security.encode_id( external_serviceexternal_service.id ), sample_datasets=sample_datasets, strings_displayed=strings_displayed, strings_displayed_after_submit=strings_displayed_after_submit ) 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.
participants (1)
-
Bitbucket