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

change default InMemoryTable sorting behavior #1591

Merged
merged 13 commits into from
Feb 28, 2019

Conversation

lizozom
Copy link
Contributor

@lizozom lizozom commented Feb 25, 2019

Summary

This PR changes the default InMemoryTable sorting logic.
It now uses a three way sort on a field ASC -> DESC -> neutral

ezgif-2-028937cd0fbb

Blocker for EUIfication of visualizations \ dashboards screens on Kibana

Checklist

  • This was checked in mobile
  • This was checked in IE11
  • This was checked in dark mode
  • Any props added have proper autodocs
  • Documentation examples were added
  • A changelog entry exists and is marked appropriately
  • This was checked for breaking changes and labeled appropriately
  • Jest tests were updated or added to match the most common scenarios
  • This was checked against keyboard-only and screenreader scenarios
  • This required updates to Framer X components

@lizozom lizozom added the tables label Feb 25, 2019
@lizozom lizozom self-assigned this Feb 25, 2019
@cchaos
Copy link
Contributor

cchaos commented Feb 25, 2019

Congrats on your first EUI PR! 😆

As a quick etiquette rule for our PR's, the PR template that has the checklist needs to be kept in the PR summary. It helps remind of all the things that we need to add alongside what the PR is actually addressing like a changelog entry and adding/updating any tests. You can strike out any items that don't make sense though. But we do need keep the whole thing in the summary.

@thompsongl
Copy link
Contributor

Thanks! Could you update the comment regarding initial sorting behavior and client sort logic? The statements are now misleading, given your changes.

// Data loaded from a server can have a default sort order which is meaningful to the
// user, but can't be reproduced with client-side sort logic. So we allow the table to display
// rows in the order in which they're initially loaded by providing an undefined sorting prop.
// Once a user sorts a column, this will become a fully-defined sorting prop.

@lizozom
Copy link
Contributor Author

lizozom commented Feb 25, 2019

@thompsongl done

@cchaos
Copy link
Contributor

cchaos commented Feb 25, 2019

I'm not sure where the aria-labelling is hooked up, but it now needs to account for this new behavior, but only if that flag is used.

screen shot 2019-02-25 at 11 47 25 am

@thompsongl
Copy link
Contributor

I'm not sure where the aria-labelling is hooked up, but it now needs to account for this new behavior, but only if that flag is used.

This is all done in table_header_cell.js. I actually think the aforementioned flag will be required so it can be passed down into the composition components.

@lizozom
Copy link
Contributor Author

lizozom commented Feb 26, 2019

@cchaos I updated the aria labels and added a flag so that BasicTable could support both modes (with and without neutral sort).

I didn't expose the flag in the InMemoryTable api yet. Should I? And if so, what should be the default?
Since we want InMemoryTable to showcase our common behavior, shouldn't we simplify it by choosing one?

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

Looks great! Thank you for fixing the screen reader stuff.

I just had some comments about making the prop on InMemoryTable overridable, and adding prop documentation.

You'll also want to be sure to rebase with master and create a changelog entry.

src/components/table/table_header_cell.js Show resolved Hide resolved
src/components/basic_table/in_memory_table.js Outdated Show resolved Hide resolved
src/components/table/table_header_cell.js Show resolved Hide resolved
src/components/basic_table/basic_table.js Show resolved Hide resolved
src/components/basic_table/in_memory_table.js Show resolved Hide resolved
@lizozom
Copy link
Contributor Author

lizozom commented Feb 26, 2019

@cchaos done review
Please check if I did the documentation right.

src/components/basic_table/in_memory_table.js Outdated Show resolved Hide resolved
src/components/basic_table/in_memory_table.js Outdated Show resolved Hide resolved
@lizozom
Copy link
Contributor Author

lizozom commented Feb 27, 2019

@cchaos @thompsongl we're good to merge?

CHANGELOG.md Outdated
@@ -1,5 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Added `allowallowNeutralSort` prop to `EuiInMemoryTable` to support unsorting table columns ([#1591](https://github.com/elastic/eui/pull/1591))
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like a type in CL

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

Docs look good, ty! I just saw a typo in the CL but other than that LGTM!

Copy link
Contributor

@thompsongl thompsongl left a comment

Choose a reason for hiding this comment

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

allowNeutralSort is still being passed through to the EuiBasicTable div element.
It's causing Warning: React does not recognize the 'allowNeutralSort' prop on a DOM element console warnings.

You'll need to remove it from the rest object before it gets spread onto the base div in basic_table.js

Note: You don't see this happen when allowNeutralSort uses the default value. It occurs when explicitly setting the prop on EuiInMemoryTable

@lizozom lizozom merged commit fd39fdc into elastic:master Feb 28, 2019
@lizozom
Copy link
Contributor Author

lizozom commented Feb 28, 2019

Once it's in master, how can I start using it in Kibana?

@chandlerprall
Copy link
Contributor

@lizozom as soon as #1619 is merged we'll make an EUI release which will include these table changes. We'll create a PR in kibana to bring the latest EUI into master, and backport that into the 7.x branch.

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.

4 participants