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

[Lens] Enable Table Pagination #118557

Merged
merged 34 commits into from
Nov 22, 2021
Merged

Conversation

drewdaemon
Copy link
Contributor

@drewdaemon drewdaemon commented Nov 15, 2021

Summary

This PR allows users to enable pagination in their data tables.

Resolves #96778

Screen.Recording.2021-11-15.at.10.54.13.AM.mov

Checklist

Delete any items that are not applicable to this PR.

@drewdaemon
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

merge conflict between base and head

@drewdaemon drewdaemon changed the title 96778/table pagination [Lens] Enable Table Pagination Nov 15, 2021
@drewdaemon drewdaemon added Feature:Lens Team:Visualizations Visualization editors, elastic-charts and infrastructure release_note:enhancement v8.1.0 labels Nov 15, 2021
@drewdaemon
Copy link
Contributor Author

@elasticmachine merge upstream

@drewdaemon
Copy link
Contributor Author

@flash1293 @mbondyra this is ready for another look whenever you have time.

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

Not sure whether we can influence this, but if there are only a few rows in the table, toggling pagination doesn't change anything which is a bit weird - the user might wonder what that switch is actually doing:
Screenshot 2021-11-18 at 15 46 16

Can we enforce showing the pagination footer? If not I think it's fine the way it is

@drewdaemon
Copy link
Contributor Author

drewdaemon commented Nov 18, 2021

Can we enforce showing the pagination footer?

The logic that is hiding it is here. It checks if the number of rows is less than the lowest page-size option. So, if we were to allow the user to select pages of size 1, we would cover every non-zero case and the pagination control would display if there was at least one row.

A good middle ground might be to add a page size option of 5 (we could still keep the default at 10). I think that would cover most cases since I don't think users would be looking for pagination options if their table has less than five rows.

A final option might be to disable the pagination toggle in the toolbar if the row count is less than the minimum possible page size.

What do you think?

@flash1293
Copy link
Contributor

I think we can just leave it as is and add an info tooltip to the setting (pagination is hidden if there are less than 10 items)

@drewdaemon
Copy link
Contributor Author

@flash1293 done.
Screen Shot 2021-11-18 at 1 03 38 PM

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

Works great, thanks!

Copy link
Contributor

@dej611 dej611 left a comment

Choose a reason for hiding this comment

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

This is a weird bug, I suspect related to EuiDataGrid component rather than this PR, that gets triggered by a combination of the Pagination feature with the Column-pivot feature in Lens:

  • Create a table with Rows + Metrics
  • Enable pagination
  • Add a Columns dimension to "pivot"
  • Now the table is no longer scrollable 🤔

pagination_scroll_issue

It is still possible to access the last rows via keyboard, but not via scrolling:

Screenshot 2021-11-19 at 13 08 09

Tested on Chrome and Safari, and can reproduce with both.

@flash1293
Copy link
Contributor

@dej611 Could you open an EUI issue for this? Seems pretty weird

@dej611
Copy link
Contributor

dej611 commented Nov 19, 2021

I think this big warning here may be related: https://elastic.github.io/eui/#/tabular-content/data-grid-virtualization

In the demo it explains that sometimes the table needs some strong hints about rerendering.
I've tried locally to add a key={columns.map(({ id }) => id).join('-') + '-' + pagination?.pageSize} which seems to fix it.

I'm trying to isolate the issue for reproduction on the EUI.

@drewdaemon
Copy link
Contributor Author

@elasticmachine merge upstream

@mbondyra
Copy link
Contributor

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
lens 242 243 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
lens 962.6KB 964.0KB +1.4KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
lens 23 24 +1

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
lens 44.1KB 44.2KB +36.0B
Unknown metric groups

API count

id before after diff
lens 259 260 +1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@dej611 dej611 left a comment

Choose a reason for hiding this comment

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

Tested locally with Safari 👍

@drewdaemon drewdaemon merged commit d1a2712 into elastic:main Nov 22, 2021
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Nov 22, 2021
@drewdaemon drewdaemon deleted the 96778/table-pagination branch November 22, 2021 16:17
dmlemeshko pushed a commit that referenced this pull request Nov 29, 2021
TinLe pushed a commit to TinLe/kibana that referenced this pull request Dec 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Lens release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Lens] Table pagination
8 participants