Commit Graph

15813 Commits

Author SHA1 Message Date
Martin Hauser ab9bd6f5b6
Closes #23049: Update development database scripts for PostgreSQL 15 and later (#23065)
Fixes #23049
2026-08-28 10:43:52 -05:00
bctiemann a8626a517f
Merge pull request #23057 from netbox-community/22991-optimize-modulebaytype-queries
Closes #22991: Omit manufacturer from ModuleBayType representation
2026-08-27 18:14:34 -04:00
Jeremy Stretch 32e383f066 Closes #22991: Omit manufacturer from ModuleBayType representation 2026-08-27 16:07:41 -04:00
Jeremy Stretch 7a030c97c6
Fixes #23042: Submit SSO login requests via POST (#23050)
Render social authentication actions as POST forms to comply with
social-auth-app-django 6.0's POST-only begin view. Pass the `next` and
SAML `idp` parameters as hidden fields so they remain available to
`do_auth()`.

Preserve the post-login URL when the login page is re-rendered after a
failed password attempt, and avoid shadowing the request data while
enumerating SAML identity providers. Extend the tests to validate the
rendered SSO forms and their hidden parameters.
2026-08-27 17:52:08 +02:00
Martin Hauser 1374fde4aa
Closes #23032: Make GraphQL custom field N+1 regression test deterministic (#23034)
Fixes #23032
2026-08-27 10:07:06 -05:00
Jeremy Stretch aa1d49d0f5 Release v4.7.0-beta2 2026-08-26 15:29:15 -04:00
Martin Hauser 743b068343 fix(dcim): Add parent field to InterfaceTemplate import form
Adds parent field to InterfaceTemplateImportForm to support channelized
interface imports. Filters parent queryset by device_type or module_type
during validation to prevent MultipleObjectsReturned errors when
resolving parent interfaces by name.

Fixes #23036
2026-08-26 14:41:22 -04:00
Jeremy Stretch cd87ab3159
Fixes #23010: Defer bulk changes to object data when adding/removing a custom field (#23011) 2026-08-26 10:51:59 -07:00
Martin Hauser 368ad277e5
Closes #22563: Preserve sidebar scroll position across navigation (#22803)
Store the vertical sidebar's scroll position in session storage so it
remains scoped to the current browser tab. Restore it on the next page
and use the browser's native scrolling behavior to reveal the active
item when needed.

When the active dropdown is closed, reveal its top-level heading instead
of the hidden child. Persist only positive offsets from an overflowing
sidebar so a collapsed or non-scrollable layout cannot erase a useful
saved position with zero.
2026-08-26 19:01:07 +02:00
Jeremy Stretch 83ba52521f
Fixes #23027: Pin config Context cache invalidation to the saving connection (#23028)
Propagate the signal-provided database alias through config context
cache invalidation so scope lookups, cache updates, and commit callbacks
use the same connection and transaction as the triggering change.

Watch Cluster scope changes through `_site_id` and add routing coverage
for direct, nested, tagged, reparented, and upstream invalidation paths.
2026-08-26 15:44:07 +02:00
Jeremy Stretch c89a544eac Merge branch 'main' into feature 2026-08-25 12:34:17 -04:00
Jeremy Stretch f8b00e9aae Release v4.6.9 2026-08-25 11:02:20 -04:00
Martin Hauser 1077ff4a33 fix(forms): Correct nullable_fields in bulk edit forms
`nullable_fields` only marks declared form fields as clearable.
Several bulk edit forms referenced missing, stale, duplicate, or
non-model fields. This left intended fields unavailable, rendered
ineffective Set Null controls, and could trigger a server error for
Contact bulk edits.

Declare the intended fields, correct the PowerFeed and DataSource
entries, and remove invalid Contact group fields. Align owner and
comments nullification on forms that do not inherit the common
bulk-edit fields, and prevent DataSource comments from rendering twice.

Add regression coverage to keep nullable declarations aligned with
their form and model fields.

Fixes #22990
2026-08-25 09:06:31 -04:00
Jeremy Stretch eab6b42659
Fixes #23000: Prefetch Cable Terminations in the GraphQL API (#23021)
CableType.a_terminations and b_terminations were declared as bare
annotations, so strawberry-django resolved them by reading the model
properties with no prefetch hint. That left two nested N+1s (one query
per Cable for terminations, one per CableTermination for the termination
GFK) plus the termination's own device FK chain, for roughly six queries
per termination.

Resolve both fields via resolvers carrying a Prefetch of the
terminations for that cable end, with the termination GFK prefetched
through the existing build_gfk_prefetch() helper so the nested joins are
derived from the client's selection set rather than hard-coded.

Each end is prefetched under its own to_attr: two prefetches of the same
relation cannot be merged by the query optimizer, so a shared lookup
would break any query selecting both ends.
2026-08-25 09:27:14 +02:00
github-actions 194f3bbde2 Update source translation strings 2026-08-25 05:09:57 +00:00
bctiemann b7e02fe098
Merge pull request #23020 from netbox-community/23007-sidenav-javascript-uses-a-different-breakpoint-from-the
Closes #23007: Align sidebar initialization with the responsive layout breakpoint
2026-08-24 17:51:44 -04:00
Martin Hauser 105e58a433
refactor(ui): Use matchMedia for desktop breakpoint detection
Replace hardcoded width check with Bootstrap's lg breakpoint (992px)
using matchMedia API. Adds constant with comment linking to navbar
configuration for maintainability.
2026-08-24 22:12:54 +02:00
bctiemann b08799860f
Merge pull request #23017 from netbox-community/22978-event-leakage-on-rollback
Fixes #22978: Discard queued events when a REST API write is rolled back
2026-08-24 16:00:23 -04:00
piyush-003 a0c695f57d
Closes #22660: Add support for HPE Synergy's proprietary 300Gb QSFP-DD interface type 2026-08-24 15:58:42 -04:00
Martin Hauser 9d4440beba refactor(ui): Remove unused Bootstrap Collapse from sidebar navigation
Remove Bootstrap Collapse instances and section link handling logic that
is no longer needed. Simplifies sidebar navigation by removing manual
collapse management and related event handlers.

Fixes #22931
2026-08-24 12:55:44 -04:00
Jeremy Stretch 79f940f362 Fixes #22978: Discard queued events when a REST API write is rolled back
The REST API's write paths are transactional, but the in-memory events queue
is not: change logging receivers queue events eagerly (for deletions in
pre_delete, before the row is removed), and event_tracking() flushes that queue
only after the response has been rendered. Where a rolled-back write is caught
and converted into a normal response — the ProtectedError/RestrictedError and
AbortRequest handlers in NetBoxModelViewSet.dispatch(), and the
ObjectDoesNotExist to PermissionDenied conversions in the perform_*() methods —
the flush therefore dispatched events for objects that were never created,
updated, or deleted.

Backport discard_events_on_rollback() from the feature branch and enter it
inside the transaction guarding each API write: perform_create(),
perform_update(), and perform_destroy(); the SequentialBulkCreatesMixin,
BulkUpdateModelMixin, and BulkDestroyModelMixin bulk actions; and
AvailableObjectsView.post(). The context manager sends clear_events on the way
out whenever the wrapped transaction is rolled back, whether by an exception
escaping the block or by an explicit set_rollback(), which also covers the
exceptions that reach dispatch(). This mirrors what the UI views now do (#22934).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-24 12:41:32 -04:00
Martin Hauser 4107109472
fix(models): Remove inert clone_fields from non-CloningMixin models (#23003)
Removes clone_fields declarations from ContactAssignment,
ImageAttachment, and FHRPGroupAssignment models that don't inherit
CloningMixin.
Adds test coverage to prevent clone_fields on models without cloning
support.

Fixes #22987
2026-08-24 08:46:05 -07:00
Jossel1n M0uette fd15a687f6
Closes #21387: Add InfiniBand 4X interface types (#23016)
Add 4X interface choices for all supported InfiniBand generations and
include the lane width in each display label. Correct the existing XDR
1X rate from 250 Gbps to 200 Gbps.
2026-08-24 17:45:34 +02:00
Jeremy Stretch 05e35e9264
Fixes #23013: Avoid denormalization refreshes for location assignment when not needed (#23014)
Skip descendant and component denormalization updates when a Location,
Rack, or Device is saved without changing its scope assignments. Handle
partial saves safely to avoid propagating stale in-memory values.
2026-08-24 17:30:37 +02:00
github-actions 43fe81f9e8 Update source translation strings 2026-08-22 05:06:32 +00:00
bctiemann 23e2c881b1
Merge pull request #23004 from netbox-community/22998-add-100gbase-x-sfp112-interface-type
Closes #22998: Add SFP112 (100GE) interface type
2026-08-21 10:24:52 -04:00
github-actions 1c84d6d8f4 Update source translation strings 2026-08-21 05:21:48 +00:00
Martin Hauser 044a627c3a
feat(dcim): Add SFP112 interface type for 100GE connections
Introduces 100GBASE-X-SFP112 interface type to support SFP112 form
factor transceiver modules. Adds new choice constant and display label
in alphabetical order within 100GE interface types section.

Fixes #22998
2026-08-20 22:22:40 +02:00
Jeremy Stretch e49e6afbbe
Fixes #22985: Exempt data file content from cache (#22986) 2026-08-20 21:14:53 +02:00
Martin Hauser b6cc7d811f fix(ui): Simplify sidebar initialization logic
Replace redundant conditional blocks with single if-else statement and
move resize listener outside viewport check. Changes width threshold
from `>` to `>=` for consistency with standard breakpoint behavior.

Fixes #22930
2026-08-20 14:41:54 -04:00
bctiemann 58ac88bc51
Merge pull request #22974 from netbox-community/22934-fix-event-queue-leaks
Fixes #22934: Clear queued events when a UI view rolls back a write
2026-08-20 13:32:27 -04:00
bctiemann 24b700336e
Merge pull request #22969 from netbox-community/22925-make-moduletypetestcase-independent-of-migration-seeded-data
Closes #22925: Make ModuleTypeTestCase independent of migration-seeded data
2026-08-20 13:14:41 -04:00
bctiemann 86c7a896a1
Merge pull request #22958 from netbox-community/22956-add-dedicated-tests-for-nestedobjectattr
Closes #22956: Add test coverage for NestedObjectAttr
2026-08-20 13:13:39 -04:00
Arthur Hanson d7f79bd501
Closes #22972: Restore tag deserialization compatibility with Django 6.1 (#22979)
Add set_base() support to CustomTaggableManager so Django's
deserializer can restore tag relationships through django-taggit.
Normalize primary-key values before delegating to taggit and add
regression coverage for object- and PK-based inputs.
2026-08-20 14:51:30 +02:00
Martin Hauser 875e7d0885
fix(api): Allow Module Bay Types to be written via the REST API (#22984)
Declare module_bay_types as a SerializedPKRelatedField on the Module
Bay, Module Bay Template, and Module Type serializers. This accepts
primary keys on write while preserving the nested representation on
read and avoids DRF's writable-nested assertion.

Because automatic serializer prefetch discovery no longer recurses into
this field, add manufacturer prefetches to the corresponding viewsets.
Populate the API test fixtures with Module Bay Types so the existing
list query-count tests cover the relationship and guard against N+1
queries.

Fixes #22982
2026-08-19 13:35:01 -07:00
Martin Hauser fb86029507
fix(extras): Use full_name for Script logger namespace (#22964)
Changes Script logger initialization to use `full_name` property instead
of reconstructing the namespace from `__module__` and
`__class__.__name__`.
Ensures dynamically loaded Scripts log to the correct public namespace.

Fixes #22953
2026-08-19 13:06:53 -07:00
Martin Hauser cff012ac9c fix(dcim): Add bulk edit support for Module Bay Types
Adds `add_module_bay_types` and `remove_module_bay_types` fields to
ModuleBayTemplate bulk edit form with fieldsets. Implements per-object
delta operations in post_save_operations to preserve existing type
assignments while adding/removing specified types.

Fixes #22961
2026-08-19 15:43:37 -04:00
Martin Hauser 3f662dd222 fix(ui): Display nested group and platform hierarchies
Replace RelatedObjectAttr with NestedObjectAttr for Tenant Groups,
Wireless LAN Groups, and Device Type default platforms. Limit Platform
hierarchies to three levels for consistency with existing Platform
fields.

Fixes #22954
2026-08-19 15:05:24 -04:00
Martin Hauser 604653935c fix(ui): Restrict sidebar initialization to the vertical navbar
initSideNav() matched every .navbar element, and
templates/base/layout.html puts that class on both the sidebar aside and
the top header, so a second SideNav was constructed for the header.
Scope the selector to .navbar-vertical, which is what the pre-Tabler
selector .sidenav did.

Widen the sidebar element type from HTMLDivElement to HTMLElement, since
the element the selector matches is an aside.

Fixes #22929
2026-08-19 14:53:21 -04:00
Arthur Hanson 05865a5e5c
Closes #22973: fix ltree search_path (#22975) 2026-08-19 20:42:30 +02:00
Jeremy Stretch 38e21a5726
Closes #22959: Notify the reader to confirm database user permission before upgrading (#22976)
Document the database permissions required to install the ltree extension
during an upgrade to NetBox v4.7. Clarify that installations following the
standard PostgreSQL setup already satisfy this requirement through database
ownership.

Provide commands for granting the database-level CREATE privilege where
needed, along with an administrator pre-installation option for deployments
using a restricted NetBox database role.

Co-authored-by: Martin Hauser <mhauser@netboxlabs.com>
2026-08-19 18:05:02 +02:00
Jeremy Stretch 6578541eee
Add optional suspected cause & suggested fix fields to bug report template (#22971) 2026-08-19 13:31:02 +02:00
github-actions 7fbd49369a Update source translation strings 2026-08-19 05:19:06 +00:00
Martin Hauser e56d84ff5f fix(ui): Add hierarchical breadcrumbs for nested objects
Display ancestor hierarchy in breadcrumbs for DeviceRole, Platform, and
PowerPanel detail views. Shows full parent chain with filtering links
to improve navigation through nested object relationships.

Fixes #22957
2026-08-18 16:42:41 -04:00
Martin Hauser 5d9fa7be86 fix(ui): Add hierarchical breadcrumbs for nested objects
Display ancestor hierarchy in breadcrumbs for DeviceRole, Platform, and
PowerPanel detail views. Shows full parent chain with filtering links
to improve navigation through nested object relationships.

Fixes #22957
2026-08-18 16:41:47 -04:00
Jeremy Stretch c2d39b12d8
Fixes #22922: Honor the saving database connection in scope propagation signals (#22928) 2026-08-18 22:40:30 +02:00
Jeremy Stretch f72072128a Fixes #22934: Clear queued events when a UI view rolls back a write
BulkCreateView, BulkDeleteView, and ObjectDeleteView each catch an exception,
roll back the transaction, and return a normal response — but without clearing
the in-memory events queue. The queue is flushed after the view returns, so
webhooks and event rules fired for creations and deletions that were never
committed.

Send the clear_events signal from each of the affected handlers, matching the
idiom already used by the sibling handlers in these views.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 15:59:44 -04:00
Jeremy Stretch 40a9df14a8 Fixes #22967: Repair CircuitTermination cached scope fields on Location move
handle_location_site_change() repaired the cached scope fields of Location-
scoped Prefixes, Clusters and WirelessLANs, but not CircuitTerminations,
which cache the same ancestry under their own termination_type/termination_id
generic FK rather than CachedScopeMixin.scope. That made them invisible both
to the repair loop and to sync_cached_scope_fields().

Two cases were left wrong. A termination at a descendant Location kept its
_site, _region and _site_group entirely, since descendants are moved by a
queryset update() which fires no post_save. A termination at the moved
Location itself had _site refreshed by the denormalized-field registry, but
not _region or _site_group: those are mapped off the separate _site
registration, which requires a Site save.

Repair both cases by selecting through the generic termination fields over
the Location and its descendants alike. These columns back the site, region
and site group filters for Circuit and CircuitTermination, so a stale value
drops the circuit out of filtered lists and leaves it showing under its
former site.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 14:40:20 -04:00
Jeremy Stretch a6f8848e3c
Fixes #22963: Honor the saving database connection in counter cache signals (#22965) 2026-08-18 11:19:13 -05:00
Martin Hauser 8e508d52f9
test(dcim): Fix ModuleType CSV import test data and assertions
Updates ModuleType bulk import test to use valid test data. Replaces
reference to non-existent 'Fan' profile with test fixture profile.
Changes assertion to use assertEqual for consistency with test patterns.

Closes #22925
2026-08-18 17:23:33 +02:00