summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-05-11 01:10:04 +0200
committerDan McGee <dan@archlinux.org>2013-05-11 01:10:04 +0200
commit8097a1fdeff36fb3db521a3b354ea8bf576869cc (patch)
tree6591226d8f58cc4462e71c21fe9853a62a76fbfd
parent76be96ac2c11604a2bfceed4212b686719620b13 (diff)
downloadarchweb-8097a1fdeff36fb3db521a3b354ea8bf576869cc.tar.gz
archweb-8097a1fdeff36fb3db521a3b354ea8bf576869cc.tar.xz
Add mirror error logs to mirror details page
Give a window of 7 days for logs here rather than the default 24 hours we do on the main status page since we are only retrieving details for a single mirror with a handful of URLs. This should make it easier to have all information regarding one mirror in a single location. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--mirrors/views.py11
-rw-r--r--templates/mirrors/mirror_details.html3
2 files changed, 12 insertions, 2 deletions
diff --git a/mirrors/views.py b/mirrors/views.py
index 73d4029..d1dd9da 100644
--- a/mirrors/views.py
+++ b/mirrors/views.py
@@ -175,6 +175,7 @@ def mirror_details(request, name):
if not request.user.is_authenticated() and \
(not mirror.public or not mirror.active):
raise Http404
+ error_cutoff = timedelta(days=7)
status_info = get_mirror_statuses(mirror_id=mirror.id)
checked_urls = {url for url in status_info['urls'] \
@@ -188,9 +189,15 @@ def mirror_details(request, name):
setattr(url, attr, None)
all_urls = sorted(checked_urls.union(other_urls), key=attrgetter('url'))
- return render(request, 'mirrors/mirror_details.html',
- {'mirror': mirror, 'urls': all_urls})
+ error_logs = get_mirror_errors(mirror_id=mirror.id, cutoff=error_cutoff)
+ context = {
+ 'mirror': mirror,
+ 'urls': all_urls,
+ 'cutoff': error_cutoff,
+ 'error_logs': error_logs,
+ }
+ return render(request, 'mirrors/mirror_details.html', context)
def mirror_details_json(request, name):
mirror = get_object_or_404(Mirror, name=name)
diff --git a/templates/mirrors/mirror_details.html b/templates/mirrors/mirror_details.html
index d3e85b0..6f0ac6c 100644
--- a/templates/mirrors/mirror_details.html
+++ b/templates/mirrors/mirror_details.html
@@ -106,6 +106,9 @@
{% endfor %}
</tbody>
</table>
+
+ <h3>Error Log</h3>
+ {% include "mirrors/error_table.html" %}
</div>
<div class="box">