Commit Graph

760 Commits

Author SHA1 Message Date
Arthur
3cd0a930dc 19644 set atomic transactions to appropriate database 2025-06-05 09:02:16 -07:00
Arthur Hanson
88f7b6508c
19380 call configure on embedded tables (#19390)
* 19380 call configure on  embedded tables

* 19380 call configure on  embedded tables

* 19380 call configure on  embedded tables
2025-05-05 09:29:32 -04:00
Jeremy Stretch
64b5867cb3 Merge branch 'main' into feature 2025-05-01 09:45:38 -04:00
Jeremy Stretch
e44ad8af45 Fixes #19346: Ensure all redirect URLs are validated 2025-04-28 14:27:49 -04:00
Jeremy Stretch
37cfc50202
Fixes #19322: Correct URL paths for bulk import views (#19323) 2025-04-25 12:20:25 -05:00
Jeremy Stretch
e1b2b4b536
Fixes #17676: Fix support for module bay creation when bulk importing module types (#19311) 2025-04-24 11:07:46 -07:00
Jeremy Stretch
6c7a0cf2b2 Merge branch 'main' into feature 2025-04-22 16:36:17 -04:00
Renato Almeida de Oliveira
7420c25687
Fixes: #18881 Site Groups are missing VLAN and VM related objects (#18932) 2025-04-21 09:11:01 -07:00
Jeremy Stretch
fc0acb020f Merge main into feature 2025-04-10 17:17:21 -04:00
Renato Almeida de Oliveira
fbd6d8c7fc
Closes #17653: Add function to trim whitespaces in export templates via jinja environment settings (#19078)
* Create RenderMixin, and unify template_code rendering and exporting

* Join migrations

* Add DEFAULT_MIME_TE constant

* Move RenderMixin to extras.models.mixins, Rename RenderMixin to RenderTemplateMixin

* Add render_jinja2 to __all__

* Rename ConfigTemplateFilterForm rendering FieldSet

* ConfigTemplate lint

* Simplify ExportTemplate get_context

* Fix table order, and add fields for translations

* Update Serializers

* Update forms, tables, graphQL, API

* Add extra tests for ConfigTemplate and ExportTemplate

* Documentation update

* Fix typo

* Misc cleanup

* Clean up template layouts

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2025-04-08 10:37:15 -04:00
Jeremy Stretch
8d7889e2c0
Closes #19002: Module type profiles (#19014)
* Move Module & ModuleType models to a separate file

* Add ModuleTypeProfile & related fields

* Initial work on JSON schema validation

* Add attributes property on ModuleType

* Introduce MultipleOfValidator

* Introduce JSONSchemaProperty

* Enable dynamic form field rendering

* Misc cleanup

* Fix migration conflict

* Ensure deterministic ordering of attriubte fields

* Support choices & default values

* Include module type attributes on module view

* Enable modifying individual attributes via REST API

* Enable filtering by attribute values

* Add documentation & tests

* Schema should be optional

* Include attributes column for profiles

* Profile is nullable

* Include some initial profiles to be installed via migration

* Fix migrations conflict

* Fix filterset test

* Misc cleanup

* Fixes #19023: get_field_value() should respect null values in bound forms (#19024)

* Skip filters which do not specify a JSON-serializable value

* Fix handling of array item types

* Fix initial data in schema field during bulk edit

* Implement sanity checking for JSON schema definitions

* Fall back to filtering by string value
2025-04-01 12:05:06 -05:00
Renato Almeida de Oliveira
864db469ba
Fixes: #18305 make contacts mixin available for plugins (#19029) 2025-04-01 09:03:25 -04:00
Jason Novinger
78332d44c7
Fixes #18845: restores sort behavior for DeviceTable.name column (#18861)
* Fixes #18845: restores sort behavior for DeviceTable.name column

* Remove accessor/order_by and modify DEVICE_LINK template

Thanks to @alehaa for the suggestion.

This also includes an additional `.select_related()` operation on
`DeviceListView.queryset` to avoid extra queries. Thanks to
@renatoalmeidaoliveira and @jeremystretch for pointing out the need for
this.
2025-03-13 09:22:49 -04:00
Renato Almeida de Oliveira Zaroubin
d83c2f45bc Add vlangroup into LocationTable, LocationListView queryset and related_models in LocationView 2025-03-04 18:34:23 +00:00
Jason Novinger
2a44affd03
Fixes #18594: asn_count sort in Sites list (#18634)
* Fixes #18594: asn_count sort in Sites list

* Fixes similar issue in `circuits.views.ProviderListView`

Thanks @bctiemann for point this out!
2025-02-20 10:01:04 -05:00
Renato Almeida de Oliveira
11514bfb21
Fixes: #18584 Add rack types column to manufacturers table (#18636)
* Add racktype_count annotation to list view queryset, create the LinkedCountColumn in ManufacturerTable

* Add Manufacturer field to RackTypeFilterForm
2025-02-18 08:41:12 -05:00
Alexander Haase
3e1cc0d7f3
Fixes 18208: Consolidate rendering configuration templates (#18604) 2025-02-10 11:03:08 -05:00
Jeremy Stretch
ef6c89ee5d Fixes #18324: Correct filter names for certain related object listings 2025-01-07 10:34:35 -05:00
Jeremy Stretch
39ca3ce571 Merge branch 'develop' into feature 2024-12-12 12:13:45 -05:00
Alexander Haase
26f8c3aae3
Closes 18061: Hide traceback from rendered device config (#18127)
* Hide traceback from rendered device config

When an exception occurs during device configuration rendering, it
usually doesn't contain information about the template being rendered,
but rather the trace of how the template was rendered. Since this could
confuse users and expose internal server information, it is now hidden.

* Improve error message display; replicate changes for VMs

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-12-11 10:28:42 -05:00
Jeremy Stretch
ff7a59db2e Closes #17752: Rename URL paths for bulk import to *_bulk_import 2024-11-22 12:51:06 -05:00
Jeremy Stretch
343a4af591
Closes #18022: Extend linter (ruff) to enforce line length limit (120 chars) (#18067)
* Enable E501 rule
* Configure ruff formatter
* Reformat migration files to fix line length violations
* Fix various E501 errors
* Move table template code to template_code.py & ignore E501 errors
* Reformat raw SQL
2024-11-21 15:58:11 -05:00
Jeremy Stretch
f08e36e538 Merge branch 'develop' into feature 2024-11-21 14:00:57 -05:00
Jeremy Stretch
a0b4b0afe0
Closes #18023: Employ register_model_view() for list views (#18029)
* Extend register_model_view() to enable registering list views

* Register circuits list views with register_model_view()

* Register core list views with register_model_view()

* Fix bulk_edit & bulk_delete URL paths

* Register dcim list views with register_model_view() (WIP)

* Register dcim list views with register_model_view()

* Register extras list views with register_model_view()

* Register ipam list views with register_model_view()

* Register tenancy list views with register_model_view()

* Register users list views with register_model_view()

* Register virtualization list views with register_model_view()

* Register vpn list views with register_model_view()

* Register wireless list views with register_model_view()

* Add change note for register_model_view()
2024-11-20 15:54:37 -05:00
bctiemann
353214098b
4867 multiple mac addresses (#17902)
* Create MACAddress model and migrations to convert existing .mac_address fields to standalone objects

* Add migrations

* All views/filtering working and documentation done; no unit tests yet

* Redo migrations following VLAN Translation

* Remove mac_address filter fields and add table columns for device/vm

* Remove unnecessary "bulk rename"

* Fix filterset tests for Device

* Fix filterset tests for Interface

* Fix tests on single-object forms

* Fix serializer tests

* Fix filterset tests for VMInterface

* Fix filterset tests for Device and VirtualMachine

* Move new field check into lookup_map iteration

* Fix general MACAddress filter tests

* Add GraphQL types/filters/schema

* Fix bulk edit/create tests (bulk editing Interfaces will be unsupported because of inheritance from ComponentBulkEditForm)

* Make mac_address read_only on InterfaceSerializer/VMInterfaceSerializer

* Undo unrelated work

* Cleanup unused IPAddress derived stuff

* API endpoints

* Add serializer objects to interface serializers

* Clean up unnecessary bulk create forms/views/routes

* Add SearchIndex and adjust indexable fields for Interface and VMInterface

* Reorganize MACAddress classes out of association with DeviceComponents

* Move MACAddressSerializer

* Enforce saving only a single is_primary MACAddress per interface/vminterface

* Perform is_primary validation on MACAddress model and just check if one already exists for the interface

* Remove form-level validation

* Fix check for current is_primary setting when reassigning

* Model cleanup

* Documentation notes and cleanup

* Simplify serializer and add ip_addresses

* Add to VMInterfaceSerializer too

* Style cleanup

* Standardize "MAC Address" instead of "MAC"

* Remove unused views

* Add is_primary field for bulk edit

* HTML cleanup and add copy-to-clipboard button

* Remove mac_address from Interface and VMInterface bulk-edit forms

* Add device and VM filtering

* Use combined assigned_object_parent in table to match structure of IPAddressTable

* Add GFK fields to MACAddressSerializer

* Reorganize "Addressing" sections to remove from proximity to "Device Components" and related groupings

* Clean up migrations

* Misc cleanup

* Add filterset test

* Remove mac_address field from interface forms

* Designate primary MAC address via a ForeignKey on the interface models

* Add serializer fields for primary_mac_address

* Update docs

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-11-18 15:11:24 -05:00
Arthur Hanson
6ab0792f02
Closes #11279: Replace _name natural key sorting with collation (#18009)
* 11279 add collation

* 11279 add collation

* 11279 add collation

* 11279 add collation

* 11279 fix tables /tests

* 11279 fix tests

* 11279 refactor VirtualDisk

* Clean up migrations

* Misc cleanup

* Correct errant file inclusion

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-11-15 09:32:09 -05:00
bctiemann
f873735dd4
Closes: #15239 - Allow adding/removing tagged VLANs in bulk editing of Interfaces (#17524)
* Allow adding/removing tagged VLANs in bulk editing of Interfaces

* Move vlan/interface-specific field operations to an overrideable method

* Ensure interfaces are MODE_TAGGED before adding/removing tagged vlans

* Add docstring for generic extra_object_field_operations

* Move tagging ops into post_save_operations and use a TabbedGroup in the form
2024-11-07 09:14:33 -05:00
Arthur Hanson
a8eb455f3e
9604 Add Termination to CircuitTermination (#17821)
* 9604 add scope type to CircuitTermination

* 9604 add scope type to CircuitTermination

* 9604 add scope type to CircuitTermination

* 9604 model_forms

* 9604 form filtersets

* 9604 form bulk_import

* 9604 form bulk_edit

* 9604 serializers

* 9604 graphql

* 9604 tests and detail template

* 9604 fix migration merge

* 9604 fix tests

* 9604 fix tests

* 9604 fix table

* 9604 updates

* fix tests

* fix tests

* fix tests

* fix tests

* fix tests

* fix tests

* fix tests

* 9604 remove provider_network

* 9604 fix tests

* 9604 fix tests

* 9604 fix forms

* 9604 review changes

* 9604 scope->termination

* 9604 fix _circuit_terminations

* 9604 fix _circuit_terminations

* 9604 sitegroup -> site_group

* 9604 update docs

* 9604 fix form termination side reference

* Misc cleanup

* Fix terminations in circuits table

* Fix missing imports

* Clean up termination attrs display

* Add termination & type to CircuitTerminationTable

* Update cable tracing logic

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-10-31 09:55:08 -04:00
bctiemann
f74a9a1c76
Fixes: #7336 - VLAN Translation (#17745)
* VLANTranslationPolicy and VLANTranslationRule models and all associated UI classes

* Change VLANTranslationPolicy to a PrimaryModel and make name unique

* Add serializer classes to InterfaceSerializer

* Remake migrations

* Add GraphQL typing

* Skip tagged models in test

* Missing migration

* Remove get_absolute_url methods

* Remove package-lock.json

* Rebuild migration and add constraints and field options

* Rebuild migrations

* Use DynamicModelChoiceField for policy field

* Make vlan_translation_policy fields on filtersets more consistent with existing __name convention

* Add vlan_translation_table to VMInterface detail page

* Add vlan_translation_policy to VMInterfaceSerializer

* Move vlan_translation_policy fields to model and filterset mixins

* Protect in-use policies against deletion

* Add vlan_translation_policy to fields in VMInterfaceSerializer

* Cleanup indentation

* Remove unnecessary ordering column

* Rebuild migrations

* Search methods and registration

* Ensure 'id' column is present by default

* Add graphql types/filters/schema for VLANTranslationRule

* Filterset tests

* View tests

* API and viewset tests (incomplete)

* Add tags to VLANTranslationRuleForm

* Complete viewset tests for VLANTranslationRule

* Make VLANTranslationRule.policy nullable (but still required)

* Revert "Make VLANTranslationRule.policy nullable (but still required)"

This reverts commit 4c1bb437ef.

* Revert nullability

* Explicitly prefetch policy in graphql

* Documentation of new and affected models

* Add note about select_related in graphql

* Rework policy/rule documentation

* Move vlan_translation_policy into 802.1Q Switching fieldset

* Remove redundant InterfaceVLANTranslationTable

* Conditionally include vlan_translation_table in interface.html and vminterface.html

* Add description field to VLANTranslationRule

* Define vlan_translation_table conditionally

* Add policy (name) filter to VLANTranslationRuleFilterSet

* Revert changes to adding-models.md (moved to another PR)

* Dynamic table for linked rules in vlantranslationpolicy.html

* Misc cleanup

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-10-30 17:09:46 -04:00
Jeremy Stretch
1e5f79a8ed Fixes #17884: Fix translation support for certain tab headings 2024-10-30 08:48:37 -04:00
Arthur Hanson
f4d4483050 17517 fix cable creation when switching device type 2024-09-19 13:24:49 -04:00
Jeremy Stretch
6f7bf5baf4 Merge branch 'develop' into feature 2024-08-29 10:51:38 -04:00
Arthur Hanson
cac92352ca 17286 fix add member to virtual chassis 2024-08-28 12:29:04 -04:00
Brian Tiemann
5bd4fc862d Add a Devices column with device_count hyperlink (via count_related) to SiteListView 2024-08-22 13:03:49 -04:00
Jeremy Stretch
8b91fb8d2d Merge branch 'develop' into feature 2024-08-14 10:54:31 -04:00
Arthur Hanson
34d20fccd5
17036 international messages (#17041)
* 17036 international messages

* 17036 fix typo

* 17036 fix _

* Misc cleanup & fixes

* More cleanup

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-08-10 11:47:06 -04:00
Arthur Hanson
796b9e84af
Closes #10500: Introduce support for nested modules (#16983)
* 10500 add ModularComponentModel

* 10500 add ModularComponentModel

* 10500 add to forms

* 10500 add to serializer, tables

* 10500 template

* 10500 add docs

* 10500 check recursion

* 10500 fix graphql

* 10500 fix conflicting migration from merge

* 10500 token resolution

* 10500 don't return reverse

* 10500 don't return reverse / optimize

* Add ModuleTypeModuleBaysView

* Fix replication of module bays on new modules

* Clean up tables & templates

* Adjust uniqueness constraints

* Correct URL

* Clean up docs

* Fix up serializers

* 10500 add filterset tests

* 10500 add nested validation to Module

* Misc cleanup

* 10500 ModuleBay recursion Test

* 10500 ModuleBay recursion Test

* 10500 ModuleBay recursion Test

* 10500 ModuleBay recursion Test

* Enable MPTT for module bays

* Fix tests

* Fix validation of module token in component names

* Misc cleanup

* Merge migrations

* Fix table ordering

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-08-05 13:13:59 -04:00
Jeremy Stretch
047d717532 Add missing table columns 2024-07-31 14:04:51 -04:00
Arthur Hanson
5a6ffde67e
12826 Add Rack Type (#16739)
* 12826 add RackType

* 12826 add forms, filters, tables

* 12826 add to menu

* 12826 remove role

* 12826 add api/serializers

* 12826 add tests and fixes

* 12826 fix tests

* 12826 fix tests

* 12826 fix tests

* 12826 fix tests

* 12826 add device_type to device and instantiation

* 12826 test device creation

* 12826 add slug

* 12826 fix tests

* 12826 fix slug field

* 12826 prevent modification of rack fields if rack_type set

* 12826 update rack fields on rack_type edit

* Misc cleanup

* Update model docs

* Add manufacturer field to RackType

* Add test for mounting_depth

* Rename 'type' to 'form_factor'

* Create base classes for Rack & RackType models, serializers

* Hide RackType-defined fields on RackForm when a rack type is set

* Establish a base filter form for Rack & RackType

* Clean up RackType attr inheritance

* Clean up templates

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-07-16 08:58:22 -04:00
Jeremy Stretch
b18a6b7c59
Fixes #16779: Fix saved filter selection for child object lists (#16789)
* Fixes #16779: Fix saved filter selection for child object lists

* Omit label_suffix
2024-07-03 08:51:30 -04:00
Jeremy Stretch
f4ac23d868 Closes #16700: Audit usage of mark_safe() for consistent escaping 2024-06-24 12:33:54 -04:00
Alexander Haase
5353f83710
15794 Make "related objects" dynamic (#15876)
* Closes #15794: Make "related objects" dynamic

Instead of hardcoding relationships between models for the detail view,
they are now dynamically generated.

* Fix related models call

* Remove extra related models hook

Instead of providing a rarely used hook method, additional related
models can now be passed directly to the lookup method.

* Fix relations view for ASNs

ASNs have ManyToMany relationships and therefore can't used automatic
resolving. Explicit relations have been restored as before.

* Add method call keywords for clarification

* Cleanup related models

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-06-12 09:46:41 -04:00
Jeremy Stretch
e0f138dea2 Closes #16070: Set default template for ObjectChildrenView 2024-05-13 15:21:52 -04:00
Abhimanyu Saharan
08923d77d1 adds vms tab on device object view #15328 2024-05-09 14:33:31 -04:00
Jeremy Stretch
51bd98bdfc Merge branch 'develop' into feature 2024-05-06 12:59:24 -04:00
Arthur
4cc5079ecb 12127 enable cable add button 2024-05-06 08:37:22 -04:00
Jeremy Stretch
312291b010 Merge branch 'develop' into feature 2024-05-01 16:09:14 -04:00
Daniel Sheppard
c08784da46
Fixes #11460 - Fix unterminated cable exception when editing cable (#15813)
* Fix cable edit form with single unterminated cable

* Minor tweaks

* Instead of skipping HTMX, override the template & move form template to an "htmx" template

* Use HTMXSelect widget for A/B type selection

* Infer A/B termination types from POST data

* Fix saving cable which results in resetting of the termination type fields

* Condense view logic

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-05-01 14:24:50 -04:00
Arthur Hanson
4923025fec
15541 Add component selector to InventoryItemTemplate (#15691)
* 15541 update InventoryItemTemplateForm

* 15541 update InventoryItemTemplateForm

* Remove custom template

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-04-25 09:22:32 -04:00
Jeremy Stretch
46bd62fdc9 Merge branch 'develop' into feature 2024-04-22 13:23:42 -04:00