galaxy-dist commit b1813ff5bb4e: Bug fixes and more UI streamlining for sample tracking.
# HG changeset patch -- Bitbucket.org # Project galaxy-dist # URL http://bitbucket.org/galaxy/galaxy-dist/overview # User Greg Von Kuster <greg@bx.psu.edu> # Date 1289426620 18000 # Node ID b1813ff5bb4ef20d0b5d5a1fdcfc16cf6ec3ba53 # Parent 0e5144e49c14eb2a77e1d3182a33b4f9c8de98fc Bug fixes and more UI streamlining for sample tracking. --- a/templates/requests/common/sample_datasets.mako +++ /dev/null @@ -1,5 +0,0 @@ -<%def name="render_sample_datasets( sample )"> - ${len( sample.datasets )} / ${len( sample.transferred_dataset_files )} -</%def> - -${render_sample_datasets( sample )} --- /dev/null +++ b/templates/requests/common/view_sample_datasets.mako @@ -0,0 +1,43 @@ +<%inherit file="/base.mako"/> +<%namespace file="/message.mako" import="render_msg" /> +<%namespace file="/requests/common/common.mako" import="render_sample_datasets" /> + +<% + is_admin = cntrller == 'requests_admin' and trans.user_is_admin() + is_complete = sample.request.is_complete + is_submitted = sample.request.is_submitted + can_select_datasets = is_admin and ( is_complete or is_submitted ) + can_transfer_datasets = is_admin and sample.untransferred_dataset_files +%> + +<br/><br/> + +<ul class="manage-table-actions"> + %if can_transfer_datasets: + <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='manage_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">Transfer datasets</a></li> + %endif + <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=transfer_status )}">Refresh page</a></li> + <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> + %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> + </div> +</ul> + +%if message: + ${render_msg( message, status )} +%endif + +%if sample and sample_datasets: + ## The list of sample_datasets may not be the same as sample.datasets because it may be + ## filtered by a transfer_status value. The value of title changes based on this filter. + ${render_sample_datasets( cntrller, sample, sample_datasets, title )} +%else: + %if transfer_status: + No datasets with status ${transfer_status}" belong to this sample + %else: + No datasets have been selected for this sample. +%endif --- a/templates/requests/common/edit_samples.mako +++ b/templates/requests/common/edit_samples.mako @@ -41,15 +41,15 @@ %if can_submit: <li><a class="action-button" confirm="More samples cannot be added to this request after 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 request</a></li> %endif - <li><a class="action-button" id="request-${request.id}-popup" class="menubutton">Request actions</a></li> + <li><a class="action-button" id="request-${request.id}-popup" class="menubutton">Request Actions</a></li><div popupmenu="request-${request.id}-popup"><a class="action-button" href="${h.url_for( controller='requests_common', action='view_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Browse this request</a> %if can_edit_request: - <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> + <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 this request</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 ) )}">View history</a> %if can_reject: - <a class="action-button" href="${h.url_for( controller='requests_admin', action='reject_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject</a> + <a class="action-button" href="${h.url_for( controller='requests_admin', action='reject_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject this request</a> %endif </div></ul> @@ -118,7 +118,7 @@ ## Render the other grids <% trans.sa_session.refresh( request.type.sample_form ) %> %for grid_index, grid_name in enumerate( request.type.sample_form.layout ): - ${render_request_type_sample_form_grids( grid_index, grid_name, request.type.sample_form.grid_fields( grid_index ), editing_samples=editing_samples )} + ${render_request_type_sample_form_grids( grid_index, grid_name, request.type.sample_form.grid_fields( grid_index ), current_samples=current_samples, editing_samples=editing_samples )} %endfor %else: <label>There are no samples.</label> --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -1831,12 +1831,12 @@ class Sample( object ): return self.events[0] return None @property - def untransferred_dataset_files( self ): - untransferred_datasets = [] + def adding_to_library_dataset_files( self ): + adding_to_library_datasets = [] for dataset in self.datasets: - if dataset.status == SampleDataset.transfer_status.NOT_STARTED: - untransferred_datasets.append( dataset ) - return untransferred_datasets + 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 = [] @@ -1845,12 +1845,40 @@ class Sample( object ): inprogress_datasets.append( dataset ) return inprogress_datasets @property + def queued_dataset_files( self ): + queued_datasets = [] + for dataset in self.datasets: + 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 = [] + for dataset in self.datasets: + if dataset.status == SampleDataset.transfer_status.ERROR: + transfer_error_datasets.append( dataset ) + return transfer_error_datasets + @property def transferred_dataset_files( self ): transferred_datasets = [] for dataset in self.datasets: if dataset.status == SampleDataset.transfer_status.COMPLETE: transferred_datasets.append( dataset ) return transferred_datasets + @property + def transferring_dataset_files( self ): + transferring_datasets = [] + for dataset in self.datasets: + if dataset.status == SampleDataset.transfer_status.TRANSFERRING: + transferring_datasets.append( dataset ) + return transferring_datasets + @property + def untransferred_dataset_files( self ): + untransferred_datasets = [] + for dataset in self.datasets: + if dataset.status != SampleDataset.transfer_status.COMPLETE: + untransferred_datasets.append( dataset ) + return untransferred_datasets def get_untransferred_dataset_size( self, filepath ): # TODO: RC: If rsh keys are not set, this method will return something like the following: # greg@scofield.bx.psu.edu's password: 46M /afs/bx.psu.edu/home/greg/chr22/chr21.fa --- a/lib/galaxy/web/controllers/requests_common.py +++ b/lib/galaxy/web/controllers/requests_common.py @@ -109,10 +109,7 @@ class RequestsCommon( BaseController, Us "datasets": len( sample.datasets ), "html_state": unicode( trans.fill_template( "requests/common/sample_state.mako", sample=sample), - 'utf-8' ), - "html_datasets": unicode( trans.fill_template( "requests/common/sample_datasets.mako", - sample=sample ), - 'utf-8' ) } + 'utf-8' ) } return rval @web.expose @web.require_login( "create sequencing requests" ) @@ -455,7 +452,7 @@ class RequestsCommon( BaseController, Us samples.append( sample ) else: samples.append( None ) - # The __save_samples method requires samples widgets, not sample objects + # The __save_samples method requires sample_widgets, not sample objects samples = self.__get_sample_widgets( trans, request, samples, **kwd ) else: samples = current_samples @@ -699,9 +696,9 @@ class RequestsCommon( BaseController, Us # are in this state. retval = request.send_email_notification( trans, common_state, final_state ) if retval: - message = comments + retval + message = comment + retval else: - message = comments + message = comment if cntrller == 'api': return 200, message return trans.response.send_redirect( web.url_for( controller='requests_common', @@ -897,7 +894,7 @@ class RequestsCommon( BaseController, Us message=message ) ) @web.expose @web.require_login( "view data transfer page" ) - def view_selected_datasets( self, trans, cntrller, **kwd ): + def view_sample_datasets( self, trans, cntrller, **kwd ): # The link on the number of selected datasets will only appear if there is at least 1 selected dataset. # If there are 0 selected datasets, there is no link, so this method will only be reached from the requests # controller if there are selected datasets. @@ -930,13 +927,34 @@ class RequestsCommon( BaseController, Us if folder_path and folder_path[-1] != os.sep: folder_path += os.sep if not sample.request.type.datatx_info['host'] \ - or not sample.request.type.datatx_info['username'] \ - or not sample.request.type.datatx_info['password']: + or not sample.request.type.datatx_info[ 'username' ] \ + or not sample.request.type.datatx_info[ 'password' ]: status = 'error' message = 'The sequencer login information is incomplete. Click sequencer information to add login details.' - return trans.fill_template( '/requests/common/view_selected_datasets.mako', + transfer_status = params.get( 'transfer_status', None ) + if transfer_status in [ None, 'None' ]: + title = 'All selected datasets for "%s"' % sample.name + sample_datasets = sample.datasets + elif transfer_status == trans.model.SampleDataset.transfer_status.IN_QUEUE: + title = 'Datasets of "%s" that are in the transfer queue' % sample.name + sample_datasets = sample.queued_dataset_files + elif transfer_status == trans.model.SampleDataset.transfer_status.TRANSFERRING: + title = 'Datasets of "%s" that are being transferred' % sample.name + sample_datasets = sample.transferring_dataset_files + elif transfer_status == trans.model.SampleDataset.transfer_status.ADD_TO_LIBRARY: + title = 'Datasets of "%s" that are being added to the target data library' % sample.name + sample_datasets = sample.adding_to_library_dataset_files + elif transfer_status == trans.model.SampleDataset.transfer_status.COMPLETE: + title = 'Datasets of "%s" that are available in the target data library' % sample.name + sample_datasets = sample.transferred_dataset_files + elif transfer_status == trans.model.SampleDataset.transfer_status.ERROR: + title = 'Datasets of "%s" that resulted in a transfer error' % sample.name + sample_datasets = sample.transfer_error_dataset_files + return trans.fill_template( '/requests/common/view_sample_datasets.mako', cntrller=cntrller, sample=sample, + sample_datasets=sample_datasets, + transfer_status=transferr_status, message=message, status=status, files=[], @@ -1129,60 +1147,48 @@ class RequestsCommon( BaseController, Us # on a set of samples. library_id = params.get( 'sample_0_library_id', 'none' ) folder_id = params.get( 'sample_0_folder_id', 'none' ) - for index, obj in enumerate( sample_widgets ): - if obj is not None: - # obj will be None if the user checked sample check boxes and selected an action + for index, sample_widget in enumerate( sample_widgets ): + if sample_widget is not None: + # sample_widget will be None if the user checked sample check boxes and selected an action # to perform on multiple samples, but did not select certain samples. sample = request.samples[ index ] - # See if any values in kwd are different from the values already associated with this sample. - id_index = index + 1 - if sample_operation == 'none': - # We are handling changes to a single sample. - library_id = params.get( 'sample_%i_library_id' % id_index, 'none' ) - folder_id = params.get( 'sample_%i_folder_id' % id_index, 'none' ) - # Update the corresponding sample's values as well as the sample_widget. - name = util.restore_text( params.get( 'sample_%i_name' % index, '' ) ) - # The bar_code field requires special handling because after a request is submitted, the - # state of a sample cannot be changed without a bar_code associated with the sample. Bar - # codes can only be added to a sample after the request is submitted. Also, a samples will - # not have an associated SampleState until the request is submitted, at which time the sample - # is automatically associated with the first SamplesState configured by the admin for the - # request's RequestType. - bar_code = util.restore_text( params.get( 'sample_%i_barcode' % index, '' ) ) - if bar_code: - bc_message = self.__validate_barcode( trans, sample, bar_code ) - if bc_message: - kwd[ 'message' ] = bc_message - del kwd[ 'save_samples_button' ] - handle_error( **kwd ) - if not sample.bar_code: - # If the sample's associated SampleState is still the initial state - # configured by the admin for the request's RequestType, this must be - # the first time a bar code was added to the sample, so change it's state - # to the next associated SampleState. - if sample.state.id == request.type.states[0].id: - event = trans.app.model.SampleEvent(sample, - request.type.states[1], - 'Bar code associated with the sample' ) - trans.sa_session.add( event ) - trans.sa_session.flush() - library, folder = self.__get_library_and_folder( trans, library_id, folder_id ) - field_values = [] - for field_index in range( len( request.type.sample_form.fields ) ): - field_values.append( util.restore_text( params.get( 'sample_%i_field_%i' % ( index, field_index ), '' ) ) ) + # Get the sample's form values to see if they have changed. form_values = trans.sa_session.query( trans.model.FormValues ).get( sample.values.id ) - form_values.content = field_values - if sample.name != name or \ - sample.bar_code != bar_code or \ - sample.library != library or \ - sample.folder != folder or \ - form_values.content != field_values: + if sample.name != sample_widget[ 'name' ] or \ + sample.bar_code != sample_widget[ 'barcode' ] or \ + sample.library != sample_widget[ 'library' ] or \ + sample.folder != sample_widget[ 'folder' ] or \ + form_values.content != sample_widget[ 'field_values' ]: # Information about this sample has been changed. - sample.name = name - sample.bar_code = bar_code - sample.library = library - sample.folder = folder - form_values.content = field_values + sample.name = sample_widget[ 'name' ] + barcode = sample_widget[ 'barcode' ] + # The bar_code field requires special handling because after a request is submitted, the + # state of a sample cannot be changed without a bar_code associated with the sample. Bar + # codes can only be added to a sample after the request is submitted. Also, a samples will + # not have an associated SampleState until the request is submitted, at which time the sample + # is automatically associated with the first SamplesState configured by the admin for the + # request's RequestType. + if barcode: + bc_message = self.__validate_barcode( trans, sample, bar_code ) + if bc_message: + kwd[ 'message' ] = bc_message + del kwd[ 'save_samples_button' ] + handle_error( **kwd ) + if not sample.bar_code: + # If the sample's associated SampleState is still the initial state + # configured by the admin for the request's RequestType, this must be + # the first time a bar code was added to the sample, so change it's state + # to the next associated SampleState. + if sample.state.id == request.type.states[0].id: + event = trans.app.model.SampleEvent(sample, + request.type.states[1], + 'Bar code associated with the sample' ) + trans.sa_session.add( event ) + trans.sa_session.flush() + sample.bar_code = barcode + sample.library = sample_widget[ 'library' ] + sample.folder = sample_widget[ 'folder' ] + form_values.content = sample_widget[ 'field_values' ] trans.sa_session.add_all( ( sample, form_values ) ) trans.sa_session.flush() def __get_library_and_folder( self, trans, library_id, folder_id ): @@ -1232,8 +1238,8 @@ class RequestsCommon( BaseController, Us """ Returns a list of dictionaries, each representing the widgets that define a sample on a form. The widgets are populated from kwd based on the set of samples received. The set of samples - corresponds to a reques.samples list, but if the user checked specific check boxes on the form, - those samples that were not check will have None objects in the list of samples. In this case, + corresponds to a request.samples list, but if the user checked specific check boxes on the form, + those samples that were not checked will have None objects in the list of samples. In this case, the corresponding sample_widget is populated from the db rather than kwd. """ params = util.Params( kwd ) @@ -1264,7 +1270,7 @@ class RequestsCommon( BaseController, Us bar_code = sample.bar_code library = sample.library folder = sample.folder - field_values = sample.values.content, + field_values = sample.values.content else: # Update the sample attributes from kwd name = util.restore_text( params.get( 'sample_%i_name' % index, sample.name ) ) @@ -1278,7 +1284,8 @@ class RequestsCommon( BaseController, Us library, folder = self.__get_library_and_folder( trans, library_id, folder_id ) field_values = [] for field_index in range( len( request.type.sample_form.fields ) ): - field_values.append( util.restore_text( params.get( 'sample_%i_field_%i' % ( index, field_index ), '' ) ) ) + field_value = util.restore_text( params.get( 'sample_%i_field_%i' % ( index, field_index ), sample.values.content[ field_index ] ) ) + field_values.append( field_value ) library_select_field, folder_select_field = self.__build_library_and_folder_select_fields( trans=trans, user=request.user, sample_index=id_index, --- a/templates/requests/common/find_samples.mako +++ b/templates/requests/common/find_samples.mako @@ -71,7 +71,7 @@ %else: State: ${sample.state.name}<br/> %endif - Datasets: <a href="${h.url_for( controller='requests_common', action='view_selected_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.transferred_dataset_files )}/${len( sample.datasets )}</a><br/> + 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/> %if is_admin: <i>User: ${sample.request.user.email}</i> %endif --- a/templates/requests/common/view_selected_datasets.mako +++ /dev/null @@ -1,37 +0,0 @@ -<%inherit file="/base.mako"/> -<%namespace file="/message.mako" import="render_msg" /> -<%namespace file="/requests/common/common.mako" import="render_sample_datasets" /> - -<% - is_admin = cntrller == 'requests_admin' and trans.user_is_admin() - is_complete = sample.request.is_complete - is_submitted = sample.request.is_submitted - can_select_datasets = is_admin and ( is_complete or is_submitted ) - can_transfer_datasets = is_admin and sample.untransferred_dataset_files -%> - -<br/><br/> - -<ul class="manage-table-actions"> - %if can_transfer_datasets: - <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='manage_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">Transfer datasets</a></li> - %endif - <li><a class="action-button" href="${h.url_for( controller='requests_common', action='view_selected_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">Refresh page</a></li> - <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> - %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> - </div> -</ul> - -%if message: - ${render_msg( message, status )} -%endif - -%if sample and sample.datasets: - <% title = 'Datasets currently selected for "sample.name"' %> - ${render_sample_datasets( cntrller, sample, sample.datasets, title )} -%endif --- a/templates/admin/requests/select_datasets_to_transfer.mako +++ b/templates/admin/requests/select_datasets_to_transfer.mako @@ -127,7 +127,7 @@ </div> %if sample and sample.datasets: - <% title = 'Datasets currently selected for "sample.name"' %> + <% title = 'Datasets currently selected for "%s"' % sample.name %><p/> ${render_sample_datasets( 'requests_admin', sample, sample.datasets, title )} %endif --- a/templates/requests/common/common.mako +++ b/templates/requests/common/common.mako @@ -100,8 +100,6 @@ // Replace HTML var cell1 = $("#sampleState-" + id); cell1.html( val.html_state ); - var cell2 = $("#sampleDatasets-" + id); - cell2.html( val.html_datasets ); sample_states[ parseInt( id ) ] = val.state; }); updater( sample_states ); @@ -115,14 +113,16 @@ </script></%def> -<%def name="render_editable_sample_row( is_admin, sample, current_sample_index, current_sample, encoded_selected_sample_ids )"> +<%def name="render_editable_sample_row( cntrller, sample, current_sample_index, current_sample, encoded_selected_sample_ids )"><% + is_admin = cntrller == 'requests_admin' and trans.user_is_admin() if sample: trans.sa_session.refresh( sample.request ) is_complete = sample.request.is_complete is_rejected = request.is_rejected is_submitted = sample.request.is_submitted is_unsubmitted = sample.request.is_unsubmitted + can_delete_samples = not is_complete display_checkboxes = editing_samples and ( is_complete or is_rejected or is_submitted ) display_bar_code = request.samples and ( is_complete or is_rejected or is_submitted ) display_datasets = request.samples and ( is_complete or is_rejected or is_submitted ) @@ -130,6 +130,7 @@ is_complete = False is_submitted = False is_unsubmitted = False + can_delete_samples = False display_checkboxes = False display_bar_code = False display_datasets = False @@ -177,20 +178,36 @@ <a id="sampleDatasets-${sample.id}" href="${h.url_for( controller='requests_admin', action='select_datasets_to_transfer', cntrller=cntrller, request_id=trans.security.encode_id( request.id ), sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.datasets )}</a> %elif sample.datasets: ## Only display a link if there is at least 1 selected dataset for the sample - <a href="${h.url_for( controller='requests_common', action='view_selected_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.datasets )}</a></td> + <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></td> %else: ${len( sample.datasets )} %endif </td><td valign="top"> - %if is_admin and sample.untransferred_dataset_files: - <a href="${h.url_for( controller='requests_common', action='manage_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.transferred_dataset_files )}</a> + %if is_admin: + %if sample.untransferred_dataset_files: + ## At least 1 selected dataset is not yet transferred, so this link + ## will direct the admin to a page allowing them to transfer datasets. + <a href="${h.url_for( controller='requests_common', action='manage_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.transferred_dataset_files )}</a> + %else: + ## All selected datasets have successfully transferred, so this link + ## will direct the admin to a page displaying all transferred datasets. + <a 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 )}">${len( sample.transferred_dataset_files )}</a> + %endif %else: - ${len( sample.transferred_dataset_files )} + %if sample.transferred_dataset_files: + ## The cuurent user is not an admin, so this link will direct the + ## user to the target data library containing those datasets that + ## were successfully transferred. + <a href="${h.url_for( controller='library_common', action='browse_library', cntrller='library', id=trans.security.encode_id( sample.library.id ) )}">${len( sample.transferred_dataset_files )}</a> + %else: + ## Display a 0 with no link. + ${len( sample.transferred_dataset_files )} + %endif %endif </td> %endif - %if sample and ( is_admin or is_unsubmitted ) and not is_complete: + %if can_delete_samples: ## Delete button <td valign="top"><a class="action-button" href="${h.url_for( controller='requests_common', action='delete_sample', cntrller=cntrller, request_id=trans.security.encode_id( request.id ), sample_id=current_sample_index )}"><img src="${h.url_for('/static/images/delete_icon.png')}" style="cursor:pointer;"/></a></td> %endif @@ -206,7 +223,7 @@ is_submitted = request.is_submitted is_unsubmitted = request.is_unsubmitted can_add_samples = request.is_unsubmitted - can_delete_samples = request.samples and not is_complete + can_delete_samples = editing_samples and request.samples and not is_complete can_edit_samples = request.samples and ( is_admin or not is_complete ) can_select_datasets = is_admin and current_samples and ( is_submitted or is_complete ) display_checkboxes = editing_samples and ( is_complete or is_rejected or is_submitted ) @@ -271,7 +288,7 @@ sample = None %> %if editing_samples: - <tr>${render_editable_sample_row( is_admin, sample, current_sample_index, current_sample, encoded_selected_sample_ids )}</tr> + <tr>${render_editable_sample_row( cntrller, sample, current_sample_index, current_sample, encoded_selected_sample_ids )}</tr> %elif sample: <tr><td>${current_sample_name}</td> @@ -302,11 +319,11 @@ <a id="sampleDatasets-${sample.id}" href="${h.url_for( controller='requests_admin', action='select_datasets_to_transfer', cntrller=cntrller, request_id=trans.security.encode_id( request.id ), sample_id= trans.security.encode_id( sample.id ) )}">${len( sample.datasets )}</a> %else: ## If there are selected datasets, display them - <a id="sampleDatasets-${sample.id}" href="${h.url_for( controller='requests_common', action='view_selected_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, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.datasets )}</a> %endif %elif sample.datasets: ## 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_selected_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, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.datasets )}</a> %else: ${len( sample.datasets )} %endif @@ -322,7 +339,7 @@ </tr> %else: ## The Add sample button was clicked for this sample_widget - <tr>${render_editable_sample_row( is_admin, None, current_sample_index, current_sample, encoded_selected_sample_ids )}</tr> + <tr>${render_editable_sample_row( cntrller, None, current_sample_index, current_sample, encoded_selected_sample_ids )}</tr> %endif %endfor </tbody> @@ -390,7 +407,7 @@ </tr></%def> -<%def name="render_request_type_sample_form_grids( grid_index, grid_name, fields_dict, editing_samples )"> +<%def name="render_request_type_sample_form_grids( grid_index, grid_name, fields_dict, current_samples, editing_samples )"><% if not grid_name: grid_name = "Sample form layout " + grid_index @@ -432,6 +449,8 @@ </%def><%def name="render_sample_datasets( cntrller, sample, sample_datasets, title )"> + ## The list of sample_datasets may not be the same as sample.datasets because it may be + ## filtered by a transfer_status value. The value of title changes based on this filter. %if sample_datasets: <% is_admin = cntrller == 'requests_admin' and trans.user_is_admin() --- a/templates/requests/common/events.mako +++ b/templates/requests/common/events.mako @@ -4,6 +4,7 @@ <% is_admin = cntrller == 'requests_admin' and trans.user_is_admin() can_edit_request = ( is_admin and not request.is_complete ) or request.is_unsubmitted + can_reject_request = is_admin and request.is_submitted can_add_samples = request.is_unsubmitted %> @@ -13,14 +14,13 @@ <div popupmenu="request-${request.id}-popup"><a class="action-button" href="${h.url_for( controller='requests_common', action='view_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Browse this request</a> %if can_edit_request: - <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> + <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 this request</a> %endif %if can_add_samples: - <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> + <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 this request</a> %endif - %if is_admin and request.is_submitted: - <a class="action-button" href="${h.url_for( controller='requests_admin', action='reject_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject</a> - <a class="action-button" href="${h.url_for( controller='requests_admin', action='select_datasets_to_transfer', request_id=trans.security.encode_id( request.id ) )}">Select datasets to transfer</a> + %if can_reject_request: + <a class="action-button" href="${h.url_for( controller='requests_admin', action='reject_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject this request</a> %endif </div></ul> --- a/templates/requests/common/edit_basic_request_info.mako +++ b/templates/requests/common/edit_basic_request_info.mako @@ -12,11 +12,11 @@ <div popupmenu="request-${request.id}-popup"><a class="action-button" href="${h.url_for( controller='requests_common', action='view_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Browse this request</a> %if can_add_samples: - <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> + <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 this request</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 ) )}">View history</a> %if is_admin and request.is_submitted: - <a class="action-button" href="${h.url_for( controller='requests_admin', action='reject_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject</a> + <a class="action-button" href="${h.url_for( controller='requests_admin', action='reject_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject this request</a><a class="action-button" href="${h.url_for( controller='requests_admin', action='select_datasets_to_transfer', request_id=trans.security.encode_id( request.id ) )}">Select datasets to transfer</a> %endif </div> --- a/templates/requests/common/view_request.mako +++ b/templates/requests/common/view_request.mako @@ -27,6 +27,7 @@ can_edit_samples = request.samples and ( is_admin or not is_complete ) can_reject = is_admin and is_submitted can_submit = request.samples and is_unsubmitted + can_undelete = request.deleted %><br/><br/> @@ -35,17 +36,17 @@ %if can_submit: <li><a class="action-button" confirm="More samples cannot be added to this request after 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 request</a></li> %endif - <li><a class="action-button" id="request-${request.id}-popup" class="menubutton">Request actions</a></li> + <li><a class="action-button" id="request-${request.id}-popup" class="menubutton">Request Actions</a></li><div popupmenu="request-${request.id}-popup"> - %if request.deleted: - <a class="action-button" href="${h.url_for( controller='requests_common', action='undelete_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Undelete</a> + %if can_undelete: + <a class="action-button" href="${h.url_for( controller='requests_common', action='undelete_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Undelete this request</a> %endif %if can_edit_request: - <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> + <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 this request</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 ) )}">View history</a> %if can_reject: - <a class="action-button" href="${h.url_for( controller='requests_admin', action='reject_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject</a> + <a class="action-button" href="${h.url_for( controller='requests_admin', action='reject_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject this request</a> %endif </div></ul> @@ -164,5 +165,5 @@ ## Render the other grids <% trans.sa_session.refresh( request.type.sample_form ) %> %for grid_index, grid_name in enumerate( request.type.sample_form.layout ): - ${render_request_type_sample_form_grids( grid_index, grid_name, request.type.sample_form.grid_fields( grid_index ), editing_samples=False )} + ${render_request_type_sample_form_grids( grid_index, grid_name, request.type.sample_form.grid_fields( grid_index ), current_samples=current_samples, editing_samples=False )} %endfor
participants (1)
-
commits-noreply@bitbucket.org