{% extends "base.html" %}
{% load i18n %}
{% load translations %}
{% load check_links %}
{% load humanize %}

{% block breadcrumbs %}
<li><a href="{% url 'manage' %}">{% trans "Manage" %}</a></li>
<li><a href="{% url 'manage-performance' %}">{% trans "Performance report" %}</a></li>
{% endblock %}


{% block content %}
{% if errors %}
<div class="panel panel-danger">
<div class="panel-heading">
  <h4 class="panel-title">
    {% documentation_icon 'admin/install' 'production' right=True %}
    {% trans "Configuration errors" %}
  </h4>
</div>
  <table class="table table-striped">
  <thead>
  <tr>
    <th>{% trans "Last occurrence" %}</th>
    <th>{% trans "Name" %}</th>
    <th>{% trans "Message" %}</th>
    <th></th>
  </tr>
  </thead>
  <tbody>
  {% for error in errors %}
  <tr class="row{% cycle '1' '2' %}">
      <td>{{ error.timestamp }}</td>
      <td>{{ error.name }}</td>
      <td><pre>{{ error.message }}</pre></td>
      <td>
      <form method="POST">
      {% csrf_token %}
      <input type="hidden" name="pk" value="{{ error.pk }}"/>
      <input type="submit" name="dismiss" value="{% trans "Dismiss" %}" class="btn btn-primary" />
      <input type="submit" name="ignore" value="{% trans "Ignore permanently" %}" class="btn btn-primary" />
      </form>
      </td>
  </tr>
  {% endfor %}
  </tbody>
  </table>
<div class="panel-footer">
    <p class="help-block">
    {% trans "You can safely permanently ignore errors for file formats you do not intend to use. These are usually caused by missing or outdated dependencies." %}
    </p>
</div>
</div>
  {% endif %}

  {% if checks %}
<div class="panel panel-default">
<div class="panel-heading">
  <h4 class="panel-title">
    {% documentation_icon 'admin/install' 'production' right=True %}
    {% trans "System checks" %}
  </h4>
</div>
  <table class="table table-striped">
  <thead>
  <tr>
    <th>{% trans "Name" %}</th>
    <th>{% trans "Message" %}</th>
    <th>{% trans "Documentation" %}</th>
  </tr>
  </thead>
  <tbody>
  {% for check in checks %}
  <tr class="row{% cycle '1' '2' %}">
      <td>{{ check.id }}</td>
      <td>{{ check.msg }}</td>
      <td>{% check_link check %}</td>
  </tr>
  {% endfor %}
  </tbody>
  </table>
  </div>

  {% endif %}

  {% if not checks and not errors %}
  {% trans "Congratulations, your setup seems to work." as msg %}
  {% show_message "success" msg %}
  {% endif %}

<div class="panel panel-default">
<div class="panel-heading">
  <h4 class="panel-title">
    {% documentation_icon 'admin/install' 'celery' right=True %}
    {% trans "Celery queues" %}
  </h4>
</div>
  <table class="table table-striped">
  <tbody>
  {% for name, length in queues %}
  <tr class="row{% cycle '1' '2' %}">
      <td>{{ name }}</td>
      <td class="number">{{ length|intcomma }}</td>
  </tr>
  {% endfor %}
  </tbody>
  </table>
</div>

</div>
{% endblock %}
