summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-05-11 01:46:55 +0200
committerDan McGee <dan@archlinux.org>2013-05-11 01:46:55 +0200
commitc4d894c85b738df53e8e06e65be48e34572b2f5f (patch)
tree3805f17e16b6f49fcbe318eb60ac03f0bbec7d84
parentdad70d0d7c70e7973cd9e3960b24e7f9ef883c61 (diff)
parent8097a1fdeff36fb3db521a3b354ea8bf576869cc (diff)
downloadarchweb-c4d894c85b738df53e8e06e65be48e34572b2f5f.tar.gz
archweb-c4d894c85b738df53e8e06e65be48e34572b2f5f.tar.xz
Merge branch 'mirror-errors'
-rw-r--r--mirrors/views.py11
-rw-r--r--templates/mirrors/error_table.html23
-rw-r--r--templates/mirrors/mirror_details.html3
-rw-r--r--templates/mirrors/status.html32
-rw-r--r--templates/mirrors/status_table.html3
5 files changed, 39 insertions, 33 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/error_table.html b/templates/mirrors/error_table.html
new file mode 100644
index 0000000..6054814
--- /dev/null
+++ b/templates/mirrors/error_table.html
@@ -0,0 +1,23 @@
+{% load flags mirror_status %}
+<table id="errorlog_mirrors" class="results">
+ <thead>
+ <tr>
+ <th>Mirror URL</th>
+ <th>Protocol</th>
+ <th>Country</th>
+ <th>Error Message</th>
+ <th>Last Occurred</th>
+ <th>Occurrences (last {{ cutoff|hours }})</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for log in error_logs %}<tr class="{% cycle 'odd' 'even' %}">
+ <td>{{ log.url__url }}</td>
+ <td>{{ log.url__protocol__protocol }}</td>
+ <td class="country">{% country_flag log.country %}{{ log.country.name }}</td>
+ <td class="wrap">{{ log.error|linebreaksbr }}</td>
+ <td>{{ log.last_occurred|date:'Y-m-d H:i' }}</td>
+ <td>{{ log.error_count }}</td>
+ </tr>{% endfor %}
+ </tbody>
+</table>
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">
diff --git a/templates/mirrors/status.html b/templates/mirrors/status.html
index 283ff68..331c18e 100644
--- a/templates/mirrors/status.html
+++ b/templates/mirrors/status.html
@@ -59,45 +59,19 @@
<a name="outofsync" id="outofsync"></a>
<h3>Out of Sync Mirrors</h3>
- {% with bad_urls as urls %}
- {% with 'outofsync_mirrors' as table_id %}
+ {% with urls=bad_urls table_id='outofsync_mirrors' %}
{% include "mirrors/status_table.html" %}
{% endwith %}
- {% endwith %}
<a name="successful" id="successful"></a>
<h3>Successfully Syncing Mirrors</h3>
- {% with good_urls as urls %}
- {% with 'successful_mirrors' as table_id %}
+ {% with urls=good_urls table_id='successful_mirrors' %}
{% include "mirrors/status_table.html" %}
{% endwith %}
- {% endwith %}
<a name="errorlog" id="errorlog"></a>
<h3>Mirror Syncing Error Log</h3>
- <table id="errorlog_mirrors" class="results">
- <thead>
- <tr>
- <th>Mirror URL</th>
- <th>Protocol</th>
- <th>Country</th>
- <th>Error Message</th>
- <th>Last Occurred</th>
- <th>Occurrences (last {{ cutoff|hours }})</th>
- </tr>
- </thead>
- <tbody>
- {% for log in error_logs %}<tr class="{% cycle 'odd' 'even' %}">
- <td>{{ log.url__url }}</td>
- <td>{{ log.url__protocol__protocol }}</td>
- <td class="country">{% country_flag log.country %}{{ log.country.name }}</td>
- <td class="wrap">{{ log.error|linebreaksbr }}</td>
- <td>{{ log.last_occurred|date:'Y-m-d H:i' }}</td>
- <td>{{ log.error_count }}</td>
- </tr>{% endfor %}
- </tbody>
- </table>
-
+ {% include "mirrors/error_table.html" %}
</div>
{% endblock %}
diff --git a/templates/mirrors/status_table.html b/templates/mirrors/status_table.html
index e848a9c..2817542 100644
--- a/templates/mirrors/status_table.html
+++ b/templates/mirrors/status_table.html
@@ -1,5 +1,4 @@
-{% load mirror_status %}
-{% load flags %}
+{% load flags mirror_status %}
<table id="{{ table_id }}" class="results">
<thead>
<tr>