Skip to content
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

Closes #14917: Replace slim-select with tom-select #15080

Merged
merged 26 commits into from
Feb 8, 2024

Conversation

jeremystretch
Copy link
Member

Fixes: #14917

  • Drop slim-select as a dependency & introduce tom-select
  • Port custom functionality from legacy APISelect to TomSelect

@jeremystretch jeremystretch added this to the v4.0 milestone Feb 8, 2024
@arthanson

This comment was marked as resolved.

@arthanson

This comment was marked as resolved.

@jeremystretch
Copy link
Member Author

jeremystretch commented Feb 8, 2024

  1. type secondary part of an existing group of ip addresses (for example I have 172.16.0.2, 172.16.0.3..) type '.16' for the filtered list the old select showed all the ip's containing the .16. For the new tom-select it shows 'No Results Found'.

Here's what's happening in the current (v3.7) UI:

  1. User opens the dropdown
  2. APISelect loads and sends its initial REST API request for /api/ipam/ip-addresses/, populating its first 50 entries
  3. User types a value, e.g. .16
  4. A second REST API request is issued, this time for /api/ipam/ip-addresses/?q=.16
  5. An empty response is received (because partial match on IPs in this manner is not currently supported)
  6. APISelect falls back to returning any of the previously retrieved IP addresses matching the query

It's simply coincidence if any matching IP addresses are displayed. We can confirm this by attempting to match on an IP address that is not returned as part of the initial set of values. The only difference in behavior is that the TomSelect implementation does not fall back to matching against cached values.

This issue can only be resolved by implementing support for partial matching on the address field for IP addresses; we'll need to raise a separate bug/FR for that if it seems reasonable. (It's worth noting that matching an IP address by its beginning value, e.g. 192.168.16 does work as expected.)

@jeremystretch
Copy link
Member Author

jeremystretch commented Feb 8, 2024

  1. What is worse is if you click off of the dropdown while it is displaying this (click to another dropdown or off to the side) it will now show '----' and if you expand it it will still show 'No Results Found', you have to press the delete key to start getting results again.

The issue here seems to be that the query is not cleared when the field loses focus, nor is it re-displayed when the field regains focus.

This appears to be a bug in tom-select itself: You can observe the same behavior in the first example here.

Edit: I've opened a bug report upstream to see if this something that can/should be tackled in tom-select itself.

@jeremystretch jeremystretch merged commit d63e1da into feature Feb 8, 2024
6 checks passed
@jeremystretch jeremystretch deleted the 14917-tom-select branch February 8, 2024 20:07
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants