mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 01:41:22 -06:00
Fixes #7072: Fix table configuration under prefix child object views
This commit is contained in:
parent
8036d1e5a5
commit
7db2b9d091
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
* [#7070](https://github.com/netbox-community/netbox/issues/7070) - Fix exception when filtering by prefix max length in UI
|
* [#7070](https://github.com/netbox-community/netbox/issues/7070) - Fix exception when filtering by prefix max length in UI
|
||||||
* [#7071](https://github.com/netbox-community/netbox/issues/7071) - Fix exception when removing a primary IP from a device/VM
|
* [#7071](https://github.com/netbox-community/netbox/issues/7071) - Fix exception when removing a primary IP from a device/VM
|
||||||
|
* [#7072](https://github.com/netbox-community/netbox/issues/7072) - Fix table configuration under prefix child object views
|
||||||
* [#7083](https://github.com/netbox-community/netbox/issues/7083) - Correct labeling for VM memory attribute
|
* [#7083](https://github.com/netbox-community/netbox/issues/7083) - Correct labeling for VM memory attribute
|
||||||
* [#7084](https://github.com/netbox-community/netbox/issues/7084) - Fix KeyError exception when editing access VLAN on an interface
|
* [#7084](https://github.com/netbox-community/netbox/issues/7084) - Fix KeyError exception when editing access VLAN on an interface
|
||||||
* [#7096](https://github.com/netbox-community/netbox/issues/7096) - Home links should honor `BASE_PATH` configuration
|
* [#7096](https://github.com/netbox-community/netbox/issues/7096) - Home links should honor `BASE_PATH` configuration
|
||||||
|
@ -404,12 +404,11 @@ class PrefixPrefixesView(generic.ObjectView):
|
|||||||
bulk_querystring = 'vrf_id={}&within={}'.format(instance.vrf.pk if instance.vrf else '0', instance.prefix)
|
bulk_querystring = 'vrf_id={}&within={}'.format(instance.vrf.pk if instance.vrf else '0', instance.prefix)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'first_available_prefix': instance.get_first_available_prefix(),
|
|
||||||
'table': table,
|
'table': table,
|
||||||
'bulk_querystring': bulk_querystring,
|
'bulk_querystring': bulk_querystring,
|
||||||
'active_tab': 'prefixes',
|
'active_tab': 'prefixes',
|
||||||
|
'first_available_prefix': instance.get_first_available_prefix(),
|
||||||
'show_available': request.GET.get('show_available', 'true') == 'true',
|
'show_available': request.GET.get('show_available', 'true') == 'true',
|
||||||
'table_config_form': TableConfigForm(table=table),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -421,7 +420,7 @@ class PrefixIPRangesView(generic.ObjectView):
|
|||||||
# Find all IPRanges belonging to this Prefix
|
# Find all IPRanges belonging to this Prefix
|
||||||
ip_ranges = instance.get_child_ranges().restrict(request.user, 'view').prefetch_related('vrf')
|
ip_ranges = instance.get_child_ranges().restrict(request.user, 'view').prefetch_related('vrf')
|
||||||
|
|
||||||
table = tables.IPRangeTable(ip_ranges)
|
table = tables.IPRangeTable(ip_ranges, user=request.user)
|
||||||
if request.user.has_perm('ipam.change_iprange') or request.user.has_perm('ipam.delete_iprange'):
|
if request.user.has_perm('ipam.change_iprange') or request.user.has_perm('ipam.delete_iprange'):
|
||||||
table.columns.show('pk')
|
table.columns.show('pk')
|
||||||
paginate_table(table, request)
|
paginate_table(table, request)
|
||||||
@ -449,7 +448,7 @@ class PrefixIPAddressesView(generic.ObjectView):
|
|||||||
if request.GET.get('show_available', 'true') == 'true':
|
if request.GET.get('show_available', 'true') == 'true':
|
||||||
ipaddresses = add_available_ipaddresses(instance.prefix, ipaddresses, instance.is_pool)
|
ipaddresses = add_available_ipaddresses(instance.prefix, ipaddresses, instance.is_pool)
|
||||||
|
|
||||||
table = tables.IPAddressTable(ipaddresses)
|
table = tables.IPAddressTable(ipaddresses, user=request.user)
|
||||||
if request.user.has_perm('ipam.change_ipaddress') or request.user.has_perm('ipam.delete_ipaddress'):
|
if request.user.has_perm('ipam.change_ipaddress') or request.user.has_perm('ipam.delete_ipaddress'):
|
||||||
table.columns.show('pk')
|
table.columns.show('pk')
|
||||||
paginate_table(table, request)
|
paginate_table(table, request)
|
||||||
@ -457,10 +456,10 @@ class PrefixIPAddressesView(generic.ObjectView):
|
|||||||
bulk_querystring = 'vrf_id={}&parent={}'.format(instance.vrf.pk if instance.vrf else '0', instance.prefix)
|
bulk_querystring = 'vrf_id={}&parent={}'.format(instance.vrf.pk if instance.vrf else '0', instance.prefix)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'first_available_ip': instance.get_first_available_ip(),
|
|
||||||
'table': table,
|
'table': table,
|
||||||
'bulk_querystring': bulk_querystring,
|
'bulk_querystring': bulk_querystring,
|
||||||
'active_tab': 'ip-addresses',
|
'active_tab': 'ip-addresses',
|
||||||
|
'first_available_ip': instance.get_first_available_ip(),
|
||||||
'show_available': request.GET.get('show_available', 'true') == 'true',
|
'show_available': request.GET.get('show_available', 'true') == 'true',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,7 +181,6 @@ class ObjectListView(ObjectPermissionRequiredMixin, View):
|
|||||||
'table': table,
|
'table': table,
|
||||||
'permissions': permissions,
|
'permissions': permissions,
|
||||||
'action_buttons': self.action_buttons,
|
'action_buttons': self.action_buttons,
|
||||||
'table_config_form': TableConfigForm(table=table),
|
|
||||||
'filter_form': self.filterset_form(request.GET, label_suffix='') if self.filterset_form else None,
|
'filter_form': self.filterset_form(request.GET, label_suffix='') if self.filterset_form else None,
|
||||||
}
|
}
|
||||||
context.update(self.extra_context())
|
context.update(self.extra_context())
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
{% extends 'ipam/prefix/base.html' %}
|
{% extends 'ipam/prefix/base.html' %}
|
||||||
|
{% load helpers %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
{% block extra_controls %}
|
{% block extra_controls %}
|
||||||
{% if perms.ipam.add_ipaddress and active_tab == 'ip-addresses' and first_available_ip %}
|
{% if perms.ipam.add_ipaddress and active_tab == 'ip-addresses' and first_available_ip %}
|
||||||
@ -11,7 +13,13 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col col-md-12">
|
<div class="col col-md-12">
|
||||||
|
{% include 'inc/table_controls.html' with table_modal="IPAddressTable_config" %}
|
||||||
{% include 'utilities/obj_table.html' with heading='IP Addresses' bulk_edit_url='ipam:ipaddress_bulk_edit' bulk_delete_url='ipam:ipaddress_bulk_delete' %}
|
{% include 'utilities/obj_table.html' with heading='IP Addresses' bulk_edit_url='ipam:ipaddress_bulk_edit' bulk_delete_url='ipam:ipaddress_bulk_delete' %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% table_config_form table table_name="IPAddressTable" %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block javascript %}
|
||||||
|
<script src="{% static 'js/tableconfig.js' %}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -1,10 +1,17 @@
|
|||||||
{% extends 'ipam/prefix/base.html' %}
|
{% extends 'ipam/prefix/base.html' %}
|
||||||
|
{% load helpers %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col col-md-12">
|
<div class="col col-md-12">
|
||||||
|
{% include 'inc/table_controls.html' with table_modal="IPRangeTable_config" %}
|
||||||
{% include 'utilities/obj_table.html' with heading='Child IP Ranges' bulk_edit_url='ipam:prefix_bulk_edit' bulk_delete_url='ipam:prefix_bulk_delete' parent=prefix %}
|
{% include 'utilities/obj_table.html' with heading='Child IP Ranges' bulk_edit_url='ipam:prefix_bulk_edit' bulk_delete_url='ipam:prefix_bulk_delete' parent=prefix %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% table_config_form table table_name="IPRangeTable" %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block javascript %}
|
||||||
|
<script src="{% static 'js/tableconfig.js' %}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -2,20 +2,17 @@
|
|||||||
{% load helpers %}
|
{% load helpers %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
{% block buttons %}
|
{% block extra_controls %}
|
||||||
{% include 'ipam/inc/toggle_available.html' %}
|
{% include 'ipam/inc/toggle_available.html' %}
|
||||||
{% if request.user.is_authenticated and table_config_form %}
|
|
||||||
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#PrefixDetailTable_config" title="Configure table"><i class="mdi mdi-cog"></i> Configure</button>
|
|
||||||
{% endif %}
|
|
||||||
{% if perms.ipam.add_prefix and active_tab == 'prefixes' and first_available_prefix %}
|
{% if perms.ipam.add_prefix and active_tab == 'prefixes' and first_available_prefix %}
|
||||||
<a href="{% url 'ipam:prefix_add' %}?prefix={{ first_available_prefix }}&vrf={{ object.vrf.pk }}&site={{ object.site.pk }}&tenant_group={{ object.tenant.group.pk }}&tenant={{ object.tenant.pk }}" class="btn btn-success">
|
<a href="{% url 'ipam:prefix_add' %}?prefix={{ first_available_prefix }}&vrf={{ object.vrf.pk }}&site={{ object.site.pk }}&tenant_group={{ object.tenant.group.pk }}&tenant={{ object.tenant.pk }}" class="btn btn-sm btn-success">
|
||||||
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> Add Child Prefix
|
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> Add Child Prefix
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if perms.ipam.add_ipaddress and active_tab == 'ip-addresses' and first_available_ip %}
|
{% if perms.ipam.add_ipaddress and active_tab == 'ip-addresses' and first_available_ip %}
|
||||||
<a href="{% url 'ipam:ipaddress_add' %}?address={{ first_available_ip }}&vrf={{ object.vrf.pk }}&tenant_group={{ object.tenant.group.pk }}&tenant={{ object.tenant.pk }}" class="btn btn-success">
|
<a href="{% url 'ipam:ipaddress_add' %}?address={{ first_available_ip }}&vrf={{ object.vrf.pk }}&tenant_group={{ object.tenant.group.pk }}&tenant={{ object.tenant.pk }}" class="btn btn-sm btn-success">
|
||||||
<span class="mdi mdi-plus-thick" aria-hidden="true"></span>
|
<span class="mdi mdi-plus-thick" aria-hidden="true"></span>
|
||||||
Add an IP Address
|
Add Child IP Address
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
@ -24,12 +21,13 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col col-md-12">
|
<div class="col col-md-12">
|
||||||
|
{% include 'inc/table_controls.html' with table_modal="PrefixDetailTable_config" %}
|
||||||
{% include 'utilities/obj_table.html' with heading='Child Prefixes' bulk_edit_url='ipam:prefix_bulk_edit' bulk_delete_url='ipam:prefix_bulk_delete' parent=prefix %}
|
{% include 'utilities/obj_table.html' with heading='Child Prefixes' bulk_edit_url='ipam:prefix_bulk_edit' bulk_delete_url='ipam:prefix_bulk_delete' parent=prefix %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% table_config_form prefix_table table_name="PrefixDetailTable" %}
|
{% table_config_form table table_name="PrefixDetailTable" %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block javascript %}
|
{% block javascript %}
|
||||||
<script src="{% static 'js/tableconfig.js' %}"></script>
|
<script src="{% static 'js/tableconfig.js' %}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -7,11 +7,11 @@
|
|||||||
<h5 class="modal-title">Table Configuration</h5>
|
<h5 class="modal-title">Table Configuration</h5>
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<form class="form-horizontal userconfigform" data-config-root="tables.{{ table_config_form.table_name }}">
|
<form class="form-horizontal userconfigform" data-config-root="tables.{{ form.table_name }}">
|
||||||
<div class="modal-body row">
|
<div class="modal-body row">
|
||||||
<div class="col-5 text-center">
|
<div class="col-5 text-center">
|
||||||
{{ table_config_form.available_columns.label }}
|
{{ form.available_columns.label }}
|
||||||
{{ table_config_form.available_columns }}
|
{{ form.available_columns }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-2 d-flex align-items-center">
|
<div class="col-2 d-flex align-items-center">
|
||||||
<div>
|
<div>
|
||||||
@ -24,8 +24,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-5 text-center">
|
<div class="col-5 text-center">
|
||||||
{{ table_config_form.columns.label }}
|
{{ form.columns.label }}
|
||||||
{{ table_config_form.columns }}
|
{{ form.columns }}
|
||||||
<a class="btn btn-primary btn-sm mt-2" id="move-option-up" data-target="id_columns">
|
<a class="btn btn-primary btn-sm mt-2" id="move-option-up" data-target="id_columns">
|
||||||
<i class="mdi mdi-arrow-up-bold"></i> Move Up
|
<i class="mdi mdi-arrow-up-bold"></i> Move Up
|
||||||
</a>
|
</a>
|
||||||
|
@ -401,7 +401,7 @@ def badge(value, bg_class='secondary', show_empty=False):
|
|||||||
def table_config_form(table, table_name=None):
|
def table_config_form(table, table_name=None):
|
||||||
return {
|
return {
|
||||||
'table_name': table_name or table.__class__.__name__,
|
'table_name': table_name or table.__class__.__name__,
|
||||||
'table_config_form': TableConfigForm(table=table),
|
'form': TableConfigForm(table=table),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user