Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bdlamprecht opened this issue Feb 21, 2019 · 7 comments · Fixed by #3894
Closed

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

bdlamprecht opened this issue Feb 21, 2019 · 7 comments · Fixed by #3894
Labels
status: accepted This issue has been accepted for implementation

Comments

@bdlamprecht
Copy link
Contributor

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.

@DanSheps
Copy link
Member

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 DanSheps added the type: feature Introduction of new functionality to the application label Feb 23, 2019
@bdlamprecht
Copy link
Contributor Author

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.

@lampwins lampwins added the status: under review Further discussion is needed to determine this issue's scope and/or implementation label Feb 25, 2019
@lampwins
Copy link
Contributor

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.

@bdlamprecht
Copy link
Contributor Author

That would be perfect!

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

@candlerb
Copy link
Contributor

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".

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed status: under review Further discussion is needed to determine this issue's scope and/or implementation labels Apr 27, 2019
@jeremystretch jeremystretch changed the title Problem with filtering by tags and site (at least for prefixes) Replace tags list on object filters with a Select2 selection widget Apr 27, 2019
@jeremystretch jeremystretch added type: ui and removed type: feature Introduction of new functionality to the application labels May 2, 2019
@tyler-8
Copy link
Contributor

tyler-8 commented 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

@hSaria
Copy link
Contributor

hSaria commented 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.

jeremystretch added a commit that referenced this issue Feb 4, 2020
Fixes #2921: Replace tags filter with Select2 widget
@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants