new: ASN prefix page

pull/12/head
Raphaël Vinot 2018-04-11 15:31:34 +02:00
parent 5ac57a9e1a
commit bf2da80e96
3 changed files with 30 additions and 2 deletions

View File

@ -20,3 +20,10 @@ def index():
q = Querying()
ranks = q.asns_global_ranking(limit=-1)
return render_template('index.html', ranks=ranks)
@app.route('/asn/<int:asn>', methods=['GET'])
def asn_details(asn):
q = Querying()
ranks = q.asn_details(asn)
return render_template('asn.html', asn=asn, ranks=ranks)

View File

@ -0,0 +1,21 @@
{% extends "main.html" %}
{% block title %}Ranking - {{ asn }}{% endblock %}
{% block content %}
<center>
<h1>Ranking - {{asn}}</h1></br></br>
</center>
<table class="table">
<tr>
<th>Prefix</th>
<th>Rank</th>
</tr>
{% for prefix, rank in ranks %}
<tr>
<td>{{ prefix }}</td>
<td>{{ rank }}</td>
</tr>
{% endfor %}
</table>
{% endblock %}

View File

@ -13,8 +13,8 @@
</tr>
{% for asn, rank in ranks %}
<tr>
<td>{{asn}}</td>
<td>{{rank}}</td>
<td><a href="{{ url_for('asn', asn=asn) }}">{{ asn }}</a></td>
<td>{{ rank }}</td>
</tr>
{% endfor %}
</table>