Tweak behavior when executing handheld batch results
redirect to final batch when done, try to warn user a bit
This commit is contained in:
parent
0d448fe6c5
commit
17017adde8
|
@ -53,6 +53,12 @@ ${parent.body()}
|
||||||
<div id="execution-options-dialog" style="display: none;">
|
<div id="execution-options-dialog" style="display: none;">
|
||||||
${h.form(url('{}.execute_results'.format(route_prefix)), name='execute-results')}
|
${h.form(url('{}.execute_results'.format(route_prefix)), name='execute-results')}
|
||||||
${h.csrf_token(request)}
|
${h.csrf_token(request)}
|
||||||
|
<br />
|
||||||
|
<p>
|
||||||
|
Please be advised, you are about to execute multiple batches! They will
|
||||||
|
be aggregated and treated as a single data source, during execution.
|
||||||
|
</p>
|
||||||
|
<br />
|
||||||
% if master.has_execution_options:
|
% if master.has_execution_options:
|
||||||
${rendered_execution_options|n}
|
${rendered_execution_options|n}
|
||||||
% endif
|
% endif
|
||||||
|
|
|
@ -880,7 +880,7 @@ class BatchMasterView(MasterView):
|
||||||
# If anything goes wrong, rollback and log the error etc.
|
# If anything goes wrong, rollback and log the error etc.
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
session.rollback()
|
session.rollback()
|
||||||
log.exception("execution failed for batch: {}".format(batch))
|
log.exception("execution failed for batch results")
|
||||||
session.close()
|
session.close()
|
||||||
if progress:
|
if progress:
|
||||||
progress.session.load()
|
progress.session.load()
|
||||||
|
@ -899,16 +899,21 @@ class BatchMasterView(MasterView):
|
||||||
# TODO: this doesn't always work...?
|
# TODO: this doesn't always work...?
|
||||||
self.request.session.flash("{} {} were executed".format(
|
self.request.session.flash("{} {} were executed".format(
|
||||||
len(batches), self.get_model_title_plural()))
|
len(batches), self.get_model_title_plural()))
|
||||||
|
success_url = self.get_execute_results_success_url(result, **kwargs)
|
||||||
else:
|
else:
|
||||||
session.rollback()
|
session.rollback()
|
||||||
|
success_url = self.get_index_url()
|
||||||
session.close()
|
session.close()
|
||||||
|
|
||||||
if progress:
|
if progress:
|
||||||
progress.session.load()
|
progress.session.load()
|
||||||
progress.session['complete'] = True
|
progress.session['complete'] = True
|
||||||
progress.session['success_url'] = self.get_index_url()
|
progress.session['success_url'] = success_url
|
||||||
progress.session.save()
|
progress.session.save()
|
||||||
|
|
||||||
|
def get_execute_results_success_url(self, result, **kwargs):
|
||||||
|
return self.get_index_url()
|
||||||
|
|
||||||
def csv(self):
|
def csv(self):
|
||||||
"""
|
"""
|
||||||
Download batch data as CSV.
|
Download batch data as CSV.
|
||||||
|
|
|
@ -199,6 +199,10 @@ class HandheldBatchView(FileBatchMasterView):
|
||||||
return self.request.route_url('labels.batch.view', uuid=result.uuid)
|
return self.request.route_url('labels.batch.view', uuid=result.uuid)
|
||||||
return super(HandheldBatchView, self).get_execute_success_url(batch)
|
return super(HandheldBatchView, self).get_execute_success_url(batch)
|
||||||
|
|
||||||
|
def get_execute_results_success_url(self, result, **kwargs):
|
||||||
|
batch = result
|
||||||
|
return self.get_execute_success_url(batch, result, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def includeme(config):
|
def includeme(config):
|
||||||
HandheldBatchView.defaults(config)
|
HandheldBatchView.defaults(config)
|
||||||
|
|
Loading…
Reference in a new issue