Skip to content

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

Merged
logeekal merged 2 commits intoelastic:8.16from
logeekal:backport/8.16/pr-201240
Dec 2, 2024
Merged

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

Conversation

@logeekal
Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from main to 8.16:

Questions ?

Please refer to the Backport tool documentation

…`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:
#	x-pack/plugins/security_solution/public/timelines/components/timeline/body/unified_timeline_body.tsx
#	x-pack/plugins/security_solution/public/timelines/components/timeline/tabs/eql/index.tsx
#	x-pack/plugins/security_solution/public/timelines/containers/index.test.tsx
@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

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
@kbn/unified-data-table 108 109 +1

Async chunks

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

id before after diff
cloudSecurityPosture 509.3KB 509.2KB -67.0B
discover 825.8KB 825.7KB -67.0B
esqlDataGrid 153.5KB 153.5KB -67.0B
securitySolution 20.2MB 20.2MB +290.0B
slo 856.0KB 856.0KB -67.0B
total +22.0B
Unknown metric groups

API count

id before after diff
@kbn/unified-data-table 183 185 +2

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.

3 participants