Explorar o código

Merge pull request #17876 from netbox-community/develop

Release v4.1.5
Jeremy Stretch hai 1 ano
pai
achega
58d9057ccd
Modificáronse 67 ficheiros con 22645 adicións e 27331 borrados
  1. 2 3
      .github/ISSUE_TEMPLATE/01-feature_request.yaml
  2. 2 3
      .github/ISSUE_TEMPLATE/02-bug_report.yaml
  3. 1 1
      README.md
  4. 5 1
      base_requirements.txt
  5. 52 0
      docs/administration/authentication/google.md
  6. 1 1
      docs/administration/authentication/microsoft-entra-id.md
  7. 3 0
      docs/customization/custom-scripts.md
  8. 1 1
      docs/development/style-guide.md
  9. 4 0
      docs/extra.css
  10. 2 1
      docs/index.md
  11. BIN=BIN
      docs/media/authentication/google_login_portal.png
  12. BIN=BIN
      docs/media/authentication/netbox_google_login.png
  13. 20 0
      docs/netbox_logo_dark.svg
  14. 0 0
      docs/netbox_logo_light.svg
  15. 24 0
      docs/release-notes/version-4.1.md
  16. 1 0
      mkdocs.yml
  17. 4 2
      netbox/core/models/jobs.py
  18. 2 1
      netbox/dcim/graphql/types.py
  19. 1 1
      netbox/dcim/models/cables.py
  20. 0 1
      netbox/extras/jobs.py
  21. 1 1
      netbox/extras/utils.py
  22. 2 0
      netbox/ipam/fields.py
  23. 29 74
      netbox/ipam/forms/bulk_edit.py
  24. 7 7
      netbox/ipam/models/ip.py
  25. 29 0
      netbox/ipam/tests/test_models.py
  26. 1 1
      netbox/manage.py
  27. 4 4
      netbox/netbox/authentication/__init__.py
  28. 2 0
      netbox/netbox/jobs.py
  29. 8 8
      netbox/netbox/tests/test_jobs.py
  30. 6 3
      netbox/netbox/views/generic/bulk_views.py
  31. 0 0
      netbox/project-static/dist/netbox.css
  32. 1 1
      netbox/project-static/package.json
  33. 8 5
      netbox/project-static/styles/custom/_markdown.scss
  34. 5 0
      netbox/project-static/styles/overrides/_tabler.scss
  35. 4 4
      netbox/project-static/yarn.lock
  36. 2 2
      netbox/release.yaml
  37. 3 2
      netbox/templates/core/plugin.html
  38. 1 1
      netbox/templates/dcim/component_list.html
  39. 1 1
      netbox/templates/dcim/device_list.html
  40. 1 14
      netbox/templates/dcim/devicetype/component_templates.html
  41. 2 0
      netbox/templates/dcim/inc/devicetype_breadcrumbs.html
  42. 38 0
      netbox/templates/dcim/inc/moduletype_buttons.html
  43. 12 1
      netbox/templates/dcim/moduletype.html
  44. 0 48
      netbox/templates/dcim/moduletype/base.html
  45. 33 40
      netbox/templates/dcim/moduletype/component_templates.html
  46. 53 53
      netbox/templates/generic/bulk_edit.html
  47. 2 0
      netbox/tenancy/graphql/types.py
  48. 1540 1871
      netbox/translations/cs/LC_MESSAGES/django.po
  49. 1118 1387
      netbox/translations/da/LC_MESSAGES/django.po
  50. 1118 1387
      netbox/translations/de/LC_MESSAGES/django.po
  51. 3034 3558
      netbox/translations/en/LC_MESSAGES/django.po
  52. 1118 1387
      netbox/translations/es/LC_MESSAGES/django.po
  53. 1118 1387
      netbox/translations/fr/LC_MESSAGES/django.po
  54. 1118 1387
      netbox/translations/it/LC_MESSAGES/django.po
  55. 2065 2465
      netbox/translations/ja/LC_MESSAGES/django.po
  56. 1118 1387
      netbox/translations/nl/LC_MESSAGES/django.po
  57. BIN=BIN
      netbox/translations/pl/LC_MESSAGES/django.mo
  58. 1546 1877
      netbox/translations/pl/LC_MESSAGES/django.po
  59. 1118 1387
      netbox/translations/pt/LC_MESSAGES/django.po
  60. 1118 1387
      netbox/translations/ru/LC_MESSAGES/django.po
  61. 1118 1387
      netbox/translations/tr/LC_MESSAGES/django.po
  62. BIN=BIN
      netbox/translations/uk/LC_MESSAGES/django.mo
  63. 1541 1872
      netbox/translations/uk/LC_MESSAGES/django.po
  64. 2464 2911
      netbox/translations/zh/LC_MESSAGES/django.po
  65. 5 2
      netbox/utilities/forms/widgets/select.py
  66. 1 0
      netbox/wireless/graphql/types.py
  67. 7 6
      requirements.txt

+ 2 - 3
.github/ISSUE_TEMPLATE/01-feature_request.yaml

@@ -14,7 +14,7 @@ body:
     attributes:
       label: NetBox version
       description: What version of NetBox are you currently running?
-      placeholder: v4.1.4
+      placeholder: v4.1.5
     validations:
       required: true
   - type: dropdown
@@ -36,9 +36,8 @@ body:
       options:
         - I volunteer to perform this work (if approved)
         - I'm a NetBox Labs customer
-        - This is a very minor change
         - N/A
-      default: 3
+      default: 2
     validations:
       required: true
   - type: textarea

+ 2 - 3
.github/ISSUE_TEMPLATE/02-bug_report.yaml

@@ -31,16 +31,15 @@ body:
       options:
         - I volunteer to perform this work (if approved)
         - I'm a NetBox Labs customer
-        - This is preventing me from using NetBox
         - N/A
-      default: 3
+      default: 2
     validations:
       required: true
   - type: input
     attributes:
       label: NetBox Version
       description: What version of NetBox are you currently running?
-      placeholder: v4.1.4
+      placeholder: v4.1.5
     validations:
       required: true
   - type: dropdown

+ 1 - 1
README.md

@@ -1,5 +1,5 @@
 <div align="center">
-  <img src="https://raw.githubusercontent.com/netbox-community/netbox/develop/docs/netbox_logo.svg" width="400" alt="NetBox logo" />
+  <img src="https://raw.githubusercontent.com/netbox-community/netbox/develop/docs/netbox_logo_light.svg" width="400" alt="NetBox logo" />
   <p><strong>The cornerstone of every automated network</strong></p>
   <a href="https://github.com/netbox-community/netbox/releases"><img src="https://img.shields.io/github/v/release/netbox-community/netbox" alt="Latest release" /></a>
   <a href="https://github.com/netbox-community/netbox/blob/master/LICENSE.txt"><img src="https://img.shields.io/badge/license-Apache_2.0-blue.svg" alt="License" /></a>

+ 5 - 1
base_requirements.txt

@@ -42,7 +42,7 @@ django-rich
 
 # Django integration for RQ (Reqis queuing)
 # https://github.com/rq/django-rq/blob/master/CHANGELOG.md
-django-rq
+django-rq<3.0
 
 # Abstraction models for rendering and paginating HTML tables
 # https://github.com/jieter/django-tables2/blob/master/CHANGELOG.md
@@ -116,6 +116,10 @@ PyYAML
 # https://github.com/psf/requests/blob/main/HISTORY.md
 requests
 
+# rq
+# https://github.com/rq/rq/blob/master/CHANGES.md
+rq<2.0
+
 # Social authentication framework
 # https://github.com/python-social-auth/social-core/blob/master/CHANGELOG.md
 social-auth-core

+ 52 - 0
docs/administration/authentication/google.md

@@ -0,0 +1,52 @@
+# Google
+
+This guide explains how to configure single sign-on (SSO) support for NetBox using [Google OAuth2](https://developers.google.com/identity/protocols/oauth2/web-server) as an authentication backend.
+
+## Google OAuth2 Configuration
+
+1. Log into [console.cloud.google.com](https://console.cloud.google.com/).
+2. Create new project for NetBox.
+3. Under "APIs and Services" click "OAuth consent screen" and enter the required information.
+4. Under "Credentials," click "Create Credentials" and select "OAuth 2.0 Client ID." Select type "Web application."
+    - "Authorized JavaScript origins" should follow the format `http[s]://<netbox>[:<port>]`
+    - "Authorized redirect URIs" should follow the format `http[s]://<netbox>[:<port>]/oauth/complete/google-oauth2/`
+5. Copy the "Client ID" and "Client Secret" values somewhere convenient.
+
+!!! note
+    Google requires the NetBox hostname to use a public top-level-domain (e.g. `.com`, `.net`). The use of IP addresses is not permitted (except `127.0.0.1`).
+
+For more information, consult [Google's documentation](https://developers.google.com/identity/protocols/oauth2/web-server#prerequisites).
+
+## NetBox Configuration
+
+### 1. Enter configuration parameters
+
+Enter the following configuration parameters in `configuration.py`, substituting your own values:
+
+```python
+REMOTE_AUTH_BACKEND = 'social_core.backends.google.GoogleOAuth2'
+SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '{CLIENT_ID}'
+SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = '{CLIENT_SECRET}'
+```
+
+### 2. Restart NetBox
+
+Restart the NetBox services so that the new configuration takes effect. This is typically done with the command below:
+
+```no-highlight
+sudo systemctl restart netbox
+```
+
+## Testing
+
+Log out of NetBox if already authenticated, and click the "Log In" button at top right. You should see the normal login form as well as an option to authenticate using Google. Click that link.
+
+![NetBox Google login form](../../media/authentication/netbox_google_login.png)
+
+You should be redirected to Google's authentication portal. Enter the username/email and password of your test account to continue. You may also be prompted to grant this application access to your account.
+
+![NetBox Google login form](../../media/authentication/google_login_portal.png)
+
+If successful, you will be redirected back to the NetBox UI, and will be logged in as the Google user. You can verify this by navigating to your profile (using the button at top right).
+
+This user account has been replicated locally to NetBox, and can now be assigned groups and permissions.

+ 1 - 1
docs/administration/authentication/microsoft-entra-id.md

@@ -16,7 +16,7 @@ Under the Azure Active Directory dashboard, navigate to **Add > App registration
 
 Enter a name for the registration (e.g. "NetBox") and ensure that the "single tenant" option is selected.
 
-Under "Redirect URI", select "Web" for the platform and enter the path to your NetBox installation, ending with `/oauth/complete/entraid-oauth2/`. Note that this URI **must** begin with `https://` unless you are referencing localhost (for development purposes).
+Under "Redirect URI", select "Web" for the platform and enter the path to your NetBox installation, ending with `/oauth/complete/azuread-oauth2/`. Note that this URI **must** begin with `https://` unless you are referencing localhost (for development purposes).
 
 ![App registration parameters](../../media/authentication/azure_ad_app_registration.png)
 

+ 3 - 0
docs/customization/custom-scripts.md

@@ -72,6 +72,9 @@ script_order = (MyCustomScript, AnotherCustomScript)
 
 Script attributes are defined under a class named `Meta` within the script. These are optional, but encouraged.
 
+!!! warning
+    These are also defined and used as properties on the base custom script class, so don't use the same names as variables or override them in your custom script.
+
 ### `name`
 
 This is the human-friendly names of your script. If omitted, the class name will be used.

+ 1 - 1
docs/development/style-guide.md

@@ -76,4 +76,4 @@ When adding a new dependency, a short description of the package and the URL of
 
 * When referring to NetBox in writing, use the proper form "NetBox," with the letters N and B capitalized. The lowercase form "netbox" should be used in code, filenames, etc. but never "Netbox" or any other deviation.
 
-* There is an SVG form of the NetBox logo at [docs/netbox_logo.svg](../netbox_logo.svg). It is preferred to use this logo for all purposes as it scales to arbitrary sizes without loss of resolution. If a raster image is required, the SVG logo should be converted to a PNG image of the prescribed size.
+* There are SVG forms of the NetBox logo for both [light mode](../netbox_logo_light.svg) and [dark mode](../netbox_logo_dark.svg) available. It is preferred to use the SVG logo for all purposes as it scales to arbitrary sizes without loss of resolution. If a raster image is required, the SVG logo should be converted to a PNG image of the desired size.

+ 4 - 0
docs/extra.css

@@ -5,6 +5,10 @@ img {
     margin-right: auto;
 }
 
+.md-content img {
+    background-color: rgba(255, 255, 255, 0.64);
+}
+
 /* Tables */
 table {
     margin-bottom: 24px;

+ 2 - 1
docs/index.md

@@ -1,4 +1,5 @@
-![NetBox](netbox_logo.svg "NetBox logo"){style="height: 100px; margin-bottom: 3em"}
+![NetBox](netbox_logo_light.svg#only-light "NetBox logo"){style="height: 100px; margin-bottom: 3em; background: none;"}
+![NetBox](netbox_logo_dark.svg#only-dark "NetBox logo"){style="height: 100px; margin-bottom: 3em; background: none;"}
 
 # The Premier Network Source of Truth
 

BIN=BIN
docs/media/authentication/google_login_portal.png


BIN=BIN
docs/media/authentication/netbox_google_login.png


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 20 - 0
docs/netbox_logo_dark.svg


+ 0 - 0
docs/netbox_logo.svg → docs/netbox_logo_light.svg


+ 24 - 0
docs/release-notes/version-4.1.md

@@ -1,5 +1,29 @@
 # NetBox v4.1
 
+## v4.1.5 (2024-10-28)
+
+### Enhancements
+
+* [#17789](https://github.com/netbox-community/netbox/issues/17789) - Provide a single "scope" field for bulk editing VLAN group scope assignments
+
+### Bug Fixes
+
+* [#17358](https://github.com/netbox-community/netbox/issues/17358) - Fix validation of overlapping IP ranges
+* [#17374](https://github.com/netbox-community/netbox/issues/17374) - Fix styling of highlighted table rows in dark mode
+* [#17460](https://github.com/netbox-community/netbox/issues/17460) - Ensure bulk action buttons are consistent for device type components
+* [#17635](https://github.com/netbox-community/netbox/issues/17635) - Ensure AbortTransaction is caught when running a custom script with `commit=False`
+* [#17685](https://github.com/netbox-community/netbox/issues/17685) - Ensure background jobs are validated before being scheduled
+* [#17710](https://github.com/netbox-community/netbox/issues/17710) - Remove cached fields on CableTermination model from GraphQL API
+* [#17740](https://github.com/netbox-community/netbox/issues/17740) - Ensure support for image attachments with a `.webp` file extension
+* [#17749](https://github.com/netbox-community/netbox/issues/17749) - Restore missing `devicetypes` and `children` fields for several objects in GraphQL API
+* [#17754](https://github.com/netbox-community/netbox/issues/17754) - Remove paginator from version history table under plugin view
+* [#17759](https://github.com/netbox-community/netbox/issues/17759) - Retain `job_timeout` value when scheduling a recurring custom script
+* [#17774](https://github.com/netbox-community/netbox/issues/17774) - Fix SSO login support for Entra ID (formerly Azure AD)
+* [#17802](https://github.com/netbox-community/netbox/issues/17802) - Fix background color for bulk rename buttons in list views
+* [#17838](https://github.com/netbox-community/netbox/issues/17838) - Adjust `manage.py` to reference `python3` executable
+
+---
+
 ## v4.1.4 (2024-10-15)
 
 ### Enhancements

+ 1 - 0
mkdocs.yml

@@ -156,6 +156,7 @@ nav:
     - Administration:
         - Authentication:
             - Overview: 'administration/authentication/overview.md'
+            - Google: 'administration/authentication/google.md'
             - Microsoft Entra ID: 'administration/authentication/microsoft-entra-id.md'
             - Okta: 'administration/authentication/okta.md'
         - Permissions: 'administration/permissions.md'

+ 4 - 2
netbox/core/models/jobs.py

@@ -130,7 +130,7 @@ class Job(models.Model):
         super().clean()
 
         # Validate the assigned object type
-        if self.object_type not in ObjectType.objects.with_feature('jobs'):
+        if self.object_type and self.object_type not in ObjectType.objects.with_feature('jobs'):
             raise ValidationError(
                 _("Jobs cannot be assigned to this object type ({type}).").format(type=self.object_type)
             )
@@ -223,7 +223,7 @@ class Job(models.Model):
         rq_queue_name = get_queue_for_model(object_type.model if object_type else None)
         queue = django_rq.get_queue(rq_queue_name)
         status = JobStatusChoices.STATUS_SCHEDULED if schedule_at else JobStatusChoices.STATUS_PENDING
-        job = Job.objects.create(
+        job = Job(
             object_type=object_type,
             object_id=object_id,
             name=name,
@@ -233,6 +233,8 @@ class Job(models.Model):
             user=user,
             job_id=uuid.uuid4()
         )
+        job.full_clean()
+        job.save()
 
         # Run the job immediately, rather than enqueuing it as a background task. Note that this is a synchronous
         # (blocking) operation, and execution will pause until the job completes.

+ 2 - 1
netbox/dcim/graphql/types.py

@@ -112,7 +112,7 @@ class ModularComponentTemplateType(ComponentTemplateType):
 
 @strawberry_django.type(
     models.CableTermination,
-    exclude=('termination_type', 'termination_id'),
+    exclude=('termination_type', 'termination_id', '_device', '_rack', '_location', '_site'),
     filters=CableTerminationFilter
 )
 class CableTerminationType(NetBoxObjectType):
@@ -243,6 +243,7 @@ class DeviceType(ConfigContextMixin, ImageAttachmentsMixin, ContactsMixin, NetBo
     consoleserverports: List[Annotated["ConsoleServerPortType", strawberry.lazy('dcim.graphql.types')]]
     poweroutlets: List[Annotated["PowerOutletType", strawberry.lazy('dcim.graphql.types')]]
     frontports: List[Annotated["FrontPortType", strawberry.lazy('dcim.graphql.types')]]
+    devicebays: List[Annotated["DeviceBayType", strawberry.lazy('dcim.graphql.types')]]
     modulebays: List[Annotated["ModuleBayType", strawberry.lazy('dcim.graphql.types')]]
     services: List[Annotated["ServiceType", strawberry.lazy('ipam.graphql.types')]]
     inventoryitems: List[Annotated["InventoryItemType", strawberry.lazy('dcim.graphql.types')]]

+ 1 - 1
netbox/dcim/models/cables.py

@@ -164,7 +164,7 @@ class Cable(PrimaryModel):
         if self.length is not None and not self.length_unit:
             raise ValidationError(_("Must specify a unit when setting a cable length"))
 
-        if self._state.adding and (not self.a_terminations or not self.b_terminations):
+        if self._state.adding and self.pk is None and (not self.a_terminations or not self.b_terminations):
             raise ValidationError(_("Must define A and B terminations when creating a new cable."))
 
         if self._terminations_modified:

+ 0 - 1
netbox/extras/jobs.py

@@ -49,7 +49,6 @@ class ScriptJob(JobRunner):
                 script.log_info(message=_("Database changes have been reverted automatically."))
                 if script.failed:
                     logger.warning("Script failed")
-                    raise
 
         except Exception as e:
             if type(e) is AbortScript:

+ 1 - 1
netbox/extras/utils.py

@@ -33,7 +33,7 @@ def image_upload(instance, filename):
 
     # Rename the file to the provided name, if any. Attempt to preserve the file extension.
     extension = filename.rsplit('.')[-1].lower()
-    if instance.name and extension in ['bmp', 'gif', 'jpeg', 'jpg', 'png']:
+    if instance.name and extension in ['bmp', 'gif', 'jpeg', 'jpg', 'png', 'webp']:
         filename = '.'.join([instance.name, extension])
     elif instance.name:
         filename = instance.name

+ 2 - 0
netbox/ipam/fields.py

@@ -105,6 +105,8 @@ IPAddressField.register_lookup(lookups.NetIn)
 IPAddressField.register_lookup(lookups.NetHostContained)
 IPAddressField.register_lookup(lookups.NetFamily)
 IPAddressField.register_lookup(lookups.NetMaskLength)
+IPAddressField.register_lookup(lookups.Host)
+IPAddressField.register_lookup(lookups.Inet)
 
 
 class ASNField(models.BigIntegerField):

+ 29 - 74
netbox/ipam/forms/bulk_edit.py

@@ -1,22 +1,23 @@
 from django import forms
 from django.contrib.contenttypes.models import ContentType
+from django.core.exceptions import ObjectDoesNotExist
 from django.utils.translation import gettext_lazy as _
 
-from dcim.models import Location, Rack, Region, Site, SiteGroup
+from dcim.models import Region, Site, SiteGroup
 from ipam.choices import *
 from ipam.constants import *
 from ipam.models import *
 from ipam.models import ASN
 from netbox.forms import NetBoxModelBulkEditForm
 from tenancy.models import Tenant
-from utilities.forms import add_blank_choice
+from utilities.forms import add_blank_choice, get_field_value
 from utilities.forms.fields import (
     CommentField, ContentTypeChoiceField, DynamicModelChoiceField, DynamicModelMultipleChoiceField, NumericArrayField,
     NumericRangeArrayField,
 )
 from utilities.forms.rendering import FieldSet
-from utilities.forms.widgets import BulkEditNullBooleanSelect
-from virtualization.models import Cluster, ClusterGroup
+from utilities.forms.widgets import BulkEditNullBooleanSelect, HTMXSelect
+from utilities.templatetags.builtins.filters import bettertitle
 
 __all__ = (
     'AggregateBulkEditForm',
@@ -429,62 +430,17 @@ class VLANGroupBulkEditForm(NetBoxModelBulkEditForm):
         required=False
     )
     scope_type = ContentTypeChoiceField(
-        label=_('Scope type'),
         queryset=ContentType.objects.filter(model__in=VLANGROUP_SCOPE_TYPES),
-        required=False
-    )
-    scope_id = forms.IntegerField(
-        required=False,
-        widget=forms.HiddenInput()
-    )
-    region = DynamicModelChoiceField(
-        label=_('Region'),
-        queryset=Region.objects.all(),
-        required=False
-    )
-    sitegroup = DynamicModelChoiceField(
-        queryset=SiteGroup.objects.all(),
-        required=False,
-        label=_('Site group')
-    )
-    site = DynamicModelChoiceField(
-        label=_('Site'),
-        queryset=Site.objects.all(),
-        required=False,
-        query_params={
-            'region_id': '$region',
-            'group_id': '$sitegroup',
-        }
-    )
-    location = DynamicModelChoiceField(
-        label=_('Location'),
-        queryset=Location.objects.all(),
+        widget=HTMXSelect(method='post', attrs={'hx-select': '#form_fields'}),
         required=False,
-        query_params={
-            'site_id': '$site',
-        }
-    )
-    rack = DynamicModelChoiceField(
-        label=_('Rack'),
-        queryset=Rack.objects.all(),
-        required=False,
-        query_params={
-            'site_id': '$site',
-            'location_id': '$location',
-        }
+        label=_('Scope type')
     )
-    clustergroup = DynamicModelChoiceField(
-        queryset=ClusterGroup.objects.all(),
+    scope = DynamicModelChoiceField(
+        label=_('Scope'),
+        queryset=Site.objects.none(),  # Initial queryset
         required=False,
-        label=_('Cluster group')
-    )
-    cluster = DynamicModelChoiceField(
-        label=_('Cluster'),
-        queryset=Cluster.objects.all(),
-        required=False,
-        query_params={
-            'group_id': '$clustergroup',
-        }
+        disabled=True,
+        selector=True
     )
     vid_ranges = NumericRangeArrayField(
         label=_('VLAN ID ranges'),
@@ -494,24 +450,23 @@ class VLANGroupBulkEditForm(NetBoxModelBulkEditForm):
     model = VLANGroup
     fieldsets = (
         FieldSet('site', 'vid_ranges', 'description'),
-        FieldSet(
-            'scope_type', 'region', 'sitegroup', 'site', 'location', 'rack', 'clustergroup', 'cluster', name=_('Scope')
-        ),
-    )
-    nullable_fields = ('description',)
-
-    def clean(self):
-        super().clean()
-
-        # Assign scope based on scope_type
-        if self.cleaned_data.get('scope_type'):
-            scope_field = self.cleaned_data['scope_type'].model
-            if scope_obj := self.cleaned_data.get(scope_field):
-                self.cleaned_data['scope_id'] = scope_obj.pk
-                self.changed_data.append('scope_id')
-            else:
-                self.cleaned_data.pop('scope_type')
-                self.changed_data.remove('scope_type')
+        FieldSet('scope_type', 'scope', name=_('Scope')),
+    )
+    nullable_fields = ('description', 'scope')
+
+    def __init__(self, *args, **kwargs):
+        super().__init__(*args, **kwargs)
+
+        if scope_type_id := get_field_value(self, 'scope_type'):
+            try:
+                scope_type = ContentType.objects.get(pk=scope_type_id)
+                model = scope_type.model_class()
+                self.fields['scope'].queryset = model.objects.all()
+                self.fields['scope'].widget.attrs['selector'] = model._meta.label_lower
+                self.fields['scope'].disabled = False
+                self.fields['scope'].label = _(bettertitle(model._meta.verbose_name))
+            except ObjectDoesNotExist:
+                pass
 
 
 class VLANBulkEditForm(NetBoxModelBulkEditForm):

+ 7 - 7
netbox/ipam/models/ip.py

@@ -580,15 +580,15 @@ class IPRange(ContactsMixin, PrimaryModel):
                 })
 
             # Check for overlapping ranges
-            overlapping_range = IPRange.objects.exclude(pk=self.pk).filter(vrf=self.vrf).filter(
-                Q(start_address__gte=self.start_address, start_address__lte=self.end_address) |  # Starts inside
-                Q(end_address__gte=self.start_address, end_address__lte=self.end_address) |  # Ends inside
-                Q(start_address__lte=self.start_address, end_address__gte=self.end_address)  # Starts & ends outside
-            ).first()
-            if overlapping_range:
+            overlapping_ranges = IPRange.objects.exclude(pk=self.pk).filter(vrf=self.vrf).filter(
+                Q(start_address__host__inet__gte=self.start_address.ip, start_address__host__inet__lte=self.end_address.ip) |  # Starts inside
+                Q(end_address__host__inet__gte=self.start_address.ip, end_address__host__inet__lte=self.end_address.ip) |  # Ends inside
+                Q(start_address__host__inet__lte=self.start_address.ip, end_address__host__inet__gte=self.end_address.ip)  # Starts & ends outside
+            )
+            if overlapping_ranges.exists():
                 raise ValidationError(
                     _("Defined addresses overlap with range {overlapping_range} in VRF {vrf}").format(
-                        overlapping_range=overlapping_range,
+                        overlapping_range=overlapping_ranges.first(),
                         vrf=self.vrf
                     ))
 

+ 29 - 0
netbox/ipam/tests/test_models.py

@@ -36,6 +36,35 @@ class TestAggregate(TestCase):
         self.assertEqual(aggregate.get_utilization(), 100)
 
 
+class TestIPRange(TestCase):
+
+    def test_overlapping_range(self):
+        iprange_192_168 = IPRange.objects.create(start_address=IPNetwork('192.168.0.1/22'), end_address=IPNetwork('192.168.0.49/22'))
+        iprange_192_168.clean()
+        iprange_3_1_99 = IPRange.objects.create(start_address=IPNetwork('1.2.3.1/24'), end_address=IPNetwork('1.2.3.99/24'))
+        iprange_3_1_99.clean()
+        iprange_3_100_199 = IPRange.objects.create(start_address=IPNetwork('1.2.3.100/24'), end_address=IPNetwork('1.2.3.199/24'))
+        iprange_3_100_199.clean()
+        iprange_3_200_255 = IPRange.objects.create(start_address=IPNetwork('1.2.3.200/24'), end_address=IPNetwork('1.2.3.255/24'))
+        iprange_3_200_255.clean()
+        iprange_4_1_99 = IPRange.objects.create(start_address=IPNetwork('1.2.4.1/24'), end_address=IPNetwork('1.2.4.99/24'))
+        iprange_4_1_99.clean()
+        iprange_4_200 = IPRange.objects.create(start_address=IPNetwork('1.2.4.200/24'), end_address=IPNetwork('1.2.4.255/24'))
+        iprange_4_200.clean()
+        # Overlapping range entirely within existing
+        with self.assertRaises(ValidationError):
+            iprange_3_123_124 = IPRange.objects.create(start_address=IPNetwork('1.2.3.123/26'), end_address=IPNetwork('1.2.3.124/26'))
+            iprange_3_123_124.clean()
+        # Overlapping range starting within existing
+        with self.assertRaises(ValidationError):
+            iprange_4_98_101 = IPRange.objects.create(start_address=IPNetwork('1.2.4.98/24'), end_address=IPNetwork('1.2.4.101/24'))
+            iprange_4_98_101.clean()
+        # Overlapping range ending within existing
+        with self.assertRaises(ValidationError):
+            iprange_4_198_201 = IPRange.objects.create(start_address=IPNetwork('1.2.4.198/24'), end_address=IPNetwork('1.2.4.201/24'))
+            iprange_4_198_201.clean()
+
+
 class TestPrefix(TestCase):
 
     def test_get_duplicates(self):

+ 1 - 1
netbox/manage.py

@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import os
 import sys
 

+ 4 - 4
netbox/netbox/authentication/__init__.py

@@ -20,10 +20,10 @@ AUTH_BACKEND_ATTRS = {
     'amazon': ('Amazon AWS', 'aws'),
     'apple': ('Apple', 'apple'),
     'auth0': ('Auth0', None),
-    'entraid-oauth2': ('Microsoft Entra ID', 'microsoft'),
-    'entraid-b2c-oauth2': ('Microsoft Entra ID', 'microsoft'),
-    'entraid-tenant-oauth2': ('Microsoft Entra ID', 'microsoft'),
-    'entraid-v2-tenant-oauth2': ('Microsoft Entra ID', 'microsoft'),
+    'azuread-oauth2': ('Microsoft Entra ID', 'microsoft'),
+    'azuread-b2c-oauth2': ('Microsoft Entra ID', 'microsoft'),
+    'azuread-tenant-oauth2': ('Microsoft Entra ID', 'microsoft'),
+    'azuread-v2-tenant-oauth2': ('Microsoft Entra ID', 'microsoft'),
     'bitbucket': ('BitBucket', 'bitbucket'),
     'bitbucket-oauth2': ('BitBucket', 'bitbucket'),
     'digitalocean': ('DigitalOcean', 'digital-ocean'),

+ 2 - 0
netbox/netbox/jobs.py

@@ -68,6 +68,8 @@ class JobRunner(ABC):
         finally:
             if job.interval:
                 new_scheduled_time = (job.scheduled or job.started) + timedelta(minutes=job.interval)
+                if job.object and getattr(job.object, "python_class", None):
+                    kwargs["job_timeout"] = job.object.python_class.job_timeout
                 cls.enqueue(
                     instance=job.object,
                     user=job.user,

+ 8 - 8
netbox/netbox/tests/test_jobs.py

@@ -5,7 +5,7 @@ from django.utils import timezone
 from django_rq import get_queue
 
 from ..jobs import *
-from core.models import Job
+from core.models import DataSource, Job
 from core.choices import JobStatusChoices
 
 
@@ -68,7 +68,7 @@ class EnqueueTest(JobRunnerTestCase):
     """
 
     def test_enqueue(self):
-        instance = Job()
+        instance = DataSource()
         for i in range(1, 3):
             job = TestJobRunner.enqueue(instance, schedule_at=self.get_schedule_at())
 
@@ -76,13 +76,13 @@ class EnqueueTest(JobRunnerTestCase):
             self.assertEqual(TestJobRunner.get_jobs(instance).count(), i)
 
     def test_enqueue_once(self):
-        job = TestJobRunner.enqueue_once(instance=Job(), schedule_at=self.get_schedule_at())
+        job = TestJobRunner.enqueue_once(instance=DataSource(), schedule_at=self.get_schedule_at())
 
         self.assertIsInstance(job, Job)
         self.assertEqual(job.name, TestJobRunner.__name__)
 
     def test_enqueue_once_twice_same(self):
-        instance = Job()
+        instance = DataSource()
         schedule_at = self.get_schedule_at()
         job1 = TestJobRunner.enqueue_once(instance, schedule_at=schedule_at)
         job2 = TestJobRunner.enqueue_once(instance, schedule_at=schedule_at)
@@ -91,7 +91,7 @@ class EnqueueTest(JobRunnerTestCase):
         self.assertEqual(TestJobRunner.get_jobs(instance).count(), 1)
 
     def test_enqueue_once_twice_different_schedule_at(self):
-        instance = Job()
+        instance = DataSource()
         job1 = TestJobRunner.enqueue_once(instance, schedule_at=self.get_schedule_at())
         job2 = TestJobRunner.enqueue_once(instance, schedule_at=self.get_schedule_at(2))
 
@@ -100,7 +100,7 @@ class EnqueueTest(JobRunnerTestCase):
         self.assertEqual(TestJobRunner.get_jobs(instance).count(), 1)
 
     def test_enqueue_once_twice_different_interval(self):
-        instance = Job()
+        instance = DataSource()
         schedule_at = self.get_schedule_at()
         job1 = TestJobRunner.enqueue_once(instance, schedule_at=schedule_at)
         job2 = TestJobRunner.enqueue_once(instance, schedule_at=schedule_at, interval=60)
@@ -112,7 +112,7 @@ class EnqueueTest(JobRunnerTestCase):
         self.assertEqual(TestJobRunner.get_jobs(instance).count(), 1)
 
     def test_enqueue_once_with_enqueue(self):
-        instance = Job()
+        instance = DataSource()
         job1 = TestJobRunner.enqueue_once(instance, schedule_at=self.get_schedule_at(2))
         job2 = TestJobRunner.enqueue(instance, schedule_at=self.get_schedule_at())
 
@@ -120,7 +120,7 @@ class EnqueueTest(JobRunnerTestCase):
         self.assertEqual(TestJobRunner.get_jobs(instance).count(), 2)
 
     def test_enqueue_once_after_enqueue(self):
-        instance = Job()
+        instance = DataSource()
         job1 = TestJobRunner.enqueue(instance, schedule_at=self.get_schedule_at())
         job2 = TestJobRunner.enqueue_once(instance, schedule_at=self.get_schedule_at(2))
 

+ 6 - 3
netbox/netbox/views/generic/bulk_views.py

@@ -3,7 +3,7 @@ import re
 from copy import deepcopy
 
 from django.contrib import messages
-from django.contrib.contenttypes.fields import GenericRel
+from django.contrib.contenttypes.fields import GenericForeignKey, GenericRel
 from django.contrib.contenttypes.models import ContentType
 from django.core.exceptions import FieldDoesNotExist, ObjectDoesNotExist, ValidationError
 from django.db import transaction, IntegrityError
@@ -576,7 +576,10 @@ class BulkEditView(GetReturnURLMixin, BaseMultiObjectView):
             for name, model_field in model_fields.items():
                 # Handle nullification
                 if name in form.nullable_fields and name in nullified_fields:
-                    setattr(obj, name, None if model_field.null else '')
+                    if type(model_field) is GenericForeignKey:
+                        setattr(obj, name, None)
+                    else:
+                        setattr(obj, name, None if model_field.null else '')
                 # Normal fields
                 elif name in form.changed_data:
                     setattr(obj, name, form.cleaned_data[name])
@@ -688,7 +691,7 @@ class BulkEditView(GetReturnURLMixin, BaseMultiObjectView):
                 logger.debug("Form validation failed")
 
         else:
-            form = self.form(initial=initial_data)
+            form = self.form(request.POST, initial=initial_data)
             restrict_form_fields(form, request.user)
 
         # Retrieve objects being edited

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
netbox/project-static/dist/netbox.css


+ 1 - 1
netbox/project-static/package.json

@@ -30,7 +30,7 @@
     "gridstack": "10.3.1",
     "htmx.org": "1.9.12",
     "query-string": "9.1.1",
-    "sass": "1.79.5",
+    "sass": "1.80.4",
     "tom-select": "2.3.1",
     "typeface-inter": "3.18.1",
     "typeface-roboto-mono": "1.1.13"

+ 8 - 5
netbox/project-static/styles/custom/_markdown.scss

@@ -28,16 +28,19 @@
 
 }
 
-// Remove the bottom margin of <p> elements inside a table cell
-td > .rendered-markdown {
-  max-height: 200px;
-  overflow-y: scroll;
-
+// Remove the bottom margin of the last <p> elements in markdown
+.rendered-markdown {
   p:last-of-type {
     margin-bottom: 0;
   }
 }
 
+// fix layout of rendered markdown inside a table cell
+td > .rendered-markdown {
+  max-height: 200px;
+  overflow-y: scroll;
+}
+
 // Markdown preview
 .markdown-widget {
   .preview {

+ 5 - 0
netbox/project-static/styles/overrides/_tabler.scss

@@ -131,6 +131,11 @@ body[data-bs-theme=dark] {
   .toast {
     color: var(--#{$prefix}body-color);
   }
+  .table-primary {
+    --tblr-table-bg: rgba(var(--tblr-secondary-rgb), 0.48);
+    --tblr-table-hover-bg: inherit;
+    --tblr-table-hover-color: inherit;
+  }
 }
 
 // Do not apply padding to <code> elements inside a <pre>

+ 4 - 4
netbox/project-static/yarn.lock

@@ -2656,10 +2656,10 @@ safe-regex-test@^1.0.3:
     es-errors "^1.3.0"
     is-regex "^1.1.4"
 
-sass@1.79.5:
-  version "1.79.5"
-  resolved "https://registry.yarnpkg.com/sass/-/sass-1.79.5.tgz#646c627601cd5f84c64f7b1485b9292a313efae4"
-  integrity sha512-W1h5kp6bdhqFh2tk3DsI771MoEJjvrSY/2ihJRJS4pjIyfJCw0nTsxqhnrUzaLMOJjFchj8rOvraI/YUVjtx5g==
+sass@1.80.4:
+  version "1.80.4"
+  resolved "https://registry.yarnpkg.com/sass/-/sass-1.80.4.tgz#bc0418fd796cad2f1a1309d8b4d7fe44b7027de0"
+  integrity sha512-rhMQ2tSF5CsuuspvC94nPM9rToiAFw2h3JTrLlgmNw1MH79v8Cr3DH6KF6o6r+8oofY3iYVPUf66KzC8yuVN1w==
   dependencies:
     "@parcel/watcher" "^2.4.1"
     chokidar "^4.0.0"

+ 2 - 2
netbox/release.yaml

@@ -1,3 +1,3 @@
-version: "4.1.4"
+version: "4.1.5"
 edition: "Community"
-published: "2024-10-15"
+published: "2024-10-28"

+ 3 - 2
netbox/templates/core/plugin.html

@@ -2,6 +2,7 @@
 {% load helpers %}
 {% load form_helpers %}
 {% load i18n %}
+{% load render_table from django_tables2 %}
 
 {% block title %}{{ plugin.title_long }}{% endblock %}
 
@@ -93,8 +94,8 @@
       <div class="col col-6">
         <div class="card">
           <h2 class="card-header">{% trans "Version History" %}</h2>
-          <div class="htmx-container table-responsive" id="object_list">
-            {% include 'htmx/table.html' %}
+          <div class="table-responsive">
+            {% render_table table 'inc/table.html' %}
           </div>
         </div>
       </div>

+ 1 - 1
netbox/templates/dcim/component_list.html

@@ -10,7 +10,7 @@
     {% endif %}
     {% if 'bulk_rename' in actions %}
       {% with bulk_rename_view=model|validated_viewname:"bulk_rename" %}
-        <button type="submit" name="_rename" {% formaction %}="{% url bulk_rename_view %}" class="btn btn-outline-warning">
+        <button type="submit" name="_rename" {% formaction %}="{% url bulk_rename_view %}" class="btn btn-outline-warning btn-float">
           <i class="mdi mdi-pencil-outline" aria-hidden="true"></i> {% trans "Rename Selected" %}
         </button>
       {% endwith %}

+ 1 - 1
netbox/templates/dcim/device_list.html

@@ -78,7 +78,7 @@
   {% if 'bulk_edit' in actions %}
     <div class="btn-group" role="group">
       {% bulk_edit_button model query_params=request.GET %}
-      <button type="submit" name="_rename" {% formaction %}="{% url 'dcim:device_bulk_rename' %}?return_url={% url 'dcim:device_list' %}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" class="btn btn-outline-warning">
+      <button type="submit" name="_rename" {% formaction %}="{% url 'dcim:device_bulk_rename' %}?return_url={% url 'dcim:device_list' %}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" class="btn btn-outline-warning btn-float">
         <i class="mdi mdi-pencil-outline" aria-hidden="true"></i> {% trans "Rename" %}
       </button>
     </div>

+ 1 - 14
netbox/templates/dcim/devicetype/component_templates.html

@@ -18,21 +18,8 @@
             <button type="submit" name="_rename"
                     {% formaction %}="{% url bulk_rename_view %}?return_url={{ return_url }}"
                     class="btn btn-outline-warning">
-                <i class="mdi mdi-pencil-outline" aria-hidden="true"></i> Rename
+                <i class="mdi mdi-pencil-outline" aria-hidden="true"></i> Rename Selected
             </button>
         {% endif %}
     {% endwith %}
 {% endblock bulk_edit_controls %}
-
-{% block bulk_extra_controls %}
-    {{ block.super }}
-    {% if request.user|can_add:child_model %}
-        <div class="bulk-button-group">
-            <a href="{% url table.Meta.model|viewname:"add" %}?device_type={{ object.pk }}&return_url={{ return_url }}" class="btn btn-primary">
-                <i class="mdi mdi-plus-thick" aria-hidden="true"></i>
-                {% trans "Add" %} {{ title }}
-            </a>
-        </div>
-    {% endif %}
-{% endblock bulk_extra_controls %}
-

+ 2 - 0
netbox/templates/dcim/inc/devicetype_breadcrumbs.html

@@ -0,0 +1,2 @@
+
+<li class="breadcrumb-item"><a href="{% url 'dcim:devicetype_list' %}?manufacturer_id={{ object.manufacturer.pk }}">{{ object.manufacturer }}</a></li>

+ 38 - 0
netbox/templates/dcim/inc/moduletype_buttons.html

@@ -0,0 +1,38 @@
+{% load buttons %}
+{% load helpers %}
+{% load i18n %}
+
+
+{% if perms.dcim.change_devicetype %}
+  <div class="dropdown">
+    <button type="button" class="btn btn-primary dropdown-toggle"data-bs-toggle="dropdown" aria-expanded="false">
+      <i class="mdi mdi-plus-thick" aria-hidden="true"></i> {% trans "Add Components" %}
+    </button>
+    <ul class="dropdown-menu">
+      {% if perms.dcim.add_consoleporttemplate %}
+        <li><a class="dropdown-item" href="{% url 'dcim:consoleporttemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_consoleports' pk=object.pk %}">{% trans "Console Ports" %}</a></li>
+      {% endif %}
+      {% if perms.dcim.add_consoleserverporttemplate %}
+        <li><a class="dropdown-item" href="{% url 'dcim:consoleserverporttemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_consoleserverports' pk=object.pk %}">{% trans "Console Server Ports" %}</a></li>
+      {% endif %}
+      {% if perms.dcim.add_powerporttemplate %}
+        <li><a class="dropdown-item" href="{% url 'dcim:powerporttemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_powerports' pk=object.pk %}">{% trans "Power Ports" %}</a></li>
+      {% endif %}
+      {% if perms.dcim.add_poweroutlettemplate %}
+        <li><a class="dropdown-item" href="{% url 'dcim:poweroutlettemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_poweroutlets' pk=object.pk %}">{% trans "Power Outlets" %}</a></li>
+      {% endif %}
+      {% if perms.dcim.add_interfacetemplate %}
+        <li><a class="dropdown-item" href="{% url 'dcim:interfacetemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_interfaces' pk=object.pk %}">{% trans "Interfaces" %}</a></li>
+      {% endif %}
+      {% if perms.dcim.add_frontporttemplate %}
+        <li><a class="dropdown-item" href="{% url 'dcim:frontporttemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_frontports' pk=object.pk %}">{% trans "Front Ports" %}</a></li>
+      {% endif %}
+      {% if perms.dcim.add_rearporttemplate %}
+        <li><a class="dropdown-item" href="{% url 'dcim:rearporttemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_rearports' pk=object.pk %}">{% trans "Rear Ports" %}</a></li>
+      {% endif %}
+      {% if perms.dcim.add_modulebaytemplate %}
+        <li><a class="dropdown-item" href="{% url 'dcim:modulebaytemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_modulebays' pk=object.pk %}">{% trans "Module Bays" %}</a></li>
+      {% endif %}
+    </ul>
+  </div>
+{% endif %}

+ 12 - 1
netbox/templates/dcim/moduletype.html

@@ -1,9 +1,20 @@
-{% extends 'dcim/moduletype/base.html' %}
+{% extends 'generic/object.html' %}
 {% load buttons %}
 {% load helpers %}
 {% load plugins %}
 {% load i18n %}
 
+{% block title %}{{ object.manufacturer }} {{ object.model }}{% endblock %}
+
+{% block breadcrumbs %}
+  {{ block.super }}
+  {%  include 'dcim/inc/devicetype_breadcrumbs.html' %}
+{% endblock %}
+
+{% block extra_controls %}
+  {%  include 'dcim/inc/moduletype_buttons.html' %}
+{% endblock %}
+
 {% block content %}
   <div class="row">
     <div class="col col-md-6">

+ 0 - 48
netbox/templates/dcim/moduletype/base.html

@@ -1,48 +0,0 @@
-{% extends 'generic/object.html' %}
-{% load buttons %}
-{% load helpers %}
-{% load plugins %}
-{% load i18n %}
-
-{% block title %}{{ object.manufacturer }} {{ object.model }}{% endblock %}
-
-{% block breadcrumbs %}
-  {{ block.super }}
-  <li class="breadcrumb-item"><a href="{% url 'dcim:moduletype_list' %}?manufacturer_id={{ object.manufacturer.pk }}">{{ object.manufacturer }}</a></li>
-{% endblock %}
-
-{% block extra_controls %}
-  {% if perms.dcim.change_devicetype %}
-    <div class="dropdown">
-      <button type="button" class="btn btn-primary dropdown-toggle"data-bs-toggle="dropdown" aria-expanded="false">
-        <i class="mdi mdi-plus-thick" aria-hidden="true"></i> {% trans "Add Components" %}
-      </button>
-      <ul class="dropdown-menu">
-        {% if perms.dcim.add_consoleporttemplate %}
-          <li><a class="dropdown-item" href="{% url 'dcim:consoleporttemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_consoleports' pk=object.pk %}">{% trans "Console Ports" %}</a></li>
-        {% endif %}
-        {% if perms.dcim.add_consoleserverporttemplate %}
-          <li><a class="dropdown-item" href="{% url 'dcim:consoleserverporttemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_consoleserverports' pk=object.pk %}">{% trans "Console Server Ports" %}</a></li>
-        {% endif %}
-        {% if perms.dcim.add_powerporttemplate %}
-          <li><a class="dropdown-item" href="{% url 'dcim:powerporttemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_powerports' pk=object.pk %}">{% trans "Power Ports" %}</a></li>
-        {% endif %}
-        {% if perms.dcim.add_poweroutlettemplate %}
-          <li><a class="dropdown-item" href="{% url 'dcim:poweroutlettemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_poweroutlets' pk=object.pk %}">{% trans "Power Outlets" %}</a></li>
-        {% endif %}
-        {% if perms.dcim.add_interfacetemplate %}
-          <li><a class="dropdown-item" href="{% url 'dcim:interfacetemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_interfaces' pk=object.pk %}">{% trans "Interfaces" %}</a></li>
-        {% endif %}
-        {% if perms.dcim.add_frontporttemplate %}
-          <li><a class="dropdown-item" href="{% url 'dcim:frontporttemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_frontports' pk=object.pk %}">{% trans "Front Ports" %}</a></li>
-        {% endif %}
-        {% if perms.dcim.add_rearporttemplate %}
-          <li><a class="dropdown-item" href="{% url 'dcim:rearporttemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_rearports' pk=object.pk %}">{% trans "Rear Ports" %}</a></li>
-        {% endif %}
-        {% if perms.dcim.add_modulebaytemplate %}
-          <li><a class="dropdown-item" href="{% url 'dcim:modulebaytemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_modulebays' pk=object.pk %}">{% trans "Module Bays" %}</a></li>
-        {% endif %}
-      </ul>
-    </div>
-  {% endif %}
-{% endblock %}

+ 33 - 40
netbox/templates/dcim/moduletype/component_templates.html

@@ -1,44 +1,37 @@
-{% extends 'dcim/moduletype/base.html' %}
+{% extends 'generic/object_children.html' %}
 {% load render_table from django_tables2 %}
 {% load helpers %}
 {% load i18n %}
 
-{% block content %}
-  {% if perms.dcim.change_moduletype %}
-    <form method="post">
-        {% csrf_token %}
-        <div class="card">
-            <div class="htmx-container table-responsive" id="object_list">
-              {% include 'htmx/table.html' %}
-            </div>
-            <div class="card-footer d-print-none">
-                {% if table.rows %}
-                    <button type="submit" name="_edit" {% formaction %}="{% url table.Meta.model|viewname:"bulk_rename" %}?return_url={{ return_url }}" class="btn btn-warning">
-                        <span class="mdi mdi-pencil-outline" aria-hidden="true"></span> {% trans "Rename" %}
-                    </button>
-                    <button type="submit" name="_edit" {% formaction %}="{% url table.Meta.model|viewname:"bulk_edit" %}?return_url={{ return_url }}" class="btn btn-warning">
-                        <span class="mdi mdi-pencil" aria-hidden="true"></span> {% trans "Edit" %}
-                    </button>
-                    <button type="submit" name="_delete" {% formaction %}="{% url table.Meta.model|viewname:"bulk_delete" %}?return_url={{ return_url }}" class="btn btn-danger">
-                        <i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> {% trans "Delete" %}
-                    </button>
-                {% endif %}
-                <div class="float-end">
-                    <a href="{% url table.Meta.model|viewname:"add" %}?module_type={{ object.pk }}&return_url={{ return_url }}" class="btn btn-primary">
-                        <i class="mdi mdi-plus-thick" aria-hidden="true"></i>
-                        {% trans "Add" %} {{ title }}
-                    </a>
-                </div>
-                <div class="clearfix"></div>
-            </div>
-        </div>
-    </form>
-  {% else %}
-    <div class="card">
-      <h2 class="card-header">{{ title }}</h2>
-      <div class="htmx-container table-responsive" id="object_list">
-        {% include 'htmx/table.html' %}
-      </div>
-    </div>
-  {% endif %}
-{% endblock content %}
+{% block title %}{{ object.manufacturer }} {{ object.model }}{% endblock %}
+
+{% block breadcrumbs %}
+  {{ block.super }}
+  {%  include 'dcim/inc/devicetype_breadcrumbs.html' %}
+{% endblock %}
+
+{% block extra_controls %}
+  {%  include 'dcim/inc/moduletype_buttons.html' %}
+{% endblock %}
+
+{% block bulk_edit_controls %}
+    {% with bulk_edit_view=child_model|validated_viewname:"bulk_edit" %}
+        {% if 'bulk_edit' in actions and bulk_edit_view %}
+            <button type="submit" name="_edit"
+                    {% formaction %}="{% url bulk_edit_view %}?device={{ object.pk }}&return_url={{ return_url }}"
+                    class="btn btn-warning">
+                <i class="mdi mdi-pencil" aria-hidden="true"></i> Edit Selected
+            </button>
+        {% endif %}
+    {% endwith %}
+    {% with bulk_rename_view=child_model|validated_viewname:"bulk_rename" %}
+        {% if 'bulk_rename' in actions and bulk_rename_view %}
+            <button type="submit" name="_rename"
+                    {% formaction %}="{% url bulk_rename_view %}?return_url={{ return_url }}"
+                    class="btn btn-outline-warning">
+                <i class="mdi mdi-pencil-outline" aria-hidden="true"></i> Rename Selected
+            </button>
+        {% endif %}
+    {% endwith %}
+{% endblock bulk_edit_controls %}
+

+ 53 - 53
netbox/templates/generic/bulk_edit.html

@@ -42,71 +42,71 @@ Context:
   {# Edit form #}
   <div class="tab-pane show active" id="edit-form" role="tabpanel" aria-labelledby="edit-form-tab">
     <form action="" method="post" class="form form-horizontal mt-5">
-
-      {% csrf_token %}
-      {% if request.POST.return_url %}
-        <input type="hidden" name="return_url" value="{{ request.POST.return_url }}" />
-      {% endif %}
-      {% for field in form.hidden_fields %}
-        {{ field }}
-      {% endfor %}
-
-      {% if form.fieldsets %}
-
-        {# Render grouped fields according to declared fieldsets #}
-        {% for fieldset in form.fieldsets %}
-          {% render_fieldset form fieldset %}
+      <div id="form_fields" hx-disinherit="hx-select hx-swap">
+        {% csrf_token %}
+        {% if request.POST.return_url %}
+          <input type="hidden" name="return_url" value="{{ request.POST.return_url }}" />
+        {% endif %}
+        {% for field in form.hidden_fields %}
+          {{ field }}
         {% endfor %}
 
-        {# Render tag add/remove fields #}
-        {% if form.add_tags and form.remove_tags %}
-          <div class="field-group mb-5">
-            <div class="row">
-              <h2 class="col-9 offset-3">{% trans "Tags" %}</h2>
+        {% if form.fieldsets %}
+
+          {# Render grouped fields according to declared fieldsets #}
+          {% for fieldset in form.fieldsets %}
+            {% render_fieldset form fieldset %}
+          {% endfor %}
+
+          {# Render tag add/remove fields #}
+          {% if form.add_tags and form.remove_tags %}
+            <div class="field-group mb-5">
+              <div class="row">
+                <h2 class="col-9 offset-3">{% trans "Tags" %}</h2>
+              </div>
+              {% render_field form.add_tags %}
+              {% render_field form.remove_tags %}
             </div>
-            {% render_field form.add_tags %}
-            {% render_field form.remove_tags %}
-          </div>
-        {% endif %}
+          {% endif %}
 
-        {# Render custom fields #}
-        {% if form.custom_fields %}
-          <div class="field-group mb-5">
-            <div class="row">
-              <h2 class="col-9 offset-3">{% trans "Custom Fields" %}</h2>
+          {# Render custom fields #}
+          {% if form.custom_fields %}
+            <div class="field-group mb-5">
+              <div class="row">
+                <h2 class="col-9 offset-3">{% trans "Custom Fields" %}</h2>
+              </div>
+              {% render_custom_fields form %}
             </div>
-            {% render_custom_fields form %}
-          </div>
-        {% endif %}
+          {% endif %}
 
-        {# Render comments #}
-        {% if form.comments %}
-          <div class="field-group mb-5">
-            <div class="row">
-              <h2 class="col-9 offset-3">{% trans "Comments" %}</h2>
+          {# Render comments #}
+          {% if form.comments %}
+            <div class="field-group mb-5">
+              <div class="row">
+                <h2 class="col-9 offset-3">{% trans "Comments" %}</h2>
+              </div>
+              {% render_field form.comments bulk_nullable=True %}
             </div>
-            {% render_field form.comments bulk_nullable=True %}
-          </div>
-        {% endif %}
+          {% endif %}
 
-      {% else %}
+        {% else %}
 
-        {# Render all fields #}
-        {% for field in form.visible_fields %}
-          {% if field.name in form.nullable_fields %}
-            {% render_field field bulk_nullable=True %}
-          {% else %}
-            {% render_field field %}
-          {% endif %}
-        {% endfor %}
+          {# Render all fields #}
+          {% for field in form.visible_fields %}
+            {% if field.name in form.nullable_fields %}
+              {% render_field field bulk_nullable=True %}
+            {% else %}
+              {% render_field field %}
+            {% endif %}
+          {% endfor %}
 
-      {% endif %}
+        {% endif %}
 
-      <div class="btn-float-group-right">
-        <a href="{{ return_url }}" class="btn btn-outline-secondary btn-float">{% trans "Cancel" %}</a>
-        <button type="submit" name="_apply" class="btn btn-primary">{% trans "Apply" %}</button>
+        <div class="btn-float-group-right">
+          <a href="{{ return_url }}" class="btn btn-outline-secondary btn-float">{% trans "Cancel" %}</a>
+          <button type="submit" name="_apply" class="btn btn-primary">{% trans "Apply" %}</button>
+        </div>
       </div>
-
     </form>
   </div>
 

+ 2 - 0
netbox/tenancy/graphql/types.py

@@ -66,6 +66,7 @@ class TenantGroupType(OrganizationalObjectType):
     parent: Annotated["TenantGroupType", strawberry.lazy('tenancy.graphql.types')] | None
 
     tenants: List[TenantType]
+    children: List[Annotated["TenantGroupType", strawberry.lazy('tenancy.graphql.types')]]
 
 
 #
@@ -99,6 +100,7 @@ class ContactGroupType(OrganizationalObjectType):
     parent: Annotated["ContactGroupType", strawberry.lazy('tenancy.graphql.types')] | None
 
     contacts: List[ContactType]
+    children: List[Annotated["ContactGroupType", strawberry.lazy('tenancy.graphql.types')]]
 
 
 @strawberry_django.type(

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1540 - 1871
netbox/translations/cs/LC_MESSAGES/django.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1118 - 1387
netbox/translations/da/LC_MESSAGES/django.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1118 - 1387
netbox/translations/de/LC_MESSAGES/django.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 3034 - 3558
netbox/translations/en/LC_MESSAGES/django.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1118 - 1387
netbox/translations/es/LC_MESSAGES/django.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1118 - 1387
netbox/translations/fr/LC_MESSAGES/django.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1118 - 1387
netbox/translations/it/LC_MESSAGES/django.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 2065 - 2465
netbox/translations/ja/LC_MESSAGES/django.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1118 - 1387
netbox/translations/nl/LC_MESSAGES/django.po


BIN=BIN
netbox/translations/pl/LC_MESSAGES/django.mo


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1546 - 1877
netbox/translations/pl/LC_MESSAGES/django.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1118 - 1387
netbox/translations/pt/LC_MESSAGES/django.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1118 - 1387
netbox/translations/ru/LC_MESSAGES/django.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1118 - 1387
netbox/translations/tr/LC_MESSAGES/django.po


BIN=BIN
netbox/translations/uk/LC_MESSAGES/django.mo


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1541 - 1872
netbox/translations/uk/LC_MESSAGES/django.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 2464 - 2911
netbox/translations/zh/LC_MESSAGES/django.po


+ 5 - 2
netbox/utilities/forms/widgets/select.py

@@ -43,9 +43,12 @@ class HTMXSelect(forms.Select):
     """
     Selection widget that will re-generate the HTML form upon the selection of a new option.
     """
-    def __init__(self, hx_url='.', hx_target_id='form_fields', attrs=None, **kwargs):
+    def __init__(self, method='get', hx_url='.', hx_target_id='form_fields', attrs=None, **kwargs):
+        method = method.lower()
+        if method not in ('delete', 'get', 'patch', 'post', 'put'):
+            raise ValueError(f"Unsupported HTTP method: {method}")
         _attrs = {
-            'hx-get': hx_url,
+            f'hx-{method}': hx_url,
             'hx-include': f'#{hx_target_id}',
             'hx-target': f'#{hx_target_id}',
         }

+ 1 - 0
netbox/wireless/graphql/types.py

@@ -23,6 +23,7 @@ class WirelessLANGroupType(OrganizationalObjectType):
     parent: Annotated["WirelessLANGroupType", strawberry.lazy('wireless.graphql.types')] | None
 
     wireless_lans: List[Annotated["WirelessLANType", strawberry.lazy('wireless.graphql.types')]]
+    children: List[Annotated["WirelessLANGroupType", strawberry.lazy('wireless.graphql.types')]]
 
 
 @strawberry_django.type(

+ 7 - 6
requirements.txt

@@ -2,13 +2,13 @@ Django==5.0.9
 django-cors-headers==4.5.0
 django-debug-toolbar==4.4.6
 django-filter==24.3
-django-htmx==1.19.0
+django-htmx==1.21.0
 django-graphiql-debug-toolbar==0.2.0
 django-mptt==0.16.0
 django-pglocks==1.0.4
 django-prometheus==2.3.1
 django-redis==5.4.0
-django-rich==1.11.0
+django-rich==1.12.0
 django-rq==2.10.2
 django-taggit==6.1.0
 django-tables2==2.7.0
@@ -20,18 +20,19 @@ feedparser==6.0.11
 gunicorn==23.0.0
 Jinja2==3.1.4
 Markdown==3.7
-mkdocs-material==9.5.41
+mkdocs-material==9.5.42
 mkdocstrings[python-legacy]==0.26.2
 netaddr==1.3.0
 nh3==0.2.18
-Pillow==10.4.0
+Pillow==11.0.0
 psycopg[c,pool]==3.2.3
 PyYAML==6.0.2
 requests==2.32.3
+rq==1.16.2
 social-auth-app-django==5.4.2
 social-auth-core==4.5.4
-strawberry-graphql==0.246.2
-strawberry-graphql-django==0.48.0
+strawberry-graphql==0.247.0
+strawberry-graphql-django==0.49.1
 svgwrite==1.4.3
 tablib==3.7.0
 tzdata==2024.2

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio