Fixes #6308: Fix linking of available VLANs in VLAN group view

This commit is contained in:
jeremystretch 2021-04-29 08:43:46 -04:00
parent 75fdff4d41
commit bb988701fe
3 changed files with 23 additions and 15 deletions

View File

@ -6,6 +6,10 @@
* [#6197](https://github.com/netbox-community/netbox/issues/6197) - Introduced `SESSION_COOKIE_NAME` config parameter
### Bug Fixes
* [#6308](https://github.com/netbox-community/netbox/issues/6308) - Fix linking of available VLANs in VLAN group view
---
## v2.11.2 (2021-04-27)

View File

@ -684,9 +684,17 @@ class VLANGroupView(generic.ObjectView):
vlans_table.columns.hide('group')
paginate_table(vlans_table, request)
# Compile permissions list for rendering the object table
permissions = {
'add': request.user.has_perm('ipam.add_vlan'),
'change': request.user.has_perm('ipam.change_vlan'),
'delete': request.user.has_perm('ipam.delete_vlan'),
}
return {
'vlans_count': vlans_count,
'vlans_table': vlans_table,
'permissions': permissions,
}

View File

@ -10,6 +10,15 @@
<li>{{ object }}</li>
{% endblock %}
{% block buttons %}
{% if perms.ipam.add_vlan %}
<a href="{% url 'ipam:vlan_add' %}?group={{ object.pk }}" class="btn btn-success">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add VLAN
</a>
{% endif %}
{{ block.super }}
{% endblock %}
{% block content %}
<div class="row">
<div class="col-md-6">
@ -52,21 +61,8 @@
</div>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<strong>VLANs</strong>
</div>
{% include 'inc/table.html' with table=vlans_table %}
{% if perms.ipam.add_vlan %}
<div class="panel-footer text-right noprint">
<a href="{% url 'ipam:vlan_add' %}?group={{ object.pk }}" class="btn btn-xs btn-primary">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add VLAN
</a>
</div>
{% endif %}
</div>
{% include 'inc/paginator.html' with paginator=vlans_table.paginator page=vlans_table.page %}
</div>
{% include 'utilities/obj_table.html' with table=vlans_table table_template='panel_table.html' heading='VLANs' bulk_edit_url='ipam:vlan_bulk_edit' bulk_delete_url='ipam:vlan_bulk_delete' %}
</div>
</div>
{% endblock %}