Various batch tweaks, for better execution options etc.

This commit is contained in:
Lance Edgar 2017-11-29 18:26:55 -06:00
parent df3623b663
commit 6decabb369
3 changed files with 10 additions and 9 deletions

View file

@ -16,8 +16,7 @@ $(function() {
if (has_execution_options) {
$('#execution-options-dialog').dialog({
title: "Execution Options",
width: 500,
height: 300,
width: 600,
modal: true,
buttons: [
{

View file

@ -31,7 +31,6 @@ import datetime
import logging
from cStringIO import StringIO
import six
import sqlalchemy as sa
from sqlalchemy import orm
@ -187,6 +186,7 @@ class BatchMasterView(MasterView):
fs.id,
fs.created,
fs.created_by,
fs.rowcount,
fs.executed,
fs.executed_by,
])
@ -196,6 +196,7 @@ class BatchMasterView(MasterView):
fs.id,
fs.created,
fs.created_by,
fs.rowcount,
])
def _postconfigure_fieldset(self, fs):
@ -489,9 +490,8 @@ class BatchMasterView(MasterView):
defaults = {}
for field in self.execution_options_schema.fields:
key = 'batch.{}.execute_option.{}'.format(batch.batch_key, field)
value = self.request.session.get(key)
if value:
defaults[field] = value
if key in self.request.session:
defaults[field] = self.request.session[key]
return Form(self.request, schema=self.execution_options_schema,
defaults=defaults or None)
@ -753,9 +753,10 @@ class BatchMasterView(MasterView):
form = self.make_execution_options_form(batch)
assert form.validate() # TODO
kwargs.update(form.data)
# cache options to use as defaults next time
for key, value in form.data.iteritems():
# TODO: properly serialize option values?
self.request.session['batch.{}.execute_option.{}'.format(batch.batch_key, key)] = unicode(value)
self.request.session['batch.{}.execute_option.{}'.format(batch.batch_key, key)] = value
key = '{}.execute'.format(self.model_class.__tablename__)
progress = SessionProgress(self.request, key)
@ -840,7 +841,7 @@ class BatchMasterView(MasterView):
# cache options to use as defaults next time
for key, value in form.data.iteritems():
self.request.session['batch.{}.execute_option.{}'.format(self.model_class.batch_key, key)] = six.text_type(value)
self.request.session['batch.{}.execute_option.{}'.format(self.model_class.batch_key, key)] = value
key = '{}.execute_results'.format(self.model_class.__tablename__)
batches = self.get_effective_data()

View file

@ -42,6 +42,7 @@ class PricingBatchView(BatchMasterView):
model_title_plural = "Pricing Batches"
route_prefix = 'batch.pricing'
url_prefix = '/batches/pricing'
template_prefix = '/batch/pricing'
creatable = False
bulk_deletable = True
rows_editable = True