netbox icon indicating copy to clipboard operation
netbox copied to clipboard

Extend filter forms to support filter modifiers

Open jeremystretch opened this issue 4 years ago • 3 comments

NetBox version

v3.0.8

Feature type

Change to existing functionality

Proposed functionality

When viewing a list of objects in the NetBox UI, a "filters" tab is present and lists all of the available filters for the relevant model. However, these filters utilize only the default behavior of each filter, and don't allow for modifications to the filter expressions defined here.

This FR proposes to extend the filter forms to include a dropdown widget for each appropriate field, allowing the user to select the desired logic. For example, when filtering by an integer value, the default behavior will be "equals," but options for "less than" (lt) and "greater than" (gt) will also be available.

Use case

Although these filter expressions are technically available and working in the current release, this addition to the user interface would make them much more convenient to use.

Database changes

No response

External dependencies

No response

jeremystretch avatar Oct 21 '21 12:10 jeremystretch

Per #7587 this should also include the ability to negate/invert a filter.

jeremystretch avatar Dec 13 '21 14:12 jeremystretch

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our contributing guide.

github-actions[bot] avatar Feb 12 '22 04:02 github-actions[bot]

We should explore what's feasible for #10352 first, as we can likely build on that solution to implement this.

jeremystretch avatar Sep 13 '22 19:09 jeremystretch

So, I was thinking of something like this: image

I still have yet to find the proper way of doing it within Django but this is the gist of it. I was thinking of adding this under some sort of "advanced search" accordion.

Does this makes sense to you ?

jsenecal avatar Oct 24 '22 13:10 jsenecal

I would prefer to keep each of the filters displayed individually under the "filters" tab, rather than requiring the use to select the desired filter(s) from a dropdown. Additionally, this sort of matrix only seems to makes sense where the user needs to supply a value. When filtering by related objects, an option to invert the logic (excluding the selected objects) seems sufficient.

jeremystretch avatar Oct 25 '22 12:10 jeremystretch

Per @jsenecal unfortunately this won't be done in time for the v3.4 beta, so I'm going to drop it from the milestone.

jeremystretch avatar Nov 02 '22 12:11 jeremystretch

@jsenecal do you still want to tackle this?

jeremystretch avatar Jan 05 '23 17:01 jeremystretch

Not sure I'm up to the task, work has the better part of me lately, I'll unassign myself.

jsenecal avatar Jan 25 '23 06:01 jsenecal