Skip to content

[8.18] [Security Solution] Adds callback onUpdatePageIndex to get current pageIndex in Unified Data table (#201240)#210047

Closed
logeekal wants to merge 2 commits intoelastic:8.18from
logeekal:backport/8.18/pr-201240
Closed

[8.18] [Security Solution] Adds callback onUpdatePageIndex to get current pageIndex in Unified Data table (#201240)#210047
logeekal wants to merge 2 commits intoelastic:8.18from
logeekal:backport/8.18/pr-201240

Conversation

@logeekal
Copy link
Copy Markdown
Contributor

@logeekal logeekal commented Feb 6, 2025

Backport

This will backport the following commits from main to 8.18:

Questions ?

Please refer to the Backport tool documentation

\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sqren/backport)\n\n"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"url":"https://github.com//pull/202345","number":202345,"state":"MERGED","mergeCommit":{"sha":"cce113fe711d344f30a57869910c705a5a466474","message":"[8.x] [Security Solution] Adds callback `onUpdatePageIndex` to get current `pageIndex` in Unified Data table (#201240) (#202345)\n\n# Backport\n\nThis will backport the following commits from `main` to `8.x`:\n- [[Security Solution] Adds callback `onUpdatePageIndex` to get current\n`pageIndex` in Unified Data table\n(#201240)](https://github.com//pull/201240)\n\n\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sqren/backport)\n\n"}},{"branch":"8.16","label":"v8.16.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com//pull/202349","number":202349,"state":"MERGED","mergeCommit":{"sha":"06b147442425fea3377b6c118e1998ffb082f90f","message":"[8.16] [Security Solution] Adds callback `onUpdatePageIndex` to get current `pageIndex` in Unified Data table (#201240) (#202349)\n\n# Backport\n\nThis will backport the following commits from `main` to `8.16`:\n- [[Security Solution] Adds callback `onUpdatePageIndex` to get current\n`pageIndex` in Unified Data table\n(#201240)](https://github.com//pull/201240)\n\n\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sqren/backport)\n\n"}}]}] BACKPORT-->

…`pageIndex` in Unified Data table (elastic#201240)

## Summary

Handles resolution for
- Notes fetching data for all Timeline Records which leads to
performance issues.
- elastic#201330

## Issue - Notes fetching data for all Timeline Records

Currently, there was no way for consumer of `UnifiedDataGrid` to get the
current `pageIndex`. Security Solution needs to get the current
`pageIndex` so the items on the current page can be calculated.

@elastic/kibana-data-discovery , please let us know if you have any
opinion here.

This results in notes being fetched for all Timeline Records which means
minimum of 500 records and if user has queries 5000 records ( for
example ), a request will be made to query notes for all those 5000
notes which leads to performance issue and sometimes error as shown
below:

![image](https://github.com/user-attachments/assets/6fcfe05d-340c-4dcb-a273-5af53ed12945)

## 👨‍💻 Changes

This adds attribute `pageIndex` to timeline state.

```javascript
{
    "pageIndex": number
}
```
`pageIndex` helps with getting the events for that particular page.

## 🟡 Caveat

- Currently this `pageIndex` is shared between Query and EQL tabs which
can lead to wonky behavior at time.
- Additionally, as of now table maintains its own page index and
consumer component cannot effect the `pageIndex` of the UnifiedDataGrid.

(cherry picked from commit de9d546)

# Conflicts:
#	src/platform/packages/shared/kbn-unified-data-table/src/components/data_table.test.tsx
#	src/platform/packages/shared/kbn-unified-data-table/src/components/data_table.tsx
#	x-pack/plugins/security_solution/public/timelines/components/timeline/tabs/eql/index.test.tsx
#	x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/tabs/eql/index.tsx
#	x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/tabs/pinned/index.tsx
#	x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/tabs/query/index.tsx
#	x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/unified_components/data_table/index.tsx
#	x-pack/solutions/security/plugins/security_solution/public/timelines/containers/index.test.tsx
@logeekal logeekal closed this Feb 6, 2025
auto-merge was automatically disabled February 6, 2025 16:17

Pull request was closed

@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Feb 6, 2025

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #16 / useTimelineEvents happy path query
  • [job] [logs] Jest Tests #16 / useTimelineEvents happy path query
  • [job] [logs] Jest Tests #16 / useTimelineEvents should not query again when a field is removed
  • [job] [logs] Jest Tests #16 / useTimelineEvents should not query again when a field is removed
  • [job] [logs] Jest Tests #16 / useTimelineEvents should not query again when a removed field is added back
  • [job] [logs] Jest Tests #16 / useTimelineEvents should not query again when a removed field is added back
  • [job] [logs] Jest Tests #16 / useTimelineEvents should query again when a new field is added
  • [job] [logs] Jest Tests #16 / useTimelineEvents should query again when a new field is added

Metrics [docs]

✅ unchanged

History

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

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants