Warn user if DB not up to date, in new table wizard
also start adding 'dirty' page behavior, to warn user if navigating away that changes will be lost also improve steps in wizard, so page header is scrolled into view when prev/next buttons are clicked. unfortunately it still does not work right if user clicks the step number on left of screen..
This commit is contained in:
parent
f5f973dc3a
commit
29817653ed
4 changed files with 115 additions and 22 deletions
|
@ -194,6 +194,8 @@ class TableView(MasterView):
|
|||
app = self.get_rattail_app()
|
||||
model = self.model
|
||||
|
||||
kwargs['alembic_current_head'] = self.db_handler.check_alembic_current_head()
|
||||
|
||||
kwargs['branch_name_options'] = self.db_handler.get_alembic_branch_names()
|
||||
|
||||
branch_name = app.get_table_prefix()
|
||||
|
@ -331,6 +333,11 @@ class TableView(MasterView):
|
|||
|
||||
return HTML.tag('span', title=text, c="{} ...".format(text[:max_length]))
|
||||
|
||||
def migrations(self):
|
||||
# TODO: allow alembic upgrade on POST
|
||||
# TODO: pass current revisions to page context
|
||||
return self.render_to_response('migrations', {})
|
||||
|
||||
@classmethod
|
||||
def defaults(cls, config):
|
||||
rattail_config = config.registry.settings.get('rattail_config')
|
||||
|
@ -348,6 +355,17 @@ class TableView(MasterView):
|
|||
url_prefix = cls.get_url_prefix()
|
||||
permission_prefix = cls.get_permission_prefix()
|
||||
|
||||
# migrations
|
||||
config.add_tailbone_permission(permission_prefix,
|
||||
'{}.migrations'.format(permission_prefix),
|
||||
"View / apply Alembic migrations")
|
||||
config.add_route('{}.migrations'.format(route_prefix),
|
||||
'{}/migrations'.format(url_prefix))
|
||||
config.add_view(cls, attr='migrations',
|
||||
route_name='{}.migrations'.format(route_prefix),
|
||||
renderer='json',
|
||||
permission='{}.migrations'.format(permission_prefix))
|
||||
|
||||
if cls.creatable:
|
||||
|
||||
# write model class to file
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue