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

Table column mapping and reuse #5011

Merged
merged 3 commits into from
Dec 1, 2023
Merged

Table column mapping and reuse #5011

merged 3 commits into from
Dec 1, 2023

Commits on Nov 30, 2023

  1. 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>
    deboer-tim committed Nov 30, 2023
    Configuration menu
    Copy the full SHA
    ca30036 View commit details
    Browse the repository at this point in the history
  2. 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>
    deboer-tim committed Nov 30, 2023
    Configuration menu
    Copy the full SHA
    e98ce24 View commit details
    Browse the repository at this point in the history
  3. chore: use nullish coalescing

    Signed-off-by: Tim deBoer <git@tdeboer.ca>
    deboer-tim committed Nov 30, 2023
    Configuration menu
    Copy the full SHA
    e87b89d View commit details
    Browse the repository at this point in the history