Commit Graph

14992 Commits

Author SHA1 Message Date
Jason Novinger
4c291f0463 Address additional bot review feedback
- clean() collects all validation errors before raising instead of stopping at the first
- Fix stale admin docs (still referenced "Custom actions" and "grouped by model")
2026-04-03 08:13:48 -05:00
Jason Novinger
e9be6e4178 Consolidate ObjectPermission detail view actions panel
Merge ObjectPermissionActionsPanel and ObjectPermissionCustomActionsPanel
into a single Actions panel that shows CRUD booleans and all registered
actions in one table, matching the form's consolidated layout.

Also fix data-object-types-selected attribute value (True -> 'true') and
update plugin docs to show Meta.permissions as the primary registration
approach.
2026-04-01 17:16:57 -05:00
Jason Novinger
84c2acb1f9 Address review feedback on registered actions
- Sort model_keys in data-models attribute for deterministic output
- Rename registered_actions field label to 'Registered actions'
- Target object_types selected list via data-object-types-selected
  attribute instead of hardcoded DOM ID
- Reduce setTimeout delay to 0ms since moveOption() is synchronous
2026-04-01 16:19:28 -05:00
Jason Novinger
002cf25a2c Flatten registered actions UI and declare via Meta.permissions
Implement two changes requested in review of #21560:

1. Use Meta.permissions for action declaration
   - Add Meta.permissions to DataSource, Device, and VirtualMachine
   - register_models() auto-registers actions from Meta.permissions
   - Remove explicit register_model_actions() calls from apps.py
   - Add get_action_model_map() utility to utilities/permissions.py

2. Flatten the ObjectPermission form UI
   - Show a single deduplicated list of action checkboxes (one per
     unique action name) instead of grouped-by-model checkboxes
   - RegisteredActionsWidget uses create_option() to inject model_keys
     and help_text; JS enables/disables based on selected object types
   - render_field.html bypasses outer wrapper for registeredactionswidget
     so widget emits rows with identical DOM structure to CRUD checkboxes
   - Unchecking a model now also unchecks unsupported action checkboxes

Fixes #21357
2026-04-01 13:23:47 -05:00
Jeremy Stretch
2fb562fe50 Merge branch 'feature' into 21357-register-model-actions 2026-03-31 12:54:53 -04:00
Martin Hauser
2389feea6b feat(virtualization): Add Virtual Machine Type model
Introduce `VirtualMachineType` to classify virtual machines and apply
default platform, vCPU, and memory values when creating a VM.

This adds the new model and its relationship to `VirtualMachine`, and
wires it through forms, filtersets, tables, views, the REST API,
GraphQL, navigation, search, documentation, and tests.

Explicit values set on a virtual machine continue to take precedence,
and changes to a type do not retroactively update existing VMs.
2026-03-31 09:10:02 -04:00
Jason Novinger
2db5976184 Adapt custom actions panel for declarative layout system
Convert the ObjectPermission detail view to use the new panel-based
layout from #21568. Add ObjectPermissionCustomActionsPanel that
cross-references assigned object types with the model_actions registry
to display which models each custom action applies to.

Also fix dark-mode visibility of disabled action checkboxes in the
permission form by overriding Bootstrap's disabled opacity.
2026-03-30 14:27:29 -05:00
Jason Novinger
6ac5afc0e9 Validate action name is not empty and clarify RESERVED_ACTIONS origin 2026-03-30 12:56:34 -05:00
Jason Novinger
cf6599d9f8 Show all registered actions with enable/disable instead of show/hide 2026-03-30 12:56:34 -05:00
Jason Novinger
2bd8f9d677 Reject reserved action names in register_model_actions() 2026-03-30 12:56:34 -05:00
Jason Novinger
de41d0d3ae Refactor SplitMultiSelectWidget to use class attributes for widget classes 2026-03-30 12:56:34 -05:00
Jason Novinger
667702e0c2 Rebuild frontend assets after rebase onto feature 2026-03-30 12:56:34 -05:00
Jason Novinger
e6314e3971 Remove stale comment in RegisteredActionsWidget 2026-03-30 12:56:29 -05:00
Jason Novinger
80595c0f67 Prevent duplicate action registration in register_model_actions() 2026-03-30 12:56:29 -05:00
Jason Novinger
3f2734d5b8 Fix shared action pre-selection and additional actions leakage on edit 2026-03-30 12:56:29 -05:00
Jason Novinger
637ebf642c Add RESERVED_ACTIONS constant and fix dedup in registered actions
- Define RESERVED_ACTIONS in users/constants.py for the four built-in
  permission actions (view, add, change, delete)
- Replace hardcoded action lists in ObjectPermissionForm with the constant
- Fix duplicate action names in clean() when the same action is registered
  across multiple models (e.g. render_config for Device and VirtualMachine)
- Fix template substring matching bug in objectpermission.html detail view
  by passing RESERVED_ACTIONS through view context for proper list membership
2026-03-30 12:56:29 -05:00
Jason Novinger
92301949df Add documentation for custom model actions
- Add plugin development guide for registering custom actions
- Update admin permissions docs to mention custom actions UI
- Add docstrings to ModelAction and register_model_actions
2026-03-30 12:56:29 -05:00
Jason Novinger
0f5198e1b1 Hide custom actions field when no applicable models selected
The entire field row is now hidden when no selected object types
have registered custom actions, avoiding an empty "Custom actions"
label.
2026-03-30 12:56:29 -05:00
Jason Novinger
7541554d36 Refine registered actions widget UI
- Use verbose labels (App | Model) for action group headers
- Simplify template layout with h5 headers instead of cards
- Consolidate Standard/Custom/Additional Actions into single Actions fieldset
2026-03-30 12:56:29 -05:00
Jason Novinger
83888db109 Add tests for ModelAction and register_model_actions 2026-03-30 12:56:29 -05:00
Jason Novinger
02b85765d9 Register custom actions for DataSource, Device, and VirtualMachine 2026-03-30 12:56:29 -05:00
Jason Novinger
b2e0116302 Add JavaScript for registered actions show/hide 2026-03-30 12:56:29 -05:00
Jason Novinger
8926445ea2 Integrate registered actions into ObjectPermissionForm 2026-03-30 12:55:49 -05:00
Jason Novinger
5cfdf6ab6a Add ObjectTypeSplitMultiSelectWidget and RegisteredActionsWidget 2026-03-30 12:55:25 -05:00
Jason Novinger
2cfecd7052 Add ModelAction and register_model_actions() API for custom permission actions 2026-03-30 12:55:25 -05:00
Martin Hauser
c7504628bd feat(dcim): Add changelog message support to bulk component creation (#21769)
Add ChangelogMessageMixin to DeviceBulkAddComponentForm and capture
changelog_message during bulk component creation. Ensure message is
applied to each created component instance. Add test coverage for
changelog message propagation.
2026-03-30 08:42:05 -07:00
bctiemann
74aa822b27 Merge pull request #21762 from netbox-community/20162-background
#20162 allow background job when adding components to devices in bulk
2026-03-27 13:02:40 -04:00
Arthur
9bc66ee0bf cleanup 2026-03-26 15:00:52 -07:00
Jeremy Stretch
296b89ae02 Fixes #21747: Skip search caching when encountering an invalid schema during migrations (#21748) 2026-03-26 16:46:41 -04:00
Arthur
3ec0551680 cleanup 2026-03-26 13:37:40 -07:00
Arthur
8a58d760fa cleanup 2026-03-26 13:25:49 -07:00
Arthur
84670af18b #20162 allow background job when adding components to devices in bulk 2026-03-26 09:56:21 -07:00
Arthur Hanson
a3a204f2fd Fix regression from #14329 (#21759) 2026-03-26 17:31:00 +01:00
Martin Hauser
2c0b6c4d55 feat(virtualization): Allow VMs to be assigned directly to devices (#21731)
Enable VMs to be assigned to a standalone device without requiring a
cluster. Add device-scoped uniqueness constraints, update validation
logic, and enhance placement flexibility. Site is now auto-inherited
from the cluster or device.
2026-03-25 10:20:00 -07:00
Jeremy Stretch
29239ca58a Closes #21635: Migrate from mkdocs to Zensical (#21742)
* Drop mkdocs from `requirements.txt` and add Zensical
* Replace mkdocs with Zensical in CI and pre-commit tasks
* Remove `.info` from the `docs/` build directory (obsolete)
* Update the legacy ReadTheDocs configuration
* Update upgrade script to use Zensical
* Remove custom docs footer
* Remove obsolete CSS
2026-03-25 16:48:29 +01:00
bctiemann
2a78c05984 Closes #19034: Add calculated RackReservation.unit_count, with min/max filtering (#21665) 2026-03-25 08:50:53 -05:00
Jeremy Stretch
bc66d9f136 Closes #21702: Include originating HTTP request in outbound webhook context data (#21726)
Adds a `request` key to the webhook data if a request is associated with the origination of the webhook.

Note: We're not attaching a complete representation of the request in the interest of both security and brevity.
2026-03-24 23:00:21 +01:00
Jeremy Stretch
b8ce81c8fe Fix migration conflict 2026-03-24 16:25:49 -04:00
bctiemann
41d05490fc Merge pull request #21691 from netbox-community/14329-cf
#14329 Improve diffs for custom_fields
2026-03-24 14:37:19 -04:00
bctiemann
82df20a8a9 Merge pull request #21648 from netbox-community/20152-support-for-marking-module-bays-and-device-bays-as-disabled
Closes #20152: Add support for disabling Device and Module bays
2026-03-24 13:12:00 -04:00
Arthur Hanson
f303ae2cd7 Closes #21662: Increase rf_channel_frequency Precision (#21690)
Increase `rf_channel_frequency` precision from two to three decimal
places.

Update the field definition and migration to use `max_digits=8` and
`decimal_places=3`, preserving support for higher channel frequencies
while allowing more precise values to be stored.
2026-03-24 17:36:20 +01:00
Étienne Brunel
1f336eee2e Closes #21575: Implement {vc_position} template variable on component template name/label (#21601) 2026-03-18 10:15:11 -07:00
Jeremy Stretch
6030fc383a Merge branch 'main' into feature 2026-03-18 10:16:21 -04:00
github-actions
c3c7cf15b2 Update source translation strings 2026-03-18 05:28:51 +00:00
Jeremy Stretch
2b7049c39c Release v4.5.5 (#21672)
* Release v4.5.5

* Pin django-rq to <4.0
v4.5.5
2026-03-17 14:58:14 -04:00
Martin Hauser
3ededeb0e7 fix(circuits): Clear Circuit Termination cache on change
Move cache update logic from signal to model save method and track
original values to properly clear old cache when circuit_id or term_side
changes. Add comprehensive tests for all cache update scenarios.

Fixes #21686
2026-03-17 13:16:22 -04:00
Arthur
1fb6507cc1 #14329 Improve diffs for custom_fields 2026-03-17 09:44:01 -07:00
Arthur Hanson
753fedf5e7 Revert "#14329 Improve diffs for custom_fields" (#21692)
This reverts commit 38afed60ef.
2026-03-17 17:35:30 +01:00
Arthur
ca021e808b #14329 Improve diffs for custom_fields 2026-03-17 09:14:41 -07:00
Arthur
38afed60ef #14329 Improve diffs for custom_fields 2026-03-17 09:09:03 -07:00