all repos — rastro @ 6738696441c3bf8d4382193143952f0e7cdac6c5

BitTorrent tracker!

app/templates/index.html (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
{% extends "base.html" %}
{% block title %}{{ app_name }} — {{ t('nav_trackers') }}{% endblock %}
{% block content %}
{% if bootstrap_note %}
<p class="notice" role="status">{{ bootstrap_note }}</p>
{% endif %}

<div class="stats-strip" aria-label="{{ t('stats_label') }}">
  <span><strong>{{ stats.total }}</strong> {{ t('stats_monitored') }}</span>
  <span><strong>{{ stats.up }}</strong> {{ t('stats_up') }}</span>
  <span><strong>{{ stats.degraded }}</strong> {{ t('stats_degraded') }}</span>
  <span><strong>{{ stats.down }}</strong> {{ t('stats_down') }}</span>
  <span><strong>{{ stats.unknown }}</strong> {{ t('stats_unknown') }}</span>
  <span>{{ t('stats_last_import') }}: {{ stats.last_import_at|dt }}</span>
  <span>{{ t('stats_last_probe') }}: {{ stats.last_probe_at|dt }}</span>
</div>

<form class="filters" method="get" action="/">
  <label>{{ t('filter_search') }} <input type="search" name="q" value="{{ q }}" placeholder="{{ t('filter_search_ph') }}"></label>
  <label>{{ t('filter_protocol') }}
    <select name="scheme">
      <option value="">{{ t('filter_any') }}</option>
      <option value="udp" {% if scheme=='udp' %}selected{% endif %}>UDP</option>
      <option value="http" {% if scheme=='http' %}selected{% endif %}>HTTP</option>
      <option value="https" {% if scheme=='https' %}selected{% endif %}>HTTPS</option>
    </select>
  </label>
  <label>{{ t('filter_status') }}
    <select name="status">
      <option value="">{{ t('filter_any') }}</option>
      {% for s in ['up','down','degraded','unknown','unsupported'] %}
      <option value="{{ s }}" {% if status==s %}selected{% endif %}>{{ s }}</option>
      {% endfor %}
    </select>
  </label>
  <label>{{ t('filter_source') }}
    <select name="source">
      <option value="">{{ t('filter_any') }}</option>
      <option value="trackerslist" {% if source=='trackerslist' %}selected{% endif %}>trackerslist</option>
      <option value="newtrackon" {% if source=='newtrackon' %}selected{% endif %}>newTrackon</option>
      <option value="jokepool710" {% if source=='jokepool710' %}selected{% endif %}>jokepool710</option>
      <option value="xiu2" {% if source=='xiu2' %}selected{% endif %}>xiu2</option>
    </select>
  </label>
  <label>{{ t('filter_sort') }}
    <select name="sort">
      <option value="checked" {% if sort=='checked' %}selected{% endif %}>{{ t('sort_checked') }}</option>
      <option value="latency" {% if sort=='latency' %}selected{% endif %}>{{ t('sort_latency') }}</option>
      <option value="url" {% if sort=='url' %}selected{% endif %}>{{ t('sort_url') }}</option>
      <option value="status" {% if sort=='status' %}selected{% endif %}>{{ t('sort_status') }}</option>
      <option value="protocol" {% if sort=='protocol' %}selected{% endif %}>{{ t('sort_protocol') }}</option>
    </select>
  </label>
  <label>{{ t('filter_order') }}
    <select name="order">
      <option value="desc" {% if order=='desc' %}selected{% endif %}>{{ t('order_desc') }}</option>
      <option value="asc" {% if order=='asc' %}selected{% endif %}>{{ t('order_asc') }}</option>
    </select>
  </label>
  <button type="submit">{{ t('filter_submit') }}</button>
</form>

<div class="table-wrap">
  <table>
    <thead>
      <tr>
        <th>{{ t('col_tracker') }}</th>
        <th>{{ t('col_protocol') }}</th>
        <th>{{ t('col_status') }}</th>
        <th>{{ t('col_uptime7') }}</th>
        <th>{{ t('col_latency') }}</th>
        <th>{{ t('col_ip') }}</th>
        <th>{{ t('col_asn') }}</th>
        <th>{{ t('col_aliases') }}</th>
        <th>{{ t('col_last_check') }}</th>
      </tr>
    </thead>
    <tbody>
      {% for row in rows %}
      <tr>
        <td>
          <a href="/trackers/{{ row.tracker.id }}" class="mono">{{ row.tracker.canonical_url }}</a>
          <button type="button" class="linkish copy-btn" data-copy="{{ row.tracker.canonical_url }}">{{ t('copy') }}</button>
          {% if row.metrics.provisional %}<span class="badge">{{ t('provisional') }}</span>{% endif %}
        </td>
        <td>{{ row.tracker.scheme|upper }}</td>
        <td>
          <span class="status status-{{ row.tracker.current_status }}" title="{{ row.tracker.current_status }}">
            <span class="dot" aria-hidden="true"></span>{{ row.tracker.current_status }}
          </span>
        </td>
        <td>{{ row.metrics.uptime_7d|pct }}</td>
        <td>{{ row.metrics.latency_median_7d|ms }}</td>
        <td>
          {% if row.tracker.supports_ipv4 %}v4{% else %}—{% endif %}
          /
          {% if row.tracker.supports_ipv6 == 'true' %}v6{% elif row.tracker.supports_ipv6 == 'not_tested' %}v6?{% else %}—{% endif %}
        </td>
        <td>{% if row.tracker.asn %}AS{{ row.tracker.asn }}{% else %}—{% endif %}{% if row.tracker.network_name %} {{ row.tracker.network_name }}{% endif %}</td>
        <td>{{ row.alias_count }}</td>
        <td>{{ row.tracker.last_checked_at|dt }}</td>
      </tr>
      {% else %}
      <tr><td colspan="9">{{ t('empty_inventory') }}</td></tr>
      {% endfor %}
    </tbody>
  </table>
</div>

{% if pages > 1 %}
<nav class="pagination" aria-label="{{ t('pagination') }}">
  {% if page > 1 %}
  <a href="?q={{ q }}&amp;scheme={{ scheme }}&amp;status={{ status }}&amp;source={{ source }}&amp;sort={{ sort }}&amp;order={{ order }}&amp;page={{ page-1 }}">{{ t('prev') }}</a>
  {% endif %}
  <span>{{ t('page_of', page=page, pages=pages, total=total) }}</span>
  {% if page < pages %}
  <a href="?q={{ q }}&amp;scheme={{ scheme }}&amp;status={{ status }}&amp;source={{ source }}&amp;sort={{ sort }}&amp;order={{ order }}&amp;page={{ page+1 }}">{{ t('next') }}</a>
  {% endif %}
</nav>
{% endif %}
{% endblock %}