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(search): add input search #277

Merged
merged 6 commits into from
Dec 2, 2024

Conversation

kahboom
Copy link
Contributor

@kahboom kahboom commented Nov 28, 2024

This PR implements #273 by adding the input search dropdown/typeahead menu for the Search Page

Changes

  • Add new hook to hold state of pre-formatted entities rendered in dropdown
  • Add new SearchMenu component with local state + PF search input

Screenshots

Screenshot 2024-11-28 at 1 46 54 PM

Screenshot 2024-11-28 at 1 51 23 PM

Screenshot 2024-11-28 at 1 45 11 PM

feat(search): enable typeahead

feat(search): add vulnerability entity

feat(search): add sbom entity

feat(search): add advisory entity

feat(search): add package entity

feat(search): add navlink
Copy link
Member

@carlosthe19916 carlosthe19916 left a comment

Choose a reason for hiding this comment

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

@kahboom thank you for the PR! Looks great
I added some observations I made while testing your PR. Please take a look at them

client/src/app/pages/search/components/SearchMenu.tsx Outdated Show resolved Hide resolved
client/src/app/pages/search/components/SearchMenu.tsx Outdated Show resolved Hide resolved
client/src/app/pages/search/components/SearchMenu.tsx Outdated Show resolved Hide resolved
client/src/app/pages/search/components/SearchMenu.tsx Outdated Show resolved Hide resolved
client/src/app/pages/search/components/SearchMenu.tsx Outdated Show resolved Hide resolved
@trust-git-bot
Copy link

trust-git-bot commented Nov 29, 2024

🚀 Storybook Deployed Preview: https://trustify-ui-pr-277-preview.surge.sh

Copy link
Member

@carlosthe19916 carlosthe19916 left a comment

Choose a reason for hiding this comment

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

@kahboom thanks for the enhancements.

When I type "a" i see some Elements like "item.decomposedPurl?.namespace" being printed in the Dropdown component (see image below). I think that is a mistake. I know packages are tricky as even V1 do not include them in the dropdown. I don't think it would be wrong also to remove it if you consider it is better.

Screenshot From 2024-12-02 10-27-24

itemId={option.id}
key={option.id}
description={option.description}
to={option.navLink}
Copy link
Member

Choose a reason for hiding this comment

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

I discovered the reason of the delay while redirecting to pages. the to element is causing a "Full page reload". This should be replaced by the native react useNavigate or a <Link/> component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For me it still shows a delay with either one (a bit improved though), but I will add it and we can always open an issue if you are still seeing it happening.

@@ -1,6 +1,6 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"include": ["src/**/*", "config/**/*", "types/**/*"],
"include": ["src/**/*", "config/**/*", "types/**/*", "setupTests.ts"],
Copy link
Member

Choose a reason for hiding this comment

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

I tested your PR removing this change and everything worked. Is there a reason to add this change? I mean, all tests seem to be executed currently without this change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was a mistake, sorry I didn't catch it in my self review, going to remove it now. Thanks!

@kahboom
Copy link
Contributor Author

kahboom commented Dec 2, 2024

@carlosthe19916 thanks for the review!

When I type "a" i see some Elements like "item.decomposedPurl?.namespace" being printed

Oops, this is how it should look now:

Screenshot 2024-12-02 at 11 03 43 AM

I don't think it would be wrong also to remove it if you consider it is better.

I've decided to keep them because we decided with Michelle to just show everything and we narrow stuff later on. Let me know how you feel about the changes.

Copy link
Member

@carlosthe19916 carlosthe19916 left a comment

Choose a reason for hiding this comment

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

@kahboom I created a PR to your PR here kahboom#1

It should address the delay thing. To me, that is as fast as any other redirect we might have in other parts of the page.

Please take a look at it

@carlosthe19916 carlosthe19916 merged commit 1fed518 into trustification:main Dec 2, 2024
8 checks passed
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.

3 participants