Add ASN last seen tab

This commit is contained in:
Sebastian Lohff 2020-06-10 03:12:23 +02:00
parent f898cd8d40
commit 9784d4dc7c
4 changed files with 42 additions and 22 deletions

View File

@ -0,0 +1,28 @@
{% extends "base.html" %}
{% block body %}
<h3>ASN Last Seen</h3>
<table class="table">
<thead>
<tr>
<th>#</th>
<th>Status</th>
<th>Directly Crawled</th>
<th>Last Seen</th>
<th>Last Seen Crawl</th>
</tr>
</thead>
<tbody>
{% for asn in last_seen %}
<tr class="{% if asn.online %}success{% else %}danger{% endif %}">
<td>{{ asn.asn }}</td>
<td>{%if not asn.online %}Offline{% endif %}</td>
<td>{% if asn.directlyCrawled %}Yes{% endif %}</td>
<td>{% if not asn.online %}{{ asn.lastSeen }}{% endif %}</td>
<td><a href="/map/{{ asn.crawlLastSeen.id }}/">Crawl {{ asn.crawlLastSeen.id }}</a></td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

View File

@ -6,7 +6,9 @@ from django.conf.urls import url
from bgpdata import views as bgpdata_views from bgpdata import views as bgpdata_views
urlpatterns = ( urlpatterns = (
url(r'^$', bgpdata_views.overview), url(r'^$', bgpdata_views.overview, name='overview'),
url(r'^([0-9]+)/$', bgpdata_views.showMap), url(r'^([0-9]+)/$', bgpdata_views.showMap, name='show_map'),
url(r'^new/([0-9]+|live)/$', bgpdata_views.show_new_map), url(r'^new/([0-9]+)/$', bgpdata_views.show_new_map, name='show_map'),
url(r'^new/(?P<crawl_id>live)/$', bgpdata_views.show_new_map, name='show_live_map'),
url(r'^lastseen/$', bgpdata_views.show_asn_last_seen, name='lastseen'),
) )

View File

@ -4,7 +4,7 @@
from django.shortcuts import render from django.shortcuts import render
from django.core.paginator import Paginator from django.core.paginator import Paginator
from bgpdata.models import CrawlRun, AS, Peering from bgpdata.models import CrawlRun, AS, Peering, ASLastSeen
from backend import crawler from backend import crawler
@ -39,3 +39,7 @@ def show_new_map(request, crawl_id):
return render(request, "bgpdata/no-map-found.html", {"crawl_id": crawl_id}) return render(request, "bgpdata/no-map-found.html", {"crawl_id": crawl_id})
return render(request, 'bgpdata/new_new_map.html', {"crawl": crawl}) return render(request, 'bgpdata/new_new_map.html', {"crawl": crawl})
def show_asn_last_seen(request):
return render(request, 'bgpdata/asn_last_seen.html', {'last_seen': ASLastSeen.objects.order_by("asn")})

View File

@ -26,29 +26,15 @@
</div> </div>
<div id="navbar" class="navbar-collapse collapse"> <div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li class="active"><a href="/">Crawl Data</a></li> <li{% if request.resolver_match.url_name == "show_map" or request.resolver_match.url_name == "overview" %} class="active"{%endif%}><a href="/">Crawl Data</a></li>
<!-- <li{% if request.resolver_match.url_name == "show_live_map" %} class="active"{%endif%}><a href="{% url "show_live_map" crawl_id="live" %}">Live View</a></li>
<li><a href="#about">About</a></li> <li{% if request.resolver_match.url_name == 'lastseen' %} class="active"{%endif%}><a href="{% url "lastseen" %}">AS Status</a></li>
<li><a href="#contact">Contact</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li class="dropdown-header">Nav header</li>
<li><a href="#">Separated link</a></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
-->
</ul> </ul>
</div><!--/.nav-collapse --> </div><!--/.nav-collapse -->
</div> </div>
</nav> </nav>
<div class="container"> <div class="{% block container_class %}container{% endblock %}">
{% block body %}{% endblock %} {% block body %}{% endblock %}
</div> </div>
</body> </body>