From 5db7d3776ae2675b1a30a98da61d8d4355839d00 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 18 Jul 2018 21:06:07 -0500 Subject: [PATCH] Expose status etc. when editing upgrade, rename Email Settings i.e. latter is renamed from Email Profiles, but within UI only for now --- .../profiles => settings/email}/view.mako | 0 tailbone/templates/upgrades/view.mako | 2 +- tailbone/views/email.py | 4 ++-- tailbone/views/upgrades.py | 18 +++++++++++++----- 4 files changed, 16 insertions(+), 8 deletions(-) rename tailbone/templates/{email/profiles => settings/email}/view.mako (100%) diff --git a/tailbone/templates/email/profiles/view.mako b/tailbone/templates/settings/email/view.mako similarity index 100% rename from tailbone/templates/email/profiles/view.mako rename to tailbone/templates/settings/email/view.mako diff --git a/tailbone/templates/upgrades/view.mako b/tailbone/templates/upgrades/view.mako index 1c9b3ec5..dfc1646a 100644 --- a/tailbone/templates/upgrades/view.mako +++ b/tailbone/templates/upgrades/view.mako @@ -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)):
% if instance.enabled and not instance.executing: ${h.form(url('{}.execute'.format(route_prefix), uuid=instance.uuid), class_='autodisable')} diff --git a/tailbone/views/email.py b/tailbone/views/email.py index b6f7b946..f9a3516d 100644 --- a/tailbone/views/email.py +++ b/tailbone/views/email.py @@ -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 diff --git a/tailbone/views/upgrades.py b/tailbone/views/upgrades.py index 2bb58006..04df5e79 100644 --- a/tailbone/views/upgrades.py +++ b/tailbone/views/upgrades.py @@ -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')