netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Public demo: https://demo.netbox.dev
http://netboxlabs.com/oss/netbox/
Apache License 2.0
15.68k stars 2.53k forks source link

Extend filter forms to support filter modifiers #7604

Open jeremystretch opened 2 years ago

jeremystretch commented 2 years ago

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 commented 2 years ago

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

github-actions[bot] commented 2 years ago

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.

jeremystretch commented 1 year ago

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

jsenecal commented 1 year ago

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 ?

jeremystretch commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

@jsenecal do you still want to tackle this?

jsenecal commented 1 year ago

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