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

[EuiInMemoryTable] Persist table rows per page and sort #198297

Merged
merged 49 commits into from
Nov 18, 2024

Conversation

sebelga
Copy link
Contributor

@sebelga sebelga commented Oct 30, 2024

In this PR I've added local storage persistence to the EuiInMemoryTable which saves the "rows per page" state of the tables. I decided to split the work into multiple PRs to make reviewing easier. In this PR I've done the tables of the "packages" and "src/plugins" folders.

Partially fixes #56406

Note on implementation

In order to persist the data we use either the useEuiTablePersist hook or the withEuiTablePersist HOC from the @kbn/shared-ux-table-persist package.

Tables updated

Note to reviewers: check to checkbox once you have manually tested the table and it works as expected

  • <TableListView /> | @elastic/appex-sharedux
    This table is used in the following components:
    • Dashboards listing
    • Visualize library
    • Maps
    • Graphs
    • Maps
    • Files
  • Observability <AlertFieldsTable /> | @elastic/response-ops
  • ESQLEditor > <QueryHistory /> | @elastic/kibana-esql (Only the sort field and direction is persisted.)
  • Search sesssion <SearchSessionsMgmtTable /> | @elastic/kibana-data-discovery
  • Data > Inspector view > <DataTableFormat /> | @elastic/kibana-data-discovery
  • Data view mgmt <RelationshipsTable /> | @elastic/kibana-data-discovery
  • Data view mgmt scripted fields <Table /> | @elastic/kibana-data-discovery
  • Data view mgmt indexed fields <Table /> | @elastic/kibana-data-discovery
  • Data view mgmt source filters <Table /> | @elastic/kibana-data-discovery
  • Data view mgmt <IndexPatternTable /> | @elastic/kibana-data-discovery
  • <SavedObjectFinder /> | @elastic/appex-sharedux
    This table is used in the following components:
    • Discover open search panel
    • Event annotation Group (package & plugin instances)
    • Embeddable > add panel
    • Visualisation > search selection
    • Canvas > embeddable flyout
    • Cases > markdown editor > lens plugin
    • Graph > source picker
    • ML > Data frame analytics > source selection
    • ML > Data visualizer > index pattern picker
    • ML > Jobs > Data feed step > Change data view
    • ML > Jobs > Index or search > page (Saved search)
    • Transform > search selection
  • SO management > UnmatchedReferences table | @elastic/kibana-core
  • SO management > Relationships table | @elastic/kibana-core

@sebelga
Copy link
Contributor Author

sebelga commented Oct 31, 2024

/ci

16 similar comments
@sebelga
Copy link
Contributor Author

sebelga commented Oct 31, 2024

/ci

@sebelga
Copy link
Contributor Author

sebelga commented Oct 31, 2024

/ci

@sebelga
Copy link
Contributor Author

sebelga commented Nov 2, 2024

/ci

@sebelga
Copy link
Contributor Author

sebelga commented Nov 4, 2024

/ci

@sebelga
Copy link
Contributor Author

sebelga commented Nov 5, 2024

/ci

@sebelga
Copy link
Contributor Author

sebelga commented Nov 5, 2024

/ci

@sebelga
Copy link
Contributor Author

sebelga commented Nov 5, 2024

/ci

@sebelga
Copy link
Contributor Author

sebelga commented Nov 5, 2024

/ci

@sebelga
Copy link
Contributor Author

sebelga commented Nov 5, 2024

/ci

@sebelga
Copy link
Contributor Author

sebelga commented Nov 6, 2024

/ci

@sebelga
Copy link
Contributor Author

sebelga commented Nov 7, 2024

/ci

@sebelga
Copy link
Contributor Author

sebelga commented Nov 7, 2024

/ci

@sebelga
Copy link
Contributor Author

sebelga commented Nov 8, 2024

/ci

@sebelga
Copy link
Contributor Author

sebelga commented Nov 8, 2024

/ci

@sebelga
Copy link
Contributor Author

sebelga commented Nov 8, 2024

/ci

@sebelga
Copy link
Contributor Author

sebelga commented Nov 9, 2024

/ci

@sebelga sebelga self-assigned this Nov 11, 2024
@sebelga sebelga added release_note:skip Skip the PR/issue when compiling release notes Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) labels Nov 11, 2024
Copy link
Member

@tsullivan tsullivan left a comment

Choose a reason for hiding this comment

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

SharedUX changes LGTM. Reviewed the code and tests

@botelastic botelastic bot added the Feature:Embedding Embedding content via iFrame label Nov 11, 2024
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
alerting 239 246 +7
dashboard 678 685 +7
data 516 523 +7
dataViewManagement 240 247 +7
esql 91 98 +7
eventAnnotationListing 571 578 +7
filesManagement 191 198 +7
graph 303 310 +7
indexLifecycleManagement 261 262 +1
indexManagement 695 696 +1
ingestPipelines 358 359 +1
lens 1469 1476 +7
maps 1242 1249 +7
observability 1055 1062 +7
savedObjectsFinder 8 14 +6
savedObjectsManagement 115 122 +7
securitySolution 6138 6145 +7
stackAlerts 161 168 +7
triggersActionsUi 853 860 +7
visualizations 478 485 +7
total +121

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
@kbn/shared-ux-table-persist 2 16 +14

Async chunks

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

id before after diff
alerting 93.8KB 93.8KB +5.0B
canvas 1.1MB 1.1MB +28.0B
cases 491.8KB 491.9KB +23.0B
dashboard 646.0KB 647.8KB +1.7KB
data 48.1KB 52.4KB +4.3KB
dataViewManagement 137.1KB 139.6KB +2.6KB
discover 805.0KB 805.0KB +24.0B
embeddable 2.8KB 2.8KB +24.0B
esql 180.4KB 181.9KB +1.5KB
eventAnnotation 7.2KB 7.2KB +26.0B
eventAnnotationListing 227.7KB 229.4KB +1.7KB
filesManagement 121.4KB 123.1KB +1.7KB
graph 414.0KB 415.7KB +1.7KB
indexLifecycleManagement 166.0KB 166.0KB +4.0B
indexManagement 689.9KB 689.9KB +5.0B
ingestPipelines 405.2KB 405.2KB +4.0B
maps 3.0MB 3.0MB +1.7KB
ml 4.7MB 4.7MB +114.0B
observability 471.2KB 472.6KB +1.4KB
savedObjectsFinder 5.2KB 7.4KB +2.2KB
savedObjectsManagement 84.6KB 86.7KB +2.0KB
securitySolution 13.4MB 13.4MB +4.0B
transform 473.0KB 473.0KB +33.0B
visualizations 316.2KB 318.0KB +1.7KB
total +24.5KB

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
savedObjectsFinder 0 1 +1

Page load bundle

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

id before after diff
triggersActionsUi 127.4KB 128.8KB +1.4KB
Unknown metric groups

API count

id before after diff
@kbn/shared-ux-table-persist 3 17 +14

History

cc @sebelga

Copy link
Member

@jgowdyelastic jgowdyelastic left a comment

Choose a reason for hiding this comment

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

ML changes LGTM

Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

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

kibana-presentation changes LGTM
code review only

Copy link
Contributor

@adcoelho adcoelho left a comment

Choose a reason for hiding this comment

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

response-ops LGTM 👍

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

Changes LGTM, tested locally 👍

Copy link
Member

@kertal kertal left a comment

Choose a reason for hiding this comment

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

LGTM, tested locally and works as expected. Great improvement, soon it will be hard to imagine, that users always had to manually restore there page size and sorting.

I see a potential to further improve this by aligning default page sizes. There are interesting selections we provide. Like:

const PAGE_SIZE_OPTIONS = [5, 10, 15, 25];

and default size 10

Here is potential align, centralize for a bit of a less fragmented UX.

But of course not in this PR, enjoy your long weekend!

@sebelga sebelga enabled auto-merge (squash) November 18, 2024 11:52
@sebelga
Copy link
Contributor Author

sebelga commented Nov 18, 2024

Thanks for the review @kertal !

I see a potential to further improve this by aligning default page sizes.

I think that each domain will have their own specific so it's ok to have different page size based on the content presented. I agree that often 10 is too small. I leave it to the teams to change their default value where it makes sense.

@sebelga sebelga merged commit 020acbe into elastic:main Nov 18, 2024
38 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11893584489

@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

@sebelga sebelga deleted the persist-table-rows-per-page branch November 18, 2024 14:42
kibanamachine added a commit that referenced this pull request Nov 18, 2024
… (#200569)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[EuiInMemoryTable] Persist table rows per page and sort
(#198297)](#198297)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Sébastien
Loix","email":"sebastien.loix@elastic.co"},"sourceCommit":{"committedDate":"2024-11-18T13:35:26Z","message":"[EuiInMemoryTable]
Persist table rows per page and sort
(#198297)","sha":"020acbeaa38c0807db4dc1d5ebdb7b112b484f1e","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Embedding","release_note:skip","v9.0.0","Team:SharedUX","backport:prev-minor"],"title":"[EuiInMemoryTable]
Persist table rows per page and
sort","number":198297,"url":"https://github.com/elastic/kibana/pull/198297","mergeCommit":{"message":"[EuiInMemoryTable]
Persist table rows per page and sort
(#198297)","sha":"020acbeaa38c0807db4dc1d5ebdb7b112b484f1e"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198297","number":198297,"mergeCommit":{"message":"[EuiInMemoryTable]
Persist table rows per page and sort
(#198297)","sha":"020acbeaa38c0807db4dc1d5ebdb7b112b484f1e"}}]}]
BACKPORT-->

Co-authored-by: Sébastien Loix <sebastien.loix@elastic.co>
jesuswr pushed a commit to jesuswr/kibana that referenced this pull request Nov 18, 2024
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) Feature:Embedding Embedding content via iFrame release_note:skip Skip the PR/issue when compiling release notes Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) v8.17.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a configuration setting for default "Rows Per Page" setting in Management