# 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 1289507783 18000 # Node ID f2383b761f4e05442fd5ba6b1cde517732aa2c03 # Parent dfc848840870fa9936a69e62322446fcb940fb40 Make sure samples have associated target libraries befoe enabling ability to transfer datasets, use better naming convention for request history code and templates, eliminate the ability to submit a request unless it has samples. --- a/templates/requests/common/view_sample_datasets.mako +++ b/templates/requests/common/view_sample_datasets.mako @@ -7,14 +7,14 @@ 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 + can_transfer_datasets = is_admin and sample.untransferred_dataset_files and sample.library and sample.folder %><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> + <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 ) )}">Manage selected 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> --- a/templates/requests/common/edit_samples.mako +++ b/templates/requests/common/edit_samples.mako @@ -47,7 +47,7 @@ %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 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> + <a class="action-button" href="${h.url_for( controller='requests_common', action='view_request_history', 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 this request</a> %endif --- a/lib/galaxy/web/controllers/requests.py +++ b/lib/galaxy/web/controllers/requests.py @@ -57,9 +57,9 @@ class Requests( BaseController ): action='undelete_request', cntrller='requests', **kwd ) ) - if operation == "request_events": + if operation == "view_request_history": return trans.response.send_redirect( web.url_for( controller='requests_common', - action='request_events', + action='view_request_history', cntrller='requests', **kwd ) ) --- a/lib/galaxy/web/controllers/requests_common.py +++ b/lib/galaxy/web/controllers/requests_common.py @@ -76,7 +76,7 @@ class RequestsGrid( grids.Grid ): StateColumn( "State", key='state', filterable="advanced", - link=( lambda item: iff( item.deleted, None, dict( operation="request_events", id=item.id ) ) ) + link=( lambda item: iff( item.deleted, None, dict( operation="view_request_history", id=item.id ) ) ) ) ] columns.append( grids.MulticolFilterColumn( "Search", @@ -579,8 +579,8 @@ class RequestsCommon( BaseController, Us status=status, message=message ) ) @web.expose - @web.require_login( "sequencing request events" ) - def request_events( self, trans, cntrller, **kwd ): + @web.require_login( "sequencing request history" ) + def view_request_history( self, trans, cntrller, **kwd ): params = util.Params( kwd ) request_id = params.get( 'id', None ) try: @@ -590,7 +590,7 @@ class RequestsCommon( BaseController, Us events_list = [] for event in request.events: events_list.append( ( event.state, time_ago( event.update_time ), event.comment ) ) - return trans.fill_template( '/requests/common/events.mako', + return trans.fill_template( '/requests/common/view_request_history.mako', cntrller=cntrller, events_list=events_list, request=request ) --- a/templates/admin/requests/select_datasets_to_transfer.mako +++ b/templates/admin/requests/select_datasets_to_transfer.mako @@ -72,7 +72,7 @@ <% is_admin = cntrller == 'requests_admin' and trans.user_is_admin() - can_transfer_datasets = is_admin and sample.untransferred_dataset_files + can_transfer_datasets = is_admin and sample.untransferred_dataset_files and sample.library and sample.folder %><br/><br/> @@ -85,8 +85,15 @@ </ul> %if not sample: + <br/><font color="red"><b><i>Select a sample before selecting datasets to transfer</i></b></font> - <br/><br/> + <br/> +%endif + +%if request.samples_without_library_destinations: + <br/> + <font color="red"><b><i>Select a target data library and folder for all samples before starting the sequence run</i></b></font> + <br/> %endif %if message: --- a/lib/galaxy/web/controllers/requests_admin.py +++ b/lib/galaxy/web/controllers/requests_admin.py @@ -175,9 +175,9 @@ class RequestsAdmin( BaseController, Use action='view_request', cntrller='requests_admin', **kwd ) ) - if operation == "request_events": + if operation == "view_request_history": return trans.response.send_redirect( web.url_for( controller='requests_common', - action='request_events', + action='view_request_history', cntrller='requests_admin', **kwd ) ) if operation == "reject": --- a/test/base/twilltestcase.py +++ b/test/base/twilltestcase.py @@ -1517,7 +1517,7 @@ class TwillTestCase( unittest.TestCase ) for check_str in strings_not_displayed: self.check_string_not_in_page( check_str ) def view_request_history( self, cntrller, request_id, strings_displayed=[], strings_not_displayed=[] ): - self.visit_url( "%s/requests_common/request_events?cntrller=%s&id=%s" % ( self.url, cntrller, request_id ) ) + self.visit_url( "%s/requests_common/view_request_history?cntrller=%s&id=%s" % ( self.url, cntrller, request_id ) ) for check_str in strings_displayed: self.check_page_for_string( check_str ) for check_str in strings_not_displayed: --- a/templates/requests/common/events.mako +++ /dev/null @@ -1,53 +0,0 @@ -<%inherit file="/base.mako"/> -<%namespace file="/message.mako" import="render_msg" /> - -<% - 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 -%> - -<br/><br/> -<ul class="manage-table-actions"> - <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 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 this request</a> - %endif - %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> - -%if message: - ${render_msg( message, status )} -%endif - -<h2>History of Sequencing Request "${request.name}"</h2> - -<div class="toolForm"> - <table class="grid"> - <thead> - <tr> - <th>State</th> - <th>Last Update</th> - <th>Comments</th> - </tr> - </thead> - <tbody> - %for state, updated, comments in events_list: - <tr class="libraryRow libraryOrFolderRow" id="libraryRow"> - <td><b><a>${state}</a></b></td> - <td><a>${updated}</a></td> - <td><a>${comments}</a></td> - </tr> - %endfor - </tbody> - </table> -</div> --- a/templates/requests/common/edit_basic_request_info.mako +++ b/templates/requests/common/edit_basic_request_info.mako @@ -3,7 +3,13 @@ <% is_admin = cntrller == 'requests_admin' and trans.user_is_admin() - can_add_samples = request.is_unsubmitted + is_complete = request.is_complete + is_submitted = request.is_submitted + is_unsubmitted = request.is_unsubmitted + can_add_samples = is_unsubmitted + can_reject = is_admin and is_submitted + can_select_datasets = is_admin and ( is_complete or is_submitted ) + can_submit_request = request.samples and is_unsubmitted %><br/><br/> @@ -11,12 +17,14 @@ <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_add_samples: + %if can_submit_request: <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_common', action='view_request_history', 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 this request</a> + %endif + %if can_select_datasets: <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/admin/requests/reject.mako +++ b/templates/admin/requests/reject.mako @@ -8,7 +8,7 @@ <h2>Reject Sequencing Request "${request.name}"</h2><ul class="manage-table-actions"><li> - <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> + <a class="action-button" href="${h.url_for( controller='requests_common', action='view_request_history', cntrller=cntrller, id=trans.security.encode_id(request.id) )}">View history</a></li><li><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> --- a/templates/requests/common/view_request.mako +++ b/templates/requests/common/view_request.mako @@ -44,7 +44,7 @@ %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 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> + <a class="action-button" href="${h.url_for( controller='requests_common', action='view_request_history', 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 this request</a> %endif @@ -52,8 +52,15 @@ </ul> %if request.is_rejected: + <br/><font color="red"><b><i>Reason for rejection: </i></b></font><b>${request.last_comment}</b> - <br/><br/> + <br/> +%endif + +%if request.samples_without_library_destinations: + <br/> + <font color="red"><b><i>Select a target data library and folder for all samples before starting the sequence run</i></b></font> + <br/> %endif %if message: @@ -94,7 +101,7 @@ <div class="form-row"><label>${field_label}:</label> %if field_label == 'State': - <a href="${h.url_for( controller='requests_common', action='request_events', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">${field_value}</a> + <a href="${h.url_for( controller='requests_common', action='view_request_history', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">${field_value}</a> %else: ${field_value} %endif @@ -154,6 +161,11 @@ render_buttons = can_edit_samples %> ${render_samples_grid( cntrller, request, displayable_sample_widgets=displayable_sample_widgets, action='view_request', editing_samples=False, encoded_selected_sample_ids=[], render_buttons=render_buttons, grid_header=grid_header )} + ## 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 ), displayable_sample_widgets=displayable_sample_widgets, editing_samples=False )} + %endfor %else: There are no samples. %if can_add_samples: @@ -162,8 +174,3 @@ </ul> %endif %endif -## 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 ), displayable_sample_widgets=displayable_sample_widgets, editing_samples=False )} -%endfor --- /dev/null +++ b/templates/requests/common/view_request_history.mako @@ -0,0 +1,58 @@ +<%inherit file="/base.mako"/> +<%namespace file="/message.mako" import="render_msg" /> + +<% + is_admin = cntrller == 'requests_admin' and trans.user_is_admin() + is_complete = request.is_complete + is_submitted = request.is_submitted + is_unsubmitted = request.is_unsubmitted + can_add_samples = is_unsubmitted + can_edit_request = ( is_admin and not is_complete ) or is_unsubmitted + can_reject = is_admin and is_submitted + can_select_datasets = is_admin and ( is_complete or is_submitted ) + can_submit_request = request.samples and is_unsubmitted +%> + +<br/><br/> +<ul class="manage-table-actions"> + <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 this request</a> + %endif + %if can_submit_request: + <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 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 this request</a> + %endif + </div> +</ul> + +%if message: + ${render_msg( message, status )} +%endif + +<h2>History of sequencing request "${request.name}"</h2> + +<div class="toolForm"> + <table class="grid"> + <thead> + <tr> + <th>State</th> + <th>Last Update</th> + <th>Comments</th> + </tr> + </thead> + <tbody> + %for state, updated, comments in events_list: + <tr class="libraryRow libraryOrFolderRow" id="libraryRow"> + <td><b><a>${state}</a></b></td> + <td><a>${updated}</a></td> + <td><a>${comments}</a></td> + </tr> + %endfor + </tbody> + </table> +</div> --- a/templates/requests/common/common.mako +++ b/templates/requests/common/common.mako @@ -322,7 +322,7 @@ %if can_select_datasets: <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='select_datasets_to_transfer', request_id=trans.security.encode_id( request.id ), sample_id=trans.security.encode_id( sample.id ) )}">Select datasets to transfer</a></li> %endif - %if sample.datasets and len( sample.datasets ) > len( transferred_dataset_files ): + %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>