[PR #3925] [MERGED] Fixes #3840: Only show valid interface VLAN choices #12701

Closed
opened 2025-12-29 22:23:08 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/3925
Author: @hSaria
Created: 1/15/2020
Status: Merged
Merged: 2/14/2020
Merged by: @jeremystretch

Base: developHead: 3840-limit-vlan-choices


📝 Commits (10+)

  • 9d846d7 Fixes #3840: Only show valid interface VLAN choices
  • 201416b Semicolons for completeness
  • 02cf39c Merge branch 'develop' into 3840-limit-vlan-choices
  • c899786 Added #3840 changelog
  • c31c8b1 Moved into v2.7.1
  • a30e50e Merge branch 'develop' into 3840-limit-vlan-choices
  • f052b90 Merge branch 'develop' into 3840-limit-vlan-choices
  • 2684f86 Merge branch 'develop' into 3840-limit-vlan-choices
  • deb653c Merge branch 'develop' into 3840-limit-vlan-choices
  • ff82274 Corrected linter warning

📊 Changes

4 files changed (+96 additions, -113 deletions)

View changed files

📝 netbox/dcim/forms.py (+43 -15)
📝 netbox/project-static/js/forms.js (+10 -7)
📝 netbox/utilities/forms.py (+7 -2)
📝 netbox/virtualization/forms.py (+36 -89)

📄 Description

Fixes: #3840

The list of VLANs when editing an interface will now only show valid choices (i.e. now matches the form validation).

In order to achieve this, I made it so the data-additional-query-param-* is now a JSON-encoded list:

  • Allow multiple values by calling add_addtional_query_param multiple times over the same key (before, it would overwrite whatever was there).
  • It works well with jQuery .data as it attempts to cast the value to JSON by default

When testing this, do a reload-from-source, else you may get a cached version of forms.js.

This is a follow up to #3589


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/3925 **Author:** [@hSaria](https://github.com/hSaria) **Created:** 1/15/2020 **Status:** ✅ Merged **Merged:** 2/14/2020 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `3840-limit-vlan-choices` --- ### 📝 Commits (10+) - [`9d846d7`](https://github.com/netbox-community/netbox/commit/9d846d7b8729d70e86a106a15f751abc3136a856) Fixes #3840: Only show valid interface VLAN choices - [`201416b`](https://github.com/netbox-community/netbox/commit/201416ba526dad9d0fa003bd12d63727f439107b) Semicolons for completeness - [`02cf39c`](https://github.com/netbox-community/netbox/commit/02cf39c85b29b2684403da88a3cd6ecd27e3bdba) Merge branch 'develop' into 3840-limit-vlan-choices - [`c899786`](https://github.com/netbox-community/netbox/commit/c8997868cee94c7ca8319e10725851578b30f375) Added #3840 changelog - [`c31c8b1`](https://github.com/netbox-community/netbox/commit/c31c8b1a2566b62b64ba0fad05d6341534aed365) Moved into v2.7.1 - [`a30e50e`](https://github.com/netbox-community/netbox/commit/a30e50ecc42c39c7341dea8859a784bfc6736e50) Merge branch 'develop' into 3840-limit-vlan-choices - [`f052b90`](https://github.com/netbox-community/netbox/commit/f052b90ec35e3907d616d8124338587383ff8515) Merge branch 'develop' into 3840-limit-vlan-choices - [`2684f86`](https://github.com/netbox-community/netbox/commit/2684f86594e19f092e2be113913783de3395e472) Merge branch 'develop' into 3840-limit-vlan-choices - [`deb653c`](https://github.com/netbox-community/netbox/commit/deb653cbf3468d19d890e491f78fd564b0dc5179) Merge branch 'develop' into 3840-limit-vlan-choices - [`ff82274`](https://github.com/netbox-community/netbox/commit/ff822743cc1d4de33fe94a5cbb8700c97dfc63b3) Corrected linter warning ### 📊 Changes **4 files changed** (+96 additions, -113 deletions) <details> <summary>View changed files</summary> 📝 `netbox/dcim/forms.py` (+43 -15) 📝 `netbox/project-static/js/forms.js` (+10 -7) 📝 `netbox/utilities/forms.py` (+7 -2) 📝 `netbox/virtualization/forms.py` (+36 -89) </details> ### 📄 Description ### Fixes: #3840 The list of VLANs when editing an interface will now only show valid choices (i.e. now matches the form validation). In order to achieve this, I made it so the `data-additional-query-param-*` is now a JSON-encoded list: * Allow multiple values by calling `add_addtional_query_param` multiple times over the same key (before, it would overwrite whatever was there). * It works well with jQuery [`.data`](https://api.jquery.com/data/#data-html5) as it attempts to cast the value to JSON by default When testing this, do a reload-from-source, else you may get a cached version of `forms.js`. > This is a follow up to #3589 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 22:23:08 +01:00
adam closed this issue 2025-12-29 22:23:08 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#12701