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

[RAC] EuiDataGrid pagination #109269

Merged
merged 12 commits into from
Aug 26, 2021
Merged

Conversation

machadoum
Copy link
Member

@machadoum machadoum commented Aug 19, 2021

Summary

  • Remove T-grid Footer
  • Use DataGrid pagination
  • Update everywhere using rowIndex to use rowIndex % itemsPerPage because we only load the current page in memory
  • Improve the loading state during query time
  • DataGrid pagination makes sure that we display the grid with the proper height.

Screenshot 2021-08-23 at 14 15 22

  • Add a full table screenshot

@machadoum machadoum requested a review from XavierM August 19, 2021 15:23
@machadoum machadoum self-assigned this Aug 19, 2021
@machadoum machadoum force-pushed the siem-alerts-t-grid-pagination branch 4 times, most recently from d7222cc to c38b421 Compare August 24, 2021 11:47
* It also improves the Gtid loading state
* DataGrid pagination makes sure that we display the grid with the proper height.
@machadoum machadoum force-pushed the siem-alerts-t-grid-pagination branch from c38b421 to f8aa22e Compare August 24, 2021 12:49
@@ -311,81 +301,56 @@ const TGridIntegratedComponent: React.FC<TGridIntegratedProps> = ({
)}
</UpdatedFlexGroup>

<FullWidthFlexGroup
$visible={!graphEventId && graphOverlay == null}
Copy link
Member Author

Choose a reason for hiding this comment

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

How to test graphOverlay and graphEventId? It was always undefined when I implemented this feature. But I see that it was recently introduced on master.

Copy link
Contributor

Choose a reason for hiding this comment

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

@stephmilovic is that correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

graphOverlay you can do analyze event from alerts, not sure the other?

Copy link
Contributor

Choose a reason for hiding this comment

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

this is broken now, need to hide tgrid when analyzer is opened
123

Copy link
Contributor

Choose a reason for hiding this comment

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

@semd we need to add this back, can you do your magic here?

* Be careful with array out of bounds. `pageRowIndex` can be bigger or equal to `data.length`
* in the scenario where the user changes the event status (Open, Acknowledged, Closed).
*/
export const getPageRowIndex = (rowIndex: number, itemsPerPage: number) => rowIndex % itemsPerPage;
Copy link
Member Author

Choose a reason for hiding this comment

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

This function is defined twice (timelines and security solutions). Where can we move it to reuse on both places?

Copy link
Contributor

@stephmilovic stephmilovic Aug 25, 2021

Choose a reason for hiding this comment

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

since this is already importing from the timeslines plugin, i think we can import it from there

Copy link
Contributor

Choose a reason for hiding this comment

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

okay I exported it from timeline public, it is imported by both o11y and securitySol.

@@ -86,16 +80,6 @@ const EventsContainerLoading = styled.div.attrs(({ className = '' }) => ({
flex-direction: column;
`;

const FullWidthFlexGroup = styled(EuiFlexGroup)<{ $visible: boolean }>`
Copy link
Member Author

@machadoum machadoum Aug 24, 2021

Choose a reason for hiding this comment

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

It was useless. should we reintroduce it because $visible could be defined?

HUGE HACK!!!

DataGrtid height isn't properly calculated when the grid has horizontal scroll.
elastic/eui#5030

In order to get around this bug we are calculating `DataGrid` height here and setting it as a prop.

Please revert this commit  and allow DataGrid to calculate its height when the bug is fixed.
@machadoum machadoum force-pushed the siem-alerts-t-grid-pagination branch from f8aa22e to 091b592 Compare August 24, 2021 14:51
@machadoum machadoum marked this pull request as ready for review August 24, 2021 15:22
@machadoum machadoum requested review from a team as code owners August 24, 2021 15:22
@machadoum machadoum added auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting Security Solution Threat Hunting Team v7.15.0 v8.0.0 labels Aug 24, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting (Team:Threat Hunting)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@machadoum machadoum added the bug Fixes for quality problems that affect the customer experience label Aug 24, 2021
@machadoum
Copy link
Member Author

I've found an unrelated issue with the checkbox while testing this branch:

When clicking on one checkbox, two are selected:
Screenshot 2021-08-24 at 18 13 13

When selecting all checkboxes, the total is wrong:
Screenshot 2021-08-24 at 18 13 04

Seams like two events have the same id. Is it a bug or some problem with the testing data?

@semd semd changed the title POC for T-Grid pagination [RAC] EuiDataGrid pagination Aug 25, 2021
@XavierM
Copy link
Contributor

XavierM commented Aug 25, 2021

@semd and @spong and I investigate your first problem, we know why. It is because now we are using an alias .alerts-securitySolution.alerts for .siem-signals-{spaceId} and every developer in kibana-siem-dev can creates their own signals index but since we are using an alias to groupe all these indexes in the cluster, it is possible to have duplicate id from siem-signals-xavier-default-00001 and siem-signals-pablo-default-00001.
We do not think that this behavior can happen in production because we do not allow user to modify the signal index name in production.

Copy link
Contributor

@mdefazio mdefazio left a comment

Choose a reason for hiding this comment

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

I didn't get a chance to get this running locally to test, but I've see you run through and it LGTM. My only question was whether we should default to more alerts by default in the view.

itemsPerPageOptions: [],
loadingEventIds: [],
loadPage: jest.fn(),
querySize: 25,
pageSize: 25,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the initial amount shown in the table? Would it make sense to have this be at least 50?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @mdefazio , Yes the default size is 50 items in security solutions and observability. This is just a test, we are good 👍

const TIME_INTERVAL = 50;

/**
* You are probably asking yourself "Why 3?". But that is the wrong mindset. You should be asking yourself "why not 3?".
Copy link
Contributor

Choose a reason for hiding this comment

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

😂

@spong
Copy link
Member

spong commented Aug 25, 2021

We do not think that this behavior can happen in production because we do not allow user to modify the signal index name in production.

Note, this technically is possible via the xpack.securitySolution.signalsIndex kibana.yml setting, however this isn't an officially supported configuration, isn't in our documentation, and has only come up in one community issue: https://discuss.elastic.co/t/detection-result-in-new-index/270347, so @XavierM's point stands.

@stephmilovic
Copy link
Contributor

nope
small bug here that the right arrow is enabled on the last page of results

Copy link
Contributor

@stephmilovic stephmilovic left a comment

Choose a reason for hiding this comment

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

Looks like that last bug is Eui related. Code looks good and I didn't surface any other issues testing locally. LGTM thank you @semd 🐎 🏁 🏎️

@semd
Copy link
Contributor

semd commented Aug 26, 2021

Looks like that last bug is Eui related. Code looks good and I didn't surface any other issues testing locally. LGTM thank you @semd 🐎 🏁 🏎️

Thanks @stephmilovic for testing it. And @machadoum! he did the hardest part 📐

@semd semd enabled auto-merge (squash) August 26, 2021 16:21
@semd semd merged commit 3854d3a into elastic:master Aug 26, 2021
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Aug 26, 2021
* Update T-Grid to use DataGrid pagination

* It also improves the Gtid loading state
* DataGrid pagination makes sure that we display the grid with the proper height.

* Add DataGrid height hack to t-grid

HUGE HACK!!!

DataGrtid height isn't properly calculated when the grid has horizontal scroll.
elastic/eui#5030

In order to get around this bug we are calculating `DataGrid` height here and setting it as a prop.

Please revert this commit  and allow DataGrid to calculate its height when the bug is fixed.

* Apply DataGrid laoding and pagination changes to observability

* Fix cypress tests

* Fix t-grid page render bug on Observability

* some pagination fixes

* hide table when analyzer active

* isolate exported function

Co-authored-by: semd <sergi.massaneda@elastic.co>
@kibanamachine
Copy link
Contributor

💔 Backport failed

Status Branch Result
7.15
7.x Commit could not be cherrypicked due to conflicts

Successful backport PRs will be merged automatically after passing CI.

To backport manually run:
node scripts/backport --pr 109269

kibanamachine added a commit that referenced this pull request Aug 26, 2021
* Update T-Grid to use DataGrid pagination

* It also improves the Gtid loading state
* DataGrid pagination makes sure that we display the grid with the proper height.

* Add DataGrid height hack to t-grid

HUGE HACK!!!

DataGrtid height isn't properly calculated when the grid has horizontal scroll.
elastic/eui#5030

In order to get around this bug we are calculating `DataGrid` height here and setting it as a prop.

Please revert this commit  and allow DataGrid to calculate its height when the bug is fixed.

* Apply DataGrid laoding and pagination changes to observability

* Fix cypress tests

* Fix t-grid page render bug on Observability

* some pagination fixes

* hide table when analyzer active

* isolate exported function

Co-authored-by: semd <sergi.massaneda@elastic.co>

Co-authored-by: Pablo Machado <pablo.nevesmachado@elastic.co>
Co-authored-by: semd <sergi.massaneda@elastic.co>
semd pushed a commit to semd/kibana that referenced this pull request Aug 30, 2021
* Update T-Grid to use DataGrid pagination

* It also improves the Gtid loading state
* DataGrid pagination makes sure that we display the grid with the proper height.

* Add DataGrid height hack to t-grid

HUGE HACK!!!

DataGrtid height isn't properly calculated when the grid has horizontal scroll.
elastic/eui#5030

In order to get around this bug we are calculating `DataGrid` height here and setting it as a prop.

Please revert this commit  and allow DataGrid to calculate its height when the bug is fixed.

* Apply DataGrid laoding and pagination changes to observability

* Fix cypress tests

* Fix t-grid page render bug on Observability

* some pagination fixes

* hide table when analyzer active

* isolate exported function

Co-authored-by: semd <sergi.massaneda@elastic.co>
# Conflicts:
#	x-pack/plugins/timelines/public/components/t_grid/body/index.tsx
@kibanamachine
Copy link
Contributor

💛 Build succeeded, but was flaky

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
timelines 843 845 +2

Async chunks

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

id before after diff
observability 554.2KB 554.3KB +141.0B
securitySolution 6.5MB 6.5MB +885.0B
timelines 426.8KB 419.2KB -7.6KB
total -6.6KB

Page load bundle

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

id before after diff
timelines 307.4KB 307.9KB +496.0B
Unknown metric groups

API count

id before after diff
timelines 963 966 +3

History

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

cc @machadoum

semd added a commit to semd/kibana that referenced this pull request Aug 30, 2021
* Update T-Grid to use DataGrid pagination

* It also improves the Gtid loading state
* DataGrid pagination makes sure that we display the grid with the proper height.

* Add DataGrid height hack to t-grid

HUGE HACK!!!

DataGrtid height isn't properly calculated when the grid has horizontal scroll.
elastic/eui#5030

In order to get around this bug we are calculating `DataGrid` height here and setting it as a prop.

Please revert this commit  and allow DataGrid to calculate its height when the bug is fixed.

* Apply DataGrid laoding and pagination changes to observability

* Fix cypress tests

* Fix t-grid page render bug on Observability

* some pagination fixes

* hide table when analyzer active

* isolate exported function

Co-authored-by: semd <sergi.massaneda@elastic.co>
semd added a commit that referenced this pull request Aug 30, 2021
* Update T-Grid to use DataGrid pagination

* It also improves the Gtid loading state
* DataGrid pagination makes sure that we display the grid with the proper height.

* Add DataGrid height hack to t-grid

HUGE HACK!!!

DataGrtid height isn't properly calculated when the grid has horizontal scroll.
elastic/eui#5030

In order to get around this bug we are calculating `DataGrid` height here and setting it as a prop.

Please revert this commit  and allow DataGrid to calculate its height when the bug is fixed.

* Apply DataGrid laoding and pagination changes to observability

* Fix cypress tests

* Fix t-grid page render bug on Observability

* some pagination fixes

* hide table when analyzer active

* isolate exported function

Co-authored-by: semd <sergi.massaneda@elastic.co>

Co-authored-by: Pablo Machado <pablo.nevesmachado@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting Security Solution Threat Hunting Team v7.15.0 v7.16.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants