{% extends "dashboard_app/base.html" %}
{% load i18n %}
{% load pagination_tags %}


{% block title %}
{{ block.super }} | {% trans "Streams" %}
{% endblock %}


{% block breadcrumbs %}
<li><a href="{% url dashboard_app.views.bundle_stream_list %}">{% trans "Bundle Streams" %}</a></li>
{% endblock %}


{% block sidebar %}
<p>
  {% blocktrans %}
  Streams are containers for bundles and are quite similar to folders or
  directories on your computer.
  {% endblocktrans %}
</p>
<p>{% trans "Currently you have access to:" %}</p>
<ul>
  <li>{% trans "All public streams" %}</li>
  {% if has_personal_streams %}
  <li>{% trans "Your personal streams" %}</li>
  {% endif %}
  {% if has_team_streams %}
  <li>{% trans "Team streams that you are a member of" %}</li>
  {% endif %}
</ul>
{% if not user.is_authenticated %}
<p>{% trans "You must" %} <a href="{% url django.contrib.auth.views.login %}">{% trans "sign in" %}</a> {% trans "to get more access" %}</p>
{% endif %}
{% endblock %}


{% block content %}
{% autopaginate bundle_stream_list %}
{% if bundle_stream_list.count %}
<table class="data">
  <tr>
    <th>Pathname</th>
    <th>Name</th>
    <th>Number of test runs</th>
    <th>Number of bundles</th>
  </tr>
  {% for bundle_stream in bundle_stream_list %}
  <tr>
    <td>{{ bundle_stream.pathname }}</td>
    <td>{{ bundle_stream.name|default:"<i>not set</i>" }}</td>
    <td><a href="{% url dashboard_app.views.test_run_list bundle_stream.pathname %}">{{ bundle_stream.get_test_run_count }}</a></td>
    <td><a href="{% url dashboard_app.views.bundle_list bundle_stream.pathname %}">{{ bundle_stream.bundles.count}}</a></td>
  </tr>
  {% endfor %}
</table>
{% else %}
{% if user.is_staff %}
<p>There are no streams yet, you can create one in the <a
  href="{% url admin:dashboard_app_bundlestream_add %}">admin</a> panel.</p>
{% else %}
<p>There are no streams yet.</p>
{% endif %}
{% endif %}
{% paginate %}
{% endblock %}
