Improved overview

master
Sebastian Lohff 9 years ago
parent 4cf5383d0d
commit fab0701626

@ -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'

@ -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 %}

Loading…
Cancel
Save