From 87c21d189f042876b544b248ce39e99c16f52b74 Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 7 Sep 2020 18:27:57 -0700 Subject: add more sorting options for family and network pages --- tor-metrics/templates/misc-families.html | 64 ++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 tor-metrics/templates/misc-families.html (limited to 'tor-metrics/templates/misc-families.html') diff --git a/tor-metrics/templates/misc-families.html b/tor-metrics/templates/misc-families.html new file mode 100644 index 0000000..8df7d6d --- /dev/null +++ b/tor-metrics/templates/misc-families.html @@ -0,0 +1,64 @@ +{% extends "skeleton.html" %} +{% set sorted_by_label = sorted_by.split(',')[0].split('.')[1] %} +{% block title %}Tor Relays :: Families By {{ sorted_by_label|replace('_', ' ')|title }}{% endblock %} +{% block body %} +

Home :: Families By {{ sorted_by_label|replace('_', ' ')|title }}

+

The set of all relay families with > 1 effective members, sorted by {{ sorted_by_label|replace('_', ' ') }}. The first seen parameter is taken from the oldest relay in the family.

+ + + + {% if sorted_by_label == 'bandwidth' %} + + {% else %} + + {% endif %} + + {% if sorted_by_label == 'exit_count' %} + + {% else %} + + {% endif %} + {% if sorted_by_label == 'middle_count' %} + + {% else %} + + {% endif %} + {% if sorted_by_label == 'first_seen' %} + + {% else %} + + {% endif %} + + + {% set processed = dict() %} + {% for k, v in relays.json['sorted']['family'].items()|sort(attribute=sorted_by, reverse=True) %} + {% if relays.json['relays'][v['relays'][0]]['fingerprint'] not in processed %} + + {% if v['bandwidth'] > 1000000 %} + {% set obs_bandwidth = '%s %s'|format((v['bandwidth'] / 1000000)|round(2, 'common'), 'MB/s') %} + {% else %} + {% set obs_bandwidth = '%s %s'|format((v['bandwidth'] / 1000)|round(2, 'common'), 'KB/s') %}{% endif %} + + + + + + {% if v['contact'] %} + + {% else %} + {% endif %} + + + + + + + {% for r in v['relays'] %} + {% set _dummy = processed.update({relays.json['relay_subset'][r]['fingerprint']: None}) %} + {% endfor %} + + {% endif %} + {% endfor %} + +
FamilyBandwidthBandwidthContactExit CountExit CountMiddle CountMiddle CountFirst SeenFirst Seen
{{ k|escape }}{{ obs_bandwidth }}{{ v['contact']|truncate(50)|escape }}none{{ v['exit_count'] }}{{ v['middle_count'] }}{{ v['first_seen'].split(' ', 1)[0]|escape }}
+{% endblock %} -- cgit v1.2.3-54-g00ecf