{% extends "admin/base_site.html" %}

{% block title %}Queues {{ block.super }}{% endblock %}

{% block extrastyle %}
    {{ block.super }}
    <style>table {width: 100%;}</style>
{% endblock %}

{% block content_title %}<h1>RQ Queues</h1>{% endblock %}

{% block breadcrumbs %}
    <div class="breadcrumbs">
        <a href="{% url 'admin:index' %}">Home</a> &rsaquo;
        <a href="{% url 'rq_home' %}">Django RQ</a>
    </div>
{% endblock %}

{% block content %}

<div id="content-main">

    <div class="module">
        <table>
            <thead>
                <tr>
                    <th>Name</th>
                    <th>Queued Jobs</th>
                    <th>Oldest Queued Job</th>
                    <th>Active Jobs</th>
                    <th>Deferred Jobs</th>
                    <th>Finished Jobs</th>
                    <th>Failed Jobs</th>
                    <th>Scheduled Jobs</th>
                    <th>Workers</th>
                    <th>Host</th>
                    <th>Port</th>
                    <th>DB</th>
                </tr>
            </thead>
            <tbody>
                {% for queue in queues %}
                    <tr class = "{% cycle 'row1' 'row2' %}">
                        <th>
                            <a href = "{% url 'rq_jobs' queue.index %}">
                                {{ queue.name }}
                            </a>
                        </th>
                        <td>
                                <a href = "{% url 'rq_jobs' queue.index %}">
                                    {{ queue.jobs }}
                                </a>
                        </td>
                        <td>{{ queue.oldest_job_timestamp }}</td>
                        <th>
                            <a href = "{% url 'rq_started_jobs' queue.index %}">
                                {{ queue.started_jobs }}
                            </a>
                        </th>
                        <th>
                            <a href = "{% url 'rq_deferred_jobs' queue.index %}">
                                {{ queue.deferred_jobs }}
                            </a>
                        </th>
                        <th>
                              <a href = "{% url 'rq_finished_jobs' queue.index %}">
                                  {{ queue.finished_jobs }}
                              </a>
                        </th>
                        <th>
                              <a href = "{% url 'rq_failed_jobs' queue.index %}">
                                  {{ queue.failed_jobs }}
                              </a>
                        </th>
                        <th>
                            <a href = "{% url 'rq_scheduled_jobs' queue.index %}">
                                {{ queue.scheduled_jobs }}
                            </a>
                        </th>
                        <th><a href = "{% url 'rq_workers' queue.index %}">
                                {{ queue.workers }}
                            </a>
                        </th>
                        <td>{{ queue.connection_kwargs.host }}</td>
                        <td>{{ queue.connection_kwargs.port }}</td>
                        <td>{{ queue.connection_kwargs.db }}</td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
        <br />
        <a href="{% url 'rq_home_json' %}">View as JSON</a>
    </div>
</div>

{% endblock %}
