{% extends 'assets/base.html' %}
{% load cache i18n %}

{% block content %}
<h1>{{ report.name }}</h1>
  {% spaceless %}
  <div class="report">
    {% block collapse %}
    <div class="pagination">
      <ul>
        <li><a class="expand-all" href="#">{% trans 'Expand all' %}</a></li>
        <li><a class="collapse-all" href="#">{% trans 'Collapse all' %}</a></li>
      </ul>
    </div>
    {% endblock %}
    {% block modes %}
    {% if report.with_modes %}
      <div class="pagination">
        <ul>
          {% for report_mode in modes %}
            <li{% if mode == report_mode.name %} class="active"{% endif %}><a href="
              {% if report_mode.name == 'dc' %}
                {% url report_detail report_mode.name dc slug %}
              {% else %}
                {% url report_detail report_mode.name slug %}
              {% endif %}">{{ report_mode.verbose_name }}</a></li>
          {% endfor %}
        </ul>
      </div>
    {% endif %}
    {% endblock %}
    {% block datacenters %}
    {% if report.with_datacenters and mode == 'dc' %}
      <div class="pagination">
        <ul>
          {% for report_datacenter in datacenters %}
            <li{% if dc == report_datacenter.id %} class="active"{% endif %}><a href="{% url report_detail mode report_datacenter.id slug %}">{{ report_datacenter.verbose_name }}</a></li>
          {% endfor %}
        </ul>
      </div>
    {% endif %}
    {% endblock %}
    {% block report_content %}
    {% cache 3600 report cache_key %}
      <p>{% trans 'Last update:' %} {% now "SHORT_DATETIME_FORMAT" %}</p>
      <table class="table table-striped">
        <thead>
          <tr>
            <th>{% trans 'Info' %}</th>
            <th>{% trans 'Count' %}</th>
            {% if report.links %}
              <th>{% trans 'Link' %}</th>
            {% endif %}
          </tr>
        </thead>
        <tbody>
          {% for node in result %}
            {% with level=0 parent=0 %}
              {% include "assets/report_tree.html" %}
            {% endwith %}
          {% endfor %}
        </tbody>
      </table>
    {% endcache %}
    {% endblock %}
  </div>
  {% endspaceless %}
{% endblock %}
