aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--portal-gui/Makefile.in1
-rw-r--r--portal-gui/rpkigui/myrpki/forms.py2
-rw-r--r--portal-gui/rpkigui/myrpki/views.py25
-rw-r--r--portal-gui/rpkigui/templates/myrpki/asn_view.html25
-rw-r--r--portal-gui/rpkigui/templates/myrpki/dashboard.html40
-rw-r--r--portal-gui/rpkigui/templates/myrpki/prefix_view.html23
6 files changed, 70 insertions, 46 deletions
diff --git a/portal-gui/Makefile.in b/portal-gui/Makefile.in
index 37de2bb3..311b6c5c 100644
--- a/portal-gui/Makefile.in
+++ b/portal-gui/Makefile.in
@@ -61,6 +61,7 @@ INSTALL_FILES=\
rpkigui/templates/base.html \
rpkigui/templates/myrpki/asn_view.html \
rpkigui/templates/myrpki/child_view.html \
+ rpkigui/templates/myrpki/conf_empty.html \
rpkigui/templates/myrpki/conf_list.html \
rpkigui/templates/myrpki/dashboard.html \
rpkigui/templates/myrpki/parent_view.html \
diff --git a/portal-gui/rpkigui/myrpki/forms.py b/portal-gui/rpkigui/myrpki/forms.py
index 58df6f3e..cb5b1f2e 100644
--- a/portal-gui/rpkigui/myrpki/forms.py
+++ b/portal-gui/rpkigui/myrpki/forms.py
@@ -140,7 +140,7 @@ def PrefixDeleteForm(prefix, *args, **kwargs):
'Can not delete prefix received from parent'
if prefix.allocated:
raise forms.ValidationError, 'Prefix is allocated to child'
- if prefix.asns:
+ if prefix.roa_requests.all():
raise forms.ValidationError, 'Prefix is used in your ROAs'
if prefix.children.all():
raise forms.ValidationError, 'Prefix has been subdivided'
diff --git a/portal-gui/rpkigui/myrpki/views.py b/portal-gui/rpkigui/myrpki/views.py
index dcddeeb9..98441789 100644
--- a/portal-gui/rpkigui/myrpki/views.py
+++ b/portal-gui/rpkigui/myrpki/views.py
@@ -211,8 +211,7 @@ def parent_import(request):
def parent_view(request, parent_handle):
"""Detail view for a particular parent."""
handle = request.session['handle']
- parent = get_object_or_404(handle.parents.all(),
- handle__exact=parent_handle)
+ parent = get_object_or_404(handle.parents, handle__exact=parent_handle)
return render('myrpki/parent_view.html', { 'parent': parent }, request)
@handle_required
@@ -249,18 +248,15 @@ def child_import(request):
def get_parents_or_404(handle, obj):
'''Return the Parent object(s) that the given address range derives
from, or raise a 404 error.'''
- while obj.parent: obj = obj.parent
-
- cert_set = obj.from_cert.filter(parent__in=handle.parents.all())
+ cert_set = top_parent(obj).from_cert.filter(parent__in=handle.parents.all())
if cert_set.count() == 0:
- raise http.Http404
-
- return handle.parents.filter(pk__in=[c.parent.pk for c in cert_set])
+ raise http.Http404, 'Object is not delegated from any parent'
+ return [c.parent for c in cert_set]
@handle_required
def address_view(request, pk):
handle = request.session['handle']
- obj = get_object_or_404(models.AddressRange.objects.all(), pk=pk)
+ obj = get_object_or_404(models.AddressRange.objects, pk=pk)
# ensure this resource range belongs to a parent of the current conf
parent_set = get_parents_or_404(handle, obj)
@@ -274,15 +270,16 @@ def asn_view(request, pk):
obj = get_object_or_404(models.Asn.objects, pk=pk)
# ensure this resource range belongs to a parent of the current conf
parent_set = get_parents_or_404(handle, obj)
+ roas = handle.roas.filter(asn=obj.lo) # roas which contain this asn
return render('myrpki/asn_view.html',
- { 'asn': obj, 'parent': parent_set }, request)
+ { 'asn': obj, 'parent': parent_set, 'roas': roas }, request)
@handle_required
def child_view(request, child_handle):
'''Detail view of child for the currently selected handle.'''
handle = request.session['handle']
- child = get_object_or_404(handle.children.all(), handle__exact=child_handle)
+ child = get_object_or_404(handle.children, handle__exact=child_handle)
return render('myrpki/child_view.html', { 'child': child }, request)
@@ -329,12 +326,13 @@ def prefix_allocate_view(request, pk):
'addr': prefix, 'form': form, 'parent': parent_set }, request)
def top_parent(prefix):
+ '''Returns the topmost resource from which the specified argument derives'''
while prefix.parent:
prefix = prefix.parent
return prefix
def find_roa(handle, prefix, asid):
- # find all roas with prefixes from the same resource cert
+ '''Find a roa with prefixes from the same resource cert.'''
roa_set = handle.roas.filter(asn=asid)
for c in top_parent(prefix).from_cert.all():
for r in roa_set:
@@ -411,9 +409,8 @@ def roa_request_delete_view(request, pk):
roa = obj.roa
obj.delete()
if not roa.from_roa_request.all():
- print 'removing empty roa for asn %d' % (roa.asn,)
roa.delete()
- glue.configure_resources(handle)
+ glue.configure_resources(handle)
return http.HttpResponseRedirect(prefix.get_absolute_url())
diff --git a/portal-gui/rpkigui/templates/myrpki/asn_view.html b/portal-gui/rpkigui/templates/myrpki/asn_view.html
index 587b73db..c7720a47 100644
--- a/portal-gui/rpkigui/templates/myrpki/asn_view.html
+++ b/portal-gui/rpkigui/templates/myrpki/asn_view.html
@@ -1,5 +1,11 @@
{% extends "base.html" %}
+{% block css %}
+table { border-collapse: collapse }
+th { border: solid 1px; padding: 1em }
+td { border: solid 1px; text-align: center; padding-left: 1em; padding-right: 1em }
+{% endblock %}
+
{% block content %}
<p>Handle: <a href="/myrpki/">{{ request.session.handle }}</a>
@@ -39,6 +45,25 @@
{% endif %}
+{% if roas %}
+<h2>ROAs</h2>
+<table>
+ <tr><th>Prefixes</th></tr>
+ {% for r in roas %}
+ <tr>
+ <td style='text-align: left'>
+ <ul>
+ {% for p in r.from_roa_request.all %}
+ <li><a href="{{ p.prefix.get_absolute_url }}">{{ p.prefix }}</a>
+ {% endfor %}
+ </ul>
+ </td>
+ </tr>
+ {% endfor %}
+ </ul>
+</table>
+{% endif %} <!-- roas -->
+
{% if form %}
<h2>Edit</h2>
<form method="POST" action="{{ request.get_full_path }}">
diff --git a/portal-gui/rpkigui/templates/myrpki/dashboard.html b/portal-gui/rpkigui/templates/myrpki/dashboard.html
index 24ad515b..be3b70b1 100644
--- a/portal-gui/rpkigui/templates/myrpki/dashboard.html
+++ b/portal-gui/rpkigui/templates/myrpki/dashboard.html
@@ -23,17 +23,17 @@ td { border: solid 1px; text-align: center; padding-left: 1em; padding-right: 1e
{% for cert in parent.resources.all %}
{% for asn in cert.asn.all %}
-<tr><td><a href="{{ asn.get_absolute_url }}">{{ asn }}</a></td>
-<td style='text-align: center'>{{cert.not_before}}</td>
-<td style='text-align: center'>{{cert.not_after}}</td>
+<tr><td style='text-align:left'><a href="{{ asn.get_absolute_url }}">{{ asn }}</a></td>
+<td>{{cert.not_before}}</td>
+<td>{{cert.not_after}}</td>
</tr>
{% endfor %}
{% for address in cert.address_range.all %}
-<tr><td>
-<a href="{{ address.get_absolute_url }}">{{ address }}</a>
-</td><td style='text-align: center'>{{cert.not_before}}</td>
-<td style='text-align: center'>{{cert.not_after}}</td>
+<tr>
+ <td style='text-align: left'><a href="{{ address.get_absolute_url }}">{{ address }}</a></td>
+ <td>{{cert.not_before}}</td>
+ <td>{{cert.not_after}}</td>
</tr>
{% endfor %}
@@ -77,22 +77,22 @@ td { border: solid 1px; text-align: center; padding-left: 1em; padding-right: 1e
</div>
-<div style="border: outset">
+<div style="border: outset"> <!-- ROAs -->
<h1 style="text-align: center">My ROA [request]s</h1>
<table>
-<tr>
-<th>Prefix</th>
-<th>ASN</th>
-</tr>
+<tr> <th>Prefix</th> <th>ASN</th> </tr>
{% for roa in request.session.handle.roas.all %}
-<tr><td>
+<tr>
+ <td style='text-align: left'>
+ <ul style='list-style-position: outside'>
{% for req in roa.from_roa_request.all %}
-<li><a href="{{ req.prefix.get_absolute_url }}">{{ req.as_roa_prefix }}</a>
+ <li><a href="{{ req.prefix.get_absolute_url }}">{{ req.as_roa_prefix }}</a>
{% endfor %}
-</td>
-<td>{{ roa.asn }}</td>
+ </ul>
+ </td>
+ <td>{{ roa.asn }}</td>
</tr>
{% endfor %}
</table>
@@ -104,14 +104,14 @@ td { border: solid 1px; text-align: center; padding-left: 1em; padding-right: 1e
<table>
{% for asn in asns %}
<tr>
-<td><a href="{{ asn.get_absolute_url }}">{{ asn }}</a></td>
-<td style='padding-left: 2em'> <a href="{{ asn.get_absolute_url }}/allocate">give</a></td>
+<td style='text-align: left'><a href="{{ asn.get_absolute_url }}">{{ asn }}</a></td>
+<td><a href="{{ asn.get_absolute_url }}/allocate">give</a></td>
</tr>
{% endfor %}
{% for addr in ars %}
<tr>
-<td><a href="{{ addr.get_absolute_url }}">{{ addr }}</a></td>
-<td style='padding-left: 2em'><a href="{{ addr.get_absolute_url }}/allocate">give</a>
+<td style='text-align: left'><a href="{{ addr.get_absolute_url }}">{{ addr }}</a></td>
+<td><a href="{{ addr.get_absolute_url }}/allocate">give</a>
| <a href="{{ addr.get_absolute_url }}/split">split</a>
| <a href="{{ addr.get_absolute_url }}/roa">roa</a></td>
</tr>
diff --git a/portal-gui/rpkigui/templates/myrpki/prefix_view.html b/portal-gui/rpkigui/templates/myrpki/prefix_view.html
index be273f05..ec4132e1 100644
--- a/portal-gui/rpkigui/templates/myrpki/prefix_view.html
+++ b/portal-gui/rpkigui/templates/myrpki/prefix_view.html
@@ -30,34 +30,35 @@ td { border: solid 1px; text-align: center; padding-left: 1em; padding-right: 1e
<tr><td>Validity:</td><td>{{ addr.from_cert.all.0.not_before }} - {{ addr.from_cert.all.0.not_after }} </td></tr>
{% if addr.allocated %}
- <tr><td>Allocated:</td><td><a href="{{addr.allocated.get_absolute_url}}">{{addr.allocated.handle}}</a></td></tr>
+ <tr>
+ <td>Allocated:</td>
+ <td><a href="{{addr.allocated.get_absolute_url}}">{{ addr.allocated.handle }}</a></td>
+ </tr>
{% endif %}
</table>
{% if addr.children.count %}
<h2>Suballocations</h2>
-
<ul>
{% for subaddr in addr.children.all %}
-<li><a href="{{ subaddr.get_absolute_url }}">{{ subaddr }}</a>
+ <li><a href="{{ subaddr.get_absolute_url }}">{{ subaddr }}</a>
{% endfor %}
</ul>
+{% endif %} <!-- suballocations -->
-{% endif %}
-
-{% if addr.roa_requests %}
+{% if addr.roa_requests.count %}
<h2>ROA requests</h2>
<table>
<tr><th>ASN</th><th>Max Length</th></tr>
{% for r in addr.roa_requests.all %}
- <tr><td>{{ r.roa.asn }}</td>
+ <tr>
+ <td>{{ r.roa.asn }}</td>
<td>{{ r.max_length }}</td>
- <td><a href="{{ r.get_absolute_url }}/delete">delete</a></tr>
+ <td><a href="{{ r.get_absolute_url }}/delete">delete</a></td>
+ </tr>
{% endfor %}
-
</table>
-
{% endif %} <!-- roa requests -->
{% if form %}
@@ -66,7 +67,7 @@ td { border: solid 1px; text-align: center; padding-left: 1em; padding-right: 1e
{{ form.as_p }}
<input type="submit">
</form>
-{% endif %}
+{% endif %} <!-- form -->
<p>Action:
<a href="{{addr.get_absolute_url}}/split">split</a> |