From 4242546270a996e84943e1b3ae05b35f2a31f3ac Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 4 Jun 2024 13:51:40 -0400 Subject: [PATCH 01/12] 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 02/12] 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 03/12] 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 04/12] 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 05/12] 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 06/12] 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 07/12] 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!y7QXQlNXKGIEhuYDl&q7!35RmSoye@esL2ae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;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" %}