Skip to content

Alias filter #51

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

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

Alias filter #51

wants to merge 14 commits into from

Conversation

Minterl
Copy link

@Minterl Minterl commented Feb 23, 2025

Press "/" when searching through new devices to filter them by alias via a popup dialog.
I would be happy to swap out the String::contains with a fuzzy search algorithm, but I figured not to be worth the extra dependency.

@pythops
Copy link
Owner

pythops commented Feb 24, 2025

Thanks for the PR 🙏
I like the idea of filtering, I just have couple of comments:

  1. Show filter popup only when the discovered devices are not empty
  2. Highlight with color the matching pattern in the name of the devices.
  3. Maybe instead of the popup, having it at the bottom of the block Discovered devices would be better in term of the ux. and when the discarded (with esc for example) then the filter is gone.

I am willing to collaborate on this one if you need my help :)

@Minterl
Copy link
Author

Minterl commented Feb 24, 2025

I agree with those points and will get to implementing them when I can.
I also seem to have introduced a bug I've experienced a few times but can't seem to reproduce. I get a "not found" error of some kind if I remember correctly.
On another note, forgive me if my code isn't exactly idiomatic with respect to what is commonplace in Ratatui. This is my first time with the library and I am learning as I go.

@pythops
Copy link
Owner

pythops commented Feb 25, 2025

no worries, I really appreciate your initiative to contribute, we are all here to learn. Again, let me know if you want to join forces and split the tasks so we can work on it together.

@pythops
Copy link
Owner

pythops commented May 10, 2025

@Minterl any update on this PR ?

@Minterl
Copy link
Author

Minterl commented May 11, 2025

Sorry for the delay, I've been pretty busy.

Show filter popup only when the discovered devices are not empty
Highlight with color the matching pattern in the name of the devices.
Maybe instead of the popup, having it at the bottom of the block Discovered devices would be better in term of the ux. and when the discarded (with esc for example) then the filter is gone.
I've implemented each of these.

@pythops
Copy link
Owner

pythops commented May 11, 2025

No worries.
I gave it a try and found some rendering issues actually:

  • the popup is render in the bottom the frame, over the adapter section
  • to cancel the search, I need to press / then remove the text, which is inconvenient imo

@Minterl
Copy link
Author

Minterl commented May 12, 2025

to cancel the search, I need to press / then remove the text, which is inconvenient imo

I agree; now enter exits the popup while maintaining the filter pattern while esc discards it.

the popup is render in the bottom the frame, over the adapter section

I can move it to the bottom of the new devices table if you think that it would provide a better user experience, but I personally think that over the bottom of the screen is better since the likelihood that the user would need to see the adapter section and simultaneously filter the new devices is small. The alternative would mean that the bottom of the device list would likely get cut off when filtering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants