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

feat: filter feature works #29

Merged
merged 9 commits into from
Mar 2, 2022
Merged

feat: filter feature works #29

merged 9 commits into from
Mar 2, 2022

Conversation

alswl
Copy link
Contributor

@alswl alswl commented Feb 24, 2022

Request #5 is done.

demo go run examples/filter/main.go.

A filtered simple default table
Currently filter by:
Press q or ctrl+c to quit

┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━┓
┃        Title┃       Author┃Desc…┃
┣━━━━━━━━━━━━━╋━━━━━━━━━━━━━╋━━━━━┫
┃Computer Sys…┃Randal E. Br…┃This…┃
┃Effective Ja…┃ Joshua Bloch┃The …┃
┃Structure an…┃Harold Abels…┃Stru…┃
┃Game Program…┃Robert Nystr…┃The …┃
┣━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━┫
┃                              1/1┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

A filtered simple default table
Currently filter by:
Press q or ctrl+c to quit

┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━┓
┃        Title┃       Author┃Desc…┃
┣━━━━━━━━━━━━━╋━━━━━━━━━━━━━╋━━━━━┫
┃Computer Sys…┃Randal E. Br…┃This…┃
┃Structure an…┃Harold Abels…┃Stru…┃
┃Game Program…┃Robert Nystr…┃The …┃
┣━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━┫
┃                        /pro  1/1┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━┓
┃        Title┃       Author┃Desc…┃
┣━━━━━━━━━━━━━╋━━━━━━━━━━━━━╋━━━━━┫
┃Game Program…┃Robert Nystr…┃The …┃
┣━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━┫
┃                       /game  1/1┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

Copy link
Owner

@Evertras Evertras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the submission! A few things to look at.

I also want to consider how a user might supply filters/searches through the API. For example, a user might have a text box outside the table to supply a filter term. Can we add a way to supply the filter term as well as the text input you've added? I do really like the / as I live in vim and that feels natural to me. :D

There will be room for expanding this in the future for things like numerical comparisons/filters, but I think that can definitely be another PR as long as we leave room for it.

@Evertras
Copy link
Owner

Just a note, we also need to make sure to fix the linting/testing coverage. I unfortunately do want to stay strict with that, as it's caught many of my own mistakes even in this project.

@alswl
Copy link
Contributor Author

alswl commented Feb 25, 2022

Just a note, we also need to make sure to fix the linting/testing coverage. I unfortunately do want to stay strict with that, as it's caught many of my own mistakes even in this project.

Sure.

@Evertras
Copy link
Owner

Evertras commented Feb 26, 2022

Hey there, just checking if you were able to add some coverage. If not, I'm willing to help out here. There appear to be some existing bugs regarding the selectable rows that snuck in unrelated to this PR, and another issue that would collide with the keymap added in this PR, so I'd like to unblock this if you find the test coverage requirements painful.

@Evertras Evertras mentioned this pull request Feb 26, 2022
@alswl
Copy link
Contributor Author

alswl commented Feb 28, 2022

@Evertras I added as more unit tests as I can. And I merged with upstream main branch(solved some conflicts).

If the coverage is still under the required, help is wanted~

@Evertras
Copy link
Owner

Evertras commented Mar 1, 2022

Thanks! Just a few linting things snuck in... a quick make lint locally should point them out as well. Once those are fixed I'm happy to merge!

@alswl
Copy link
Contributor Author

alswl commented Mar 1, 2022

@Evertras thanks for point out. Style issues were fixed.

@Evertras
Copy link
Owner

Evertras commented Mar 2, 2022

Thank you for the patience, I'll take care of the coverage gap; I'll just not make a release until I fix that. Appreciate the work!

@Evertras Evertras merged commit 682b725 into Evertras:main Mar 2, 2022
@alswl
Copy link
Contributor Author

alswl commented May 3, 2022

@Evertras Maybe availableRows is better than visibleRows.

@alswl alswl deleted the feat/filter branch February 13, 2023 07:38
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