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

@ -1,4 +1,4 @@
## -*- coding: utf-8 -*-
## -*- coding: utf-8; -*-
<%inherit file="/base.mako" />
<%def name="title()">New ${model_title}</%def>
@ -6,6 +6,17 @@
<%def name="extra_javascript()">
${parent.extra_javascript()}
${self.disable_button_js()}
% if dform is not Undefined:
% for field in dform:
<% resources = field.get_widget_resources() %>
% for path in resources['js']:
${h.javascript_link(request.static_url(path))}
% endfor
% for path in resources['css']:
${h.stylesheet_link(request.static_url(path))}
% endfor
% endfor
% endif
</%def>
<%def name="disable_button_js()">

View file

@ -1,10 +1,10 @@
## -*- coding: utf-8 -*-
## -*- coding: utf-8; -*-
<%inherit file="/base.mako" />
<%def name="title()">Edit ${model_title}: ${instance_title}</%def>
<%def name="head_tags()">
${parent.head_tags()}
<%def name="extra_javascript()">
${parent.extra_javascript()}
<script type="text/javascript">
$(function() {
@ -18,6 +18,17 @@
});
</script>
% if dform is not Undefined:
% for field in dform:
<% resources = field.get_widget_resources() %>
% for path in resources['js']:
${h.javascript_link(request.static_url(path))}
% endfor
% for path in resources['css']:
${h.stylesheet_link(request.static_url(path))}
% endfor
% endfor
% endif
</%def>
<%def name="context_menu_items()">

View file

@ -0,0 +1,19 @@
## -*- coding: utf-8; -*-
<%inherit file="/master/view.mako" />
${parent.body()}
% if not instance.executed and request.has_perm('{}.execute'.format(permission_prefix)):
<div class="buttons">
% if instance.enabled and not instance.executing:
${h.form(url('{}.execute'.format(route_prefix), uuid=instance.uuid))}
${h.csrf_token(request)}
${h.submit('execute', "Execute this upgrade", class_='autodisable')}
${h.end_form()}
% elif instance.enabled:
<button type="button" disabled="disabled" title="This upgrade is currently executing">Execute this upgrade</button>
% else:
<button type="button" disabled="disabled" title="This upgrade is not enabled">Execute this upgrade</button>
% endif
</div>
% endif