mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-13 20:49:52 +02:00
Merge remote-tracking branch 'origin/feature' into 21357-register-model-actions
This commit is contained in:
@@ -4,9 +4,9 @@
|
||||
|
||||
Default: `False`
|
||||
|
||||
This setting enables debugging. Debugging should be enabled only during development or troubleshooting. Note that only
|
||||
clients which access NetBox from a recognized [internal IP address](./system.md#internal_ips) will see debugging tools in the user
|
||||
interface.
|
||||
This setting enables debugging and displays a debugging toolbar in the user interface. Debugging should be enabled only during development or troubleshooting.
|
||||
|
||||
Note that the debugging toolbar will be displayed only for requests originating from [internal IP addresses](./system.md#internal_ips), if defined. If no internal IPs are defined, the toolbar will be displayed for all requests.
|
||||
|
||||
!!! warning
|
||||
Never enable debugging on a production system, as it can expose sensitive data to unauthenticated users and impose a
|
||||
|
||||
@@ -77,7 +77,7 @@ This data enables the project maintainers to estimate how many NetBox deployment
|
||||
|
||||
!!! tip "Dynamic Configuration Parameter"
|
||||
|
||||
Default: `True`
|
||||
Default: `False`
|
||||
|
||||
When pruning expired changelog entries (per `CHANGELOG_RETENTION`), retain each non-deleted object's original `create`
|
||||
change record and its most recent `update` change record. If an object has a `delete` change record, its changelog
|
||||
@@ -88,10 +88,6 @@ entries are pruned normally according to `CHANGELOG_RETENTION`.
|
||||
exempt from pruning. All other changelog records (including intermediate `update` records and all `delete` records)
|
||||
remain subject to pruning per `CHANGELOG_RETENTION`.
|
||||
|
||||
!!! warning
|
||||
This setting is enabled by default. Upgrading deployments that rely on complete pruning of expired changelog entries
|
||||
should explicitly set `CHANGELOG_RETAIN_CREATE_LAST_UPDATE = False` to preserve the previous behavior.
|
||||
|
||||
---
|
||||
|
||||
## CHANGELOG_RETENTION
|
||||
|
||||
@@ -105,6 +105,13 @@ A list of IP addresses recognized as internal to the system, used to control the
|
||||
example, the debugging toolbar will be viewable only when a client is accessing NetBox from one of the listed IP
|
||||
addresses (and [`DEBUG`](./development.md#debug) is `True`).
|
||||
|
||||
!!! info "New in NetBox v4.6"
|
||||
Setting this parameter to an empty list will enable the toolbar for all requests provided debugging is enabled:
|
||||
|
||||
```python
|
||||
INTERNAL_IPS = []
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ISOLATED_DEPLOYMENT
|
||||
|
||||
@@ -63,6 +63,7 @@ NetBox supports limited custom validation for custom field values. Following are
|
||||
* Text: Regular expression (optional)
|
||||
* Integer: Minimum and/or maximum value (optional)
|
||||
* Selection: Must exactly match one of the prescribed choices
|
||||
* JSON: Must adhere to the defined validation schema (if any)
|
||||
|
||||
### Custom Selection Fields
|
||||
|
||||
|
||||
@@ -26,15 +26,20 @@ The following data is available as context for Jinja2 templates:
|
||||
* `event` - The type of event which triggered the webhook: `created`, `updated`, or `deleted`.
|
||||
* `timestamp` - The time at which the event occurred (in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format).
|
||||
* `object_type` - The NetBox model which triggered the change in the form `app_label.model_name`.
|
||||
* `username` - The name of the user account associated with the change.
|
||||
* `request_id` - The unique request ID. This may be used to correlate multiple changes associated with a single request.
|
||||
* `request` - Data about the triggering request (if available).
|
||||
* `request.id` - The UUID associated with the request
|
||||
* `request.method` - The HTTP method (e.g. `GET` or `POST`)
|
||||
* `request.path` - The URL path (ex: `/dcim/sites/123/edit/`)
|
||||
* `request.user` - The name of the authenticated user who made the request (if available)
|
||||
* `data` - A detailed representation of the object in its current state. This is typically equivalent to the model's representation in NetBox's REST API.
|
||||
* `snapshots` - Minimal "snapshots" of the object state both before and after the change was made; provided as a dictionary with keys named `prechange` and `postchange`. These are not as extensive as the fully serialized representation, but contain enough information to convey what has changed.
|
||||
* ⚠️ `request_id` - The unique request ID. This may be used to correlate multiple changes associated with a single request.
|
||||
* ⚠️ `username` - The name of the user account associated with the change.
|
||||
|
||||
!!! warning "Deprecation of legacy fields"
|
||||
The "request_id" and "username" fields in the webhook payload above are deprecated and should no longer be used. Support for them will be removed in NetBox v4.7.0.
|
||||
!!! warning "Deprecation of legacy keys"
|
||||
The `request_id` and `username` keys in the webhook payload above are deprecated and should no longer be used. Support for them will be removed in NetBox v4.7.0.
|
||||
|
||||
Use `request.user.username` and `request.request_id` from the `request` object included in the callback context instead.
|
||||
Use `request.user` and `request.id` from the `request` object included in the callback context instead.
|
||||
|
||||
### Default Request Body
|
||||
|
||||
@@ -61,6 +66,12 @@ If no body template is specified, the request body will be populated with a JSON
|
||||
"region": null,
|
||||
...
|
||||
},
|
||||
"request": {
|
||||
"id": "17af32f0-852a-46ca-a7d4-33ecd0c13de6",
|
||||
"method": "POST",
|
||||
"path": "/dcim/sites/add/",
|
||||
"user": "jstretch"
|
||||
},
|
||||
"snapshots": {
|
||||
"prechange": null,
|
||||
"postchange": {
|
||||
|
||||
@@ -32,6 +32,26 @@ For example, `{vc_position:1}` will render as `1` when no Virtual Chassis positi
|
||||
|
||||
Automatic renaming is supported for all modular component types (those listed above).
|
||||
|
||||
### Position Inheritance for Nested Modules
|
||||
|
||||
When using nested module bays (modules installed inside other modules), the `{module}` placeholder
|
||||
can also be used in the **position** field of module bay templates to inherit the parent bay's
|
||||
position. This allows a single module type to produce correctly named components at any nesting
|
||||
depth, with a user-controlled separator.
|
||||
|
||||
For example, a line card module type might define sub-bay positions as `{module}/1`, `{module}/2`,
|
||||
etc. When the line card is installed in a device bay with position `3`, these sub-bay positions
|
||||
resolve to `3/1`, `3/2`, etc. An SFP module type with interface template `SFP {module}` installed
|
||||
in sub-bay `3/2` then produces interface `SFP 3/2`.
|
||||
|
||||
The separator between levels is defined by the user in the position field template itself. Using
|
||||
`{module}-1` produces positions like `3-1`, while `{module}.1` produces `3.1`. This provides
|
||||
full flexibility without requiring a global separator configuration.
|
||||
|
||||
!!! note
|
||||
If the position field does not contain `{module}`, no inheritance occurs and behavior is
|
||||
unchanged from previous versions.
|
||||
|
||||
## Fields
|
||||
|
||||
### Manufacturer
|
||||
|
||||
@@ -118,3 +118,7 @@ For numeric custom fields only. The maximum valid value (optional).
|
||||
### Validation Regex
|
||||
|
||||
For string-based custom fields only. A regular expression used to validate the field's value (optional).
|
||||
|
||||
### Validation Schema
|
||||
|
||||
For JSON custom fields, users have the option of defining a [validation schema](https://json-schema.org). Any value applied to this custom field on a model will be validated against the provided schema, if any.
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
# Search
|
||||
|
||||
Plugins can define and register their own models to extend NetBox's core search functionality. Typically, a plugin will include a file named `search.py`, which holds all search indexes for its models (see the example below).
|
||||
Plugins can define and register their own models to extend NetBox's core search functionality. Typically, a plugin will include a file named `search.py`, which holds all search indexes for its models.
|
||||
|
||||
```python
|
||||
```python title="search.py"
|
||||
# search.py
|
||||
from netbox.search import SearchIndex
|
||||
from netbox.search import SearchIndex, register_search
|
||||
|
||||
from .models import MyModel
|
||||
|
||||
@register_search
|
||||
class MyModelIndex(SearchIndex):
|
||||
model = MyModel
|
||||
fields = (
|
||||
@@ -17,15 +19,11 @@ class MyModelIndex(SearchIndex):
|
||||
display_attrs = ('site', 'device', 'status', 'description')
|
||||
```
|
||||
|
||||
Fields listed in `display_attrs` will not be cached for search, but will be displayed alongside the object when it appears in global search results. This is helpful for conveying to the user additional information about an object.
|
||||
Decorate each `SearchIndex` subclass with `@register_search` to register it with NetBox. When using the default `search.py` module, no additional `indexes = [...]` list is required.
|
||||
|
||||
To register one or more indexes with NetBox, define a list named `indexes` at the end of this file:
|
||||
|
||||
```python
|
||||
indexes = [MyModelIndex]
|
||||
```
|
||||
Fields listed in `display_attrs` are not cached for matching, but they are displayed alongside the object in global search results to provide additional context.
|
||||
|
||||
!!! tip
|
||||
The path to the list of search indexes can be modified by setting `search_indexes` in the PluginConfig instance.
|
||||
The legacy `indexes = [...]` list remains supported via `PluginConfig.search_indexes` for backward compatibility and custom loading patterns.
|
||||
|
||||
::: netbox.search.SearchIndex
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
# UI Components
|
||||
|
||||
!!! note "New in NetBox v4.5"
|
||||
All UI components described here were introduced in NetBox v4.5. Be sure to set the minimum NetBox version to 4.5.0 for your plugin before incorporating any of these resources.
|
||||
!!! note "New in NetBox v4.6"
|
||||
All UI components described here were introduced in NetBox v4.6. Be sure to set the minimum NetBox version to 4.6.0 for your plugin before incorporating any of these resources.
|
||||
|
||||
!!! danger "Beta Feature"
|
||||
UI components are considered a beta feature, and are still under active development. Please be aware that the API for resources on this page is subject to change in future releases.
|
||||
|
||||
To simply the process of designing your plugin's user interface, and to encourage a consistent look and feel throughout the entire application, NetBox provides a set of components that enable programmatic UI design. These make it possible to declare complex page layouts with little or no custom HTML.
|
||||
To simplify the process of designing your plugin's user interface, and to encourage a consistent look and feel throughout the entire application, NetBox provides a set of components that enable programmatic UI design. These make it possible to declare complex page layouts with little or no custom HTML.
|
||||
|
||||
## Page Layout
|
||||
|
||||
@@ -75,9 +72,12 @@ class RecentChangesPanel(Panel):
|
||||
**super().get_context(context),
|
||||
'changes': get_changes()[:10],
|
||||
}
|
||||
|
||||
def should_render(self, context):
|
||||
return len(context['changes']) > 0
|
||||
```
|
||||
|
||||
NetBox also includes a set of panels suite for specific uses, such as display object details or embedding a table of related objects. These are listed below.
|
||||
NetBox also includes a set of panels suited for specific uses, such as displaying object details or embedding a table of related objects. These are listed below.
|
||||
|
||||
::: netbox.ui.panels.Panel
|
||||
|
||||
@@ -85,26 +85,6 @@ NetBox also includes a set of panels suite for specific uses, such as display ob
|
||||
|
||||
::: netbox.ui.panels.ObjectAttributesPanel
|
||||
|
||||
#### Object Attributes
|
||||
|
||||
The following classes are available to represent object attributes within an ObjectAttributesPanel. Additionally, plugins can subclass `netbox.ui.attrs.ObjectAttribute` to create custom classes.
|
||||
|
||||
| Class | Description |
|
||||
|--------------------------------------|--------------------------------------------------|
|
||||
| `netbox.ui.attrs.AddressAttr` | A physical or mailing address. |
|
||||
| `netbox.ui.attrs.BooleanAttr` | A boolean value |
|
||||
| `netbox.ui.attrs.ColorAttr` | A color expressed in RGB |
|
||||
| `netbox.ui.attrs.ChoiceAttr` | A selection from a set of choices |
|
||||
| `netbox.ui.attrs.GPSCoordinatesAttr` | GPS coordinates (latitude and longitude) |
|
||||
| `netbox.ui.attrs.ImageAttr` | An attached image (displays the image) |
|
||||
| `netbox.ui.attrs.NestedObjectAttr` | A related nested object |
|
||||
| `netbox.ui.attrs.NumericAttr` | An integer or float value |
|
||||
| `netbox.ui.attrs.RelatedObjectAttr` | A related object |
|
||||
| `netbox.ui.attrs.TemplatedAttr` | Renders an attribute using a custom template |
|
||||
| `netbox.ui.attrs.TextAttr` | A string (text) value |
|
||||
| `netbox.ui.attrs.TimezoneAttr` | A timezone with annotated offset |
|
||||
| `netbox.ui.attrs.UtilizationAttr` | A numeric value expressed as a utilization graph |
|
||||
|
||||
::: netbox.ui.panels.OrganizationalObjectPanel
|
||||
|
||||
::: netbox.ui.panels.NestedGroupObjectPanel
|
||||
@@ -119,9 +99,13 @@ The following classes are available to represent object attributes within an Obj
|
||||
|
||||
::: netbox.ui.panels.TemplatePanel
|
||||
|
||||
::: netbox.ui.panels.TextCodePanel
|
||||
|
||||
::: netbox.ui.panels.ContextTablePanel
|
||||
|
||||
::: netbox.ui.panels.PluginContentPanel
|
||||
|
||||
## Panel Actions
|
||||
### Panel Actions
|
||||
|
||||
Each panel may have actions associated with it. These render as links or buttons within the panel header, opposite the panel's title. For example, a common use case is to include an "Add" action on a panel which displays a list of objects. Below is an example of this.
|
||||
|
||||
@@ -146,3 +130,60 @@ panels.ObjectsTablePanel(
|
||||
::: netbox.ui.actions.AddObject
|
||||
|
||||
::: netbox.ui.actions.CopyContent
|
||||
|
||||
## Object Attributes
|
||||
|
||||
The following classes are available to represent object attributes within an ObjectAttributesPanel. Additionally, plugins can subclass `netbox.ui.attrs.ObjectAttribute` to create custom classes.
|
||||
|
||||
| Class | Description |
|
||||
|------------------------------------------|--------------------------------------------------|
|
||||
| `netbox.ui.attrs.AddressAttr` | A physical or mailing address. |
|
||||
| `netbox.ui.attrs.BooleanAttr` | A boolean value |
|
||||
| `netbox.ui.attrs.ChoiceAttr` | A selection from a set of choices |
|
||||
| `netbox.ui.attrs.ColorAttr` | A color expressed in RGB |
|
||||
| `netbox.ui.attrs.DateTimeAttr` | A date or datetime value |
|
||||
| `netbox.ui.attrs.GenericForeignKeyAttr` | A related object via a generic foreign key |
|
||||
| `netbox.ui.attrs.GPSCoordinatesAttr` | GPS coordinates (latitude and longitude) |
|
||||
| `netbox.ui.attrs.ImageAttr` | An attached image (displays the image) |
|
||||
| `netbox.ui.attrs.NestedObjectAttr` | A related nested object (includes ancestors) |
|
||||
| `netbox.ui.attrs.NumericAttr` | An integer or float value |
|
||||
| `netbox.ui.attrs.RelatedObjectAttr` | A related object |
|
||||
| `netbox.ui.attrs.RelatedObjectListAttr` | A list of related objects |
|
||||
| `netbox.ui.attrs.TemplatedAttr` | Renders an attribute using a custom template |
|
||||
| `netbox.ui.attrs.TextAttr` | A string (text) value |
|
||||
| `netbox.ui.attrs.TimezoneAttr` | A timezone with annotated offset |
|
||||
| `netbox.ui.attrs.UtilizationAttr` | A numeric value expressed as a utilization graph |
|
||||
|
||||
::: netbox.ui.attrs.ObjectAttribute
|
||||
|
||||
::: netbox.ui.attrs.AddressAttr
|
||||
|
||||
::: netbox.ui.attrs.BooleanAttr
|
||||
|
||||
::: netbox.ui.attrs.ChoiceAttr
|
||||
|
||||
::: netbox.ui.attrs.ColorAttr
|
||||
|
||||
::: netbox.ui.attrs.DateTimeAttr
|
||||
|
||||
::: netbox.ui.attrs.GenericForeignKeyAttr
|
||||
|
||||
::: netbox.ui.attrs.GPSCoordinatesAttr
|
||||
|
||||
::: netbox.ui.attrs.ImageAttr
|
||||
|
||||
::: netbox.ui.attrs.NestedObjectAttr
|
||||
|
||||
::: netbox.ui.attrs.NumericAttr
|
||||
|
||||
::: netbox.ui.attrs.RelatedObjectAttr
|
||||
|
||||
::: netbox.ui.attrs.RelatedObjectListAttr
|
||||
|
||||
::: netbox.ui.attrs.TemplatedAttr
|
||||
|
||||
::: netbox.ui.attrs.TextAttr
|
||||
|
||||
::: netbox.ui.attrs.TimezoneAttr
|
||||
|
||||
::: netbox.ui.attrs.UtilizationAttr
|
||||
|
||||
@@ -36,6 +36,7 @@ The resulting webhook payload will look like the following:
|
||||
"url": "/api/dcim/sites/2/",
|
||||
...
|
||||
},
|
||||
"request": {...},
|
||||
"snapshots": {...},
|
||||
"context": {
|
||||
"foo": 123
|
||||
@@ -43,10 +44,10 @@ The resulting webhook payload will look like the following:
|
||||
}
|
||||
```
|
||||
|
||||
!!! warning "Deprecation of legacy fields"
|
||||
The "request_id" and "username" fields in the webhook payload above are deprecated and should no longer be used. Support for them will be removed in NetBox v4.7.0.
|
||||
!!! warning "Deprecation of legacy keys"
|
||||
The `request_id` and `username` keys in the webhook payload above are deprecated and should no longer be used. Support for them will be removed in NetBox v4.7.0.
|
||||
|
||||
Use `request.user.username` and `request.request_id` from the `request` object included in the callback context instead.
|
||||
Use `request.user` and `request.id` from the `request` object included in the callback context instead.
|
||||
|
||||
!!! note "Consider namespacing webhook data"
|
||||
The data returned from all webhook callbacks will be compiled into a single `context` dictionary. Any existing keys within this dictionary will be overwritten by subsequent callbacks which include those keys. To avoid collisions with webhook data provided by other plugins, consider namespacing your plugin's data within a nested dictionary as such:
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
# NetBox v4.5
|
||||
|
||||
## v4.5.6 (2026-03-31)
|
||||
|
||||
### Enhancements
|
||||
|
||||
* [#21480](https://github.com/netbox-community/netbox/issues/21480) - Add OSFP224 (1.6T) interface type
|
||||
* [#21727](https://github.com/netbox-community/netbox/issues/21727) - Add 2.5GBASE-X SFP modular interface type
|
||||
* [#21743](https://github.com/netbox-community/netbox/issues/21743) - Improve object change diff styling and layout
|
||||
* [#21793](https://github.com/netbox-community/netbox/issues/21793) - Add 50 Gbps, 800 Gbps, and 1.6 Tbps interface speed options
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* [#20467](https://github.com/netbox-community/netbox/issues/20467) - Fix resolution of the `{module}` variable for position fields in nested modules
|
||||
* [#21698](https://github.com/netbox-community/netbox/issues/21698) - Adjust custom field URL filter to support non-standard port numbers
|
||||
* [#21707](https://github.com/netbox-community/netbox/issues/21707) - Fix grouping of owner fields in provider account add/edit forms
|
||||
* [#21749](https://github.com/netbox-community/netbox/issues/21749) - Fix `FieldError` exception when sorting the circuit group assignment table by the member column
|
||||
* [#21763](https://github.com/netbox-community/netbox/issues/21763) - Use separate add/remove form fields when editing a site or provider with a large number of ASNs assigned
|
||||
|
||||
---
|
||||
|
||||
## v4.5.5 (2026-03-17)
|
||||
|
||||
### Enhancements
|
||||
|
||||
Reference in New Issue
Block a user