[PR #6860] [MERGED] Re-Implement Filter Panel & Support Custom API Select Fetch Triggers #13180

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/6860
Author: @thatmattlove
Created: 8/2/2021
Status: Merged
Merged: 8/3/2021
Merged by: @thatmattlove

Base: featureHead: feature-object-filter


📝 Commits (2)

  • 863048c Deprecate collapsible advanced search and re-implement field-based filtering on object views
  • afc8d5b Fix PEP8 formatting error

📊 Changes

20 files changed (+538 additions, -260 deletions)

View changed files

📝 netbox/circuits/forms.py (+16 -8)
📝 netbox/dcim/forms.py (+123 -62)
📝 netbox/extras/forms.py (+30 -15)
📝 netbox/ipam/forms.py (+50 -25)
📝 netbox/project-static/dist/netbox-dark.css (+1 -1)
📝 netbox/project-static/dist/netbox-light.css (+1 -1)
📝 netbox/project-static/dist/netbox.js (+7 -7)
📝 netbox/project-static/dist/netbox.js.map (+2 -2)
📝 netbox/project-static/src/select/api.ts (+84 -17)
📝 netbox/project-static/src/select/util.ts (+9 -0)
📝 netbox/project-static/styles/netbox.scss (+9 -3)
📝 netbox/project-static/styles/select.scss (+30 -1)
📝 netbox/templates/dcim/connections_list.html (+12 -30)
📝 netbox/templates/dcim/rack_elevation_list.html (+46 -51)
📝 netbox/templates/generic/object_list.html (+7 -7)
netbox/templates/inc/filter_list.html (+62 -0)
📝 netbox/templates/inc/table_controls.html (+1 -11)
📝 netbox/tenancy/forms.py (+8 -4)
📝 netbox/utilities/forms/fields.py (+12 -1)
📝 netbox/virtualization/forms.py (+28 -14)

📄 Description

Re-Implement Filter Panel

From a comment in #6797, it was mentioned that the advanced search collapsible panel is a bit cumbersome, and I agree. Originally, it was implemented because the static sidebar reduced the screen real-estate such that the previous filter panel combined with the object list table made things feel cramped. However, with the new collapsible sidebar, this is no longer a concern. This re-implements the previous filter panel and adds some responsiveness.

Support Custom API Select Fetch Event Types

In order to do the above, I implemented the ability to selectively (pun intended?) specify trigger events for which API selects will load their data — load (data is immediately loaded; current and default behavior), open (data is loaded every time the element is opened), and collapse (data is only loaded when a parent collapsing element is opened). This can be (optionally) set at the field level with the new fetch_trigger kwarg on DynamicModelChoiceMixin. Since the only current use-case is for the object list filter panels, I added fetch_trigger='open' to all filter form API select fields only.


🔄 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/6860 **Author:** [@thatmattlove](https://github.com/thatmattlove) **Created:** 8/2/2021 **Status:** ✅ Merged **Merged:** 8/3/2021 **Merged by:** [@thatmattlove](https://github.com/thatmattlove) **Base:** `feature` ← **Head:** `feature-object-filter` --- ### 📝 Commits (2) - [`863048c`](https://github.com/netbox-community/netbox/commit/863048cda229891379881ad2722b70f9d68b63e9) Deprecate collapsible advanced search and re-implement field-based filtering on object views - [`afc8d5b`](https://github.com/netbox-community/netbox/commit/afc8d5bbbff6124ccf137112682a6456a66e8da3) Fix PEP8 formatting error ### 📊 Changes **20 files changed** (+538 additions, -260 deletions) <details> <summary>View changed files</summary> 📝 `netbox/circuits/forms.py` (+16 -8) 📝 `netbox/dcim/forms.py` (+123 -62) 📝 `netbox/extras/forms.py` (+30 -15) 📝 `netbox/ipam/forms.py` (+50 -25) 📝 `netbox/project-static/dist/netbox-dark.css` (+1 -1) 📝 `netbox/project-static/dist/netbox-light.css` (+1 -1) 📝 `netbox/project-static/dist/netbox.js` (+7 -7) 📝 `netbox/project-static/dist/netbox.js.map` (+2 -2) 📝 `netbox/project-static/src/select/api.ts` (+84 -17) 📝 `netbox/project-static/src/select/util.ts` (+9 -0) 📝 `netbox/project-static/styles/netbox.scss` (+9 -3) 📝 `netbox/project-static/styles/select.scss` (+30 -1) 📝 `netbox/templates/dcim/connections_list.html` (+12 -30) 📝 `netbox/templates/dcim/rack_elevation_list.html` (+46 -51) 📝 `netbox/templates/generic/object_list.html` (+7 -7) ➕ `netbox/templates/inc/filter_list.html` (+62 -0) 📝 `netbox/templates/inc/table_controls.html` (+1 -11) 📝 `netbox/tenancy/forms.py` (+8 -4) 📝 `netbox/utilities/forms/fields.py` (+12 -1) 📝 `netbox/virtualization/forms.py` (+28 -14) </details> ### 📄 Description ## Re-Implement Filter Panel From a comment in #6797, it was mentioned that the advanced search collapsible panel is a bit cumbersome, and I agree. Originally, it was implemented because the static sidebar reduced the screen real-estate such that the previous filter panel combined with the object list table made things feel cramped. However, with the new collapsible sidebar, this is no longer a concern. This re-implements the previous filter panel and adds some responsiveness. ## Support Custom API Select Fetch Event Types In order to do the above, I implemented the ability to selectively (pun intended?) specify trigger events for which API selects will load their data — `load` (data is immediately loaded; current and default behavior), `open` (data is loaded every time the element is opened), and `collapse` (data is only loaded when a parent collapsing element is opened). This can be (optionally) set at the field level with the new `fetch_trigger` kwarg on `DynamicModelChoiceMixin`. Since the only current use-case is for the object list filter panels, I added `fetch_trigger='open'` to all filter form API select fields only. --- <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:25:49 +01:00
adam closed this issue 2025-12-29 22:25:50 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#13180