From f59c6699f63d40296088a583ff9cf21142beac08 Mon Sep 17 00:00:00 2001 From: Arthur Date: Mon, 28 Nov 2022 10:29:25 -0800 Subject: [PATCH 01/10] 11025 fix error tag toast --- netbox/utilities/templatetags/helpers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/netbox/utilities/templatetags/helpers.py b/netbox/utilities/templatetags/helpers.py index 462b37feb..139562355 100644 --- a/netbox/utilities/templatetags/helpers.py +++ b/netbox/utilities/templatetags/helpers.py @@ -215,6 +215,7 @@ def status_from_tag(tag: str = "info") -> str: 'warning': 'warning', 'success': 'success', 'error': 'danger', + 'danger': 'danger', 'debug': 'info', 'info': 'info', } From 9e51a8d9d2900ac919f896fc6999108b1d936306 Mon Sep 17 00:00:00 2001 From: Arthur Date: Mon, 28 Nov 2022 08:45:24 -0800 Subject: [PATCH 02/10] 10999 fix power utilization on Device detail --- netbox/templates/dcim/device.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/templates/dcim/device.html b/netbox/templates/dcim/device.html index 19e7e6e3c..0080c8cf3 100644 --- a/netbox/templates/dcim/device.html +++ b/netbox/templates/dcim/device.html @@ -229,7 +229,7 @@ Utilization {% for powerport in object.powerports.all %} - {% with utilization=powerport.get_power_draw powerfeed=powerport.connected_endpoint %} + {% with utilization=powerport.get_power_draw powerfeed=powerport.connected_endpoints.0 %} {{ powerport }} {{ utilization.outlet_count }} From 3bd560add8cf9dc9d9304c7ce995556c205987c3 Mon Sep 17 00:00:00 2001 From: Patrick Hurrelmann Date: Wed, 30 Nov 2022 13:39:22 +0100 Subject: [PATCH 03/10] Fixes #11028 - Enable clearing of the color field for front and rear ports in bulk edit --- netbox/dcim/forms/bulk_edit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netbox/dcim/forms/bulk_edit.py b/netbox/dcim/forms/bulk_edit.py index 396f7e59b..db2d3ca2a 100644 --- a/netbox/dcim/forms/bulk_edit.py +++ b/netbox/dcim/forms/bulk_edit.py @@ -1218,7 +1218,7 @@ class FrontPortBulkEditForm( fieldsets = ( (None, ('module', 'type', 'label', 'color', 'description', 'mark_connected')), ) - nullable_fields = ('module', 'label', 'description') + nullable_fields = ('module', 'label', 'description', 'color') class RearPortBulkEditForm( @@ -1229,7 +1229,7 @@ class RearPortBulkEditForm( fieldsets = ( (None, ('module', 'type', 'label', 'color', 'description', 'mark_connected')), ) - nullable_fields = ('module', 'label', 'description') + nullable_fields = ('module', 'label', 'description', 'color') class ModuleBayBulkEditForm( From cf0258204f4a032c84c38affe4c3f3a84eb4fc02 Mon Sep 17 00:00:00 2001 From: Arthur Date: Tue, 29 Nov 2022 11:02:35 -0800 Subject: [PATCH 04/10] 11048 fix connected_endpoint refs --- docs/customization/reports.md | 4 ++-- netbox/dcim/models/device_components.py | 2 +- netbox/templates/dcim/interface.html | 2 +- netbox/templates/dcim/rack.html | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/customization/reports.md b/docs/customization/reports.md index 150c32f40..ab2f1f81b 100644 --- a/docs/customization/reports.md +++ b/docs/customization/reports.md @@ -45,7 +45,7 @@ class DeviceConnectionsReport(Report): # Check that every console port for every active device has a connection defined. active = DeviceStatusChoices.STATUS_ACTIVE for console_port in ConsolePort.objects.prefetch_related('device').filter(device__status=active): - if console_port.connected_endpoint is None: + if not console_port.connected_endpoints: self.log_failure( console_port.device, "No console connection defined for {}".format(console_port.name) @@ -64,7 +64,7 @@ class DeviceConnectionsReport(Report): for device in Device.objects.filter(status=DeviceStatusChoices.STATUS_ACTIVE): connected_ports = 0 for power_port in PowerPort.objects.filter(device=device): - if power_port.connected_endpoint is not None: + if power_port.connected_endpoints: connected_ports += 1 if not power_port.path.is_active: self.log_warning( diff --git a/netbox/dcim/models/device_components.py b/netbox/dcim/models/device_components.py index 8f1285901..ce768e439 100644 --- a/netbox/dcim/models/device_components.py +++ b/netbox/dcim/models/device_components.py @@ -189,7 +189,7 @@ class PathEndpoint(models.Model): dcim.signals in response to changes in the cable path, and complements the `origin` GenericForeignKey field on the CablePath model. `_path` should not be accessed directly; rather, use the `path` property. - `connected_endpoint()` is a convenience method for returning the destination of the associated CablePath, if any. + `connected_endpoints()` is a convenience method for returning the destination of the associated CablePath, if any. """ _path = models.ForeignKey( to='dcim.CablePath', diff --git a/netbox/templates/dcim/interface.html b/netbox/templates/dcim/interface.html index 887433d7b..49078c8db 100644 --- a/netbox/templates/dcim/interface.html +++ b/netbox/templates/dcim/interface.html @@ -210,7 +210,7 @@
Wireless
- {% with peer=object.connected_endpoint %} + {% with peer=object.connected_endpoints.0 %} diff --git a/netbox/templates/dcim/rack.html b/netbox/templates/dcim/rack.html index 51e873ffa..87ece4169 100644 --- a/netbox/templates/dcim/rack.html +++ b/netbox/templates/dcim/rack.html @@ -173,7 +173,7 @@ - {% with power_port=powerfeed.connected_endpoint %} + {% with power_port=powerfeed.connected_endpoints.0 %} {% if power_port %} {% else %} From 4ed45e4031eed85431fa1c1cba74dd33438596a3 Mon Sep 17 00:00:00 2001 From: Arthur Date: Mon, 28 Nov 2022 09:59:33 -0800 Subject: [PATCH 05/10] 11014 fix rack elevation name sorting --- netbox/dcim/views.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index 5930d6b2d..199009286 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -590,14 +590,14 @@ class RackElevationListView(generic.ObjectListView): total_count = racks.count() ORDERING_CHOICES = { - 'name': 'Name (A-Z)', - '-name': 'Name (Z-A)', + '_name': 'Name (A-Z)', + '-_name': 'Name (Z-A)', 'facility_id': 'Facility ID (A-Z)', '-facility_id': 'Facility ID (Z-A)', } - sort = request.GET.get('sort', "name") + sort = request.GET.get('sort', "_name") if sort not in ORDERING_CHOICES: - sort = 'name' + sort = '_name' racks = racks.order_by(sort) From b36afdc92407167cce82e33277083a4b2130bb21 Mon Sep 17 00:00:00 2001 From: Arthur Date: Tue, 29 Nov 2022 11:21:13 -0800 Subject: [PATCH 06/10] 11014 code review changes --- netbox/dcim/views.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index 199009286..7decb8b36 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -590,14 +590,16 @@ class RackElevationListView(generic.ObjectListView): total_count = racks.count() ORDERING_CHOICES = { - '_name': 'Name (A-Z)', - '-_name': 'Name (Z-A)', + 'name': 'Name (A-Z)', + '-name': 'Name (Z-A)', 'facility_id': 'Facility ID (A-Z)', '-facility_id': 'Facility ID (Z-A)', } - sort = request.GET.get('sort', "_name") + sort = request.GET.get('sort', "name") if sort not in ORDERING_CHOICES: - sort = '_name' + sort = 'name' + sort_choice = sort + sort = sort.replace("name", "_name") racks = racks.order_by(sort) @@ -622,7 +624,7 @@ class RackElevationListView(generic.ObjectListView): 'page': page, 'total_count': total_count, 'sort': sort, - 'sort_display_name': ORDERING_CHOICES[sort], + 'sort_display_name': ORDERING_CHOICES[sort_choice], 'sort_choices': ORDERING_CHOICES, 'rack_face': rack_face, 'filter_form': forms.RackElevationFilterForm(request.GET), From 00d72f18cf12121d41b6bff38e11dd133e94ea48 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Wed, 30 Nov 2022 15:22:13 -0500 Subject: [PATCH 07/10] Annotate need for natural ordering --- netbox/dcim/views.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index 7decb8b36..e8a7c66bd 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -589,19 +589,18 @@ class RackElevationListView(generic.ObjectListView): racks = filtersets.RackFilterSet(request.GET, self.queryset).qs total_count = racks.count() + # Ordering ORDERING_CHOICES = { 'name': 'Name (A-Z)', '-name': 'Name (Z-A)', 'facility_id': 'Facility ID (A-Z)', '-facility_id': 'Facility ID (Z-A)', } - sort = request.GET.get('sort', "name") + sort = request.GET.get('sort', 'name') if sort not in ORDERING_CHOICES: sort = 'name' - sort_choice = sort - sort = sort.replace("name", "_name") - - racks = racks.order_by(sort) + sort_field = sort.replace("name", "_name") # Use natural ordering + racks = racks.order_by(sort_field) # Pagination per_page = get_paginate_count(request) @@ -624,7 +623,7 @@ class RackElevationListView(generic.ObjectListView): 'page': page, 'total_count': total_count, 'sort': sort, - 'sort_display_name': ORDERING_CHOICES[sort_choice], + 'sort_display_name': ORDERING_CHOICES[sort], 'sort_choices': ORDERING_CHOICES, 'rack_face': rack_face, 'filter_form': forms.RackElevationFilterForm(request.GET), From 281934cf3445eb343abd7bab18eccacb292525e8 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Wed, 30 Nov 2022 15:37:50 -0500 Subject: [PATCH 08/10] Fixes #11047: Cloning a rack reservation should replicate rack & user --- docs/release-notes/version-3.3.md | 3 +++ netbox/dcim/models/racks.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/docs/release-notes/version-3.3.md b/docs/release-notes/version-3.3.md index ffb3b9ffe..069926022 100644 --- a/docs/release-notes/version-3.3.md +++ b/docs/release-notes/version-3.3.md @@ -21,6 +21,9 @@ * [#10969](https://github.com/netbox-community/netbox/issues/10969) - Update cable paths ending at associated rear port when creating new front ports * [#10996](https://github.com/netbox-community/netbox/issues/10996) - Hide checkboxes on child object lists when no bulk operations are available * [#10997](https://github.com/netbox-community/netbox/issues/10997) - Fix exception when editing NAT IP for VM with no cluster +* [#11014](https://github.com/netbox-community/netbox/issues/11014) - Use natural ordering when sorting rack elevations by name +* [#11028](https://github.com/netbox-community/netbox/issues/11028) - Enable bulk clearing of color attribute of pass-through ports +* [#11047](https://github.com/netbox-community/netbox/issues/11047) - Cloning a rack reservation should replicate rack & user --- diff --git a/netbox/dcim/models/racks.py b/netbox/dcim/models/racks.py index 20027675a..df4702501 100644 --- a/netbox/dcim/models/racks.py +++ b/netbox/dcim/models/racks.py @@ -477,6 +477,8 @@ class RackReservation(NetBoxModel): max_length=200 ) + clone_fields = ('rack', 'user', 'tenant') + class Meta: ordering = ['created', 'pk'] From f2f36c67f6729df2bc59f62986af1ebadd31c59e Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Wed, 30 Nov 2022 15:51:37 -0500 Subject: [PATCH 09/10] Release v3.3.9 --- .github/ISSUE_TEMPLATE/bug_report.yaml | 2 +- .github/ISSUE_TEMPLATE/feature_request.yaml | 2 +- docs/release-notes/version-3.3.md | 2 +- netbox/netbox/settings.py | 2 +- requirements.txt | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 3beec4cf7..03a58a2d7 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -14,7 +14,7 @@ body: attributes: label: NetBox version description: What version of NetBox are you currently running? - placeholder: v3.3.8 + placeholder: v3.3.9 validations: required: true - type: dropdown diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index 6688de9fe..94c879aed 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -14,7 +14,7 @@ body: attributes: label: NetBox version description: What version of NetBox are you currently running? - placeholder: v3.3.8 + placeholder: v3.3.9 validations: required: true - type: dropdown diff --git a/docs/release-notes/version-3.3.md b/docs/release-notes/version-3.3.md index 069926022..6de56fd31 100644 --- a/docs/release-notes/version-3.3.md +++ b/docs/release-notes/version-3.3.md @@ -1,6 +1,6 @@ # NetBox v3.3 -## v3.3.9 (FUTURE) +## v3.3.9 (2022-11-30) ### Enhancements diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index fa5480e19..6ce4148a2 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -29,7 +29,7 @@ django.utils.encoding.force_text = force_str # Environment setup # -VERSION = '3.3.9-dev' +VERSION = '3.3.9' # Hostname HOSTNAME = platform.node() diff --git a/requirements.txt b/requirements.txt index 4504925f6..e920fcb0c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,7 +11,7 @@ django-redis==5.2.0 django-rich==1.4.0 django-rq==2.6.0 django-tables2==2.4.1 -django-taggit==3.0.0 +django-taggit==3.1.0 django-timezone-field==5.0 djangorestframework==3.14.0 drf-yasg[validation]==1.21.4 @@ -19,18 +19,18 @@ graphene-django==2.15.0 gunicorn==20.1.0 Jinja2==3.1.2 Markdown==3.3.7 -mkdocs-material==8.5.10 +mkdocs-material==8.5.11 mkdocstrings[python-legacy]==0.19.0 netaddr==0.8.0 Pillow==9.3.0 psycopg2-binary==2.9.5 PyYAML==6.0 -sentry-sdk==1.11.0 +sentry-sdk==1.11.1 social-auth-app-django==5.0.0 social-auth-core[openidconnect]==4.3.0 svgwrite==1.4.3 tablib==3.2.1 -tzdata==2022.6 +tzdata==2022.7 # Workaround for #7401 jsonschema==3.2.0 From fb407e90768bfb5c224af0e72a1985198e65a57f Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Wed, 30 Nov 2022 16:18:03 -0500 Subject: [PATCH 10/10] PRVB --- docs/release-notes/version-3.3.md | 4 ++++ netbox/netbox/settings.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-3.3.md b/docs/release-notes/version-3.3.md index 6de56fd31..2d62fb5bd 100644 --- a/docs/release-notes/version-3.3.md +++ b/docs/release-notes/version-3.3.md @@ -1,5 +1,9 @@ # NetBox v3.3 +## v3.3.10 (FUTURE) + +--- + ## v3.3.9 (2022-11-30) ### Enhancements diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index 6ce4148a2..773c8753f 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -29,7 +29,7 @@ django.utils.encoding.force_text = force_str # Environment setup # -VERSION = '3.3.9' +VERSION = '3.3.10-dev' # Hostname HOSTNAME = platform.node()
{{ powerfeed|linkify }} {% badge powerfeed.get_status_display bg_color=powerfeed.get_status_color %} {% badge powerfeed.get_type_display bg_color=powerfeed.get_type_color %}{% utilization_graph power_port.get_power_draw.allocated|percentage:powerfeed.available_power %}