1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Merge branch 'develop' into 9665-rack-elevation-sorting

This commit is contained in:
Arthur
2022-09-01 09:38:38 -07:00
6 changed files with 19 additions and 12 deletions

View File

@ -11,6 +11,7 @@
### Bug Fixes
* [#9328](https://github.com/netbox-community/netbox/issues/9328) - Hide available IPs when non-default ordering is applied
* [#9895](https://github.com/netbox-community/netbox/issues/9895) - Various corrections to OpenAPI spec
* [#9962](https://github.com/netbox-community/netbox/issues/9962) - SSO login should respect `next` URL query parameter
* [#9963](https://github.com/netbox-community/netbox/issues/9963) - Fix support for custom `CSRF_COOKIE_NAME` value
@ -21,8 +22,10 @@
* [#10177](https://github.com/netbox-community/netbox/issues/10177) - Correct display of custom fields when editing VM interfaces
* [#10178](https://github.com/netbox-community/netbox/issues/10178) - Display manufacturer name alongside device type under device view
* [#10181](https://github.com/netbox-community/netbox/issues/10181) - Restore MultiPartParser (regression from #10031)
* [#10184](https://github.com/netbox-community/netbox/issues/10184) - Fix vertical alignment when displaying object attributes with buttons
* [#10208](https://github.com/netbox-community/netbox/issues/10208) - Fix permissions evaluation for interface actions dropdown menu
* [#10217](https://github.com/netbox-community/netbox/issues/10217) - Handle exception when trace splits to multiple rear ports
* [#10220](https://github.com/netbox-community/netbox/issues/10220) - Validate IP version when assigning primary IPs to a virtual machine
---

View File

@ -526,9 +526,8 @@ class PrefixIPAddressesView(generic.ObjectChildrenView):
return parent.get_child_ips().restrict(request.user, 'view').prefetch_related('vrf', 'tenant', 'tenant__group')
def prep_table_data(self, request, queryset, parent):
if not request.GET.get('q'):
if not request.GET.get('q') and not request.GET.get('sort'):
return add_available_ipaddresses(parent.prefix, queryset, parent.is_pool)
return queryset
def get_extra_context(self, request, instance):

View File

@ -46,10 +46,10 @@
</tr>
<tr>
<th scope="row">Rack</th>
<td>
<td class="position-relative">
{% if object.rack %}
{{ object.rack|linkify }}
<div class="float-end noprint">
<div class="position-absolute top-50 end-0 translate-middle-y noprint">
<a href="{{ object.rack.get_absolute_url }}?device={{ object.pk }}" class="btn btn-primary btn-sm" title="Highlight device">
<i class="mdi mdi-view-day-outline"></i>
</a>

View File

@ -58,9 +58,9 @@
</tr>
<tr>
<th scope="row">Racks</th>
<td>
<td class="position-relative">
{% if rack_count %}
<div class="float-end noprint">
<div class="position-absolute top-50 end-0 translate-middle-y noprint">
<a href="{% url 'dcim:rack_elevation_list' %}?location_id={{ object.pk }}" class="btn btn-sm btn-primary" title="View elevations">
<i class="mdi mdi-server"></i>
</a>

View File

@ -85,11 +85,11 @@
</tr>
<tr>
<th scope="row">Physical Address</th>
<td>
<td class="position-relative">
{% if object.physical_address %}
<div class="float-end noprint">
<div class="position-absolute top-50 end-0 translate-middle-y noprint">
<a href="{{ config.MAPS_URL }}{{ object.physical_address|urlencode }}" target="_blank" class="btn btn-primary btn-sm">
<i class="mdi mdi-map-marker"></i> Map It
<i class="mdi mdi-map-marker"></i> Map
</a>
</div>
<span>{{ object.physical_address|linebreaksbr }}</span>
@ -104,9 +104,9 @@
</tr>
<tr>
<th scope="row">GPS Coordinates</th>
<td>
<td class="position-relative">
{% if object.latitude and object.longitude %}
<div class="float-end noprint">
<div class="position-absolute top-50 end-0 translate-middle-y noprint">
<a href="{{ config.MAPS_URL }}{{ object.latitude }},{{ object.longitude }}" target="_blank" class="btn btn-primary btn-sm">
<i class="mdi mdi-map-marker"></i> Map It
</a>

View File

@ -368,9 +368,14 @@ class VirtualMachine(NetBoxModel, ConfigContextModel):
# Validate primary IP addresses
interfaces = self.interfaces.all()
for field in ['primary_ip4', 'primary_ip6']:
for family in (4, 6):
field = f'primary_ip{family}'
ip = getattr(self, field)
if ip is not None:
if ip.address.version != family:
raise ValidationError({
field: f"Must be an IPv{family} address. ({ip} is an IPv{ip.address.version} address.)",
})
if ip.assigned_object in interfaces:
pass
elif ip.nat_inside is not None and ip.nat_inside.assigned_object in interfaces: