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

fix: add rowgroup to tables #5005

Merged
merged 2 commits into from Nov 28, 2023
Merged

fix: add rowgroup to tables #5005

merged 2 commits into from Nov 28, 2023

Conversation

deboer-tim
Copy link
Collaborator

What does this PR do?

Lint re-formatting makes it look like a big change, but it's just the addition of

elements around header row and data rows as described here: https://www.w3.org/WAI/ARIA/apg/patterns/table/examples/table/

Screenshot/screencast of this PR

N/A, no change.

What issues does this PR fix or reference?

Part of #4967.

How to test this PR?

yarn test:renderer or try Volumes page to confirm no change.

Lint re-formatting makes it look like a big change, but it's just the addition
of <div role="rowgroup"> elements around header row and data rows as described
here: https://www.w3.org/WAI/ARIA/apg/patterns/table/examples/table/

Part of #4967.

Signed-off-by: Tim deBoer <git@tdeboer.ca>
@deboer-tim deboer-tim requested review from benoitf and a team as code owners November 27, 2023 16:28
@deboer-tim deboer-tim requested review from jeffmaury and cdrage and removed request for a team November 27, 2023 16:28
@benoitf
Copy link
Collaborator

benoitf commented Nov 27, 2023

LGTM reviewed using https://github.com/containers/podman-desktop/pull/5005/files?diff=unified&w=1

I suppose we need a test to test this role, see if we.re able to correctly use them to fetch items/data

Signed-off-by: Tim deBoer <git@tdeboer.ca>
@deboer-tim
Copy link
Collaborator Author

TBH I expect our e2e tests will use the other parts of #4967 (e.g. lookup row by name) more than this role, I was just ticking it off as an easy thing we can fix to be correct for Aria. We should have tests though - added.

deboer-tim added a commit that referenced this pull request Nov 27, 2023
It has come up a couple times so I thought I should make a proposal for how I
think we should share column renderers between tables. IMHO we have three cases:
1. Type-specific column rendering like Image name. These should continue to be
   type-specific as today.
2. Generic columns that really just need to (e.g.) render a string in a certain
   way.
3. The middle ground where it's a little more complex, or maybe you need to
   render a couple properties.

This commit adds a simple type-mapping function to directly support #2, and
applies it to VolumeList.

For the middle ground, I think we're going to have convenient cases where objects
used in two tables have the same property types & names (e.g. { id: string,
some-prop: number}) and we can just render those, and other cases where maybe the
renderer should use another type (e.g. Condition) or one of the objects has a
different property name. Again, this commit provides a simple way for tables to
do whatever mapping is required.

Based on top of #5005 assuming that would merge soon.

Fixes #5002. We would share more columns as we add other tables that would
use them.

Signed-off-by: Tim deBoer <git@tdeboer.ca>
Copy link
Contributor

@cdrage cdrage left a comment

Choose a reason for hiding this comment

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

Confirm that there is no change UI wise! Code LGTM.

@deboer-tim deboer-tim merged commit 3d1ba1d into main Nov 28, 2023
9 checks passed
@deboer-tim deboer-tim deleted the table-rowgroups branch November 28, 2023 12:55
@podman-desktop-bot podman-desktop-bot added this to the 1.6.0 milestone Nov 28, 2023
deboer-tim added a commit that referenced this pull request Nov 30, 2023
It has come up a couple times so I thought I should make a proposal for how I
think we should share column renderers between tables. IMHO we have three cases:
1. Type-specific column rendering like Image name. These should continue to be
   type-specific as today.
2. Generic columns that really just need to (e.g.) render a string in a certain
   way.
3. The middle ground where it's a little more complex, or maybe you need to
   render a couple properties.

This commit adds a simple type-mapping function to directly support #2, and
applies it to VolumeList.

For the middle ground, I think we're going to have convenient cases where objects
used in two tables have the same property types & names (e.g. { id: string,
some-prop: number}) and we can just render those, and other cases where maybe the
renderer should use another type (e.g. Condition) or one of the objects has a
different property name. Again, this commit provides a simple way for tables to
do whatever mapping is required.

Based on top of #5005 assuming that would merge soon.

Fixes #5002. We would share more columns as we add other tables that would
use them.

Signed-off-by: Tim deBoer <git@tdeboer.ca>
cdrage pushed a commit that referenced this pull request Dec 1, 2023
* feat: column type mapping

It has come up a couple times so I thought I should make a proposal for how I
think we should share column renderers between tables. IMHO we have three cases:
1. Type-specific column rendering like Image name. These should continue to be
   type-specific as today.
2. Generic columns that really just need to (e.g.) render a string in a certain
   way.
3. The middle ground where it's a little more complex, or maybe you need to
   render a couple properties.

This commit adds a simple type-mapping function to directly support #2, and
applies it to VolumeList.

For the middle ground, I think we're going to have convenient cases where objects
used in two tables have the same property types & names (e.g. { id: string,
some-prop: number}) and we can just render those, and other cases where maybe the
renderer should use another type (e.g. Condition) or one of the objects has a
different property name. Again, this commit provides a simple way for tables to
do whatever mapping is required.

Based on top of #5005 assuming that would merge soon.

Fixes #5002. We would share more columns as we add other tables that would
use them.

Signed-off-by: Tim deBoer <git@tdeboer.ca>

* fix: generic render type

Responding to PR feedback:
- Changes SimpleColumn object type to string.
- Uses a generic parameter default to provide typing to Column renderMapping.
  The second type parameter on Column defaults to the original type, but if
  you set it then the renderMapping must convert to that type.

Signed-off-by: Tim deBoer <git@tdeboer.ca>

* chore: use nullish coalescing

Signed-off-by: Tim deBoer <git@tdeboer.ca>

---------

Signed-off-by: Tim deBoer <git@tdeboer.ca>
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.

None yet

4 participants