admin: outposts show should-be version

This commit is contained in:
Jens Langhammer 2020-09-19 19:03:54 +02:00
parent a02fcb0a7a
commit b04f92c8b4
3 changed files with 11 additions and 7 deletions

View file

@ -71,8 +71,12 @@
<td role="cell">
<span>
{% with ver=outpost.deployment_version %}
{% if ver.outdated or ver.version == "" %}
<i class="fas fa-times pf-m-danger"></i> {{ ver.version|default:"-" }}
{% if ver.outdated %}
{% if ver.version == "" %}
<i class="fas fa-times pf-m-danger"></i> -
{% else %}
<i class="fas fa-times pf-m-danger"></i> {% blocktrans with is=ver.version should=ver.should %}{{ is }}, should be {{ should }}{% endblocktrans %}
{% endif %}
{% else %}
<i class="fas fa-check pf-m-success"></i> {{ ver.version }}
{% endif %}

View file

@ -63,7 +63,7 @@ class OutpostUpdateView(
template_name = "generic/update.html"
success_url = reverse_lazy("passbook_admin:outposts")
success_message = _("Successfully updated Certificate-Key Pair")
success_message = _("Successfully updated Outpost")
class OutpostDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView):
@ -74,4 +74,4 @@ class OutpostDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteMessa
template_name = "generic/delete.html"
success_url = reverse_lazy("passbook_admin:outposts")
success_message = _("Successfully deleted Certificate-Key Pair")
success_message = _("Successfully deleted Outpost")

View file

@ -118,12 +118,12 @@ class Outpost(models.Model):
key = self.state_cache_prefix("version")
value = cache.get(key, None)
if not value:
return {"version": "", "outdated": False}
return {"version": "", "outdated": False, "should": OUR_VERSION}
try:
outpost_version = parse(value)
return {"version": value, "outdated": outpost_version < OUR_VERSION}
return {"version": value, "outdated": outpost_version < OUR_VERSION, "should": OUR_VERSION}
except InvalidVersion:
return {"version": version, "outdated": False}
return {"version": version, "outdated": False, "should": OUR_VERSION}
@property
def user(self) -> User: