From 44c7786cd945d20c319586486c983aab11c2167d Mon Sep 17 00:00:00 2001 From: Arthur Hanson Date: Wed, 18 Sep 2024 14:05:02 -0700 Subject: [PATCH 1/6] 17521 fix error message toast color in dark mode --- netbox/project-static/dist/netbox.css | Bin 554338 -> 554399 bytes .../styles/overrides/_tabler.scss | 3 +++ 2 files changed, 3 insertions(+) diff --git a/netbox/project-static/dist/netbox.css b/netbox/project-static/dist/netbox.css index f1b9e24e23ae8510895a55af5db0c4ccabca521f..6f4f8ac3648e3912d5d823e73442fc2c8be46fea 100644 GIT binary patch delta 47 zcmaF#N^$;c#fBEf7N!>F7M2#)7Pc1lEgZHH)4S3*q*zPx6N^ix2Rvqz+in}dp(+ai DuxAi| delta 31 mcmbRLTJg~<#fBEf7N!>F7M2#)7Pc1lEgZHH+p8itRAm9mt_t-4 diff --git a/netbox/project-static/styles/overrides/_tabler.scss b/netbox/project-static/styles/overrides/_tabler.scss index 814a6d82b..252da8f4a 100644 --- a/netbox/project-static/styles/overrides/_tabler.scss +++ b/netbox/project-static/styles/overrides/_tabler.scss @@ -128,6 +128,9 @@ body[data-bs-theme=dark] { .footer .text-primary { color: white !important; } + .toast { + color: var(--#{$prefix}body-color); + } } // Do not apply padding to elements inside a

From 8e6a15a25e5e4c940588791cd932fbab8db99026 Mon Sep 17 00:00:00 2001
From: Arthur Hanson 
Date: Wed, 18 Sep 2024 10:23:36 -0700
Subject: [PATCH 2/6] 14201 allow searching for ASN with prefix AS

---
 netbox/ipam/models/asns.py | 4 ++++
 netbox/ipam/search.py      | 1 +
 2 files changed, 5 insertions(+)

diff --git a/netbox/ipam/models/asns.py b/netbox/ipam/models/asns.py
index ba483a745..d02efd91c 100644
--- a/netbox/ipam/models/asns.py
+++ b/netbox/ipam/models/asns.py
@@ -149,3 +149,7 @@ class ASN(PrimaryModel):
             return f'{self.asn} ({self.asn // 65536}.{self.asn % 65536})'
         else:
             return self.asn
+
+    @property
+    def prefixed_name(self):
+        return f'AS{self.asn_with_asdot}'
diff --git a/netbox/ipam/search.py b/netbox/ipam/search.py
index 59b741b8f..414321b7d 100644
--- a/netbox/ipam/search.py
+++ b/netbox/ipam/search.py
@@ -19,6 +19,7 @@ class ASNIndex(SearchIndex):
     model = models.ASN
     fields = (
         ('asn', 100),
+        ('prefixed_name', 110),
         ('description', 500),
     )
     display_attrs = ('rir', 'tenant', 'description')

From 6d0a3485a11ba7a74dff0553758508515f0975af Mon Sep 17 00:00:00 2001
From: Arthur Hanson 
Date: Tue, 17 Sep 2024 13:16:09 -0700
Subject: [PATCH 3/6] 17522 enable localization of user preference form

---
 netbox/netbox/preferences.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/netbox/netbox/preferences.py b/netbox/netbox/preferences.py
index d911aabb0..4fdb7e31f 100644
--- a/netbox/netbox/preferences.py
+++ b/netbox/netbox/preferences.py
@@ -1,5 +1,5 @@
 from django.conf import settings
-from django.utils.translation import gettext as _
+from django.utils.translation import gettext_lazy as _
 
 from netbox.registry import registry
 from users.preferences import UserPreference

From 8deaaae44b8f11cccded9702a62fb0bda53dff05 Mon Sep 17 00:00:00 2001
From: bctiemann 
Date: Thu, 19 Sep 2024 13:07:36 -0400
Subject: [PATCH 4/6] Fixes: #17083 - Wrap labels in a div to reduce
 inadvertently clickable area to their left in forms (#17525)

* Wrap labels in a div to reduce inadvertently clickable area to their left in forms

* Set form label to be inline-block
---
 netbox/utilities/templates/form_helpers/render_field.html | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/netbox/utilities/templates/form_helpers/render_field.html b/netbox/utilities/templates/form_helpers/render_field.html
index 47d1f8d10..9abaaa633 100644
--- a/netbox/utilities/templates/form_helpers/render_field.html
+++ b/netbox/utilities/templates/form_helpers/render_field.html
@@ -6,9 +6,11 @@
 
   {# Render the field label (if any), except for checkboxes #}
   {% if label and not field|widget_type == 'checkboxinput' %}
-    
+    
+ +
{% endif %} {# Render the field itself #} From f4d4483050afbf52b9e08a64c469442c108f40d7 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Date: Tue, 17 Sep 2024 10:30:27 -0700 Subject: [PATCH 5/6] 17517 fix cable creation when switching device type --- netbox/dcim/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index 1f5b73603..98665a7a0 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -3253,10 +3253,10 @@ class CableEditView(generic.ObjectEditView): doesn't currently provide a hook for dynamic class resolution. """ a_terminations_type = CABLE_TERMINATION_TYPES.get( - request.GET.get('a_terminations_type') or request.POST.get('a_terminations_type') + request.POST.get('a_terminations_type') or request.GET.get('a_terminations_type') ) b_terminations_type = CABLE_TERMINATION_TYPES.get( - request.GET.get('b_terminations_type') or request.POST.get('b_terminations_type') + request.POST.get('b_terminations_type') or request.GET.get('b_terminations_type') ) if obj.pk: From 2dd5c82845a1eab2a746cbeec33a350ac4e4a1dc Mon Sep 17 00:00:00 2001 From: bctiemann Date: Thu, 19 Sep 2024 13:51:24 -0400 Subject: [PATCH 6/6] Fixes: #15408 - Add primary_ip4 and primary_ip6 to bulk import form for VDC (#17509) * Add primary_ip4 and primary_ip6 to bulk import form for VDC * Specify IPAddress querysets with address field accessor and labels * Filter primary_ip4/ip6 querysets to only those IPs available on the device * Fix comment * Make ipv6 help text more correct * Shorten IPv6 example --------- Co-authored-by: Jeremy Stretch --- netbox/dcim/forms/bulk_import.py | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/netbox/dcim/forms/bulk_import.py b/netbox/dcim/forms/bulk_import.py index 9b4a8475b..e9c8b362e 100644 --- a/netbox/dcim/forms/bulk_import.py +++ b/netbox/dcim/forms/bulk_import.py @@ -9,7 +9,7 @@ from dcim.choices import * from dcim.constants import * from dcim.models import * from extras.models import ConfigTemplate -from ipam.models import VRF +from ipam.models import VRF, IPAddress from netbox.forms import NetBoxModelImportForm from tenancy.models import Tenant from utilities.forms.fields import ( @@ -1435,9 +1435,33 @@ class VirtualDeviceContextImportForm(NetBoxModelImportForm): label=_('Status'), choices=VirtualDeviceContextStatusChoices, ) + primary_ip4 = CSVModelChoiceField( + label=_('Primary IPv4'), + queryset=IPAddress.objects.all(), + required=False, + to_field_name='address', + help_text=_('IPv4 address with mask, e.g. 1.2.3.4/24') + ) + primary_ip6 = CSVModelChoiceField( + label=_('Primary IPv6'), + queryset=IPAddress.objects.all(), + required=False, + to_field_name='address', + help_text=_('IPv6 address with prefix length, e.g. 2001:db8::1/64') + ) class Meta: fields = [ - 'name', 'device', 'status', 'tenant', 'identifier', 'comments', + 'name', 'device', 'status', 'tenant', 'identifier', 'comments', 'primary_ip4', 'primary_ip6', ] model = VirtualDeviceContext + + def __init__(self, data=None, *args, **kwargs): + super().__init__(data, *args, **kwargs) + + if data: + + # Limit primary_ip4/ip6 querysets by assigned device + params = {f"interface__device__{self.fields['device'].to_field_name}": data.get('device')} + self.fields['primary_ip4'].queryset = self.fields['primary_ip4'].queryset.filter(**params) + self.fields['primary_ip6'].queryset = self.fields['primary_ip6'].queryset.filter(**params)