Add basic support for performing / tracking app upgrades

also add `MasterView.executable` and friends
This commit is contained in:
Lance Edgar 2017-08-05 22:07:49 -05:00
parent f476c696fd
commit f5688f1f90
11 changed files with 386 additions and 26 deletions

View file

@ -69,6 +69,7 @@ class BatchMasterView(MasterView):
refresh_after_create = False
edit_with_rows = False
cloneable = False
executable = True
supports_mobile = True
mobile_filterable = True
mobile_rows_viewable = True
@ -107,13 +108,13 @@ class BatchMasterView(MasterView):
kwargs['batch'] = batch
kwargs['handler'] = self.handler
kwargs['execute_title'] = self.get_execute_title(batch)
kwargs['execute_enabled'] = self.executable(batch)
kwargs['execute_enabled'] = self.instance_executable(batch)
if kwargs['execute_enabled'] and self.has_execution_options:
kwargs['rendered_execution_options'] = self.render_execution_options(batch)
return kwargs
def template_kwargs_index(self, **kwargs):
kwargs['execute_enabled'] = self.executable()
kwargs['execute_enabled'] = self.instance_executable(None)
if kwargs['execute_enabled'] and self.has_execution_options:
kwargs['rendered_execution_options'] = self.render_execution_options()
return kwargs
@ -339,7 +340,7 @@ class BatchMasterView(MasterView):
'form': form,
'batch': batch,
'execute_title': self.get_execute_title(batch),
'execute_enabled': self.executable(batch),
'execute_enabled': self.instance_executable(batch),
}
if self.edit_with_rows:
@ -449,7 +450,7 @@ class BatchMasterView(MasterView):
def after_edit_row(self, row):
self.handler.refresh_row(row)
def executable(self, batch=None):
def instance_executable(self, batch=None):
return self.handler.executable(batch)
def batch_refreshable(self, batch):
@ -1018,14 +1019,6 @@ class BatchMasterView(MasterView):
config.add_view(cls, attr='mobile_mark_pending', route_name='mobile.{}.mark_pending'.format(route_prefix),
permission='{}.edit'.format(permission_prefix))
# execute batch
config.add_route('{}.execute'.format(route_prefix), '{}/{{uuid}}/execute'.format(url_prefix))
config.add_view(cls, attr='execute', route_name='{}.execute'.format(route_prefix),
permission='{}.execute'.format(permission_prefix))
config.add_tailbone_permission(permission_prefix, '{}.execute'.format(permission_prefix),
"Execute {}".format(model_title))
# execute (multiple) batch results
config.add_route('{}.execute_results'.format(route_prefix), '{}/execute-results'.format(url_prefix))
config.add_view(cls, attr='execute_results', route_name='{}.execute_results'.format(route_prefix),