Improved overview

This commit is contained in:
Sebastian Lohff 2015-03-28 21:15:32 +01:00
parent 4cf5383d0d
commit fab0701626
2 changed files with 29 additions and 1 deletions

View File

@ -26,6 +26,15 @@ class CrawlRun(models.Model):
def __unicode__(self): def __unicode__(self):
return u"Run %d - %s to %s" % (self.pk, self.startTime, self.endTime if self.endTime else "?") 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): class CrawlLog(models.Model):
INFO = 'INFO' INFO = 'INFO'
ERROR = 'ERROR' ERROR = 'ERROR'

View File

@ -2,8 +2,27 @@
{% block body %} {% block body %}
<h3>Crawl results</h3> <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 %} {% 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 %} {% endfor %}
</tbody>
</table>
{% endblock %} {% endblock %}