From fab0701626231071c5e93a095e3df95948a760dd Mon Sep 17 00:00:00 2001 From: Sebastian Lohff Date: Sat, 28 Mar 2015 21:15:32 +0100 Subject: [PATCH] Improved overview --- bgpdata/models.py | 9 +++++++++ bgpdata/templates/bgpdata/overview.html | 21 ++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/bgpdata/models.py b/bgpdata/models.py index 2804a56..04db76d 100644 --- a/bgpdata/models.py +++ b/bgpdata/models.py @@ -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' diff --git a/bgpdata/templates/bgpdata/overview.html b/bgpdata/templates/bgpdata/overview.html index c89731c..a74c3b9 100644 --- a/bgpdata/templates/bgpdata/overview.html +++ b/bgpdata/templates/bgpdata/overview.html @@ -2,8 +2,27 @@ {% block body %}

Crawl results

+ + + + + + + + + + + {% for crawl in crawls %} - Crawl {{crawl.id}} from {{crawl.startTime}}
+ + + + + + + {% endfor %} + +
#start timeend time# AS# Peerings
Crawl {{crawl.id}}{{crawl.startTime}}{{crawl.endTime}}{{crawl.countAS}} / {{crawl.countASOnline}} / {{crawl.countASOffline }}{{crawl.countPeerings}}
{% endblock %}