galaxy-dist commit 77575a5f348d: lims:
# HG changeset patch -- Bitbucket.org # Project galaxy-dist # URL http://bitbucket.org/galaxy/galaxy-dist/overview # User rc # Date 1280930211 14400 # Node ID 77575a5f348d7d10c1df423c5faa71abaefd5f8a # Parent 6e19bc97f2b8ba816ab20fc53a88f3504c992e00 lims: - bug fix: now a admin cannot delete a transfer dataset when the transfer has started. - added user warning when a dataset is deleted. --- a/lib/galaxy/web/controllers/requests_admin.py +++ b/lib/galaxy/web/controllers/requests_admin.py @@ -593,16 +593,25 @@ class RequestsAdmin( BaseController ): elif operation == "delete": id_list = util.listify( kwd['id'] ) + not_deleted = [] for id in id_list: sample_dataset = trans.sa_session.query( trans.app.model.SampleDataset ).get( trans.security.decode_id(id) ) sample_id = sample_dataset.sample_id - trans.sa_session.delete( sample_dataset ) - trans.sa_session.flush() + if sample_dataset.status == sample_dataset.sample.transfer_status.NOT_STARTED: + trans.sa_session.delete( sample_dataset ) + trans.sa_session.flush() + else: + not_deleted.append(sample_dataset.name) + message = '%i dataset(s) have been successfully deleted. ' % (len(id_list) - len(not_deleted)) + status = 'done' + if not_deleted: + status = 'warning' + message = message + '%s could not be deleted. Only datasets with transfer status "Not Started" can be deleted. ' % str(not_deleted) return trans.response.send_redirect( web.url_for( controller='requests_admin', action='manage_datasets', sample_id=sample_id, - status='done', - message="%i dataset(s) have been removed." % len(id_list)) ) + status=status, + message=message) ) elif operation == "rename": id_list = util.listify( kwd['id'] )
participants (1)
-
commits-noreply@bitbucket.org