{% load hc_extras %}
{% if events %}
    <table class="table" id="log">
    {% for event in events %}
    {% if event.n %}
    <tr class="ok" data-dt="{{ event.created.isoformat }}" data-url="{% url 'hc-ping-details' check.code event.n  %}">
        <td class="n-cell">
            <span class="hash">#</span>{{ event.n }}
        </td>
        <td class="date"></td>
        <td class="time"></td>
        <td class="event">
            {% if event.exitstatus > 0 %}
            <span class="label label-danger">Status {{ event.exitstatus }}</span>
            {% elif event.kind == "fail" %}
            <span class="label label-danger">Failure</span>
            {% elif event.kind == "start" %}
            <span class="label label-start">Started</span>
            {% elif event.kind == "ign" %}
            <span class="label label-ign">Ignored</span>
            {% else %}
            <span class="label label-success">OK</span>
            {% endif %}
        </td>
        <td class="details">
            {% if event.delta %}
            <div class="delta">
                <span class="ic-timer"></span>
                {{ event.delta|hms }}
            </div>
            {% endif %}

            {% if event.scheme == "email" %}
                {{ event.ua }}
            {% else %}
                {{ event.scheme|upper }}
                {{ event.method }}
                {% if event.remote_addr %}
                from {{ event.remote_addr }}
                {% endif %}
                <span class="ua-body">
                    {% if event.ua %}
                    - {{ event.ua|truncatechars:80 }}
                    {% endif %}
                </span>
            {% endif %}
        </td>
    </tr>
    {% endif %}
    {% if event.check_status %}
    <tr class="missing" data-dt="{{ event.created.isoformat }}">
        <td class="n-cell">
            <span class="ic-missing"></span>
        </td>
        <td class="date"></td>
        <td class="time"></td>
        <td class="alert-info" colspan="2">
            {% include "front/event_summary.html" %}
        </td>
    </tr>
    {% endif %}
    {% endfor %}
    </table>

    <p class="text-center">
        <a href="{% url 'hc-log' check.code %}">Show More&hellip;</a>
    </p>
{% else %}
    <div class="alert no-events">
        You will see a <span class="hidden-xs">live-updating</span> log of received pings here. <br />
        This check has not received any pings yet.
    </div>
{% endif %}
