{% extends "base.html" %}

{% block content %}

<nav aria-label="breadcrumb">
  <ol class="breadcrumb">
    <li class="breadcrumb-item"><a href="{% url 'grafana:org-list' %}">Organizations</a></li>
    <li class="breadcrumb-item active" aria-current="page"><a href="{% url 'grafana:org-detail' object.pk %}">{{object.name}}</a></li>
  </ol>
</nav>

<ul class="nav nav-tabs">
  <li class="nav-item">
    <a class="nav-link active" href="{% url 'grafana:org-detail' object.pk %}">Dashboards</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="{% url 'grafana:org-versions' object.pk %}">Versions</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="{% url 'grafana:org-annotations' object.pk %}">Annotations</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="{% url 'grafana:org-users' object.pk %}">Users</a>
  </li>
</ul>

<table class="table table-bordered">
  <tr>
    <th>Title</th>
    <th>View</th>
    <th>Tags</th>
    <th>Last Updated</th>
  </tr>
  {% for dash in dashboard_set.all %}
  <tr>
    <td><a href="{% url 'grafana:dash-detail' dash.pk %}">{{ dash.title }}</a></td>
    <td><a href="{{dash.get_public_link}}">View on Grafana</a></td>
    <td>
      <ul>
        {% for tag in dash.tag_set.all %}
        <li><a href="{% url 'grafana:org-detail' object.pk %}?tag={{tag.term}}">{{tag.term}}</a></li>
        {% endfor %}
      </ul>
    </td>
    <td>{{dash.updated}}</td>
  </tr>
  {% endfor %}
</table>

{% endblock %}
