Replace tags list on object filters with a Select2 selection widget #2403

Closed
opened 2025-12-29 17:25:46 +01:00 by adam · 7 comments
Owner

Originally created by @bdlamprecht on GitHub (Feb 21, 2019).

Environment

  • Python version: 3.6.7
  • NetBox version: 2.5.6

Steps to Reproduce

  1. Create prefixes in different sites, some with tags, some without
  2. On the Prefixes page and in the Tags section of the WebUI, click to filter by one of the tags
  3. You should now see only those prefixes that are assigned that tag value
  4. Update the filter to limit your results to an individual site and click Apply
  5. The previous tag filter is removed showing only the filter by site

Expected Behavior

To be able to cumulatively add filters and tags as the same time to drill down and find what the object you may be looking for.

Observed Behavior

Explained above.

Originally created by @bdlamprecht on GitHub (Feb 21, 2019). ### Environment * Python version: 3.6.7 * NetBox version: 2.5.6 ### Steps to Reproduce 1. Create prefixes in different sites, some with tags, some without 2. On the `Prefixes` page and in the `Tags` section of the WebUI, click to filter by one of the tags 3. You should now see only those prefixes that are assigned that tag value 4. Update the filter to limit your results to an individual site and click `Apply` 5. The previous tag filter is removed showing only the filter by site <!-- What did you expect to happen? --> ### Expected Behavior To be able to cumulatively add filters and tags as the same time to drill down and find what the object you may be looking for. <!-- What happened instead? --> ### Observed Behavior Explained above.
adam added the status: accepted label 2025-12-29 17:25:46 +01:00
adam closed this issue 2025-12-29 17:25:46 +01:00
Author
Owner

@DanSheps commented on GitHub (Feb 23, 2019):

This is not just present on the Prefix, but anywhere where the tag cloud exists.

I am not sure if this should be classed as a bug as this appears to be how it was intended to operate.

@DanSheps commented on GitHub (Feb 23, 2019): This is not just present on the Prefix, but anywhere where the tag cloud exists. I am not sure if this should be classed as a bug as this appears to be how it was intended to operate.
Author
Owner

@bdlamprecht commented on GitHub (Feb 24, 2019):

I expected that it wasn't limited to just the Prefix model, but didn't look everywhere.
Also, I wasn't sure if it was a bug or an feature request, so I opened it as a bug as it seemed to be intended to do the same thing as the filter did.

To make sure I follow the correct process, do I need to open an FR or by having the enhancement tag added, is everything taken care of and this functionality will be added sometime in the future?

Let me know if I need to do anything else.

@bdlamprecht commented on GitHub (Feb 24, 2019): I expected that it wasn't limited to just the `Prefix` model, but didn't look everywhere. Also, I wasn't sure if it was a bug or an feature request, so I opened it as a bug as it **seemed** to be intended to do the same thing as the `filter` did. To make sure I follow the correct process, do I need to open an FR or by having the `enhancement` tag added, is everything taken care of and this functionality will be added sometime in the future? Let me know if I need to do anything else.
Author
Owner

@lampwins commented on GitHub (Feb 25, 2019):

My vote would be to replace the current UI tag filtering method with a multi-select2 widget as a part of the standard filter forms.

@lampwins commented on GitHub (Feb 25, 2019): My vote would be to replace the current UI tag filtering method with a multi-select2 widget as a part of the standard filter forms.
Author
Owner

@bdlamprecht commented on GitHub (Feb 27, 2019):

That would be perfect!

Having separate methods for filtering that get in the way of each other is not ideal.

@bdlamprecht commented on GitHub (Feb 27, 2019): That would be perfect! Having separate methods for filtering that get in the way of each other is not ideal.
Author
Owner

@candlerb commented on GitHub (Apr 12, 2019):

I was also surprised that when I selected a tag to drill down to a subset of devices, and then entered part of a device's name, that the tag filtering was lost.

However today there's no way to remove tag filtering either, apart from doing an unrelated search.

I agree that having a multi-select would be good, where you can select tag(s) and deselect them as separate operations.

It needs to be clear whether it acts as "and" or "or". I guess a multi-select normally acts as "or", but there's also a valid use case for "and". Perhaps there should be selection labelled "any" or "all".

@candlerb commented on GitHub (Apr 12, 2019): I was also surprised that when I selected a tag to drill down to a subset of devices, and then entered part of a device's name, that the tag filtering was lost. However today there's no way to *remove* tag filtering either, apart from doing an unrelated search. I agree that having a multi-select would be good, where you can select tag(s) and deselect them as separate operations. It needs to be clear whether it acts as "and" or "or". I guess a multi-select normally acts as "or", but there's also a valid use case for "and". Perhaps there should be selection labelled "any" or "all".
Author
Owner

@tyler-8 commented on GitHub (Oct 30, 2019):

I've identified a tag display bug (v2.6.6) that would be remediated by this fix.

Tag two objects (2 sites or 2 circuits for example) with tags that partially match: zeta and zeta-tag. In the list view, click the tag for zeta-tag to filter the results. You'll see both tags highlighted as if they've both been selected. I think the intent is that only the truly selected tag would be highlighted.

Template line in question: https://github.com/netbox-community/netbox/blob/develop/netbox/templates/inc/tags_panel.html#L10

@tyler-8 commented on GitHub (Oct 30, 2019): I've identified a tag display bug (v2.6.6) that would be remediated by this fix. Tag two objects (2 sites or 2 circuits for example) with tags that partially match: `zeta` and `zeta-tag`. In the list view, click the tag for `zeta-tag` to filter the results. You'll see both tags highlighted as if they've both been selected. I think the intent is that only the truly selected tag would be highlighted. Template line in question: https://github.com/netbox-community/netbox/blob/develop/netbox/templates/inc/tags_panel.html#L10
Author
Owner

@hSaria commented on GitHub (Jan 10, 2020):

I was tackling this issue by adding a new class that the filter forms can inherit from but ran into the problem with ordering as some of them have their field order set part-implicitly (some fields are in field_order, the rest follow the order that they were defined in).

Inheritance without modifying the order will place the tags field between the explicit and implicit fields in the filter form, so I'd have to order all of them manually. In addition, the field will become a part of the primary filter panel (not sure if we should keep it in a separate panel for distinction).

The straight-forward solution would be to just change templates/inc/tags_panel.html, which I'm not sure is the most elegant one, but it is the one involving the least changes.

@hSaria commented on GitHub (Jan 10, 2020): I was tackling this issue by adding a new class that the filter forms can inherit from but ran into the problem with ordering as some of them have their field order set part-implicitly (some fields are in `field_order`, the rest follow the order that they were defined in). Inheritance without modifying the order will place the tags field between the explicit and implicit fields in the filter form, so I'd have to order all of them manually. In addition, the field will become a part of the primary filter panel (not sure if we should keep it in a separate panel for distinction). The straight-forward solution would be to just change `templates/inc/tags_panel.html`, which I'm not sure is the most elegant one, but it is the one involving the least changes.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2403