Commit Graph

14589 Commits

Author SHA1 Message Date
Jason Novinger
2f3d7b1c5c Fix applied_filters template tag to use field-type-specific lookup labelsresolves
Some checks failed
CI / build (20.x, 3.12) (push) Has been cancelled
CI / build (20.x, 3.13) (push) Has been cancelled
E.g. resolves gt="after" for dates vs "greater than" for numbers
2025-11-25 15:24:03 -06:00
Jason Novinger
212ec72f22 Switch to sentence case for filter pill text 2025-11-25 15:24:03 -06:00
Jason Novinger
905a516d23 Removed explicit checks against QueryField and [Null]BooleanField
I did add them to FORM_FIELD_LOOKUPS, though, to underscore that they
were considered and are intentially empty for future devs.
2025-11-25 15:24:03 -06:00
Jason Novinger
d4535df043 Fix filterset registration for doubly-registered models 2025-11-25 15:24:03 -06:00
Jason Novinger
93f916d115 Include MODIFIER_EMPTY_FALSE/_TRUE in __all__
Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2025-11-25 15:24:02 -06:00
Jason Novinger
592a0f9653 Support filter modifiers for ChoiceField 2025-11-25 15:24:02 -06:00
Jason Novinger
d1788c1d2f Enables filter modifiers on APISelect based fields 2025-11-25 15:24:02 -06:00
Jason Novinger
5d309ce85f Remove unused star import, leftover from earlier work 2025-11-25 15:24:02 -06:00
Jason Novinger
ebdf3f98d5 Update app registry for new filtersets store 2025-11-25 15:24:02 -06:00
Jason Novinger
46f9b2ccb4 Remove unneeded imports left from earlier registry work 2025-11-25 15:24:02 -06:00
Jason Novinger
64f38334be Refactor register_filterset to be more generic and simple 2025-11-25 15:24:02 -06:00
Jason Novinger
cf0a13f535 Address PR feedback: refactor brittle test for APISelect useage
Now checks if widget is actually APISelect, rather than trying to infer
from the class name.
2025-11-25 15:24:02 -06:00
Jason Novinger
e2b9317be1 Fix registry pattern to use model identifiers as keys
Changed filterset registration to use model identifiers ('{app_label}.{model_name}')
as registry keys instead of form classes, matching NetBox's pattern for search indexes.
2025-11-25 15:24:02 -06:00
Jason Novinger
316c12c6a9 Address PR feedback: Rename FilterModifierWidget parameter to widget 2025-11-25 15:24:02 -06:00
Jason Novinger
d900bfc312 Address PR feedback: Refactor applied_filters to use FORM_FIELD_LOOKUPS 2025-11-25 15:24:02 -06:00
Jason Novinger
3dcc299cda Address PR feedback: Refactor and consolidate field filtering logic
Consolidated field enhancement logic in FilterModifierMixin by:
- Creating QueryField marker type (CharField subclass) for search fields
- Updating FilterForm and NetBoxModelFilterSetForm to use QueryField for 'q'
- Moving all skip logic into _get_lookup_choices() to return empty list for
  fields that shouldn't be enhanced
- Removing separate _should_skip_field() method
- Removing unused field_name parameter from _get_lookup_choices()
- Replacing hardcoded field name check ('q') with type-based detection
2025-11-25 15:24:02 -06:00
Jason Novinger
626155c5f5 Address PR feedback: Move FORM_FIELD_LOOKUPS to module-level constant
Extracts the field type to lookup mappings from FilterModifierMixin class
attribute to a module-level constant for better reusability.
2025-11-25 15:24:02 -06:00
Jason Novinger
711984a825 Fix filter modifier form submission bug with 'action' field collision
Forms with a field named "action" (e.g., ObjectChangeFilterForm) were causing
the form.action property to be shadowed by the field element, resulting in
[object HTMLSelectElement] appearing in the URL path.

Use form.getAttribute('action') instead of form.action to reliably retrieve
the form's action URL without collision from form fields.

Fixes form submission on /core/changelog/ and any other forms with an 'action'
field using filter modifiers.
2025-11-25 15:24:02 -06:00
Jason Novinger
c298108c1c Address PR feedback: Move FilterModifierMixin into base filter form classes
Incorporates FilterModifierMixin into NetBoxModelFilterSetForm and FilterForm,
making filter modifiers automatic for all filter forms throughout the application.
2025-11-25 15:24:02 -06:00
Jason Novinger
ab70c4b2c1 Address PR feedback: Replace global filterset mappings with registry 2025-11-25 15:24:02 -06:00
Jason Novinger
de96bc8770 Add ChoiceField support to FilterModifierMixin
Enable filter modifiers for single-choice ChoiceFields in addition to the
existing MultipleChoiceField support. ChoiceFields can now display modifier
dropdowns with "Is", "Is Not", "Is Empty", and "Is Not Empty" options when
the corresponding FilterSet defines those lookups.

The mixin correctly verifies lookup availability against the FilterSet, so
modifiers only appear when multiple lookup options are actually supported.
Currently most FilterSets only define 'exact' for single-choice fields, but
this change enables future FilterSet enhancements to expose additional
lookups for ChoiceFields.
2025-11-25 15:24:02 -06:00
Jason Novinger
e9bacf9a2e Enable filter form modifiers on Extras models 2025-11-25 15:24:02 -06:00
Jason Novinger
aa061f958f Enable filter form modifiers on Core models 2025-11-25 15:24:02 -06:00
Jason Novinger
a5b5dd0357 Enable filter form modifiers on Users models 2025-11-25 15:24:02 -06:00
Jason Novinger
f0c6b186ce Enable filter form modifiers on Circuit models 2025-11-25 15:24:02 -06:00
Jason Novinger
cf2608a4ff Enable filter form modifiers on Virtualization models 2025-11-25 15:24:02 -06:00
Jason Novinger
9c436ee0cd Enable filter form modifiers on VPN models 2025-11-25 15:24:02 -06:00
Jason Novinger
4199aeb21e Enable filter form modifiers on IPAM models 2025-11-25 15:24:02 -06:00
Jason Novinger
a7a1a95955 Enable filter form modifiers on Wireless models 2025-11-25 15:24:02 -06:00
Jason Novinger
63ea883717 Enable filter form modifiers on Tenancy models 2025-11-25 15:24:02 -06:00
Jason Novinger
d5f33bd4b4 Enable filter form modifiers on DCIM models 2025-11-25 15:24:02 -06:00
Jason Novinger
8291eb5c13 Fix CircuitFilterForm inheritance 2025-11-25 15:24:02 -06:00
Jason Novinger
93c5c3b846 Fix import order 2025-11-25 15:24:02 -06:00
Jason Novinger
e544976534 Remove extraneous TS comments 2025-11-25 15:24:02 -06:00
Jason Novinger
e19591484c Fixes #7604: Add filter modifier dropdowns for advanced lookup operators
Implements dynamic filter modifier UI that allows users to select lookup operators
(exact, contains, starts with, regex, negation, empty/not empty) directly in filter
forms without manual URL parameter editing.

Supports filters for all scalar types and strings, as well as some
related object filters. Explicitly does not support filters on fields
that use APIWidget. That has been broken out in to follow up work.

**Backend:**
- FilterModifierWidget: Wraps form widgets with lookup modifier dropdown
- FilterModifierMixin: Auto-enhances filterset fields with appropriate lookups
- Extended lookup support: Adds negation (n), regex, iregex, empty_true/false lookups
- Field-type-aware: CharField gets text lookups, IntegerField gets comparison operators, etc.

**Frontend:**
- TypeScript handler syncs modifier dropdown with URL parameters
- Dynamically updates form field names (serial → serial__ic) on modifier change
- Flexible-width modifier dropdowns with semantic CSS classes
2025-11-25 15:23:54 -06:00
Jeremy Stretch
afba5b2791 Merge branch 'main' into feature
Some checks are pending
CI / build (20.x, 3.12) (push) Waiting to run
CI / build (20.x, 3.13) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, actions) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, python) (push) Waiting to run
2025-11-25 15:25:53 -05:00
Jeremy Stretch
8b3f7ce507
Merge pull request #20880 from netbox-community/release-v4.4.7
Some checks failed
CodeQL / Analyze (${{ matrix.language }}) (none, actions) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, python) (push) Waiting to run
CI / build (20.x, 3.10) (push) Has been cancelled
CI / build (20.x, 3.11) (push) Has been cancelled
CI / build (20.x, 3.12) (push) Has been cancelled
Release v4.4.7
2025-11-25 14:57:13 -05:00
Jeremy Stretch
adad3745ae Release v4.4.7 2025-11-25 14:37:06 -05:00
Jeremy Stretch
8055fae253
Fixes #20865: Enforce proper min/max values for latitude & longitude (#20872) 2025-11-25 12:52:04 -06:00
bctiemann
1505285aff
Merge pull request #20829 from netbox-community/19338-graphql-in_list-on-feature
Closes: #19338 - GraphQL: Adds in_list lookups for id and enum fields
2025-11-25 13:41:23 -05:00
Jeremy Stretch
7cc7c7ab81
Closes #20788: Cable profiles and and position mapping (#20802) 2025-11-25 12:18:15 -06:00
Brian Tiemann
ae21a6a684 Change explicitly specified id fields to FilterLookups 2025-11-25 13:06:24 -05:00
Arthur
aac3a51431 20743 add request to Script EventRule run
Some checks are pending
CI / build (20.x, 3.10) (push) Waiting to run
CI / build (20.x, 3.11) (push) Waiting to run
CI / build (20.x, 3.12) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, actions) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, python) (push) Waiting to run
2025-11-25 09:21:38 -05:00
bctiemann
3e0ad2176f
Merge pull request #20855 from ifoughal/20822-add-auto_sync_enabled-property-for-configtemplates
Fixes 20822: add auto sync enabled property for configtemplates
2025-11-25 09:18:31 -05:00
bctiemann
4e8edfb3d6
Merge pull request #20847 from pheus/20839-fix-objecttype-filterform-for-customlinks-and-savedfilters
Fixes #20839: Rename `object_type` to `object_type_id` in FilterForm for `CustomLink` and `SavedFilter`
2025-11-25 09:08:16 -05:00
bctiemann
651557a82b
Merge pull request #20838 from pheus/20820-add-objecttype-filterfield-to-customfield-filterform
Closes #20820: Add Object Type Filter to CustomField
2025-11-25 08:59:28 -05:00
Étienne Brunel
c3d66dc42e fix: Add Molex Micro-Fit 2x3 on PowerPortTypeChoices and PowerOutletTypeChoices 2025-11-25 08:46:32 -05:00
github-actions
a50e570f22 Update source translation strings
Some checks are pending
CodeQL / Analyze (${{ matrix.language }}) (none, actions) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, python) (push) Waiting to run
2025-11-25 05:02:04 +00:00
Jeremy Stretch
a44a79ec79
Fixes #20649: Enforce view permissions on REST API endpoint for custom scripts (#20871)
Some checks are pending
CI / build (20.x, 3.10) (push) Waiting to run
CI / build (20.x, 3.11) (push) Waiting to run
CI / build (20.x, 3.12) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, actions) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, python) (push) Waiting to run
2025-11-24 18:28:35 -06:00
Martin Hauser
b919868521
Closes #20823: Validate token expiration date on creation (#20862) 2025-11-24 15:05:59 -06:00