Expose status etc. when editing upgrade, rename Email Settings

i.e. latter is renamed from Email Profiles, but within UI only for now
This commit is contained in:
Lance Edgar 2018-07-18 21:06:07 -05:00
parent 34bdd2ac84
commit 5db7d3776a
4 changed files with 16 additions and 8 deletions

View file

@ -38,7 +38,7 @@
${parent.body()}
% if not instance.executed and request.has_perm('{}.execute'.format(permission_prefix)):
% if not instance.executed and instance.status_code == enum.UPGRADE_STATUS_PENDING 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), class_='autodisable')}

View file

@ -45,9 +45,9 @@ class ProfilesView(MasterView):
Master view for email admin (settings/preview).
"""
normalized_model_name = 'emailprofile'
model_title = "Email Profile"
model_title = "Email Setting"
model_key = 'key'
url_prefix = '/email/profiles'
url_prefix = '/settings/email'
filterable = False
pageable = False
creatable = False

View file

@ -95,6 +95,7 @@ class UpgradeView(MasterView):
'created',
'created_by',
'enabled',
'executing',
'executed',
'executed_by',
'status_code',
@ -153,7 +154,18 @@ class UpgradeView(MasterView):
def configure_form(self, f):
super(UpgradeView, self).configure_form(f)
f.set_enum('status_code', self.enum.UPGRADE_STATUS)
# status_code
if self.creating:
f.remove_field('status_code')
else:
f.set_enum('status_code', self.enum.UPGRADE_STATUS)
# f.set_readonly('status_code')
# executing
if not self.editing:
f.remove('executing')
f.set_type('created', 'datetime')
f.set_type('enabled', 'boolean')
f.set_type('executed', 'datetime')
@ -172,10 +184,6 @@ class UpgradeView(MasterView):
f.remove_field('created_by')
f.remove_field('stdout_file')
f.remove_field('stderr_file')
if self.creating:
f.remove_field('status_code')
else:
f.set_readonly('status_code')
if self.creating or not upgrade.executed:
f.remove_field('executed')
f.remove_field('executed_by')