From 8e48e939aab3b75a50c73cb46b2cc4c30f801ae8 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Date: Mon, 3 Jun 2024 07:24:01 -0700 Subject: [PATCH 01/21] 16261 fix graphql lookup for MultiValueCharFilter fields (#16354) * 16261 fix graphql lookup for MultiValueCharFilter fields * 16261 fix graphql lookup for MultiValueCharFilter fields * 16261 fixup test * 16261 fixup test * Omit redundant assignment --------- Co-authored-by: Jeremy Stretch --- netbox/ipam/tests/test_api.py | 2 +- netbox/netbox/graphql/filter_mixins.py | 5 +++-- netbox/utilities/testing/api.py | 12 ++++++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/netbox/ipam/tests/test_api.py b/netbox/ipam/tests/test_api.py index 20ba35c6b..2cf7a2f1c 100644 --- a/netbox/ipam/tests/test_api.py +++ b/netbox/ipam/tests/test_api.py @@ -649,7 +649,7 @@ class IPAddressTest(APIViewTestCases.APIViewTestCase): 'description': 'New description', } graphql_filter = { - 'address': '192.168.0.1/24', + 'address': {'lookup': 'i_exact', 'value': '192.168.0.1/24'}, } @classmethod diff --git a/netbox/netbox/graphql/filter_mixins.py b/netbox/netbox/graphql/filter_mixins.py index 322435c72..5075e9aa2 100644 --- a/netbox/netbox/graphql/filter_mixins.py +++ b/netbox/netbox/graphql/filter_mixins.py @@ -23,8 +23,9 @@ def map_strawberry_type(field): elif isinstance(field, MultiValueArrayFilter): pass elif isinstance(field, MultiValueCharFilter): - should_create_function = True - attr_type = List[str] | None + # Note: Need to use the legacy FilterLookup from filters, not from + # strawberry_django.FilterLookup as we currently have USE_DEPRECATED_FILTERS + attr_type = strawberry_django.filters.FilterLookup[str] | None elif isinstance(field, MultiValueDateFilter): attr_type = auto elif isinstance(field, MultiValueDateTimeFilter): diff --git a/netbox/utilities/testing/api.py b/netbox/utilities/testing/api.py index 019d6e6ca..62ac817e2 100644 --- a/netbox/utilities/testing/api.py +++ b/netbox/utilities/testing/api.py @@ -493,10 +493,18 @@ class APIViewTestCases: def _build_filtered_query(self, name, **filters): """ - Create a filtered query: i.e. ip_address_list(filters: {address: "1.1.1.1/24"}){. + Create a filtered query: i.e. device_list(filters: {name: {i_contains: "akron"}}){. """ + # TODO: This should be extended to support AND, OR multi-lookups if filters: - filter_string = ', '.join(f'{k}: "{v}"' for k, v in filters.items()) + for field_name, params in filters.items(): + lookup = params['lookup'] + value = params['value'] + if lookup: + query = f'{{{lookup}: "{value}"}}' + filter_string = f'{field_name}: {query}' + else: + filter_string = f'{field_name}: "{value}"' filter_string = f'(filters: {{{filter_string}}})' else: filter_string = '' From 291e0665d07c257f9ee98eee4db5720ab2b3dba9 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 4 Jun 2024 05:02:13 +0000 Subject: [PATCH 02/21] Update source translation strings --- netbox/translations/en/LC_MESSAGES/django.po | 198 +++++++++---------- 1 file changed, 99 insertions(+), 99 deletions(-) diff --git a/netbox/translations/en/LC_MESSAGES/django.po b/netbox/translations/en/LC_MESSAGES/django.po index bb938e9d7..af150e24c 100644 --- a/netbox/translations/en/LC_MESSAGES/django.po +++ b/netbox/translations/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-06-01 05:02+0000\n" +"POT-Creation-Date: 2024-06-04 05:02+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -172,7 +172,7 @@ msgstr "" #: netbox/dcim/forms/filtersets.py:1524 netbox/dcim/forms/model_forms.py:136 #: netbox/dcim/forms/model_forms.py:164 netbox/dcim/forms/model_forms.py:206 #: netbox/dcim/forms/model_forms.py:406 netbox/dcim/forms/model_forms.py:668 -#: netbox/dcim/forms/object_create.py:391 netbox/dcim/tables/devices.py:158 +#: netbox/dcim/forms/object_create.py:391 netbox/dcim/tables/devices.py:150 #: netbox/dcim/tables/power.py:26 netbox/dcim/tables/power.py:93 #: netbox/dcim/tables/racks.py:62 netbox/dcim/tables/racks.py:138 #: netbox/dcim/tables/sites.py:129 netbox/extras/filtersets.py:477 @@ -492,8 +492,8 @@ msgstr "" #: netbox/dcim/forms/bulk_edit.py:1071 netbox/dcim/forms/bulk_edit.py:1098 #: netbox/dcim/forms/bulk_edit.py:1571 netbox/dcim/forms/filtersets.py:983 #: netbox/dcim/forms/filtersets.py:1359 netbox/dcim/forms/filtersets.py:1380 -#: netbox/dcim/tables/devices.py:699 netbox/dcim/tables/devices.py:759 -#: netbox/dcim/tables/devices.py:986 netbox/dcim/tables/devicetypes.py:245 +#: netbox/dcim/tables/devices.py:687 netbox/dcim/tables/devices.py:744 +#: netbox/dcim/tables/devices.py:968 netbox/dcim/tables/devicetypes.py:245 #: netbox/dcim/tables/devicetypes.py:260 netbox/dcim/tables/racks.py:32 #: netbox/extras/forms/bulk_edit.py:260 netbox/extras/tables/tables.py:333 #: netbox/templates/circuits/circuittype.html:30 @@ -527,8 +527,8 @@ msgstr "" #: netbox/dcim/forms/filtersets.py:1354 netbox/dcim/forms/filtersets.py:1375 #: netbox/dcim/forms/model_forms.py:643 netbox/dcim/forms/model_forms.py:649 #: netbox/dcim/forms/object_import.py:84 netbox/dcim/forms/object_import.py:113 -#: netbox/dcim/forms/object_import.py:145 netbox/dcim/tables/devices.py:183 -#: netbox/dcim/tables/devices.py:815 netbox/dcim/tables/power.py:77 +#: netbox/dcim/forms/object_import.py:145 netbox/dcim/tables/devices.py:175 +#: netbox/dcim/tables/devices.py:797 netbox/dcim/tables/power.py:77 #: netbox/extras/forms/bulk_import.py:39 netbox/extras/tables/tables.py:283 #: netbox/extras/tables/tables.py:355 netbox/extras/tables/tables.py:473 #: netbox/netbox/tables/tables.py:239 netbox/templates/circuits/circuit.html:30 @@ -583,8 +583,8 @@ msgstr "" #: netbox/dcim/forms/filtersets.py:282 netbox/dcim/forms/filtersets.py:728 #: netbox/dcim/forms/filtersets.py:843 netbox/dcim/forms/filtersets.py:877 #: netbox/dcim/forms/filtersets.py:978 netbox/dcim/forms/filtersets.py:1089 -#: netbox/dcim/tables/devices.py:145 netbox/dcim/tables/devices.py:818 -#: netbox/dcim/tables/devices.py:1046 netbox/dcim/tables/modules.py:69 +#: netbox/dcim/tables/devices.py:137 netbox/dcim/tables/devices.py:800 +#: netbox/dcim/tables/devices.py:1028 netbox/dcim/tables/modules.py:69 #: netbox/dcim/tables/power.py:74 netbox/dcim/tables/racks.py:66 #: netbox/dcim/tables/sites.py:82 netbox/dcim/tables/sites.py:133 #: netbox/ipam/forms/bulk_edit.py:241 netbox/ipam/forms/bulk_edit.py:290 @@ -868,7 +868,7 @@ msgstr "" #: netbox/dcim/forms/filtersets.py:1406 netbox/dcim/forms/filtersets.py:1420 #: netbox/dcim/forms/model_forms.py:179 netbox/dcim/forms/model_forms.py:211 #: netbox/dcim/forms/model_forms.py:411 netbox/dcim/forms/model_forms.py:673 -#: netbox/dcim/tables/devices.py:162 netbox/dcim/tables/power.py:30 +#: netbox/dcim/tables/devices.py:154 netbox/dcim/tables/power.py:30 #: netbox/dcim/tables/racks.py:58 netbox/dcim/tables/racks.py:143 #: netbox/extras/filtersets.py:488 netbox/extras/forms/filtersets.py:329 #: netbox/ipam/forms/bulk_edit.py:457 netbox/ipam/forms/filtersets.py:173 @@ -913,7 +913,7 @@ msgstr "" #: netbox/dcim/forms/filtersets.py:1055 netbox/dcim/forms/filtersets.py:1468 #: netbox/dcim/forms/filtersets.py:1492 netbox/dcim/forms/filtersets.py:1516 #: netbox/dcim/forms/model_forms.py:111 netbox/dcim/forms/object_create.py:375 -#: netbox/dcim/tables/devices.py:148 netbox/dcim/tables/sites.py:85 +#: netbox/dcim/tables/devices.py:140 netbox/dcim/tables/sites.py:85 #: netbox/extras/filtersets.py:455 netbox/ipam/forms/bulk_edit.py:206 #: netbox/ipam/forms/bulk_edit.py:438 netbox/ipam/forms/bulk_edit.py:512 #: netbox/ipam/forms/filtersets.py:217 netbox/ipam/forms/filtersets.py:422 @@ -1207,14 +1207,14 @@ msgstr "" #: netbox/core/tables/jobs.py:14 netbox/core/tables/plugins.py:13 #: netbox/core/tables/tasks.py:11 netbox/core/tables/tasks.py:115 #: netbox/dcim/forms/filtersets.py:61 netbox/dcim/forms/object_create.py:43 -#: netbox/dcim/tables/devices.py:60 netbox/dcim/tables/devices.py:97 -#: netbox/dcim/tables/devices.py:139 netbox/dcim/tables/devices.py:294 -#: netbox/dcim/tables/devices.py:380 netbox/dcim/tables/devices.py:424 -#: netbox/dcim/tables/devices.py:476 netbox/dcim/tables/devices.py:528 -#: netbox/dcim/tables/devices.py:644 netbox/dcim/tables/devices.py:726 -#: netbox/dcim/tables/devices.py:776 netbox/dcim/tables/devices.py:842 -#: netbox/dcim/tables/devices.py:957 netbox/dcim/tables/devices.py:977 -#: netbox/dcim/tables/devices.py:1006 netbox/dcim/tables/devices.py:1036 +#: netbox/dcim/tables/devices.py:52 netbox/dcim/tables/devices.py:89 +#: netbox/dcim/tables/devices.py:131 netbox/dcim/tables/devices.py:286 +#: netbox/dcim/tables/devices.py:380 netbox/dcim/tables/devices.py:421 +#: netbox/dcim/tables/devices.py:470 netbox/dcim/tables/devices.py:519 +#: netbox/dcim/tables/devices.py:632 netbox/dcim/tables/devices.py:714 +#: netbox/dcim/tables/devices.py:761 netbox/dcim/tables/devices.py:824 +#: netbox/dcim/tables/devices.py:939 netbox/dcim/tables/devices.py:959 +#: netbox/dcim/tables/devices.py:988 netbox/dcim/tables/devices.py:1018 #: netbox/dcim/tables/devicetypes.py:32 netbox/dcim/tables/power.py:22 #: netbox/dcim/tables/power.py:62 netbox/dcim/tables/racks.py:23 #: netbox/dcim/tables/racks.py:53 netbox/dcim/tables/sites.py:24 @@ -1304,7 +1304,7 @@ msgstr "" #: netbox/virtualization/tables/clusters.py:62 #: netbox/virtualization/tables/virtualmachines.py:54 #: netbox/virtualization/tables/virtualmachines.py:132 -#: netbox/virtualization/tables/virtualmachines.py:185 +#: netbox/virtualization/tables/virtualmachines.py:187 #: netbox/vpn/tables/crypto.py:18 netbox/vpn/tables/crypto.py:57 #: netbox/vpn/tables/crypto.py:93 netbox/vpn/tables/crypto.py:129 #: netbox/vpn/tables/crypto.py:158 netbox/vpn/tables/l2vpn.py:23 @@ -1344,7 +1344,7 @@ msgstr "" #: netbox/circuits/tables/circuits.py:76 netbox/circuits/tables/providers.py:48 #: netbox/circuits/tables/providers.py:82 -#: netbox/circuits/tables/providers.py:107 netbox/dcim/tables/devices.py:1019 +#: netbox/circuits/tables/providers.py:107 netbox/dcim/tables/devices.py:1001 #: netbox/dcim/tables/devicetypes.py:92 netbox/dcim/tables/modules.py:29 #: netbox/dcim/tables/modules.py:72 netbox/dcim/tables/power.py:39 #: netbox/dcim/tables/power.py:96 netbox/dcim/tables/racks.py:76 @@ -1515,7 +1515,7 @@ msgstr "" #: netbox/core/forms/bulk_edit.py:25 netbox/core/forms/filtersets.py:40 #: netbox/core/tables/data.py:26 netbox/dcim/forms/bulk_edit.py:1020 #: netbox/dcim/forms/bulk_edit.py:1293 netbox/dcim/forms/filtersets.py:1276 -#: netbox/dcim/tables/devices.py:553 netbox/dcim/tables/devicetypes.py:221 +#: netbox/dcim/tables/devices.py:541 netbox/dcim/tables/devicetypes.py:221 #: netbox/extras/forms/bulk_edit.py:98 netbox/extras/forms/bulk_edit.py:162 #: netbox/extras/forms/bulk_edit.py:221 netbox/extras/forms/filtersets.py:120 #: netbox/extras/forms/filtersets.py:207 netbox/extras/forms/filtersets.py:268 @@ -2163,7 +2163,7 @@ msgstr "" #: netbox/dcim/forms/model_forms.py:73 netbox/dcim/forms/model_forms.py:92 #: netbox/dcim/forms/model_forms.py:169 netbox/dcim/forms/model_forms.py:1007 #: netbox/dcim/forms/model_forms.py:1446 netbox/dcim/forms/object_import.py:176 -#: netbox/dcim/tables/devices.py:652 netbox/dcim/tables/devices.py:937 +#: netbox/dcim/tables/devices.py:640 netbox/dcim/tables/devices.py:919 #: netbox/extras/tables/tables.py:186 netbox/ipam/tables/fhrp.py:59 #: netbox/ipam/tables/ip.py:374 netbox/ipam/tables/services.py:44 #: netbox/templates/dcim/interface.html:102 @@ -2297,7 +2297,7 @@ msgstr "" #: netbox/dcim/choices.py:979 netbox/dcim/forms/bulk_edit.py:1303 #: netbox/dcim/forms/bulk_import.py:785 netbox/dcim/forms/model_forms.py:919 -#: netbox/dcim/tables/devices.py:656 netbox/templates/dcim/interface.html:106 +#: netbox/dcim/tables/devices.py:644 netbox/templates/dcim/interface.html:106 #: netbox/templates/virtualization/vminterface.html:43 #: netbox/virtualization/forms/bulk_edit.py:212 #: netbox/virtualization/forms/bulk_import.py:158 @@ -2781,7 +2781,7 @@ msgid "Virtual Chassis (ID)" msgstr "" #: netbox/dcim/filtersets.py:1401 netbox/dcim/forms/filtersets.py:107 -#: netbox/dcim/tables/devices.py:211 netbox/netbox/navigation/menu.py:66 +#: netbox/dcim/tables/devices.py:203 netbox/netbox/navigation/menu.py:66 #: netbox/templates/dcim/device.html:120 #: netbox/templates/dcim/device_edit.html:93 #: netbox/templates/dcim/virtualchassis.html:20 @@ -2811,7 +2811,7 @@ msgstr "" #: netbox/dcim/forms/bulk_import.py:836 netbox/dcim/forms/filtersets.py:1334 #: netbox/dcim/forms/model_forms.py:1322 #: netbox/dcim/models/device_components.py:712 -#: netbox/dcim/tables/devices.py:622 netbox/ipam/filtersets.py:316 +#: netbox/dcim/tables/devices.py:610 netbox/ipam/filtersets.py:316 #: netbox/ipam/filtersets.py:327 netbox/ipam/filtersets.py:483 #: netbox/ipam/filtersets.py:584 netbox/ipam/filtersets.py:595 #: netbox/ipam/forms/bulk_edit.py:227 netbox/ipam/forms/bulk_edit.py:282 @@ -2852,7 +2852,7 @@ msgid "L2VPN (ID)" msgstr "" #: netbox/dcim/filtersets.py:1563 netbox/dcim/forms/filtersets.py:1339 -#: netbox/dcim/tables/devices.py:570 netbox/ipam/filtersets.py:1022 +#: netbox/dcim/tables/devices.py:558 netbox/ipam/filtersets.py:1022 #: netbox/ipam/forms/filtersets.py:525 netbox/ipam/tables/vlans.py:133 #: netbox/templates/dcim/interface.html:93 netbox/templates/ipam/vlan.html:66 #: netbox/templates/vpn/l2vpntermination.html:12 @@ -2902,7 +2902,7 @@ msgstr "" msgid "Wireless LAN" msgstr "" -#: netbox/dcim/filtersets.py:1667 netbox/dcim/tables/devices.py:609 +#: netbox/dcim/filtersets.py:1667 netbox/dcim/tables/devices.py:597 msgid "Wireless link" msgstr "" @@ -2957,8 +2957,8 @@ msgstr "" #: netbox/dcim/forms/bulk_create.py:112 netbox/dcim/forms/filtersets.py:1396 #: netbox/dcim/forms/model_forms.py:431 netbox/dcim/forms/model_forms.py:486 #: netbox/dcim/forms/object_create.py:197 -#: netbox/dcim/forms/object_create.py:353 netbox/dcim/tables/devices.py:170 -#: netbox/dcim/tables/devices.py:702 netbox/dcim/tables/devicetypes.py:242 +#: netbox/dcim/forms/object_create.py:353 netbox/dcim/tables/devices.py:162 +#: netbox/dcim/tables/devices.py:690 netbox/dcim/tables/devicetypes.py:242 #: netbox/templates/dcim/device.html:43 netbox/templates/dcim/device.html:130 #: netbox/templates/dcim/modulebay.html:34 #: netbox/templates/dcim/virtualchassis.html:66 @@ -3035,8 +3035,8 @@ msgstr "" #: netbox/dcim/forms/filtersets.py:706 netbox/dcim/forms/filtersets.py:1426 #: netbox/dcim/forms/model_forms.py:219 netbox/dcim/forms/model_forms.py:1015 #: netbox/dcim/forms/model_forms.py:1454 netbox/dcim/forms/object_import.py:181 -#: netbox/dcim/tables/devices.py:174 netbox/dcim/tables/devices.py:810 -#: netbox/dcim/tables/devices.py:921 netbox/dcim/tables/devicetypes.py:300 +#: netbox/dcim/tables/devices.py:166 netbox/dcim/tables/devices.py:792 +#: netbox/dcim/tables/devices.py:903 netbox/dcim/tables/devicetypes.py:300 #: netbox/dcim/tables/racks.py:69 netbox/extras/filtersets.py:504 #: netbox/ipam/forms/bulk_edit.py:246 netbox/ipam/forms/bulk_edit.py:295 #: netbox/ipam/forms/bulk_edit.py:343 netbox/ipam/forms/bulk_edit.py:549 @@ -3159,7 +3159,7 @@ msgstr "" #: netbox/dcim/forms/filtersets.py:954 netbox/dcim/forms/filtersets.py:1086 #: netbox/dcim/forms/model_forms.py:226 netbox/dcim/forms/model_forms.py:248 #: netbox/dcim/forms/model_forms.py:422 netbox/dcim/forms/model_forms.py:700 -#: netbox/dcim/forms/object_create.py:400 netbox/dcim/tables/devices.py:166 +#: netbox/dcim/forms/object_create.py:400 netbox/dcim/tables/devices.py:158 #: netbox/dcim/tables/power.py:70 netbox/dcim/tables/racks.py:148 #: netbox/ipam/forms/bulk_edit.py:465 netbox/ipam/forms/filtersets.py:442 #: netbox/ipam/forms/model_forms.py:610 netbox/templates/dcim/device.html:30 @@ -3193,8 +3193,8 @@ msgstr "" #: netbox/dcim/forms/model_forms.py:281 netbox/dcim/forms/model_forms.py:293 #: netbox/dcim/forms/model_forms.py:339 netbox/dcim/forms/model_forms.py:379 #: netbox/dcim/forms/model_forms.py:1020 netbox/dcim/forms/model_forms.py:1459 -#: netbox/dcim/forms/object_import.py:187 netbox/dcim/tables/devices.py:101 -#: netbox/dcim/tables/devices.py:177 netbox/dcim/tables/devices.py:924 +#: netbox/dcim/forms/object_import.py:187 netbox/dcim/tables/devices.py:93 +#: netbox/dcim/tables/devices.py:169 netbox/dcim/tables/devices.py:906 #: netbox/dcim/tables/devicetypes.py:81 netbox/dcim/tables/devicetypes.py:304 #: netbox/dcim/tables/modules.py:20 netbox/dcim/tables/modules.py:60 #: netbox/templates/dcim/devicetype.html:14 @@ -3277,7 +3277,7 @@ msgstr "" #: netbox/dcim/forms/bulk_edit.py:593 netbox/dcim/forms/bulk_import.py:443 #: netbox/dcim/forms/filtersets.py:725 netbox/dcim/forms/model_forms.py:394 -#: netbox/dcim/forms/model_forms.py:456 netbox/dcim/tables/devices.py:187 +#: netbox/dcim/forms/model_forms.py:456 netbox/dcim/tables/devices.py:179 #: netbox/extras/filtersets.py:515 netbox/templates/dcim/device.html:184 #: netbox/templates/dcim/platform.html:26 #: netbox/templates/virtualization/virtualmachine.html:27 @@ -3309,13 +3309,13 @@ msgstr "" #: netbox/dcim/forms/model_forms.py:794 netbox/dcim/forms/model_forms.py:1153 #: netbox/dcim/forms/model_forms.py:1608 netbox/dcim/forms/object_create.py:257 #: netbox/dcim/tables/connections.py:22 netbox/dcim/tables/connections.py:41 -#: netbox/dcim/tables/connections.py:60 netbox/dcim/tables/devices.py:290 -#: netbox/dcim/tables/devices.py:359 netbox/dcim/tables/devices.py:403 -#: netbox/dcim/tables/devices.py:448 netbox/dcim/tables/devices.py:502 -#: netbox/dcim/tables/devices.py:594 netbox/dcim/tables/devices.py:692 -#: netbox/dcim/tables/devices.py:752 netbox/dcim/tables/devices.py:802 -#: netbox/dcim/tables/devices.py:862 netbox/dcim/tables/devices.py:914 -#: netbox/dcim/tables/devices.py:1040 netbox/dcim/tables/modules.py:52 +#: netbox/dcim/tables/connections.py:60 netbox/dcim/tables/devices.py:282 +#: netbox/dcim/tables/devices.py:359 netbox/dcim/tables/devices.py:400 +#: netbox/dcim/tables/devices.py:442 netbox/dcim/tables/devices.py:493 +#: netbox/dcim/tables/devices.py:582 netbox/dcim/tables/devices.py:680 +#: netbox/dcim/tables/devices.py:737 netbox/dcim/tables/devices.py:784 +#: netbox/dcim/tables/devices.py:844 netbox/dcim/tables/devices.py:896 +#: netbox/dcim/tables/devices.py:1022 netbox/dcim/tables/modules.py:52 #: netbox/extras/forms/filtersets.py:330 netbox/ipam/forms/bulk_import.py:303 #: netbox/ipam/forms/bulk_import.py:489 netbox/ipam/forms/filtersets.py:558 #: netbox/ipam/forms/model_forms.py:317 netbox/ipam/forms/model_forms.py:725 @@ -3489,7 +3489,7 @@ msgid "Wireless role" msgstr "" #: netbox/dcim/forms/bulk_edit.py:1186 netbox/dcim/forms/model_forms.py:609 -#: netbox/dcim/forms/model_forms.py:1168 netbox/dcim/tables/devices.py:313 +#: netbox/dcim/forms/model_forms.py:1168 netbox/dcim/tables/devices.py:305 #: netbox/templates/dcim/consoleport.html:24 #: netbox/templates/dcim/consoleserverport.html:24 #: netbox/templates/dcim/frontport.html:24 @@ -3501,7 +3501,7 @@ msgstr "" msgid "Module" msgstr "" -#: netbox/dcim/forms/bulk_edit.py:1313 netbox/dcim/tables/devices.py:661 +#: netbox/dcim/forms/bulk_edit.py:1313 netbox/dcim/tables/devices.py:649 #: netbox/templates/dcim/interface.html:110 msgid "LAG" msgstr "" @@ -3513,7 +3513,7 @@ msgstr "" #: netbox/dcim/forms/bulk_edit.py:1324 netbox/dcim/forms/bulk_import.py:659 #: netbox/dcim/forms/bulk_import.py:685 netbox/dcim/forms/filtersets.py:1169 #: netbox/dcim/forms/filtersets.py:1191 netbox/dcim/forms/filtersets.py:1264 -#: netbox/dcim/tables/devices.py:606 +#: netbox/dcim/tables/devices.py:594 #: netbox/templates/circuits/inc/circuit_termination_fields.html:67 #: netbox/templates/dcim/consoleport.html:40 #: netbox/templates/dcim/consoleserverport.html:40 @@ -3542,14 +3542,14 @@ msgid "VLAN group" msgstr "" #: netbox/dcim/forms/bulk_edit.py:1369 netbox/dcim/forms/model_forms.py:1304 -#: netbox/dcim/tables/devices.py:579 +#: netbox/dcim/tables/devices.py:567 #: netbox/virtualization/forms/bulk_edit.py:248 #: netbox/virtualization/forms/model_forms.py:326 msgid "Untagged VLAN" msgstr "" #: netbox/dcim/forms/bulk_edit.py:1377 netbox/dcim/forms/model_forms.py:1313 -#: netbox/dcim/tables/devices.py:585 +#: netbox/dcim/tables/devices.py:573 #: netbox/virtualization/forms/bulk_edit.py:256 #: netbox/virtualization/forms/model_forms.py:335 msgid "Tagged VLANs" @@ -3560,7 +3560,7 @@ msgid "Wireless LAN group" msgstr "" #: netbox/dcim/forms/bulk_edit.py:1392 netbox/dcim/forms/model_forms.py:1291 -#: netbox/dcim/tables/devices.py:615 netbox/netbox/navigation/menu.py:133 +#: netbox/dcim/tables/devices.py:603 netbox/netbox/navigation/menu.py:133 #: netbox/templates/dcim/interface.html:280 #: netbox/wireless/tables/wirelesslan.py:24 msgid "Wireless LANs" @@ -3740,7 +3740,7 @@ msgid "Virtual chassis" msgstr "" #: netbox/dcim/forms/bulk_import.py:462 netbox/dcim/forms/model_forms.py:465 -#: netbox/dcim/tables/devices.py:207 netbox/extras/filtersets.py:548 +#: netbox/dcim/tables/devices.py:199 netbox/extras/filtersets.py:548 #: netbox/extras/forms/filtersets.py:331 netbox/ipam/forms/bulk_edit.py:479 #: netbox/ipam/forms/filtersets.py:415 netbox/ipam/forms/filtersets.py:459 #: netbox/ipam/forms/model_forms.py:627 netbox/templates/dcim/device.html:232 @@ -3935,7 +3935,7 @@ msgstr "" msgid "Physical medium classification" msgstr "" -#: netbox/dcim/forms/bulk_import.py:973 netbox/dcim/tables/devices.py:823 +#: netbox/dcim/forms/bulk_import.py:973 netbox/dcim/tables/devices.py:805 msgid "Installed device" msgstr "" @@ -4024,7 +4024,7 @@ msgid "{side_upper} side termination not found: {device} {name}" msgstr "" #: netbox/dcim/forms/bulk_import.py:1244 netbox/dcim/forms/model_forms.py:730 -#: netbox/dcim/tables/devices.py:1010 netbox/templates/dcim/device.html:131 +#: netbox/dcim/tables/devices.py:992 netbox/templates/dcim/device.html:131 #: netbox/templates/dcim/virtualchassis.html:27 #: netbox/templates/dcim/virtualchassis.html:67 msgid "Master" @@ -4205,7 +4205,7 @@ msgid "Transmit power (dBm)" msgstr "" #: netbox/dcim/forms/filtersets.py:1350 netbox/dcim/forms/filtersets.py:1372 -#: netbox/dcim/tables/devices.py:324 netbox/templates/dcim/cable.html:12 +#: netbox/dcim/tables/devices.py:316 netbox/templates/dcim/cable.html:12 #: netbox/templates/dcim/cable_trace.html:46 #: netbox/templates/dcim/frontport.html:77 #: netbox/templates/dcim/htmx/cable_edit.html:50 @@ -4215,7 +4215,7 @@ msgstr "" msgid "Cable" msgstr "" -#: netbox/dcim/forms/filtersets.py:1442 netbox/dcim/tables/devices.py:933 +#: netbox/dcim/forms/filtersets.py:1442 netbox/dcim/tables/devices.py:915 msgid "Discovered" msgstr "" @@ -4381,7 +4381,7 @@ msgid "Front Port" msgstr "" #: netbox/dcim/forms/model_forms.py:1093 netbox/dcim/forms/model_forms.py:1531 -#: netbox/dcim/tables/devices.py:705 +#: netbox/dcim/tables/devices.py:693 #: netbox/templates/circuits/inc/circuit_termination_fields.html:53 #: netbox/templates/dcim/consoleport.html:79 #: netbox/templates/dcim/consoleserverport.html:80 @@ -4394,7 +4394,7 @@ msgid "Rear Port" msgstr "" #: netbox/dcim/forms/model_forms.py:1094 netbox/dcim/forms/model_forms.py:1532 -#: netbox/dcim/tables/connections.py:46 netbox/dcim/tables/devices.py:509 +#: netbox/dcim/tables/connections.py:46 netbox/dcim/tables/devices.py:500 #: netbox/templates/dcim/poweroutlet.html:44 #: netbox/templates/dcim/powerport.html:17 msgid "Power Port" @@ -4481,7 +4481,7 @@ msgid "" msgstr "" #: netbox/dcim/forms/object_create.py:110 -#: netbox/dcim/forms/object_create.py:271 netbox/dcim/tables/devices.py:257 +#: netbox/dcim/forms/object_create.py:271 netbox/dcim/tables/devices.py:249 msgid "Rear ports" msgstr "" @@ -4511,7 +4511,7 @@ msgid "" "selected number of rear port positions ({rearport_count})." msgstr "" -#: netbox/dcim/forms/object_create.py:409 netbox/dcim/tables/devices.py:1016 +#: netbox/dcim/forms/object_create.py:409 netbox/dcim/tables/devices.py:998 #: netbox/ipam/tables/fhrp.py:31 netbox/templates/dcim/virtualchassis.html:53 #: netbox/templates/dcim/virtualchassis_edit.html:47 #: netbox/templates/ipam/fhrpgroup.html:38 @@ -5968,7 +5968,7 @@ msgstr "" msgid "Reachable" msgstr "" -#: netbox/dcim/tables/devices.py:66 netbox/dcim/tables/devices.py:111 +#: netbox/dcim/tables/devices.py:58 netbox/dcim/tables/devices.py:103 #: netbox/dcim/tables/racks.py:81 netbox/dcim/tables/sites.py:143 #: netbox/extras/tables/tables.py:435 netbox/netbox/navigation/menu.py:56 #: netbox/netbox/navigation/menu.py:60 netbox/netbox/navigation/menu.py:62 @@ -5978,12 +5978,12 @@ msgstr "" msgid "Devices" msgstr "" -#: netbox/dcim/tables/devices.py:71 netbox/dcim/tables/devices.py:116 +#: netbox/dcim/tables/devices.py:63 netbox/dcim/tables/devices.py:108 #: netbox/virtualization/tables/clusters.py:88 msgid "VMs" msgstr "" -#: netbox/dcim/tables/devices.py:105 netbox/dcim/tables/devices.py:221 +#: netbox/dcim/tables/devices.py:97 netbox/dcim/tables/devices.py:213 #: netbox/extras/forms/model_forms.py:506 netbox/templates/dcim/device.html:112 #: netbox/templates/dcim/device/render_config.html:11 #: netbox/templates/dcim/device/render_config.html:14 @@ -5997,11 +5997,11 @@ msgstr "" msgid "Config Template" msgstr "" -#: netbox/dcim/tables/devices.py:155 netbox/templates/dcim/sitegroup.html:26 +#: netbox/dcim/tables/devices.py:147 netbox/templates/dcim/sitegroup.html:26 msgid "Site Group" msgstr "" -#: netbox/dcim/tables/devices.py:192 netbox/dcim/tables/devices.py:1051 +#: netbox/dcim/tables/devices.py:184 netbox/dcim/tables/devices.py:1033 #: netbox/ipam/forms/bulk_import.py:511 netbox/ipam/forms/model_forms.py:304 #: netbox/ipam/forms/model_forms.py:313 netbox/ipam/tables/ip.py:352 #: netbox/ipam/tables/ip.py:418 netbox/ipam/tables/ip.py:441 @@ -6010,50 +6010,50 @@ msgstr "" msgid "IP Address" msgstr "" -#: netbox/dcim/tables/devices.py:196 netbox/dcim/tables/devices.py:1055 +#: netbox/dcim/tables/devices.py:188 netbox/dcim/tables/devices.py:1037 #: netbox/virtualization/tables/virtualmachines.py:85 msgid "IPv4 Address" msgstr "" -#: netbox/dcim/tables/devices.py:200 netbox/dcim/tables/devices.py:1059 +#: netbox/dcim/tables/devices.py:192 netbox/dcim/tables/devices.py:1041 #: netbox/virtualization/tables/virtualmachines.py:89 msgid "IPv6 Address" msgstr "" -#: netbox/dcim/tables/devices.py:215 +#: netbox/dcim/tables/devices.py:207 msgid "VC Position" msgstr "" -#: netbox/dcim/tables/devices.py:218 +#: netbox/dcim/tables/devices.py:210 msgid "VC Priority" msgstr "" -#: netbox/dcim/tables/devices.py:225 netbox/templates/dcim/device_edit.html:38 +#: netbox/dcim/tables/devices.py:217 netbox/templates/dcim/device_edit.html:38 #: netbox/templates/dcim/devicebay_populate.html:16 msgid "Parent Device" msgstr "" -#: netbox/dcim/tables/devices.py:230 +#: netbox/dcim/tables/devices.py:222 msgid "Position (Device Bay)" msgstr "" -#: netbox/dcim/tables/devices.py:239 +#: netbox/dcim/tables/devices.py:231 msgid "Console ports" msgstr "" -#: netbox/dcim/tables/devices.py:242 +#: netbox/dcim/tables/devices.py:234 msgid "Console server ports" msgstr "" -#: netbox/dcim/tables/devices.py:245 +#: netbox/dcim/tables/devices.py:237 msgid "Power ports" msgstr "" -#: netbox/dcim/tables/devices.py:248 +#: netbox/dcim/tables/devices.py:240 msgid "Power outlets" msgstr "" -#: netbox/dcim/tables/devices.py:251 netbox/dcim/tables/devices.py:1064 +#: netbox/dcim/tables/devices.py:243 netbox/dcim/tables/devices.py:1046 #: netbox/dcim/tables/devicetypes.py:125 netbox/dcim/views.py:1006 #: netbox/dcim/views.py:1245 netbox/dcim/views.py:1931 #: netbox/netbox/navigation/menu.py:81 netbox/netbox/navigation/menu.py:237 @@ -6071,28 +6071,28 @@ msgstr "" msgid "Interfaces" msgstr "" -#: netbox/dcim/tables/devices.py:254 +#: netbox/dcim/tables/devices.py:246 msgid "Front ports" msgstr "" -#: netbox/dcim/tables/devices.py:260 +#: netbox/dcim/tables/devices.py:252 msgid "Device bays" msgstr "" -#: netbox/dcim/tables/devices.py:263 +#: netbox/dcim/tables/devices.py:255 msgid "Module bays" msgstr "" -#: netbox/dcim/tables/devices.py:266 +#: netbox/dcim/tables/devices.py:258 msgid "Inventory items" msgstr "" -#: netbox/dcim/tables/devices.py:305 netbox/dcim/tables/modules.py:56 +#: netbox/dcim/tables/devices.py:297 netbox/dcim/tables/modules.py:56 #: netbox/templates/dcim/modulebay.html:17 msgid "Module Bay" msgstr "" -#: netbox/dcim/tables/devices.py:318 netbox/dcim/tables/devicetypes.py:48 +#: netbox/dcim/tables/devices.py:310 netbox/dcim/tables/devicetypes.py:48 #: netbox/dcim/tables/devicetypes.py:140 netbox/dcim/views.py:1081 #: netbox/dcim/views.py:2024 netbox/netbox/navigation/menu.py:90 #: netbox/templates/dcim/device/base.html:52 @@ -6103,27 +6103,27 @@ msgstr "" msgid "Inventory Items" msgstr "" -#: netbox/dcim/tables/devices.py:330 +#: netbox/dcim/tables/devices.py:322 msgid "Cable Color" msgstr "" -#: netbox/dcim/tables/devices.py:336 +#: netbox/dcim/tables/devices.py:328 msgid "Link Peers" msgstr "" -#: netbox/dcim/tables/devices.py:339 +#: netbox/dcim/tables/devices.py:331 msgid "Mark Connected" msgstr "" -#: netbox/dcim/tables/devices.py:455 +#: netbox/dcim/tables/devices.py:449 msgid "Maximum draw (W)" msgstr "" -#: netbox/dcim/tables/devices.py:458 +#: netbox/dcim/tables/devices.py:452 msgid "Allocated draw (W)" msgstr "" -#: netbox/dcim/tables/devices.py:558 netbox/ipam/forms/model_forms.py:747 +#: netbox/dcim/tables/devices.py:546 netbox/ipam/forms/model_forms.py:747 #: netbox/ipam/tables/fhrp.py:28 netbox/ipam/views.py:602 #: netbox/ipam/views.py:701 netbox/netbox/navigation/menu.py:145 #: netbox/netbox/navigation/menu.py:147 @@ -6135,12 +6135,12 @@ msgstr "" msgid "IP Addresses" msgstr "" -#: netbox/dcim/tables/devices.py:564 netbox/netbox/navigation/menu.py:189 +#: netbox/dcim/tables/devices.py:552 netbox/netbox/navigation/menu.py:189 #: netbox/templates/ipam/inc/panels/fhrp_groups.html:6 msgid "FHRP Groups" msgstr "" -#: netbox/dcim/tables/devices.py:576 netbox/templates/dcim/interface.html:89 +#: netbox/dcim/tables/devices.py:564 netbox/templates/dcim/interface.html:89 #: netbox/templates/virtualization/vminterface.html:67 #: netbox/templates/vpn/tunnel.html:18 #: netbox/templates/vpn/tunneltermination.html:13 @@ -6151,37 +6151,37 @@ msgstr "" msgid "Tunnel" msgstr "" -#: netbox/dcim/tables/devices.py:601 netbox/dcim/tables/devicetypes.py:224 +#: netbox/dcim/tables/devices.py:589 netbox/dcim/tables/devicetypes.py:224 #: netbox/templates/dcim/interface.html:65 msgid "Management Only" msgstr "" -#: netbox/dcim/tables/devices.py:619 +#: netbox/dcim/tables/devices.py:607 msgid "VDCs" msgstr "" -#: netbox/dcim/tables/devices.py:870 netbox/templates/dcim/modulebay.html:49 +#: netbox/dcim/tables/devices.py:852 netbox/templates/dcim/modulebay.html:49 msgid "Installed Module" msgstr "" -#: netbox/dcim/tables/devices.py:873 +#: netbox/dcim/tables/devices.py:855 msgid "Module Serial" msgstr "" -#: netbox/dcim/tables/devices.py:877 +#: netbox/dcim/tables/devices.py:859 msgid "Module Asset Tag" msgstr "" -#: netbox/dcim/tables/devices.py:886 +#: netbox/dcim/tables/devices.py:868 msgid "Module Status" msgstr "" -#: netbox/dcim/tables/devices.py:928 netbox/dcim/tables/devicetypes.py:308 +#: netbox/dcim/tables/devices.py:910 netbox/dcim/tables/devicetypes.py:308 #: netbox/templates/dcim/inventoryitem.html:40 msgid "Component" msgstr "" -#: netbox/dcim/tables/devices.py:983 +#: netbox/dcim/tables/devices.py:965 msgid "Items" msgstr "" @@ -6770,12 +6770,12 @@ msgstr "" msgid "Show your personal bookmarks" msgstr "" -#: netbox/extras/events.py:128 +#: netbox/extras/events.py:134 #, python-brace-format msgid "Unknown action type for an event rule: {action_type}" msgstr "" -#: netbox/extras/events.py:176 +#: netbox/extras/events.py:182 #, python-brace-format msgid "Cannot import events pipeline {name} error: {error}" msgstr "" @@ -8156,7 +8156,7 @@ msgstr "" msgid "Database changes have been reverted due to error." msgstr "" -#: netbox/extras/signals.py:146 +#: netbox/extras/signals.py:133 #, python-brace-format msgid "Deletion is prevented by a protection rule: {message}" msgstr "" @@ -8937,7 +8937,7 @@ msgstr "" #: netbox/virtualization/forms/filtersets.py:238 #: netbox/virtualization/forms/model_forms.py:220 #: netbox/virtualization/tables/virtualmachines.py:128 -#: netbox/virtualization/tables/virtualmachines.py:181 netbox/vpn/choices.py:45 +#: netbox/virtualization/tables/virtualmachines.py:183 netbox/vpn/choices.py:45 #: netbox/vpn/forms/filtersets.py:293 netbox/vpn/forms/model_forms.py:160 #: netbox/vpn/forms/model_forms.py:171 netbox/vpn/forms/model_forms.py:273 #: netbox/vpn/forms/model_forms.py:454 From 7be003f5a0385ef0fa489c8ad0d7dc0d4669db28 Mon Sep 17 00:00:00 2001 From: "Jamie (Bear) Murphy" <1613241+ITJamie@users.noreply.github.com> Date: Tue, 4 Jun 2024 13:49:08 +0100 Subject: [PATCH 03/21] Allow plugins to extend objectchange view (#16371) * allow plugins to extend objectchangeview with panels * replace tabs with spaces * Update netbox/templates/extras/objectchange.html Co-authored-by: Jeremy Stretch * Eliminate excessive vertical margin --------- Co-authored-by: Jeremy Stretch --- netbox/templates/extras/objectchange.html | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/netbox/templates/extras/objectchange.html b/netbox/templates/extras/objectchange.html index 368a71821..ffd6e77fa 100644 --- a/netbox/templates/extras/objectchange.html +++ b/netbox/templates/extras/objectchange.html @@ -1,5 +1,6 @@ {% extends 'generic/object.html' %} {% load helpers %} +{% load plugins %} {% load i18n %} {% block title %}{{ object }}{% endblock %} @@ -22,7 +23,7 @@ {% block subtitle %}{% endblock %} {% block content %} -
+
{% trans "Change" %}
@@ -104,7 +105,7 @@
-
+
{% trans "Pre-Change Data" %}
@@ -144,7 +145,15 @@
-
+
+
+ {% plugin_left_page object %} +
+
+ {% plugin_right_page object %} +
+
+
{% include 'inc/panel_table.html' with table=related_changes_table heading='Related Changes' panel_class='default' %} {% if related_changes_count > related_changes_table.rows|length %} @@ -158,4 +167,9 @@ {% endif %}
+
+
+ {% plugin_full_width_page object %} +
+
{% endblock %} From 8ab9afb8db5628469ba70424d46bf44b829cf36c Mon Sep 17 00:00:00 2001 From: Daniel Sheppard Date: Tue, 4 Jun 2024 08:02:38 -0500 Subject: [PATCH 04/21] =?UTF-8?q?Fixes:=20#16083=20-=20Add=20font-variant-?= =?UTF-8?q?ligatures=20setting=20to=20disable=20ligatur=E2=80=A6=20(#16383?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixes: #16083 - Add font-variant-ligatures setting to disable ligatures on chromium * Fix comment * Disable ligatures on input fields * Condense rules & apply to all elements --------- Co-authored-by: Jeremy Stretch --- netbox/project-static/dist/netbox.css | Bin 551631 -> 551692 bytes .../styles/overrides/_tabler.scss | 7 +++++++ 2 files changed, 7 insertions(+) diff --git a/netbox/project-static/dist/netbox.css b/netbox/project-static/dist/netbox.css index 082a5b64d2374a533a0cd977972c5efb72012a24..0ec53a6d27390befa166d8e074df6917b0c345ef 100644 GIT binary patch delta 80 zcmX?qRk7!qVnYjK3sVbo3rh=Y3tJ2O7LMi!Cavn}2QIM4%cbS#mFSiw7G)*^>72~; j#FEmY)MBf={JhlKf}-h#dzgi%7ffX3*}f!#Lt6*{#ycIs delta 31 mcmeCVrg;9UVnYjK3sVbo3rh=Y3tJ2O7LMkK?FS+_e1rhSaSKfV diff --git a/netbox/project-static/styles/overrides/_tabler.scss b/netbox/project-static/styles/overrides/_tabler.scss index b31fdac6b..5ea63be76 100644 --- a/netbox/project-static/styles/overrides/_tabler.scss +++ b/netbox/project-static/styles/overrides/_tabler.scss @@ -1,3 +1,10 @@ +// Disable font-ligatures for Chromium based browsers +// Chromium requires `font-variant-ligatures: none` in addition to `font-feature-settings "liga" 0` +* { + font-feature-settings: "liga" 0; + font-variant-ligatures: none; +} + // Restore default foreground & background colors for
 blocks
 pre {
   background-color: transparent;

From 87109f5539758a3d62ea8200d89641b21bb2d283 Mon Sep 17 00:00:00 2001
From: Julio Oliveira at Encora
 <149191228+Julio-Oliveira-Encora@users.noreply.github.com>
Date: Tue, 4 Jun 2024 10:37:08 -0300
Subject: [PATCH 05/21] 16315 - Cant filter changelog by object type (no
 results found) (#16324)

* Replaced "api=/api/extras/content-types/" with "/api/extras/object-types/" for JournalEntryFilterForm and ObjectChangeFilterForm.

* Addressed PR comment.

* Correct feature classifications

---------

Co-authored-by: Jeremy Stretch 
---
 netbox/extras/forms/filtersets.py | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/netbox/extras/forms/filtersets.py b/netbox/extras/forms/filtersets.py
index d4235c465..e6b001f2c 100644
--- a/netbox/extras/forms/filtersets.py
+++ b/netbox/extras/forms/filtersets.py
@@ -464,13 +464,10 @@ class JournalEntryFilterForm(NetBoxModelFilterSetForm):
         required=False,
         label=_('User')
     )
-    assigned_object_type_id = DynamicModelMultipleChoiceField(
-        queryset=ObjectType.objects.all(),
+    assigned_object_type_id = ContentTypeMultipleChoiceField(
+        queryset=ObjectType.objects.with_feature('journaling'),
         required=False,
         label=_('Object Type'),
-        widget=APISelectMultiple(
-            api_url='/api/extras/content-types/',
-        )
     )
     kind = forms.ChoiceField(
         label=_('Kind'),
@@ -507,11 +504,8 @@ class ObjectChangeFilterForm(SavedFiltersMixin, FilterForm):
         required=False,
         label=_('User')
     )
-    changed_object_type_id = DynamicModelMultipleChoiceField(
-        queryset=ObjectType.objects.all(),
+    changed_object_type_id = ContentTypeMultipleChoiceField(
+        queryset=ObjectType.objects.with_feature('change_logging'),
         required=False,
         label=_('Object Type'),
-        widget=APISelectMultiple(
-            api_url='/api/extras/content-types/',
-        )
     )

From 4242546270a996e84943e1b3ae05b35f2a31f3ac Mon Sep 17 00:00:00 2001
From: Jeremy Stretch 
Date: Tue, 4 Jun 2024 13:51:40 -0400
Subject: [PATCH 06/21] Fixes #16376: Log changes on terminating objects when
 attaching a cable

---
 netbox/dcim/models/cables.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/netbox/dcim/models/cables.py b/netbox/dcim/models/cables.py
index 64f0b8560..7afead829 100644
--- a/netbox/dcim/models/cables.py
+++ b/netbox/dcim/models/cables.py
@@ -355,11 +355,11 @@ class CableTermination(ChangeLoggedModel):
         super().save(*args, **kwargs)
 
         # Set the cable on the terminating object
-        termination_model = self.termination._meta.model
-        termination_model.objects.filter(pk=self.termination_id).update(
-            cable=self.cable,
-            cable_end=self.cable_end
-        )
+        termination = self.termination._meta.model.objects.get(pk=self.termination_id)
+        termination.snapshot()
+        termination.cable = self.cable
+        termination.cable_end = self.cable_end
+        termination.save()
 
     def delete(self, *args, **kwargs):
 

From 81f0a4050528636c8f023c2a674dbcaf4a076312 Mon Sep 17 00:00:00 2001
From: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Date: Wed, 5 Jun 2024 05:02:18 +0000
Subject: [PATCH 07/21] Update source translation strings

---
 netbox/translations/en/LC_MESSAGES/django.po | 58 ++++++++++----------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/netbox/translations/en/LC_MESSAGES/django.po b/netbox/translations/en/LC_MESSAGES/django.po
index af150e24c..2c459a302 100644
--- a/netbox/translations/en/LC_MESSAGES/django.po
+++ b/netbox/translations/en/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2024-06-04 05:02+0000\n"
+"POT-Creation-Date: 2024-06-05 05:02+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME \n"
 "Language-Team: LANGUAGE \n"
@@ -965,7 +965,7 @@ msgstr ""
 #: netbox/extras/forms/filtersets.py:143 netbox/extras/forms/filtersets.py:183
 #: netbox/extras/forms/filtersets.py:199 netbox/extras/forms/filtersets.py:230
 #: netbox/extras/forms/filtersets.py:254 netbox/extras/forms/filtersets.py:450
-#: netbox/extras/forms/filtersets.py:488 netbox/ipam/forms/filtersets.py:99
+#: netbox/extras/forms/filtersets.py:485 netbox/ipam/forms/filtersets.py:99
 #: netbox/ipam/forms/filtersets.py:266 netbox/ipam/forms/filtersets.py:307
 #: netbox/ipam/forms/filtersets.py:382 netbox/ipam/forms/filtersets.py:475
 #: netbox/ipam/forms/filtersets.py:534 netbox/ipam/forms/filtersets.py:552
@@ -1577,9 +1577,9 @@ msgid "Creation"
 msgstr ""
 
 #: netbox/core/forms/filtersets.py:71 netbox/extras/forms/filtersets.py:470
-#: netbox/extras/forms/filtersets.py:513 netbox/extras/tables/tables.py:183
+#: netbox/extras/forms/filtersets.py:510 netbox/extras/tables/tables.py:183
 #: netbox/extras/tables/tables.py:504 netbox/templates/core/job.html:20
-#: netbox/templates/extras/objectchange.html:51
+#: netbox/templates/extras/objectchange.html:52
 #: netbox/tenancy/tables/contacts.py:90 netbox/vpn/tables/l2vpn.py:59
 msgid "Object Type"
 msgstr ""
@@ -1619,9 +1619,9 @@ msgstr ""
 #: netbox/core/forms/filtersets.py:123 netbox/dcim/forms/bulk_edit.py:361
 #: netbox/dcim/forms/filtersets.py:353 netbox/dcim/forms/filtersets.py:397
 #: netbox/dcim/forms/model_forms.py:258 netbox/extras/forms/filtersets.py:465
-#: netbox/extras/forms/filtersets.py:508
+#: netbox/extras/forms/filtersets.py:505
 #: netbox/templates/dcim/rackreservation.html:58
-#: netbox/templates/extras/objectchange.html:35
+#: netbox/templates/extras/objectchange.html:36
 #: netbox/templates/extras/savedfilter.html:21
 #: netbox/templates/inc/user_menu.html:15 netbox/templates/users/token.html:21
 #: netbox/templates/users/user.html:6 netbox/templates/users/user.html:14
@@ -1976,7 +1976,7 @@ msgstr ""
 #: netbox/extras/tables/tables.py:509 netbox/extras/tables/tables.py:574
 #: netbox/netbox/tables/tables.py:243 netbox/templates/extras/eventrule.html:84
 #: netbox/templates/extras/journalentry.html:18
-#: netbox/templates/extras/objectchange.html:57
+#: netbox/templates/extras/objectchange.html:58
 #: netbox/tenancy/tables/contacts.py:93 netbox/vpn/tables/l2vpn.py:64
 msgid "Object"
 msgstr ""
@@ -4172,7 +4172,7 @@ msgid "Connection"
 msgstr ""
 
 #: netbox/dcim/forms/filtersets.py:1254 netbox/extras/forms/bulk_edit.py:316
-#: netbox/extras/forms/bulk_import.py:242 netbox/extras/forms/filtersets.py:476
+#: netbox/extras/forms/bulk_import.py:242 netbox/extras/forms/filtersets.py:473
 #: netbox/extras/forms/model_forms.py:551 netbox/extras/tables/tables.py:512
 #: netbox/templates/extras/journalentry.html:30
 msgid "Kind"
@@ -7144,23 +7144,23 @@ msgstr ""
 msgid "Tenant groups"
 msgstr ""
 
-#: netbox/extras/forms/filtersets.py:454 netbox/extras/forms/filtersets.py:492
+#: netbox/extras/forms/filtersets.py:454 netbox/extras/forms/filtersets.py:489
 msgid "After"
 msgstr ""
 
-#: netbox/extras/forms/filtersets.py:459 netbox/extras/forms/filtersets.py:497
+#: netbox/extras/forms/filtersets.py:459 netbox/extras/forms/filtersets.py:494
 msgid "Before"
 msgstr ""
 
-#: netbox/extras/forms/filtersets.py:487 netbox/extras/tables/tables.py:456
+#: netbox/extras/forms/filtersets.py:484 netbox/extras/tables/tables.py:456
 #: netbox/extras/tables/tables.py:542 netbox/extras/tables/tables.py:567
-#: netbox/templates/extras/objectchange.html:31
+#: netbox/templates/extras/objectchange.html:32
 msgid "Time"
 msgstr ""
 
-#: netbox/extras/forms/filtersets.py:501 netbox/extras/forms/model_forms.py:282
+#: netbox/extras/forms/filtersets.py:498 netbox/extras/forms/model_forms.py:282
 #: netbox/extras/tables/tables.py:470 netbox/templates/extras/eventrule.html:77
-#: netbox/templates/extras/objectchange.html:45
+#: netbox/templates/extras/objectchange.html:46
 msgid "Action"
 msgstr ""
 
@@ -8256,7 +8256,7 @@ msgid "Full Name"
 msgstr ""
 
 #: netbox/extras/tables/tables.py:483
-#: netbox/templates/extras/objectchange.html:67
+#: netbox/templates/extras/objectchange.html:68
 msgid "Request ID"
 msgstr ""
 
@@ -10275,7 +10275,7 @@ msgid "Journal Entries"
 msgstr ""
 
 #: netbox/netbox/navigation/menu.py:359
-#: netbox/templates/extras/objectchange.html:8
+#: netbox/templates/extras/objectchange.html:9
 #: netbox/templates/extras/objectchange_list.html:4
 msgid "Change Log"
 msgstr ""
@@ -10734,8 +10734,8 @@ msgstr ""
 #: netbox/templates/extras/configcontext.html:70
 #: netbox/templates/extras/eventrule.html:72
 #: netbox/templates/extras/htmx/script_result.html:56
-#: netbox/templates/extras/objectchange.html:123
-#: netbox/templates/extras/objectchange.html:141
+#: netbox/templates/extras/objectchange.html:124
+#: netbox/templates/extras/objectchange.html:142
 #: netbox/templates/extras/webhook.html:67
 #: netbox/templates/extras/webhook.html:79
 #: netbox/templates/inc/panel_table.html:13
@@ -12308,48 +12308,48 @@ msgstr ""
 msgid "New Journal Entry"
 msgstr ""
 
-#: netbox/templates/extras/objectchange.html:28
+#: netbox/templates/extras/objectchange.html:29
 #: netbox/templates/users/objectpermission.html:42
 msgid "Change"
 msgstr ""
 
-#: netbox/templates/extras/objectchange.html:78
+#: netbox/templates/extras/objectchange.html:79
 msgid "Difference"
 msgstr ""
 
-#: netbox/templates/extras/objectchange.html:81
+#: netbox/templates/extras/objectchange.html:82
 msgid "Previous"
 msgstr ""
 
-#: netbox/templates/extras/objectchange.html:84
+#: netbox/templates/extras/objectchange.html:85
 msgid "Next"
 msgstr ""
 
-#: netbox/templates/extras/objectchange.html:92
+#: netbox/templates/extras/objectchange.html:93
 msgid "Object Created"
 msgstr ""
 
-#: netbox/templates/extras/objectchange.html:94
+#: netbox/templates/extras/objectchange.html:95
 msgid "Object Deleted"
 msgstr ""
 
-#: netbox/templates/extras/objectchange.html:96
+#: netbox/templates/extras/objectchange.html:97
 msgid "No Changes"
 msgstr ""
 
-#: netbox/templates/extras/objectchange.html:110
+#: netbox/templates/extras/objectchange.html:111
 msgid "Pre-Change Data"
 msgstr ""
 
-#: netbox/templates/extras/objectchange.html:121
+#: netbox/templates/extras/objectchange.html:122
 msgid "Warning: Comparing non-atomic change to previous change record"
 msgstr ""
 
-#: netbox/templates/extras/objectchange.html:130
+#: netbox/templates/extras/objectchange.html:131
 msgid "Post-Change Data"
 msgstr ""
 
-#: netbox/templates/extras/objectchange.html:153
+#: netbox/templates/extras/objectchange.html:162
 #, python-format
 msgid "See All %(count)s Changes"
 msgstr ""

From c27cb6f153062b1a0d8a7f819db358763d1205f5 Mon Sep 17 00:00:00 2001
From: Jeremy Stretch 
Date: Wed, 5 Jun 2024 09:02:05 -0400
Subject: [PATCH 08/21] Fix styling of object jobs table

---
 netbox/templates/core/object_jobs.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/netbox/templates/core/object_jobs.html b/netbox/templates/core/object_jobs.html
index 7d8c0a3b7..14e31e5be 100644
--- a/netbox/templates/core/object_jobs.html
+++ b/netbox/templates/core/object_jobs.html
@@ -5,7 +5,7 @@
   
-
+
{% render_table table 'inc/table.html' %} {% include 'inc/paginator.html' with paginator=table.paginator page=table.page %}
From b10fb67ce93f6bbd2fe3ee9f40037b1bd3327e89 Mon Sep 17 00:00:00 2001 From: Julio Oliveira at Encora <149191228+Julio-Oliveira-Encora@users.noreply.github.com> Date: Wed, 5 Jun 2024 16:23:36 -0300 Subject: [PATCH 09/21] Fixed error when the active Config is deleted and rest only one to restore. (#16408) --- netbox/core/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/core/views.py b/netbox/core/views.py index 5a65c5755..ded49c0b8 100644 --- a/netbox/core/views.py +++ b/netbox/core/views.py @@ -224,7 +224,7 @@ class ConfigRevisionRestoreView(ContentTypePermissionRequiredMixin, View): for param in PARAMS: params.append(( param.name, - current_config.data.get(param.name, None), + current_config.data.get(param.name, None) if current_config else None, candidate_config.data.get(param.name, None) )) From 18b43408ec4637b094b0ebe389e43939528a7d53 Mon Sep 17 00:00:00 2001 From: Louis Jarasius Date: Thu, 6 Jun 2024 22:44:32 +1000 Subject: [PATCH 10/21] Fixes #16274: Dark mode highlight color (#16355) * Increase ::selection background-color aplha * Improve comment for override * Add compiled CSS * Only override on dark theme --- netbox/project-static/dist/netbox.css | Bin 551692 -> 551835 bytes .../styles/overrides/_tabler.scss | 5 +++++ 2 files changed, 5 insertions(+) diff --git a/netbox/project-static/dist/netbox.css b/netbox/project-static/dist/netbox.css index 0ec53a6d27390befa166d8e074df6917b0c345ef..0696d2e827f51ae3142a610e546459a4bba62033 100644 GIT binary patch delta 59 zcmeCVra1e$VnYjK3sVbo3rh=Y3tJ2O7LLBi>4uY;L^-Xjic@n^lS?wE>%}k{P3PFo PZp~z3vArjfqd^b=Xx9^2 delta 31 mcmbPzU9snyVnYjK3sVbo3rh=Y3tJ2O7LLBi?XpoEb%FrB!V0$l diff --git a/netbox/project-static/styles/overrides/_tabler.scss b/netbox/project-static/styles/overrides/_tabler.scss index 5ea63be76..97f1298df 100644 --- a/netbox/project-static/styles/overrides/_tabler.scss +++ b/netbox/project-static/styles/overrides/_tabler.scss @@ -39,3 +39,8 @@ table a { // Adjust table anchor link contrast as not enough contrast in dark mode filter: brightness(110%); } + +// Override background color alpha value +[data-bs-theme=dark] ::selection { + background-color: rgba(var(--tblr-primary-rgb),.48) +} From 8f87c72eaa94f849573fcfa232d91a481278504e Mon Sep 17 00:00:00 2001 From: Arthur Hanson Date: Thu, 6 Jun 2024 06:05:59 -0700 Subject: [PATCH 11/21] 16050 Show script python_class name and description (#16185) * 16050 Show script python_class name and description * 16050 change to use Meta.description * 16050 change to use Meta.description * 16050 remove module name customization from docs --- docs/customization/custom-scripts.md | 6 ------ netbox/templates/extras/script/base.html | 4 ++-- netbox/templates/extras/script_list.html | 6 +++--- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/docs/customization/custom-scripts.md b/docs/customization/custom-scripts.md index 21ae20f05..2a8f252aa 100644 --- a/docs/customization/custom-scripts.md +++ b/docs/customization/custom-scripts.md @@ -65,12 +65,6 @@ class AnotherCustomScript(Script): script_order = (MyCustomScript, AnotherCustomScript) ``` -## Module Attributes - -### `name` - -You can define `name` within a script module (the Python file which contains one or more scripts) to set the module name. If `name` is not defined, the module's file name will be used. - ## Script Attributes Script attributes are defined under a class named `Meta` within the script. These are optional, but encouraged. diff --git a/netbox/templates/extras/script/base.html b/netbox/templates/extras/script/base.html index 7220b329d..725e4737c 100644 --- a/netbox/templates/extras/script/base.html +++ b/netbox/templates/extras/script/base.html @@ -4,7 +4,7 @@ {% load log_levels %} {% load i18n %} -{% block title %}{{ script }}{% endblock %} +{% block title %}{{ script.python_class.name }}{% endblock %} {% block object_identifier %} {{ script.full_name }} @@ -17,7 +17,7 @@ {% block subtitle %}
- {{ script.Meta.description|markdown }} + {{ script.python_class.Meta.description|markdown }}
{% endblock subtitle %} diff --git a/netbox/templates/extras/script_list.html b/netbox/templates/extras/script_list.html index 7ce5ca6eb..27b6115a7 100644 --- a/netbox/templates/extras/script_list.html +++ b/netbox/templates/extras/script_list.html @@ -56,15 +56,15 @@ {% if script.is_executable %} - {{ script.name }} + {{ script.python_class.name }} {% else %} - {{ script.name }} + {{ script.python_class.name }} {% endif %} - {{ script.description|markdown|placeholder }} + {{ script.python_class.Meta.description|markdown|placeholder }} {% if last_job %} {{ last_job.created|isodatetime }} From 3acf3b51ee50e9f07e0f93e8042943a3294e8ca0 Mon Sep 17 00:00:00 2001 From: Julio Oliveira at Encora <149191228+Julio-Oliveira-Encora@users.noreply.github.com> Date: Thu, 6 Jun 2024 10:35:27 -0300 Subject: [PATCH 12/21] Fixes: #14567 - Export current view of IP Addresses (#15659) * Added javascript and htmx to change the url. * Added javascript and htmx to change the url * Addressed PR comments * Added Netbox.js and netbox.js.map * Addressed PR comments * Addressed PR comments * Addressed PR comments * Addressed PR comments * Addressed PR comments * Addressed PR comments * Addressed PR comments * Addressed PR comments * Linter Issues * Fix assets issue * Fix assets issue * Addressed PR comment. It was added clearLinkParams to clear button. * Added passive:true to search.ts --------- Co-authored-by: Jeremy Stretch --- netbox/project-static/dist/netbox.js | Bin 387735 -> 388117 bytes netbox/project-static/dist/netbox.js.map | Bin 352915 -> 353214 bytes netbox/project-static/src/search.ts | 76 +++++++++++++----- .../utilities/templates/buttons/export.html | 2 +- 4 files changed, 57 insertions(+), 21 deletions(-) diff --git a/netbox/project-static/dist/netbox.js b/netbox/project-static/dist/netbox.js index 58c419b3d4e979c8b658b9af989305a238748219..d8c7c36c5ac619e183f96c8b911e1a5046e6e7e7 100644 GIT binary patch delta 8800 zcmZu$d3Y36w*T(A-E4u#l0bk!k|tocR6-CG=+HtovXPB!kPt$pyQ;gAUMjsMoe&Wn zS;qw;92XQuXU6B7QNbCf)F-I8&A1G%-?)Id3z-4m?mhP` zzkAMYd~@2~x27dotv1J1{ZTQP>D--^0};>etkhA86cSt>e6W^hazTy{Od-KzjHd2> zXdY8{zn#x~gQ@IG@OcJbWEq3=VA|-2$EqlTJXj1znR}4)8s-_S=e5i=_-mds)$Osm zBGz`1WU?Ioh}XNq>9MNUo#EOU&W>GW5RdF~RS$QiO zwCn$ui41pq&t~ZpBx{qtVKtl;q4+(svU+2Bjiyh5N%bDVC5AQtX%UcK4IC~ZF8YPe||m>a>lVvOkW7rah;w4n_-wjtX>F9 zSfRFcA?#;k`aF(>(v?CJUbYCfv2J{55o~15IAt+h%K9*WF)U<_=vxdwuqI8p0;)}H z9X_%Qo?+{>0Xw8I)~M~vhbtMY#Fv-Dw4_pxW5N2|+{+dSb@;_{C}V52r4Bd-tO9>n z0h?Ki*1r<&W5k|YNb9FpdIXEbW)n&jM@U)GVq}1%2%=)MS7;}TU=#yM#nZ*~O{sQM z3HS{9r&UnR>a?m-C>=ve@2!Dfv#@5bg{Og@Kdpg9qgxf#VG+GjFl-V0H0%iFCaA`U zV`FZ1zh52LC1s`pJ zc`S(Uw}73Csts!%hpCtxg(*Bh)QYo^inT|;gdMHW#X{O&TVWDo!+Pc#UGY}5jF9ugBCQVwFo6NR3+MIk3NXY4{`c0mSf$Df^Kg&th!g6YhMl`fdi+}PuS%UBfec7c0piMnZ1SjkQ3&=6B4!k7-s zkU(y!C*_=CFc1kzUW-sb6xrwk!y7QXQlNXK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2caNbcc+ILO=4zij&bNM^C=*|N;d(~rwCtEsyOfJ_Spy1_XD!pa1CHUMO}Bgm{s wok}1-Y`T~nbEK3f(3?&`vs~Rk&UFPU0_ya2u5!(5Z;@jLVwUYKa;*F=0O#Lf+5i9m delta 104 zcmdmYTy*kL(S{br7N#xCA+n5B)5GMLXKDoKxH~!q>v%glM?hGaPL7V5PC9`gQBOz5 wNS#V2M`v^A={EArk)pni&Q(r2&W_G55Cy)@CC*vx>*bk&m}UEVc~*WG0DK-ErvLx| diff --git a/netbox/project-static/src/search.ts b/netbox/project-static/src/search.ts index 4be740196..1295527cf 100644 --- a/netbox/project-static/src/search.ts +++ b/netbox/project-static/src/search.ts @@ -7,38 +7,74 @@ import { isTruthy } from './util'; */ function quickSearchEventHandler(event: Event): void { const quicksearch = event.currentTarget as HTMLInputElement; - const clearbtn = document.getElementById("quicksearch_clear") as HTMLAnchorElement; + const clearbtn = document.getElementById('quicksearch_clear') as HTMLAnchorElement; if (isTruthy(clearbtn)) { - if (quicksearch.value === "") { - clearbtn.classList.add("invisible"); + if (quicksearch.value === '') { + clearbtn.classList.add('invisible'); } else { - clearbtn.classList.remove("invisible"); + clearbtn.classList.remove('invisible'); } } } +/** + * Clear the existing search parameters in the link to export Current View. + */ +function clearLinkParams(): void { + const link = document.getElementById('export_current_view') as HTMLLinkElement; + const linkUpdated = link?.href.split('&')[0]; + link.setAttribute('href', linkUpdated); +} + +/** + * Update the Export View link to add the Quick Search parameters. + * @param event + */ +function handleQuickSearchParams(event: Event): void { + const quickSearchParameters = event.currentTarget as HTMLInputElement; + + // Clear the existing search parameters + clearLinkParams(); + + if (quickSearchParameters != null) { + const link = document.getElementById('export_current_view') as HTMLLinkElement; + const search_parameter = `q=${quickSearchParameters.value}`; + const linkUpdated = link?.href + '&' + search_parameter; + link.setAttribute('href', linkUpdated); + } +} + /** * Initialize Quicksearch Event listener/handlers. */ export function initQuickSearch(): void { - const quicksearch = document.getElementById("quicksearch") as HTMLInputElement; - const clearbtn = document.getElementById("quicksearch_clear") as HTMLAnchorElement; + const quicksearch = document.getElementById('quicksearch') as HTMLInputElement; + const clearbtn = document.getElementById('quicksearch_clear') as HTMLAnchorElement; if (isTruthy(quicksearch)) { - quicksearch.addEventListener("keyup", quickSearchEventHandler, { - passive: true - }) - quicksearch.addEventListener("search", quickSearchEventHandler, { - passive: true - }) + quicksearch.addEventListener('keyup', quickSearchEventHandler, { + passive: true, + }); + quicksearch.addEventListener('search', quickSearchEventHandler, { + passive: true, + }); + quicksearch.addEventListener('change', handleQuickSearchParams, { + passive: true, + }); + if (isTruthy(clearbtn)) { - clearbtn.addEventListener("click", async () => { - const search = new Event('search'); - quicksearch.value = ''; - await new Promise(f => setTimeout(f, 100)); - quicksearch.dispatchEvent(search); - }, { - passive: true - }) + clearbtn.addEventListener( + 'click', + async () => { + const search = new Event('search'); + quicksearch.value = ''; + await new Promise(f => setTimeout(f, 100)); + quicksearch.dispatchEvent(search); + clearLinkParams(); + }, + { + passive: true, + }, + ); } } } diff --git a/netbox/utilities/templates/buttons/export.html b/netbox/utilities/templates/buttons/export.html index 2085356fa..279757236 100644 --- a/netbox/utilities/templates/buttons/export.html +++ b/netbox/utilities/templates/buttons/export.html @@ -4,7 +4,7 @@ {% trans "Export" %}