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

TypeScriptified basic_table. #2428

Merged
merged 82 commits into from
Dec 9, 2019
Merged

Conversation

sainthkh
Copy link
Contributor

@sainthkh sainthkh commented Oct 15, 2019

Summary

Related to #1557.
Closes #2523

TypeScriptified basic_table dir. In other words, EuiBasicTable and EuiInMemoryTable are now TypeScript!

Note

  • Had to fix babel PropTypes generator. It didn't generate appropriate checker for discriminated unions.
  • Wanted to use Omit but Eui uses 3.3.3. So, I commented the code out.

Checklist

  • Checked in dark mode
  • Checked in mobile
  • Checked in IE11 and Firefox
  • Props have proper autodocs
  • Added documentation examples
  • Added or updated jest tests
  • Checked for breaking changes and labeled appropriately
  • Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@chandlerprall chandlerprall self-requested a review October 15, 2019 15:02
@chandlerprall
Copy link
Contributor

chandlerprall commented Oct 15, 2019

Thank you very much for this effort! I'll start reviewing soon.

Wanted to use Omit but Eui uses 3.3.3. So, I commented the code out.

We have an Omit type defined in https://github.com/elastic/eui/blob/master/src/components/common.ts#L24

sorting?: SortingType;
}

export type Props = CommonProps &
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we export this as EuiBasicTableProps? I believe we've been moving in that direction recently.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually I renamed this to EuiBasicTableProps in my branch of your branch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then, I'll do that in that way.

Make it possible to type-check the props of EuiBasicTable and
EuiInMemoryTable more effectively by making their props generic, and
using the generic parameter throughout the tables' types.
@pugnascotia
Copy link
Contributor

Thanks for the PR @sainthkh! I'll go through these changes shortly, but first I raised a PR against your branch:

sainthkh#1

These changes introduce a generic parameters to the basic table props, and threads that parameter through the types. The generic parameter makes it possible to get rid of some of the any types, and get better validation of e.g. prop names. My branch type-checks clean, but one test fails and I think it's because of your changes to the prop-types generator. Please run the following to see what I mean:

yarn test-unit src/components/selectable/selectable.test.tsx

@@ -1007,7 +1004,7 @@ exports[`EuiInMemoryTable with pagination and selection 1`] = `
responsive={true}
selection={
Object {
"onSelectionChanged": [Function],
"onSelectionChange": [Function],
Copy link
Contributor

Choose a reason for hiding this comment

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

Why has this been renamed? I think it should be done as a separate PR, assuming it's actually necessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

onSelectionChanged was never correct, see #2432 / #2433

items: [],
pagination: false,
sorting: false,
responsive: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

We seem to have lost this prop completely. It supposed to be passed on to EuiBasicTable.

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.

Copy link
Contributor

@pugnascotia pugnascotia left a comment

Choose a reason for hiding this comment

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

The changes look good overall - @chandlerprall what do you think of also adding in generic support?

@chandlerprall
Copy link
Contributor

chandlerprall commented Nov 18, 2019

@sainthkh I'm done with my passes, I've got a handful of changes to add to your branch, if you would please update again with master I'll set up that PR. The i18ntokens.json conflict can be resolved by taking "their" side, any pending changes will be regenerated by the next build.

@sainthkh
Copy link
Contributor Author

@chandlerprall Sorry, I misunderstood your comment and was waiting for your PR against my forked repo.

I've merged your branch first to my branch and merged again to the master branch.

@chandlerprall
Copy link
Contributor

No worries! Everything looks good to me, and with the American Thanksgiving holiday this week I'd like to hold off merging this until next week, as we'll be less able to respond to any unintended consequences and it'd be more difficult to get Kibana upgraded.

Early next week I'll do another Kibana pass to make sure I have a clean branch there ready to go, and then we'll merge and release these changes.

Thank you, once again, for working through this conversion!

@chandlerprall
Copy link
Contributor

chandlerprall commented Dec 6, 2019

Update: Took longer to update my Kibana branch against changes in master than expected, now planning to merging this on Monday the 9th.

@sainthkh
Copy link
Contributor Author

sainthkh commented Dec 7, 2019

@chandlerprall I agree. Kibana changes really fast. If there's anything to do on my side, please tell me.

Copy link
Contributor

@chandlerprall chandlerprall left a comment

Choose a reason for hiding this comment

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

LGTM; lots of local digging & testing.

Thanks again @sainthkh for working on this and putting up with the back-and-forth communication & waiting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@elastic/eui has no exported member 'EuiBasicTable'
6 participants