summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mirrors/views.py13
-rw-r--r--templates/mirrors/mirror_details.html111
-rw-r--r--templates/mirrors/mirrors.html2
3 files changed, 96 insertions, 30 deletions
diff --git a/mirrors/views.py b/mirrors/views.py
index a2b94de8..032a4700 100644
--- a/mirrors/views.py
+++ b/mirrors/views.py
@@ -104,10 +104,19 @@ def mirror_details(request, name):
mirror = get_object_or_404(Mirror, name=name)
if not request.user.is_authenticated() and \
(not mirror.public or not mirror.active):
- # TODO: maybe this should be 403? but that would leak existence
raise Http404
+
+ status_info = get_mirror_statuses()
+ checked_urls = [url for url in status_info['urls'] \
+ if url.mirror_id == mirror.id]
+ all_urls = mirror.urls.select_related('protocol')
+ # get each item from checked_urls and supplement with anything in all_urls
+ # if it wasn't there
+ all_urls = set(checked_urls).union(all_urls)
+ all_urls = sorted(all_urls, key=lambda x: x.url)
+
return direct_to_template(request, 'mirrors/mirror_details.html',
- {'mirror': mirror})
+ {'mirror': mirror, 'urls': all_urls})
def status(request):
bad_timedelta = datetime.timedelta(days=3)
diff --git a/templates/mirrors/mirror_details.html b/templates/mirrors/mirror_details.html
index 90baa75d..ae7ec63f 100644
--- a/templates/mirrors/mirror_details.html
+++ b/templates/mirrors/mirror_details.html
@@ -1,4 +1,5 @@
{% extends "base.html" %}
+{% load mirror_status %}
{% block title %}Arch Linux - {{ mirror.name }} - Mirror Details{% endblock %}
@@ -12,47 +13,105 @@
<tr>
<th>Name:</th>
<td>{{ mirror.name }}</td>
- </tr><tr>
+ </tr>
+ <tr>
<th>Tier:</th>
<td>{{ mirror.get_tier_display }}</td>
- </tr><tr>
+ </tr>
+ <tr>
+ <th>Country:</th>
+ <td>{{ mirror.country }}</td>
+ </tr>
+ <tr>
+ <th>Has ISOs:</th>
+ <td>{{ mirror.isos|yesno }}</td>
+ </tr>
+ {% if user.is_authenticated %}
+ <tr>
+ <th>Public:</th>
+ <td>{{ mirror.public|yesno }}</td>
+ </tr>
+ <tr>
+ <th>Active:</th>
+ <td>{{ mirror.active|yesno }}</td>
+ </tr>
+ <tr>
+ <th>Rsync IPs:</th>
+ <td class="wrap">{{mirror.rsync_ips.all|join:', '}}</td>
+ </tr>
+ <tr>
+ <th>Admin Email:</th>
+ <td>{{ mirror.admin_email }}</td>
+ </tr>
+ <tr>
+ <th>Notes:</th>
+ <td>{{ mirror.notes|linebreaks }}</td>
+ </tr>
+ <tr>
<th>Upstream:</th>
- <!-- TODO: linking to non-public mirrors -->
<td>{% if mirror.upstream %}
<a href="{{ mirror.upstream.get_absolute_url }}"
title="Mirror details for {{ mirror.upstream.name }}">{{ mirror.upstream.name }}</a>
{% else %}None{% endif %}</td>
- </tr><tr>
+ </tr>
+ <tr>
<th>Downstream:</th>
{% with mirror.downstream as ds_mirrors %}
<td>{% if ds_mirrors %}
{% for ds in ds_mirrors %}
<a href="{{ ds.get_absolute_url }}"
- title="Mirror details for {{ ds.name }}">{{ ds.name }}</a><br/>
+ title="Mirror details for {{ ds.name }}">{{ ds.name }}</a>
+ {% if not ds.active %}<span class="testing-dep">(inactive)</span>{% endif %}
+ {% if not ds.public %}<span class="testing-dep">(private)</span>{% endif %}
+ <br/>
{% endfor %}
- {% else %}None{% endif %}
- </td>
- {% endwith %}
- </tr><tr>
- <th>Country:</th>
- <td>{{ mirror.country }}</td>
- </tr><tr>
- <th>Has ISOs:</th>
- <td>{{ mirror.isos|yesno }}</td>
- </tr><tr>
- <th>Protocols:</th>
- <td>{{ mirror.supported_protocols }}</td>
- </tr><tr>
- <th>Mirror URLs:</th>
- {% with mirror.urls.all as urls %}
- <td>{% if urls %}
- {% for u in urls %}
- <a href="{{ u.url }}">{{ u.url }}</a><br/>
- {% endfor %}
- {% else %}None{% endif %}
- </td>
+ {% else %}None{% endif %}</td>
{% endwith %}
</tr>
+ {% endif %}
+ </table>
+
+ <h3>Available URLs</h3>
+
+ <table id="available_urls" class="results">
+ <thead>
+ <tr>
+ <th>Mirror URL</th>
+ <th>IPv4</th>
+ <th>IPv6</th>
+ <th>Last Sync</th>
+ <th>Completion %</th>
+ <th>μ Delay (hh:mm)</th>
+ <th>μ Duration (secs)</th>
+ <th>σ Duration (secs)</th>
+ <th>Mirror Score</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for m_url in urls %}
+ <tr class="{% cycle 'odd' 'even' %}">
+ <td>{% if m_url.protocol.is_download %}<a href="{{ m_url.url }}">{{ m_url.url }}</a>{% else %}{{ m_url.url }}{% endif %}</td>
+ <td>{{ m_url.has_ipv4|yesno }}</td>
+ <td>{{ m_url.has_ipv6|yesno }}</td>
+ <td>{{ m_url.last_sync|date:'Y-m-d H:i'|default:'unknown' }}</td>
+ <td>{{ m_url.completion_pct|percentage:1 }}</td>
+ <td>{{ m_url.delay|duration|default:'unknown' }}</td>
+ <td>{{ m_url.duration_avg|floatformat:2 }}</td>
+ <td>{{ m_url.duration_stddev|floatformat:2 }}</td>
+ <td>{{ m_url.score|floatformat:1|default:'∞' }}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
</table>
</div>
+{% load cdn %}{% jquery %}
+<script type="text/javascript" src="/media/jquery.tablesorter.min.js"></script>
+<script type="text/javascript" src="/media/archweb.js"></script>
+<script type="text/javascript">
+$(document).ready(function() {
+ $("#available_urls:has(tbody tr)").tablesorter(
+ {widgets: ['zebra'], sortList: [[0,0]],
+ headers: { 6: { sorter: 'mostlydigit' }, 7: { sorter: 'mostlydigit' }, 8: { sorter: 'mostlydigit' } } });
+});
+</script>
{% endblock %}
diff --git a/templates/mirrors/mirrors.html b/templates/mirrors/mirrors.html
index 56f23db5..67a678d9 100644
--- a/templates/mirrors/mirrors.html
+++ b/templates/mirrors/mirrors.html
@@ -15,7 +15,6 @@
{% if user.is_authenticated %}
<th>Public</th>
<th>Active</th>
- <th>Rsync IPs</th>
<th>Admin Email</th>
<th>Notes</th>
{% endif %}
@@ -33,7 +32,6 @@
{% if user.is_authenticated %}
<td>{{mirror.public|yesno}}</td>
<td>{{mirror.active|yesno}}</td>
- <td class="wrap">{{mirror.rsync_ips.all|join:', '}}</td>
<td>{{mirror.admin_email}}</td>
<td class="wrap">{{mirror.notes|linebreaks}}</td>
{% endif %}