Browse Source

Improved overview

master
Sebastian Lohff 7 years ago
parent
commit
fab0701626
  1. 9
      bgpdata/models.py
  2. 21
      bgpdata/templates/bgpdata/overview.html

9
bgpdata/models.py

@ -26,6 +26,15 @@ class CrawlRun(models.Model): @@ -26,6 +26,15 @@ class CrawlRun(models.Model):
def __unicode__(self):
return u"Run %d - %s to %s" % (self.pk, self.startTime, self.endTime if self.endTime else "?")
def countAS(self):
return self.as_set.count()
def countASOnline(self):
return self.as_set.filter(online=True).count()
def countASOffline(self):
return self.as_set.filter(online=False).count()
def countPeerings(self):
return Peering.objects.filter(Q(as1__crawl=self)|Q(as2__crawl=self)).count()
class CrawlLog(models.Model):
INFO = 'INFO'
ERROR = 'ERROR'

21
bgpdata/templates/bgpdata/overview.html

@ -2,8 +2,27 @@ @@ -2,8 +2,27 @@
{% block body %}
<h3>Crawl results</h3>
<table class="table">
<thead>
<tr>
<th>#</th>
<th>start time</th>
<th>end time</th>
<th># AS</th>
<th># Peerings</th>
</tr>
</thead>
<tbody>
{% for crawl in crawls %}
<a href="/map/{{crawl.id}}/">Crawl {{crawl.id}} from {{crawl.startTime}}</a><br />
<tr class="{% if crawl.endTime%}success{%else%}warning{%endif%}">
<td><a href="/map/{{crawl.id}}/">Crawl {{crawl.id}}</a></td>
<td>{{crawl.startTime}}</td>
<td>{{crawl.endTime}}</td>
<td><span class="label label-primary">{{crawl.countAS}}</span> / <span class="label label-success">{{crawl.countASOnline}}</span> / <span class="label label-danger">{{crawl.countASOffline }}</span></td>
<td><span class="label label-primary">{{crawl.countPeerings}}</span></td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

Loading…
Cancel
Save