-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ [#595] Add configuration status check to the admin
- Loading branch information
1 parent
1900553
commit 62e6565
Showing
5 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
backend/src/openarchiefbeheer/config/templates/configuration_health_check.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{% load i18n %} | ||
|
||
<div> | ||
<h2> | ||
{% translate 'Configuration status' %} | ||
| ||
{% if success %} | ||
<img src="/static/admin/img/icon-yes.svg" alt="{% translate 'Configuration complete' %}"> | ||
{% else %} | ||
<img src="/static/admin/img/icon-no.svg" alt="{% translate 'Configuration incomplete' %}"> | ||
{% endif %} | ||
</h2> | ||
{% if success %} | ||
<p>{% translate 'The configuration is complete.' %}</p> | ||
{% else %} | ||
<p>{% translate 'The following issues have been detected:' %}</p> | ||
<ul class="config-error-list"> | ||
{% for error in errors %} | ||
<li>{{ error.message }}</li> | ||
{% endfor %} | ||
</ul> | ||
{% endif %} | ||
</div> |
Empty file.
11 changes: 11 additions & 0 deletions
11
backend/src/openarchiefbeheer/config/templatetags/configuration_health_check.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from django import template | ||
|
||
from ..health_checks import is_configuration_complete | ||
|
||
register = template.Library() | ||
|
||
|
||
@register.inclusion_tag("configuration_health_check.html") | ||
def configuration_health_check(): | ||
result = is_configuration_complete() | ||
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{% extends "admin/index.html" %} | ||
{% load configuration_health_check static i18n %} | ||
|
||
{% block sidebar %} | ||
<div class="admin-sidebar"> | ||
<div class="admin-sidebar-item" id="configuration-health-check"> | ||
{% configuration_health_check %} | ||
</div> | ||
|
||
<!-- Overwriting the parent template --> | ||
<div class="admin-sidebar-item" id="recent-actions-module"> | ||
<h2>{% translate 'Recent actions' %}</h2> | ||
<h3>{% translate 'My actions' %}</h3> | ||
{% load log %} | ||
{% get_admin_log 10 as admin_log for_user user %} | ||
{% if not admin_log %} | ||
<p>{% translate 'None available' %}</p> | ||
{% else %} | ||
<ul class="actionlist"> | ||
{% for entry in admin_log %} | ||
<li class="{% if entry.is_addition %}addlink{% endif %}{% if entry.is_change %}changelink{% endif %}{% if entry.is_deletion %}deletelink{% endif %}"> | ||
<span class="visually-hidden">{% if entry.is_addition %}{% translate 'Added:' %}{% elif entry.is_change %}{% translate 'Changed:' %}{% elif entry.is_deletion %}{% translate 'Deleted:' %}{% endif %}</span> | ||
{% if entry.is_deletion or not entry.get_admin_url %} | ||
{{ entry.object_repr }} | ||
{% else %} | ||
<a href="{{ entry.get_admin_url }}">{{ entry.object_repr }}</a> | ||
{% endif %} | ||
<br> | ||
{% if entry.content_type %} | ||
<span class="mini quiet">{% filter capfirst %}{{ entry.content_type.name }}{% endfilter %}</span> | ||
{% else %} | ||
<span class="mini quiet">{% translate 'Unknown content' %}</span> | ||
{% endif %} | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
{% endif %} | ||
</div> | ||
</div> | ||
|
||
|
||
{% endblock %} |