From 6decabb369e3f34b599bcbe48145176f2b5cb947 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 29 Nov 2017 18:26:55 -0600 Subject: [PATCH] Various batch tweaks, for better execution options etc. --- tailbone/static/js/tailbone.batch.js | 3 +-- tailbone/views/batch/core.py | 15 ++++++++------- tailbone/views/batch/pricing.py | 1 + 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/tailbone/static/js/tailbone.batch.js b/tailbone/static/js/tailbone.batch.js index c3fd30bc..f421e9fe 100644 --- a/tailbone/static/js/tailbone.batch.js +++ b/tailbone/static/js/tailbone.batch.js @@ -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: [ { diff --git a/tailbone/views/batch/core.py b/tailbone/views/batch/core.py index c0eea65b..7c121398 100644 --- a/tailbone/views/batch/core.py +++ b/tailbone/views/batch/core.py @@ -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() diff --git a/tailbone/views/batch/pricing.py b/tailbone/views/batch/pricing.py index 70199440..d422da11 100644 --- a/tailbone/views/batch/pricing.py +++ b/tailbone/views/batch/pricing.py @@ -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