Improve 'health status' warnings

- Don't show error message if only non-critical warnings present

(cherry picked from commit 5443beef65)
This commit is contained in:
Oliver 2021-09-20 17:15:31 +10:00
parent 44e0fd1a68
commit 3b763e95fd
2 changed files with 7 additions and 10 deletions

View File

@ -36,9 +36,14 @@ def health_status(request):
'email_configured': InvenTree.status.is_email_configured(), 'email_configured': InvenTree.status.is_email_configured(),
} }
# The following keys are required to denote system health
health_keys = [
'django_q_running',
]
all_healthy = True all_healthy = True
for k in status.keys(): for k in health_keys:
if status[k] is not True: if status[k] is not True:
all_healthy = False all_healthy = False

View File

@ -71,11 +71,7 @@
<a class='dropdown-toggle' data-toggle='dropdown' href="#"> <a class='dropdown-toggle' data-toggle='dropdown' href="#">
{% if user.is_staff %} {% if user.is_staff %}
{% if not system_healthy %} {% if not system_healthy %}
{% if not django_q_running %}
<span class='fas fa-exclamation-triangle icon-red'></span> <span class='fas fa-exclamation-triangle icon-red'></span>
{% else %}
<span class='fas fa-exclamation-triangle icon-orange'></span>
{% endif %}
{% elif not up_to_date %} {% elif not up_to_date %}
<span class='fas fa-info-circle icon-green'></span> <span class='fas fa-info-circle icon-green'></span>
{% endif %} {% endif %}
@ -96,11 +92,7 @@
{% if system_healthy or not user.is_staff %} {% if system_healthy or not user.is_staff %}
<span class='fas fa-server'></span> <span class='fas fa-server'></span>
{% else %} {% else %}
{% if not django_q_running %}
<span class='fas fa-server icon-red'></span> <span class='fas fa-server icon-red'></span>
{% else %}
<span class='fas fa-server icon-orange'></span>
{% endif %}
{% endif %} {% endif %}
</span> {% trans "System Information" %} </span> {% trans "System Information" %}
</a></li> </a></li>