{% extends "master.html" %}

{% block title %} - Failed{% endblock %}

{% block body %}
<div class="container main">
    <div class="failed-jobs section">
        <h1>Failed Jobs</h1>

        <div class="filters">
            <ul>
                <li><a href="#" data-filter="all">all</a></li>
                {% for job_type in g.job_types %}
                <li><a href="#" data-filter="{{ job_type }}">{{ job_type }}</a></li>
                {% endfor %}
            </ul>
        </div>

        <div class="actions">
            <a href="/failed/delete" class="delete-all btn btn-small btn-danger">delete all</a>
        </div>

        <table class="table table-striped table-bordered table-condensed">
            <thead>
                <tr>
                    <th>Job Type</th>
                    <th>Job ID</th>
                    <th>Date</th>
                    <th>Message</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                {% for error in errors %}
                <tr>
                    <td class="job-type-col">{{ error['job_key'] }}</td>
                    <td class="job-id-col">{{ error['job_id'] }}</td>
                    <td class="job-date-col">{{ error['date'] }}</td>
                    <td>{{ error['error'] }}</td>
                    <td class="job-actions-col"><a href="/failed/delete/{{ error['job_id'] }}" class="delete btn btn-small btn-danger">delete</a></td>
                </tr>
                {% else %}
                <tr>
                    <td colspan="5" class="no-fails">No errors happened so far. Yay!!!</td>
                </tr>
                {% endfor %}
            </tbody>
        </table>

        <span class="explain">click retry or delete to change a failed job</span>
    </div>

</div>
{% endblock %}
