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

modified table controls to recognize titles in table properties #1650

Merged
merged 9 commits into from Oct 29, 2020

Conversation

sarahtrefethen
Copy link
Contributor

This is intended to address this issue: #1610 (Table column should respect 'title' #1610)

@CLAassistant
Copy link

CLAassistant commented Oct 16, 2020

CLA assistant check
All committers have signed the CLA.

@coveralls
Copy link

coveralls commented Oct 16, 2020

Coverage Status

Coverage remained the same at 88.665% when pulling 0d35c28 on pandium:table_column_title_fix into bdd934f on eclipsesource:master.

Copy link
Member

@sdirix sdirix left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution 👍

I took a first look:

  • Please remove the console.log
  • You don't need to change any version numbers as we handle them with our release process
  • Please don't remove tests. Here it shows that the contributed code can't handle array objects without properties, crashing JSON Forms.
  • Please add tests for the new functionality

Copy link
Member

@sdirix sdirix left a comment

Choose a reason for hiding this comment

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

I looked over the code and suggested changes to support empty titles as well as to simplify the code. It would be great if you could also add some testcases.

packages/vanilla/src/complex/TableArrayControl.tsx Outdated Show resolved Hide resolved
packages/material/src/complex/MaterialTableControl.tsx Outdated Show resolved Hide resolved
@@ -109,6 +114,7 @@ const generateCells = (
schema,
rowPath,
cellPath: rowPath,
title: schema.title ? schema.title : '',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
title: schema.title ? schema.title : '',
title

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The variable 'title' that was previously declared in the conditional above is out of scope here. But maybe props that aren't objects don't need titles?

packages/material/src/complex/MaterialTableControl.tsx Outdated Show resolved Hide resolved
packages/material/src/complex/MaterialTableControl.tsx Outdated Show resolved Hide resolved
@@ -73,6 +73,40 @@ const fixture = {
]
};

const fixture2 = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added because editing 'fixture' caused another test to fail, I didn't want to change any other tests.

@@ -96,6 +96,7 @@ const generateCells = (
const props = {
propName: prop,
schema,
title: schema.properties?.[prop]?.title ?? startCase(prop),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

now that this conditional is just one line (thank you for teaching me new syntax!) I don't think it needs to be a variable anymore

Copy link
Member

@sdirix sdirix left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the contribution!

Copy link
Member

@AlexandraBuzila AlexandraBuzila left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@sdirix sdirix merged commit 08c6b93 into eclipsesource:master Oct 29, 2020
@sdirix sdirix linked an issue Oct 29, 2020 that may be closed by this pull request
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.

Table column should respect 'title'
5 participants