Various batch tweaks, for better execution options etc.
This commit is contained in:
		
							parent
							
								
									df3623b663
								
							
						
					
					
						commit
						6decabb369
					
				
					 3 changed files with 10 additions and 9 deletions
				
			
		|  | @ -16,8 +16,7 @@ $(function() { | ||||||
|         if (has_execution_options) { |         if (has_execution_options) { | ||||||
|             $('#execution-options-dialog').dialog({ |             $('#execution-options-dialog').dialog({ | ||||||
|                 title: "Execution Options", |                 title: "Execution Options", | ||||||
|                 width: 500, |                 width: 600, | ||||||
|                 height: 300, |  | ||||||
|                 modal: true, |                 modal: true, | ||||||
|                 buttons: [ |                 buttons: [ | ||||||
|                     { |                     { | ||||||
|  |  | ||||||
|  | @ -31,7 +31,6 @@ import datetime | ||||||
| import logging | import logging | ||||||
| from cStringIO import StringIO | from cStringIO import StringIO | ||||||
| 
 | 
 | ||||||
| import six |  | ||||||
| import sqlalchemy as sa | import sqlalchemy as sa | ||||||
| from sqlalchemy import orm | from sqlalchemy import orm | ||||||
| 
 | 
 | ||||||
|  | @ -187,6 +186,7 @@ class BatchMasterView(MasterView): | ||||||
|                         fs.id, |                         fs.id, | ||||||
|                         fs.created, |                         fs.created, | ||||||
|                         fs.created_by, |                         fs.created_by, | ||||||
|  |                         fs.rowcount, | ||||||
|                         fs.executed, |                         fs.executed, | ||||||
|                         fs.executed_by, |                         fs.executed_by, | ||||||
|                     ]) |                     ]) | ||||||
|  | @ -196,6 +196,7 @@ class BatchMasterView(MasterView): | ||||||
|                         fs.id, |                         fs.id, | ||||||
|                         fs.created, |                         fs.created, | ||||||
|                         fs.created_by, |                         fs.created_by, | ||||||
|  |                         fs.rowcount, | ||||||
|                     ]) |                     ]) | ||||||
| 
 | 
 | ||||||
|     def _postconfigure_fieldset(self, fs): |     def _postconfigure_fieldset(self, fs): | ||||||
|  | @ -489,9 +490,8 @@ class BatchMasterView(MasterView): | ||||||
|         defaults = {} |         defaults = {} | ||||||
|         for field in self.execution_options_schema.fields: |         for field in self.execution_options_schema.fields: | ||||||
|             key = 'batch.{}.execute_option.{}'.format(batch.batch_key, field) |             key = 'batch.{}.execute_option.{}'.format(batch.batch_key, field) | ||||||
|             value = self.request.session.get(key) |             if key in self.request.session: | ||||||
|             if value: |                 defaults[field] = self.request.session[key] | ||||||
|                 defaults[field] = value |  | ||||||
|         return Form(self.request, schema=self.execution_options_schema, |         return Form(self.request, schema=self.execution_options_schema, | ||||||
|                     defaults=defaults or None) |                     defaults=defaults or None) | ||||||
| 
 | 
 | ||||||
|  | @ -753,9 +753,10 @@ class BatchMasterView(MasterView): | ||||||
|                 form = self.make_execution_options_form(batch) |                 form = self.make_execution_options_form(batch) | ||||||
|                 assert form.validate() # TODO |                 assert form.validate() # TODO | ||||||
|                 kwargs.update(form.data) |                 kwargs.update(form.data) | ||||||
|  | 
 | ||||||
|  |                 # cache options to use as defaults next time | ||||||
|                 for key, value in form.data.iteritems(): |                 for key, value in form.data.iteritems(): | ||||||
|                     # TODO: properly serialize option values? |                     self.request.session['batch.{}.execute_option.{}'.format(batch.batch_key, key)] = value | ||||||
|                     self.request.session['batch.{}.execute_option.{}'.format(batch.batch_key, key)] = unicode(value) |  | ||||||
| 
 | 
 | ||||||
|             key = '{}.execute'.format(self.model_class.__tablename__) |             key = '{}.execute'.format(self.model_class.__tablename__) | ||||||
|             progress = SessionProgress(self.request, key) |             progress = SessionProgress(self.request, key) | ||||||
|  | @ -840,7 +841,7 @@ class BatchMasterView(MasterView): | ||||||
| 
 | 
 | ||||||
|                 # cache options to use as defaults next time |                 # cache options to use as defaults next time | ||||||
|                 for key, value in form.data.iteritems(): |                 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__) |             key = '{}.execute_results'.format(self.model_class.__tablename__) | ||||||
|             batches = self.get_effective_data() |             batches = self.get_effective_data() | ||||||
|  |  | ||||||
|  | @ -42,6 +42,7 @@ class PricingBatchView(BatchMasterView): | ||||||
|     model_title_plural = "Pricing Batches" |     model_title_plural = "Pricing Batches" | ||||||
|     route_prefix = 'batch.pricing' |     route_prefix = 'batch.pricing' | ||||||
|     url_prefix = '/batches/pricing' |     url_prefix = '/batches/pricing' | ||||||
|  |     template_prefix = '/batch/pricing' | ||||||
|     creatable = False |     creatable = False | ||||||
|     bulk_deletable = True |     bulk_deletable = True | ||||||
|     rows_editable = True |     rows_editable = True | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lance Edgar
						Lance Edgar