IPv6 prefix search, url cleanup

This commit is contained in:
Sebastian Lohff 2017-03-25 04:43:20 +01:00
parent 81bbcda8eb
commit d544e3364f
5 changed files with 16 additions and 14 deletions

View File

@ -70,7 +70,14 @@ def freeSubnet(request):
prefixLen = 0
try:
prefixLen = int(request.GET.get("prefixLen", 27))
prefixLen = request.GET.get("prefixLen", None)
if not prefixLen:
if parentRange.protocol == InetNum.IPv4:
prefixLen = 27
else:
prefixLen = 60
prefixLen = int(prefixLen)
if prefixLen < 8 or \
(parentRange.protocol == InetNum.IPv4 and prefixLen > 32) or \
(parentRange.protocol == InetNum.IPv6 and prefixLen > 128):

View File

@ -40,7 +40,7 @@ function findPrefix(size, step) {
var parentRangeOpt = $('#id_'+ef+'parent_range option:selected');
if(parentRangeOpt.val()) {
var prefixLen = 27;
var prefixLen = null;
var m = netInpText.match("([0-9.:]+/)?(\\d+)");
console.log(prefixLen)
console.log(netInpText);
@ -69,8 +69,8 @@ $(document).ready(function() {
console.log("NOOT NOOT");
$('#div_id_number label').append(' <small>(<a onClick="findASNumber();">next free number</a>)</small>');
$('#div_id_0-number label').append(' <small>(<a onClick="findASNumber(0);">next free number</a>)</small>');
$('#div_id_prefix label').append(' <small>(<a onClick="findPrefix(27);">next free /27</a>)</small>');
$('#div_id_1-prefix label').append(' <small>(<a onClick="findPrefix(27, 1);">next free /27</a>)</small>');
$('#div_id_prefix label').append(' <small>(<a onClick="findPrefix(27);">next free /27 or /60</a>)</small>');
$('#div_id_1-prefix label').append(' <small>(<a onClick="findPrefix(27, 1);">next free /27 or /60</a>)</small>');
});
</script>

View File

@ -11,7 +11,7 @@
<div class="panel-body">
<h3>Create Database Objects</h3>
<ul>
<li><a href="{% url "whoisdb:mnt-create" %}">Create new Maintainer</a></li>
<li><a href="{% url "whoisdb:maintainer-create" %}">Create new Maintainer</a></li>
<li><a href="{% url "whoisdb:contact-create" %}">Create new Role/Person</a></li>
<li><a href="{% url "rrequests:dashboard" %}">Request resources</a></li>
{% if netblocks %}

View File

@ -15,12 +15,12 @@
</p>
</p>
Create <a href="{% url "whoisdb:mnt-create" %}">new Maintainer</a>, create <a href="{% url "whoisdb:contact-create" %}">new Contact</a>, <a href="{% url "rrequests:dashboard" %}">request resources</a>{% if netblocks %}, create <a href="{% url "whoisdb:inetnum-create" %}">Subnet</a>{% endif %}{% if asblocks %}, create <a href="{% url "whoisdb:asnumber-create" %}">AS</a>, create <a href="{% url "whoisdb:asblock-create" %}">ASblock</a>{% endif %}{% if netblocks and asblocks %}, create <a href="{% url "whoisdb:asandsubnet-wizard" %}">AS / Subnet pair</a>{% endif %}
Create <a href="{% url "whoisdb:maintainer-create" %}">new Maintainer</a>, create <a href="{% url "whoisdb:contact-create" %}">new Contact</a>, <a href="{% url "rrequests:dashboard" %}">request resources</a>{% if netblocks %}, create <a href="{% url "whoisdb:inetnum-create" %}">Subnet</a>{% endif %}{% if asblocks %}, create <a href="{% url "whoisdb:asnumber-create" %}">AS</a>, create <a href="{% url "whoisdb:asblock-create" %}">ASblock</a>{% endif %}{% if netblocks and asblocks %}, create <a href="{% url "whoisdb:asandsubnet-wizard" %}">AS / Subnet pair</a>{% endif %}
</p>
<!--
<h3>Create Database Objects</h3>
<ul>
<li><a href="{% url "whoisdb:mnt-create" %}">Create new Maintainer</a></li>
<li><a href="{% url "whoisdb:maintainer-create" %}">Create new Maintainer</a></li>
<li><a href="{% url "whoisdb:contact-create" %}">Create new Role/Person</a></li>
<li><a href="{% url "rrequests:dashboard" %}">Request resources</a></li>
{% if netblocks %}
@ -48,7 +48,7 @@
</thead>
<tbody>
{% for mnt in mnts %}
{% include "whoisdb/handle_table_row.html" with obj=mnt objType="Maintainer" prefix="mnt" %}
{% include "whoisdb/handle_table_row.html" with obj=mnt objType="Maintainer" prefix="maintainer" %}
{% endfor %}
{% for contact in contacts %}
{% include "whoisdb/handle_table_row.html" with obj=contact objType="Contact / Role" prefix="contact" %}

View File

@ -8,12 +8,7 @@ urlpatterns = [
url(r'^handle/(?P<handle>[A-Z0-9-]+)/$', whoisdb_views.showHandle, name='showhandle'),
url(r'^handle/(?P<handle>[A-Z0-9-]+)/$', whoisdb_views.showHandle, name='handle-detail'),
url(r'^mnt/create/$', whoisdb_views.MaintainerCreate.as_view(), name='mnt-create'),
url(r'^mnt/show/(?P<handle>[A-Z0-9-]+)/$', whoisdb_views.MaintainerDetail.as_view(), name='mnt-detail'),
url(r'^mnt/edit/(?P<handle>[A-Z0-9-]+)/$', whoisdb_views.MaintainerEdit.as_view(), name='mnt-edit'),
url(r'^mnt/delete/(?P<handle>[A-Z0-9-]+)/$', whoisdb_views.MaintainerDelete.as_view(), name='mnt-delete'),
# FIXME hacky duplicates
url(r'^mnt/create/$', whoisdb_views.MaintainerCreate.as_view(), name='mnt-create'),
url(r'^mnt/create/$', whoisdb_views.MaintainerCreate.as_view(), name='maintainer-create'),
url(r'^mnt/show/(?P<handle>[A-Z0-9-]+)/$', whoisdb_views.MaintainerDetail.as_view(), name='maintainer-detail'),
url(r'^mnt/edit/(?P<handle>[A-Z0-9-]+)/$', whoisdb_views.MaintainerEdit.as_view(), name='maintainer-edit'),
url(r'^mnt/delete/(?P<handle>[A-Z0-9-]+)/$', whoisdb_views.MaintainerDelete.as_view(), name='maintainer-delete'),