{% extends "base_objectbrowser.html" %}
{% block title %}Configuration Health{% endblock %}
{% block smallheader %}config {% endblock %}
{% block largeheader %}Health{% endblock %}
{% block content %}

<h4>Sanity checks</h4>
{% if booleans %}
<table class="table table-condensed">
	<tr>
		<th>Check</th>
		<th>Status</th>
	</tr>
{% for k,v in booleans.items %}
	<tr>
		<td>{{ k }}</td>
		<td class="{% if v %}ok{% else %}warning{% endif %}">{{ v }}</td>
	</tr>
{% endfor %}
{% endif %}
</table>

{% if object_health %}
<div>
    <hr>
	<h4>Object Health</h4>
	<table class="table table-condensed">
	<tr>
		<th>Description</th>
		<th>Count</th>
	</tr>
	{% for k,v in object_health.items %}
		<tr>
			<td><a href="?show={{ k }}">{{ k }}</a></td>
			<td>{{ v|length }}</td>
		</tr>
	{% endfor %}
    </table>
</div>
{% endif %}

{% if parser_errors %}
<!-- Display a list of config errors -->
<div>
    <hr>
       <h4>Parser Errors</h4>
<table class="table table-condensed">
	<tr>
        <th>Error</th>
        <th>Item</th>
		<th>Filename</th>
		<th colspan=3>Actions</th>

	</tr>
{% for i in parser_errors %}
	<tr>
        <td>{{ i.message }}</td>
        <td>
            {% if i.model %}
                <a title="{{ i.model }}" href="{% url adagios.objectbrowser.views.edit_object i.model.id %}">{{ i.item.meta.object_type }} {{ i.model.description }}</a>
            {% else %}
                n/a
            {% endif %}
        </td>
		<td><a href="/objectbrowser/search?filename={{ i.filename }}">{{ i.filename }}</a></td>
		<td><a href="{{ objectbrowser }}/delete_object?id={{ i.item }}">Delete Object</a> </td>
        <td> <a href="#">Create Reference</a></td>
        <td> <a href="#">Manually Edit</a> </td>
	</tr>
{% endfor %}
</table>
</div>
{% endif %}

{% endblock %}
