galaxy-dist commit c8173a50bc9b: sample_tracking fixes
# HG changeset patch -- Bitbucket.org # Project galaxy-dist # URL http://bitbucket.org/galaxy/galaxy-dist/overview # User rc # Date 1287030296 14400 # Node ID c8173a50bc9bdb0c8e07807c1b73be746557647f # Parent 4d5b00b6fe741a35320a572302d1fb8bb7eb6971 sample_tracking fixes --- a/templates/requests/common/sample_datasets.mako +++ b/templates/requests/common/sample_datasets.mako @@ -1,5 +1,5 @@ -<%def name="render_sample_datasets( cntrller, sample )"> - <a href="${h.url_for( controller='requests_common', action='view_dataset_transfer', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${sample.transferred_dataset_files} / ${len( sample.datasets )}</a> +<%def name="render_sample_datasets( sample )"> + ${sample.transferred_dataset_files} / ${len( sample.datasets )} </%def> -${render_sample_datasets( cntrller, sample )} +${render_sample_datasets( sample )} --- a/test/functional/test_forms_and_requests.py +++ b/test/functional/test_forms_and_requests.py @@ -160,8 +160,8 @@ class TestFormsAndRequests( TwillTestCas name = 'Test Requestype' self.create_request_type( name, "test sequencer configuration", - str( request_form.id ), - str( sample_form.id ), + self.security.encode_id( request_form.id ), + self.security.encode_id( sample_form.id ), sample_states, strings_displayed=[ 'Create a new sequencer configuration' ], strings_displayed_after_submit=[ "Sequencer configuration (%s) has been created" % name ] ) --- a/lib/galaxy/web/controllers/requests_common.py +++ b/lib/galaxy/web/controllers/requests_common.py @@ -88,7 +88,7 @@ class RequestsGrid( grids.Grid ): StateColumn( "State", key='state', filterable="advanced", - link=( lambda item: iff( item.deleted, None, dict( operation="events", id=item.id ) ) ) + link=( lambda item: iff( item.deleted, None, dict( operation="request_events", id=item.id ) ) ) ) ] columns.append( grids.MulticolFilterColumn( "Search", @@ -105,7 +105,7 @@ class RequestsGrid( grids.Grid ): class RequestsCommon( BaseController, UsesFormDefinitionWidgets ): @web.json - def sample_state_updates( self, trans, cntrller, ids=None, states=None ): + def sample_state_updates( self, trans, ids=None, states=None ): # Avoid caching trans.response.headers['Pragma'] = 'no-cache' trans.response.headers['Expires'] = '0' @@ -120,12 +120,10 @@ class RequestsCommon( BaseController, Us rval[ id ] = { "state": sample.state.name, "datasets": len( sample.datasets ), "html_state": unicode( trans.fill_template( "requests/common/sample_state.mako", - sample=sample, - cntrller=cntrller ), + sample=sample), 'utf-8' ), "html_datasets": unicode( trans.fill_template( "requests/common/sample_datasets.mako", - sample=sample, - cntrller=cntrller ), + sample=sample ), 'utf-8' ) } return rval @web.expose @@ -865,8 +863,6 @@ class RequestsCommon( BaseController, Us library_id = current_samples[ copy_sample_index][ 'library_select_field' ].get_selected( return_value=True ) folder_id = current_samples[ copy_sample_index ][ 'folder_select_field' ].get_selected( return_value=True ) name = current_samples[ copy_sample_index ][ 'name' ] + '_%i' % ( len( current_samples ) + 1 ) - library_id = 'none' - folder_id = 'none' field_values = [ val for val in current_samples[ copy_sample_index ][ 'field_values' ] ] else: # The user has not selected a sample to copy (may just be adding a sample). --- a/lib/galaxy/web/controllers/requests.py +++ b/lib/galaxy/web/controllers/requests.py @@ -52,6 +52,12 @@ class Requests( BaseController ): action='undelete_request', cntrller='requests', **kwd ) ) + if operation == "request_events": + return trans.response.send_redirect( web.url_for( controller='requests_common', + action='request_events', + cntrller='requests', + **kwd ) ) + # If there are requests that have been rejected, show a message as a reminder to the user rejected = 0 for request in trans.sa_session.query( trans.app.model.Request ) \ --- a/templates/admin/requests/view_request_type.mako +++ b/templates/admin/requests/view_request_type.mako @@ -11,7 +11,7 @@ <div class="toolForm"><div class="toolFormTitle">Sequencer configuration information</div> - <form name="view_request_type" action="${h.url_for( controller='requests_admin', action='create_request_type', rt_id=request_type.id)}" method="post" > + <form name="view_request_type" action="${h.url_for( controller='requests_admin', action='create_request_type', rt_id=trans.security.encode_id( request_type.id ))}" method="post" ><div class="form-row"><label>Name</label> ${request_type.name} --- a/templates/requests/common/manage_request.mako +++ b/templates/requests/common/manage_request.mako @@ -62,7 +62,7 @@ // Build request data var ids = [] var states = [] - $.each( sample_states, function ( id, state, cntrller ) { + $.each( sample_states, function ( id, state ) { ids.push( id ); states.push( state ); }); @@ -73,7 +73,7 @@ dataType: "json", data: { ids: ids.join( "," ), states: states.join( "," ) }, success : function ( data ) { - $.each( data, function( cntrller, id, val ) { + $.each( data, function( id, val ) { // Replace HTML var cell1 = $("#sampleState-" + id); cell1.html( val.html_state ); @@ -140,7 +140,6 @@ <a class="action-button" confirm="More samples cannot be added to this request once it is submitted. Click OK to submit." href="${h.url_for( controller='requests_common', action='submit_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Submit</a> %endif <a class="action-button" href="${h.url_for( controller='requests_common', action='request_events', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">History</a> - <a class="action-button" href="${h.url_for( controller='requests_common', action='edit_basic_request_info', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Edit</a> %if is_admin: %if request.is_submitted: <a class="action-button" href="${h.url_for( controller='requests_admin', action='reject', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject</a> @@ -178,6 +177,13 @@ <h4><img src="/static/images/fugue/toggle-expand.png" alt="Show" onclick="showContent(this);" style="cursor:pointer;"/> Request Information</h4><div style="display:none;"> + <div class="form-row"> + <ul class="manage-table-actions"> + <li> + <a class="action-button" href="${h.url_for( controller='requests_common', action='edit_basic_request_info', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Edit request informaton</a> + </li> + </ul> + </div><table class="grid" border="0"><tbody><tr> @@ -452,7 +458,7 @@ %if sample.request.is_unsubmitted: <td>Unsubmitted</td> %else: - <td id="sampleState-${sample.id}">${render_sample_state( cntrller, sample )}</td> + <td><a id="sampleState-${sample.id}" href="${h.url_for( controller='requests_common', action='sample_events', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${render_sample_state( sample )}</a></td> %endif %if info['library']: %if cntrller == 'requests': @@ -469,9 +475,9 @@ <td></td> %endif %if request.is_submitted or request.is_complete: - <td id="sampleDatasets-${sample.id}"> - ${render_sample_datasets( cntrller, sample )} - </td> + <td><a id="sampleDatasets-${sample.id}" href="${h.url_for( controller='requests_common', action='view_dataset_transfer', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}"> + ${render_sample_datasets( sample )} + </a></td> %endif %else: ${show_basic_info_form( sample_index, sample, info )} --- a/templates/requests/common/sample_state.mako +++ b/templates/requests/common/sample_state.mako @@ -1,5 +1,5 @@ -<%def name="render_sample_state( cntrller, sample )"> - <a href="${h.url_for( controller='requests_common', action='sample_events', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${sample.state.name}</a> +<%def name="render_sample_state( sample )"> + ${sample.state.name} </%def> -${render_sample_state( cntrller, sample )} +${render_sample_state( sample )} --- a/lib/galaxy/web/controllers/requests_admin.py +++ b/lib/galaxy/web/controllers/requests_admin.py @@ -163,6 +163,11 @@ class RequestsAdmin( BaseController, Use action='manage_request', cntrller='requests_admin', **kwd ) ) + if operation == "request_events": + return trans.response.send_redirect( web.url_for( controller='requests_common', + action='request_events', + cntrller='requests_admin', + **kwd ) ) if operation == "reject": return self.reject_request( trans, **kwd ) if operation == "view_type": @@ -423,7 +428,6 @@ class RequestsAdmin( BaseController, Use request_id=request_id, folder_path=folder_path, sample_id=sample.id, - open_folder=True, message=message, status=status ) ) # Get the filenames from the remote host @@ -590,21 +594,31 @@ class RequestsAdmin( BaseController, Use FOLDER_ID=str(sample.folder.id), DATASETS=datasets ) # Send the message - conn = amqp.Connection( host=trans.app.config.amqp['host'] + ":" + trans.app.config.amqp['port'], - userid=trans.app.config.amqp['userid'], - password=trans.app.config.amqp['password'], - virtual_host=trans.app.config.amqp['virtual_host'], - insist=False ) - chan = conn.channel() - msg = amqp.Message( data.replace( '\n', '' ).replace( '\r', '' ), - content_type='text/plain', - application_headers={'msg_type': 'data_transfer'} ) - msg.properties["delivery_mode"] = 2 - chan.basic_publish( msg, - exchange=trans.app.config.amqp['exchange'], - routing_key=trans.app.config.amqp['routing_key'] ) - chan.close() - conn.close() + try: + conn = amqp.Connection( host=trans.app.config.amqp['host'] + ":" + trans.app.config.amqp['port'], + userid=trans.app.config.amqp['userid'], + password=trans.app.config.amqp['password'], + virtual_host=trans.app.config.amqp['virtual_host'], + insist=False ) + chan = conn.channel() + msg = amqp.Message( data.replace( '\n', '' ).replace( '\r', '' ), + content_type='text/plain', + application_headers={'msg_type': 'data_transfer'} ) + msg.properties["delivery_mode"] = 2 + chan.basic_publish( msg, + exchange=trans.app.config.amqp['exchange'], + routing_key=trans.app.config.amqp['routing_key'] ) + chan.close() + conn.close() + except Exception, e: + message = "Error in sending the data transfer message to the Galaxy AMQP message queue:<br/>%s" % str(e) + status = "error" + return trans.response.send_redirect( web.url_for( controller='requests_admin', + action='manage_datasets', + sample_id=trans.security.encode_id( sample.id ), + status=status, + message=message) ) + def __start_datatx( self, trans, sample, selected_sample_datasets ): datatx_user = self.__setup_datatx_user( trans, sample.library, sample.folder ) # Validate sequencer information
participants (1)
-
commits-noreply@bitbucket.org