Skip to content

Commit

Permalink
✨ [#595] Add configuration status check to the admin
Browse files Browse the repository at this point in the history
  • Loading branch information
SilviaAmAm committed Feb 14, 2025
1 parent 1900553 commit 62e6565
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% load i18n %}

<div>
<h2>
{% translate 'Configuration status' %}
&nbsp;
{% 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.
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
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,70 @@ div.breadcrumbs a:focus, div.breadcrumbs a:hover {
color: var(--primary) !important;
}

.admin-sidebar {
float: right;
width: 260px;
position: relative;
margin-right: -300px;
}

.colSM .admin-sidebar {
float: left;
margin-right: 0;
margin-left: -300px;
}

.admin-sidebar .admin-sidebar-item {
background: var(--darkened-bg);
padding-bottom: 16px;
margin-bottom: 16px;
margin-top: 0;
}

.admin-sidebar .admin-sidebar-item .config-error-list {
padding: 0 16px;
margin: 16px;
}

.admin-sidebar h2 {
background: none;
padding: 16px;
margin: 0 0 16px 0;
border-bottom: 1px solid var(--hairline-color);
font-size: 1.125rem;
color: var(--body-fg);
font-weight: 400;
}

.admin-sidebar h3 {
color: var(--body-quiet-color);
padding: 0 16px;
margin: 0 0 16px;
}

.admin-sidebar h4 {
font-size: 0.8125rem;
}

.admin-sidebar p {
padding-left: 16px;
padding-right: 16px;
}

.admin-sidebar .actionlist {
padding: 0;
margin: 16px;
}

.admin-sidebar .actionlist li {
line-height: 1.2;
margin-bottom: 10px;
padding-left: 18px;
}




/* Calendar & time widget */
.calendar caption,
.calendarbox h2 {
Expand Down
42 changes: 42 additions & 0 deletions backend/src/openarchiefbeheer/templates/admin/index.html
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 %}

0 comments on commit 62e6565

Please sign in to comment.