Show warning when un-attached policies exist
This commit is contained in:
parent
20ad062814
commit
722e2e4050
|
@ -81,7 +81,7 @@
|
||||||
title="{% trans 'No Factors configured. No Users will be able to login.' %}"></span>
|
title="{% trans 'No Factors configured. No Users will be able to login.' %}"></span>
|
||||||
{{ factor_count }}
|
{{ factor_count }}
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="pficon pficon-ok"></span>{{ worker_count }}
|
<span class="pficon pficon-ok"></span>{{ factor_count }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
@ -99,9 +99,13 @@
|
||||||
<div class="card-pf-body">
|
<div class="card-pf-body">
|
||||||
<p class="card-pf-aggregate-status-notifications">
|
<p class="card-pf-aggregate-status-notifications">
|
||||||
<span class="card-pf-aggregate-status-notification">
|
<span class="card-pf-aggregate-status-notification">
|
||||||
<a href="{% url 'passbook_admin:policies' %}">
|
{% if policies_without_attachment > 0 %}
|
||||||
<span class="pficon pficon-ok"></span>{{ policy_count }}
|
<span class="pficon-warning-triangle-o" data-toggle="tooltip" data-placement="right"
|
||||||
</a>
|
title="{% trans 'Policies without attachment exist.' %}"></span>
|
||||||
|
{{ policy_count }}
|
||||||
|
{% else %}
|
||||||
|
<span class="pficon pficon-ok"></span>{{ policy_count }}
|
||||||
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
<table class="table table-striped table-bordered">
|
<table class="table table-striped table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th></th>
|
||||||
<th>{% trans 'Name' %}</th>
|
<th>{% trans 'Name' %}</th>
|
||||||
<th>{% trans 'Type' %}</th>
|
<th>{% trans 'Type' %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
|
@ -35,7 +36,14 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for policy in object_list %}
|
{% for policy in object_list %}
|
||||||
<tr>
|
<tr {% if not policy.policymodel_set.exists %} class="warning" {% endif %}>
|
||||||
|
<th>
|
||||||
|
{% if not policy.policymodel_set.exists %}
|
||||||
|
<span class="pficon-warning-triangle-o" data-toggle="tooltip" data-placement="right" title="{% trans 'Warning: Policy is not assigned.' %}"></span>
|
||||||
|
{% else %}
|
||||||
|
<span class="pficon-ok" data-toggle="tooltip" data-placement="right" title="{% blocktrans with objects=policy.policymodel_set.all|join:', ' %}Assigned to objects {{ objects }}{% endblocktrans %}"></span>
|
||||||
|
{% endif %}
|
||||||
|
</th>
|
||||||
<td>{{ policy.name }}</td>
|
<td>{{ policy.name }}</td>
|
||||||
<td>{{ policy|verbose_name }}</td>
|
<td>{{ policy|verbose_name }}</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
@ -24,4 +24,5 @@ class AdministrationOverviewView(AdminRequiredMixin, TemplateView):
|
||||||
kwargs['version'] = __version__
|
kwargs['version'] = __version__
|
||||||
kwargs['worker_count'] = len(CELERY_APP.control.ping(timeout=0.5))
|
kwargs['worker_count'] = len(CELERY_APP.control.ping(timeout=0.5))
|
||||||
kwargs['providers_without_application'] = Provider.objects.filter(application=None)
|
kwargs['providers_without_application'] = Provider.objects.filter(application=None)
|
||||||
|
kwargs['policies_without_attachment'] = len(Policy.objects.filter(policymodel__isnull=True))
|
||||||
return super().get_context_data(**kwargs)
|
return super().get_context_data(**kwargs)
|
||||||
|
|
Reference in New Issue