{% extends "base.html" %}

{% block content %}
    {% for minion, results in minions.items %}
    <h2>{{ minion }}</h2>
    <table class="table table-striped table-hover">
        <thead>
            <tr>
                <th>check</th>
                <th>status</th>
                <th>last checked</th>
            </tr>
        </thead>
        <tbody>
        {% for result in results %}
            <tr{% if result.failed %} class="error"{% endif %}>
                <td><tt>{{ result.check.name }}</tt></td>
                <td>
                    {% if result.result_type == 'percentage' %}
                        <div class="progress progress-success">
                            <div class="bar" style="width: {{ result.result }}">
                            </div>
                            &nbsp;<small>{{ result.result }}</small>
                        </div>
                    {% else %}
                        {% if result.result_type == 'boolean' %}
                            {% if result.result == 'True' %}
                                <span class="badge badge-success"><i class="icon-ok icon-white"></i></span>
                            {% else %}
                                <span class="badge badge-important"><i class="icon-fire icon-white"></i></span>
                            {% endif %}
                        {% else %}
                            {{ result.result }}
                        {% endif %}
                    {% endif %}</td>
                <td title="{{ result.timestamp }}">{{ result.timestamp|timesince }} ago</td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
    {% empty %}
    <div class="well">
        <p><span class="label label-important">No Data</span> Looks like you just started. Try running <tt>salmon run_checks</tt>.</p>
    </div>
    {% endfor %}
{% endblock content %}