Skip to content

Enhance search and add filtering #142

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

Merged
merged 3 commits into from
Aug 24, 2023
Merged

Enhance search and add filtering #142

merged 3 commits into from
Aug 24, 2023

Conversation

F-X64
Copy link
Member

@F-X64 F-X64 commented Aug 2, 2023

What has changed?

Open questions
@KKoukiou @lucasgarfield I'm not a fan of the constant resizing that is happening once filters are selected.
Can we somehow add a default size to the table so we won't have this screen shake?
What can be improved in this implementation?

closes #119 #66

@F-X64 F-X64 added the v2 Second iteration of the CID front-end label Aug 2, 2023
@F-X64 F-X64 force-pushed the enhance-search-and-filter#119 branch from d8df161 to d8b184b Compare August 2, 2023 09:09
@KKoukiou
Copy link
Collaborator

KKoukiou commented Aug 2, 2023

@FKolwa You can fix the width of the columns easily by setting the percentage based width property on the Th component https://www.patternfly.org/components/table#cell-width-breakpoint-modifiers

@F-X64 F-X64 force-pushed the enhance-search-and-filter#119 branch from 1f3fa66 to 14f6020 Compare August 2, 2023 09:19
);
};

const onFilterSelect = (_: React.MouseEvent | undefined, itemId: string | number | undefined) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

General TS question: Jest won't let my tests pass if I won't specify the entire array of possible inputs for functions that are derived from "onSelect" which in this case is "string | number | undefined". Is there a better way to declare this on a function that only accepts strings anyways?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I tried a few things, couldn't make it work without respecting the mentioned inputs

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for giving it a try!

Copy link
Contributor

@schogges schogges Aug 25, 2023

Choose a reason for hiding this comment

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

@FKolwa The only shorter version I could come up with would be using the lookup type (or indexed access type) MenuProps['onSelect']. This would still mean that the itemId can be string | number | undefined, but you wouldn't have to write the types all over again. This could be also applied to the ImageTableFilter onFilterSelect prop.

Suggested change
const onFilterSelect = (_: React.MouseEvent | undefined, itemId: string | number | undefined) => {
// import { MenuProps } from '@patternfly/react-core'
// ...
const onFilterSelect: MenuProps['onSelect'] = (_, itemId) => {

@F-X64
Copy link
Member Author

F-X64 commented Aug 2, 2023

@FKolwa You can fix the width of the columns easily by setting the percentage based width property on the Th component https://www.patternfly.org/components/table#cell-width-breakpoint-modifiers

Thanks! I guess there is no way to do the same thing with a predefined height, or is there? (table height, not row height)

@KKoukiou
Copy link
Collaborator

KKoukiou commented Aug 2, 2023

@FKolwa You can fix the width of the columns easily by setting the percentage based width property on the Th component https://www.patternfly.org/components/table#cell-width-breakpoint-modifiers

Thanks! I guess there is no way to do the same thing with a predefined height, or is there? (table height, not row height)

@FKolwa if you want to fix the maximum height check maybe this https://www.patternfly.org/components/table#sticky-columns-and-header

@F-X64 F-X64 force-pushed the enhance-search-and-filter#119 branch 2 times, most recently from 346bed8 to 60574d2 Compare August 21, 2023 06:11
F-X64 added 2 commits August 21, 2023 13:04
Add new filter component to handle filtering of image data by region, architecture and provider
Add new component to ImageTable
@F-X64 F-X64 force-pushed the enhance-search-and-filter#119 branch from e1ed684 to a63c7fd Compare August 21, 2023 11:04
@F-X64 F-X64 force-pushed the enhance-search-and-filter#119 branch from a63c7fd to 9044ef5 Compare August 21, 2023 11:08
@F-X64
Copy link
Member Author

F-X64 commented Aug 21, 2023

I've added a proper "empty" view to the table in case the search doesn't return any valid results which makes the fixed table height mostly irrelevant. Is there anything left you would change?
@KKoukiou @lucasgarfield @epapbak

@F-X64
Copy link
Member Author

F-X64 commented Aug 23, 2023

@schogges Would you like to give me a review as well? ;)
Would be glad for any opinion I can get.

Copy link
Collaborator

@epapbak epapbak left a comment

Choose a reason for hiding this comment

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

LGTM

@F-X64
Copy link
Member Author

F-X64 commented Aug 24, 2023

Thanks @epapbak for your review. Let's get this in as this is blocking our further development. If someone detects some severe mistakes, please comment on this issue so we can create follow ups.

@F-X64 F-X64 merged commit e8d4a98 into main Aug 24, 2023
@F-X64 F-X64 deleted the enhance-search-and-filter#119 branch August 24, 2023 07:17
@schogges
Copy link
Contributor

schogges commented Aug 25, 2023

@schogges Would you like to give me a review as well? ;) Would be glad for any opinion I can get.

@FKolwa Sorry, I saw it too late, but I'm glad @epapbak unblocked you 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v2 Second iteration of the CID front-end
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance table filtering and searching
4 participants