<!--

    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.

-->
{% extends "stats/base.html" %}
{% load humanize %}
{% load table %}

{% block title %}Namespace | {{property.name}}{% endblock %}

{% block breadcrumbs %}
<div class="breadcrumbs">
    <a href="{% url 'home' %}">Home</a>
    &rsaquo; all topics
</div>
{% endblock %}


{% block content %}

<div class="module filtered" id="changelist">
<div id="changelist-filter">
    <h2>Clusters</h2>
<ul>
   <li {% if not selectedCluster %}class="selected"{% endif %}><a href="?">All</a></li>

   {% for cluster in clusters %}
      <li {% if selectedCluster == cluster.name %}class="selected"{% endif %}
          ><a href="?cluster={{cluster}}">{{cluster}}</a></li>
   {% endfor %}

   <li>
</ul>
</div>
</div>

<table>
<thead>
    <tr>
        {% column_header topics 'cluster__name' 'Cluster' %}
        {% column_header topics 'namespace__name' 'Namespace' %}
        {% column_header topics 'name' 'Topic' %}
        {% column_header topics 'msgRateIn' 'Msg/s in' %}
        {% column_header topics 'msgRateOut' 'Msg/s out' %}
        {% column_header topics 'msgThroughputIn' 'Bytes/s in' %}
        {% column_header topics 'msgThroughputOut' 'Bytes/s out' %}
        {% column_header topics 'backlog' 'Backlog' %}
        {% column_header topics 'broker' 'Broker' %}
    </tr>
</thead>
<tbody>

{% for topic in topics.results %}
    <tr class="{% cycle 'row1' 'row2' %}">
        <th>{{topic.cluster}}</td>
        <th><a href="{% url 'namespace' topic.namespace.name %}">{{topic.namespace}}</a></th>
        <th><a href="{{topic.get_absolute_url}}">{{topic.short_name}}</a></th>
        <td>{{topic.msgRateIn | intcomma}}</td>
        <td>{{topic.msgRateOut | intcomma}}</td>
        <td>{{topic.msgThroughputIn | intcomma}}</td>
        <td>{{topic.msgThroughputOut | intcomma}}</td>
        <td>{{topic.backlog | intcomma}}</td>
        <td title="{{topic.broker | escape}}"><a href="{% url 'broker' topic.broker %}">
            {{topic.broker | escape | truncatechars:20 }}</a></td>
    </tr>
{% empty %}
    <tr><td>No topics</td></tr>
{% endfor %}
</tbody>
</table>

{% table_footer topics %}


{% endblock %}
