-
Notifications
You must be signed in to change notification settings - Fork 186
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
Add search bar for filtering flags in home page #268
Add search bar for filtering flags in home page #268
Conversation
Codecov Report
@@ Coverage Diff @@
## master #268 +/- ##
=======================================
Coverage 81.76% 81.76%
=======================================
Files 26 26
Lines 1530 1530
=======================================
Hits 1251 1251
Misses 210 210
Partials 69 69 Continue to review full report at Codecov.
|
Hey, this is GREAT! I've wanted to do something like the search for a while, but didn't decide which way to go, client side or server side search for the UI? The advantage of server side search is that we get the limit/offset pagination upfront to be scalable into huge amount of flags. And client side search for its simplicity. |
I don't know if flagr home page is a good case for pagination and server side filtering, since I cant see a use case of too many flags (more than 1000?). |
this.filteredFlags = this.flags.filter( | ||
({ id, description}) => | ||
id.toString().startsWith(this.searchTerm) || | ||
description.startsWith(this.searchTerm) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible to make it a substring search instead of just startsWith
? At least, the search should be as good as cmd+f from the browser. This is equivalent to "description_like" params, so we can easily migrate the search box to server-side search in the future (if it's necessary).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zhouzhuojie Alright, done.
Description
I added a search bar that can help to find a flag throw a big number of flags on the home page.
Motivation and Context
When the usage of flagr grows, I tend to add more flags for every configuration I have. By doing that, I affect directly the length of the list of flags on the home page. I was trying to suggest a new way to navigate throw all the flags easily.
How Has This Been Tested?
Tested locally, manually.
Types of changes
Checklist: