-
Notifications
You must be signed in to change notification settings - Fork 3
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 header search bar #81
Conversation
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.
Well done @FKolwa! I like the new search performance 🥇
src/app/components/Search.tsx
Outdated
React.useEffect(() => { | ||
loadData() | ||
}) |
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.
I guess loadData
should only run when Search
is getting mounted. Therefore I would recommend to add an empty dependency array, otherwise it would run on every render.
React.useEffect(() => { | |
loadData() | |
}) | |
React.useEffect(() => { | |
loadData() | |
}, []) |
Same for the effect in src/app/Pages/Browser/Search.tsx
, not sure what will stay 🙂
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.
The behavior was already discovered, but interesting fix 😄
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.
I guess
loadData
should only run whenSearch
is getting mounted. Therefore I would recommend to add an empty dependency array, otherwise it would run on every render.Same for the effect in
src/app/Pages/Browser/Search.tsx
, not sure what will stay 🙂
Nice, great find! The sad thing is I ran into an issue on the image detail view in which the component stayed mounted after selecting a new image version which had the exact same fix (by monitoring the props passed in with the path) but I completely ignore this onEffect call.. face palm
Signed-off-by: Benedikt Bongartz <bongartz@klimlive.de>
Replace fzf with fuzzysort for more accuracy and performance Highlight search results Print results to application launcher window
Add new dynamic routes for /image/<provider>/<region>/<imageName>
Co-authored-by: Mo <mf.89@gmx.de>
Weird https://localhost:9000/browser/google/global/rhel_9_arm64 does work, while https://localhost:9000/browser/google/global/rhel_8.2_sap_x86_64 does not. 🦝 |
Yeah thats an issue for the WSGI server (the webpack server) running on your local machine. I think this is related to the missing 404 redirect in the development environment. The one page application is redirecting subdirectory calls to the router (or simpler, calls index.html) and renders the subpage accordingly. This works fine in our staging environment or in production but the webpack server does not (yet) know how to handle these calls. We should open an issue for that. |
Yeah I ran into the exact same thing. I don't know why some of them are properly redirect and others won't. In prod the CDN handles the proper redirect just fine, the dev server doesn't.. |
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.
Only a little cleanup left and the missing package-lock changes need to be committed but everything else looks amazing! Thanks for doing this!
@@ -45,19 +47,25 @@ const routes: AppRouteConfig[] = [ | |||
component: <AWSImageBrowser title='Cloud Image Directory | AWS Image Browser'/>, | |||
exact: true, | |||
label: 'AWS', | |||
path: '/browser/AWS', | |||
path: '/browser/aws', |
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.
Nice, thanks for fixing this.
This always annoyed me and I always forgot to fix it in the end
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.
Well done everyone, this is working pretty smooth 🎉 👍 I just checked out the branch locally and have some more feedback 🙂
src/app/components/Search.tsx
Outdated
|
||
return ( | ||
<> | ||
{/* TODO: https://hy.reactjs.org/docs/hooks-reference.html#usecallback */} |
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.
This TODO seems to be misplaced now. I guess this was meant to be a TODO for handleChange
🤔 🙂
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.
🚀
Signed-off-by: Benedikt Bongartz <bongartz@klimlive.de>
Signed-off-by: Benedikt Bongartz <bongartz@klimlive.de>
Co-authored-by: FKolwa <47077340+FKolwa@users.noreply.github.com>
Co-authored-by: Mo <mf.89@gmx.de>
Co-authored-by: Mo <mf.89@gmx.de>
18a2fff
to
9cec98b
Compare
hm... seems there is still an issue with fetch in the unittests. if i understand it correctly, the problem is that fetch is not available. Which confuses me a bit. It should be available since Anyway, I tried to install node-fetch. But that seems to expect types. Adding the type For now, I have reverted the changes, what would you suggest to fix this? @FKolwa @schogges ? 🐎 https://stackoverflow.com/questions/48433783/referenceerror-fetch-is-not-defined |
Hmm. Okay so one problem is that fetch is a browser specific tool. As our jest tests aren't running in an actual browser fetch is simply not available. We didn't have this issue in our tests so far because they weren't testing anything where fetch was executed. Jest can run in different test environments, one of them is node. The node-fetch package was specifically made for enabling fetch in node. Our current test environment uses jsdom instead of node which at this moment doesn't support fetch (jestjs/jest#13834) . So I'd say there are at least two ways of doing this: Further try to find a way around fetch in jsdom or try to rewrite our tests to use node instead (and require node-fetch in test-setup.js). |
Seems like even though they announced to remove the |
I like it! I'd say we go with cross-fetch for now to keep within the scope of the issue and create a new issue to transition to react-query. That'll be a great replacement for the fetch calls we use to create the tables in our browser views. |
Ok, i will try to change it once iam home :) |
Signed-off-by: Benedikt Bongartz <bongartz@klimlive.de>
for more information, see https://pre-commit.ci
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.
Removed as suggested by @schogges
oh i guess it would have been better to squash all this back and forth. 😵💫 😅 |
This pr is a poc for a search bar based on the fzf lib.
In addition to the listings of aws, gcp and azure images, another tab leading to a search is added. There you will find an unoptimized search, which renders all hits as links to the detail api point in the page.Closes #75
deprecated details
Example:
During the implementation, I noticed that there is no modal for a detailed view of the images. This means that it is not possible to share specific images as a link. Does it make sense to add a route for it?
Another point is the search. Maybe it makes more sense to put the bar immediately in the "headline" and limit the suggestions (hits with the highest score) to 5-10 items. Similar to the google search.
wdyt @FKolwa @major @schogges @miyunari ?