[PR #15104] [MERGED] Closes #13283: Add context to dropdown options #14523

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/15104
Author: @jeremystretch
Created: 2/9/2024
Status: Merged
Merged: 2/13/2024
Merged by: @jeremystretch

Base: featureHead: 13283-ui-select-context


📝 Commits (10+)

📊 Changes

13 files changed (+176 additions, -34 deletions)

View changed files

📝 docs/customization/custom-scripts.md (+17 -0)
📝 netbox/dcim/forms/bulk_edit.py (+6 -0)
📝 netbox/dcim/forms/connections.py (+9 -3)
📝 netbox/dcim/forms/model_forms.py (+22 -4)
📝 netbox/extras/scripts.py (+4 -1)
📝 netbox/ipam/forms/model_forms.py (+7 -1)
📝 netbox/project-static/dist/netbox.js (+4 -4)
📝 netbox/project-static/dist/netbox.js.map (+1 -1)
📝 netbox/project-static/src/select/classes/dynamicTomSelect.ts (+43 -3)
📝 netbox/project-static/src/select/dynamic.ts (+27 -8)
📝 netbox/project-static/src/select/static.ts (+8 -3)
📝 netbox/utilities/forms/fields/dynamic.py (+22 -4)
📝 netbox/wireless/forms/model_forms.py (+6 -2)

📄 Description

Fixes: #13283

  • Introduce support for populating the following attributes within a dropdown option:
    • Value
    • Label
    • Disabled indicator
    • Description
    • Depth in hierarchy (for indentation)
    • Parent object
  • Expose a new option_attrs keyword argument on dynamic choice form fields that can be used to override default/undefined fields

🔄 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/15104 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 2/9/2024 **Status:** ✅ Merged **Merged:** 2/13/2024 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `feature` ← **Head:** `13283-ui-select-context` --- ### 📝 Commits (10+) - [`ff460c2`](https://github.com/netbox-community/netbox/commit/ff460c2829138b314b551db130afb68c82621d2c) Initial work on #13283 - [`87d92f8`](https://github.com/netbox-community/netbox/commit/87d92f8ee486712366ab83100d3e389e5251cc76) Enable passing TomSelect HTML template attibutes on DynamicModelChoiceField - [`f155e3c`](https://github.com/netbox-community/netbox/commit/f155e3c3d50107ba38d36415cc2746ab1992f6d6) Merge disabled_indicator into option_attrs - [`7da211e`](https://github.com/netbox-community/netbox/commit/7da211e67a15fa3235d1744842e81d2f2692607f) Add support for annotating a numeric count on dropdown options - [`a7ea105`](https://github.com/netbox-community/netbox/commit/a7ea10524782582ca2abce650c37ae46a3fee08a) Annotate parent object on relevant fields - [`053e02d`](https://github.com/netbox-community/netbox/commit/053e02d4d774c444ce9370bdde5be137583a5ee0) Improve rendering of color options - [`80b49aa`](https://github.com/netbox-community/netbox/commit/80b49aa6b2617a295c30105aa7420022ca1787df) Improve rendering of color options - [`aec66f7`](https://github.com/netbox-community/netbox/commit/aec66f77f7ed3deb0533ab260cc9fcb2002abcfe) Rename option_attrs to context - [`2d5757a`](https://github.com/netbox-community/netbox/commit/2d5757af0e196c5890c06357a5134e402f5eb188) Expose option context on ObjectVar for custom scripts - [`6ae9ff6`](https://github.com/netbox-community/netbox/commit/6ae9ff68baf6778e5cffcff65c564c8e08c5efe9) Merge branch 'feature' into 13283-ui-select-context ### 📊 Changes **13 files changed** (+176 additions, -34 deletions) <details> <summary>View changed files</summary> 📝 `docs/customization/custom-scripts.md` (+17 -0) 📝 `netbox/dcim/forms/bulk_edit.py` (+6 -0) 📝 `netbox/dcim/forms/connections.py` (+9 -3) 📝 `netbox/dcim/forms/model_forms.py` (+22 -4) 📝 `netbox/extras/scripts.py` (+4 -1) 📝 `netbox/ipam/forms/model_forms.py` (+7 -1) 📝 `netbox/project-static/dist/netbox.js` (+4 -4) 📝 `netbox/project-static/dist/netbox.js.map` (+1 -1) 📝 `netbox/project-static/src/select/classes/dynamicTomSelect.ts` (+43 -3) 📝 `netbox/project-static/src/select/dynamic.ts` (+27 -8) 📝 `netbox/project-static/src/select/static.ts` (+8 -3) 📝 `netbox/utilities/forms/fields/dynamic.py` (+22 -4) 📝 `netbox/wireless/forms/model_forms.py` (+6 -2) </details> ### 📄 Description ### Fixes: #13283 - Introduce support for populating the following attributes within a dropdown option: - Value - Label - Disabled indicator - Description - Depth in hierarchy (for indentation) - Parent object - Expose a new `option_attrs` keyword argument on dynamic choice form fields that can be used to override default/undefined fields --- <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 23:24:58 +01:00
adam closed this issue 2025-12-29 23:24:58 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#14523