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][Analyzer] Make analyzer full screen mode compatible with EuiDataGrid's #110723

Closed

Conversation

kqualters-elastic
Copy link
Contributor

Summary

This pr enables the analyzer to work with EuiDataGrid full screen mode, by making use of EuiMutationObserver, a query selector to see when the data grid is actually expanded, and some artificial click events to open/close EuiDataGrid's full screen mode as appropriate when a user is using resolver.

resolver_full_screen_eui_data_grid

Checklist

Delete any items that are not applicable to this PR.

@kqualters-elastic kqualters-elastic added v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting Security Solution Threat Hunting Team auto-backport Deprecated - use backport:version if exact versions are needed Theme: rac label obsolete Feature:RAC label obsolete v7.15.0 labels Aug 31, 2021
@kqualters-elastic kqualters-elastic requested review from a team as code owners August 31, 2021 21:34
@elasticmachine
Copy link
Contributor

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

@@ -147,6 +147,9 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S
const [coreStart, startPlugins] = await core.getStartServices();
const subPlugins = await this.startSubPlugins(this.storage, coreStart, startPlugins);
const { renderApp } = await this.lazyApplicationDependencies();
if (startPlugins.timelines && this._store) {
Copy link
Contributor

Choose a reason for hiding this comment

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

we do not need that anymore because of this commit da68c5d

Copy link
Contributor

@XavierM XavierM left a comment

Choose a reason for hiding this comment

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

is this still working as expected in timeline fly-out?

@kqualters-elastic
Copy link
Contributor Author

kqualters-elastic commented Sep 1, 2021

is this still working as expected in timeline fly-out?

yes
image
image

@kibanamachine
Copy link
Contributor

💛 Build succeeded, but was flaky


Test Failures

Kibana Pipeline / general / X-Pack Alerting API Integration Tests.x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/find·ts.alerting api integration security and spaces enabled Alerts alerts find "after each" hook for "should handle find alert request with fields appropriately"

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has not failed recently on tracked branches

[00:00:00]       │
[00:00:00]         └-: alerting api integration security and spaces enabled
[00:00:00]           └-> "before all" hook in "alerting api integration security and spaces enabled"
[00:03:59]           └-: Alerts
[00:03:59]             └-> "before all" hook in "Alerts"
[00:05:31]             └-: alerts
[00:05:31]               └-> "before all" hook in "alerts"
[00:05:31]               └-> "before all" hook in "alerts"
[00:05:31]                 │ debg creating space
[00:05:32]                 │ debg created space
[00:05:32]                 │ debg creating space
[00:05:33]                 │ debg created space
[00:05:33]                 │ debg creating space
[00:05:34]                 │ debg created space
[00:05:34]                 │ debg creating user no_kibana_privileges
[00:05:34]                 │ info [o.e.x.s.a.u.TransportPutUserAction] [node-01] added user [no_kibana_privileges]
[00:05:34]                 │ debg created user no_kibana_privileges
[00:05:34]                 │ debg creating role no_kibana_privileges
[00:05:34]                 │ info [o.e.x.s.a.r.TransportPutRoleAction] [node-01] added role [no_kibana_privileges]
[00:05:34]                 │ debg creating user superuser
[00:05:34]                 │ info [o.e.x.s.a.u.TransportPutUserAction] [node-01] added user [superuser]
[00:05:34]                 │ debg created user superuser
[00:05:34]                 │ debg creating user global_read
[00:05:34]                 │ info [o.e.x.s.a.u.TransportPutUserAction] [node-01] added user [global_read]
[00:05:34]                 │ debg created user global_read
[00:05:34]                 │ debg creating role global_read_role
[00:05:34]                 │ info [o.e.x.s.a.r.TransportPutRoleAction] [node-01] added role [global_read_role]
[00:05:34]                 │ debg creating user space_1_all
[00:05:34]                 │ info [o.e.x.s.a.u.TransportPutUserAction] [node-01] added user [space_1_all]
[00:05:34]                 │ debg created user space_1_all
[00:05:34]                 │ debg creating role space_1_all_role
[00:05:34]                 │ info [o.e.x.s.a.r.TransportPutRoleAction] [node-01] added role [space_1_all_role]
[00:05:34]                 │ debg creating user space_1_all_with_restricted_fixture
[00:05:35]                 │ info [o.e.x.s.a.u.TransportPutUserAction] [node-01] added user [space_1_all_with_restricted_fixture]
[00:05:35]                 │ debg created user space_1_all_with_restricted_fixture
[00:05:35]                 │ debg creating role space_1_all_with_restricted_fixture_role
[00:05:35]                 │ info [o.e.x.s.a.r.TransportPutRoleAction] [node-01] added role [space_1_all_with_restricted_fixture_role]
[00:05:35]                 │ debg creating user space_1_all_alerts_none_actions
[00:05:35]                 │ info [o.e.x.s.a.u.TransportPutUserAction] [node-01] added user [space_1_all_alerts_none_actions]
[00:05:35]                 │ debg created user space_1_all_alerts_none_actions
[00:05:35]                 │ debg creating role space_1_all_alerts_none_actions_role
[00:05:35]                 │ info [o.e.x.s.a.r.TransportPutRoleAction] [node-01] added role [space_1_all_alerts_none_actions_role]
[00:05:35]               └-: find
[00:05:35]                 └-> "before all" hook in "find"

Stack Trace

Error: expected 204 "No Content", got 409 "Conflict"
    at Test._assertStatus (/dev/shm/workspace/parallel/16/kibana/node_modules/supertest/lib/test.js:268:12)
    at Test._assertFunction (/dev/shm/workspace/parallel/16/kibana/node_modules/supertest/lib/test.js:283:11)
    at Test.assert (/dev/shm/workspace/parallel/16/kibana/node_modules/supertest/lib/test.js:173:18)
    at assert (/dev/shm/workspace/parallel/16/kibana/node_modules/supertest/lib/test.js:131:12)
    at /dev/shm/workspace/parallel/16/kibana/node_modules/supertest/lib/test.js:128:5
    at Test.Request.callback (/dev/shm/workspace/parallel/16/kibana/node_modules/supertest/node_modules/superagent/lib/node/index.js:718:3)
    at /dev/shm/workspace/parallel/16/kibana/node_modules/supertest/node_modules/superagent/lib/node/index.js:906:18
    at IncomingMessage.<anonymous> (/dev/shm/workspace/parallel/16/kibana/node_modules/supertest/node_modules/superagent/lib/node/parsers/json.js:19:7)
    at endReadableNT (internal/streams/readable.js:1317:12)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)

Metrics [docs]

Async chunks

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

id before after diff
securitySolution 6.5MB 6.5MB +4.6KB
timelines 420.4KB 421.2KB +810.0B
total +5.4KB

History

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

const onMutation = useCallback(() => {
const isExpanded = document.querySelector('.euiDataGrid--fullScreen') !== null;
setDataGridExpanded(isExpanded);
}, [setDataGridExpanded]);
Copy link
Contributor

@XavierM XavierM Sep 1, 2021

Choose a reason for hiding this comment

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

i think you should be able to remove this setter as a dependency because it is coming from useState

@@ -734,7 +734,6 @@ export const BodyComponent = React.memo<StatefulBodyProps>(
);

const height = useDataGridHeightHack(pageSize, data.length);

Copy link
Contributor

Choose a reason for hiding this comment

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

nit -> we can avoid a change file here

@@ -29,6 +29,25 @@ export const resetScroll = () => {
}, 0);
};

export const setDataGridFullScreen = (isExpanded: boolean) => {
const clickEvent = new KeyboardEvent('click', {
Copy link
Contributor

Choose a reason for hiding this comment

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

oof

Copy link
Contributor

Choose a reason for hiding this comment

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

can you please put a // TODO with a link to the Eui issue so we remember to come back and refactor once a method is available. @chandlerprall could you please help us find an eui issue?

Copy link
Contributor

Choose a reason for hiding this comment

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

gutterSize="none"
>
<ScrollableFlexItem grow={1}>
{nonDeletedEvents.length === 0 && loading === false ? (
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not still using the same logic than before with totalCountMinusDeleted

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry bad merge will fix

}
/>
)}
{totalCountMinusDeleted > 0 && (
Copy link
Contributor

Choose a reason for hiding this comment

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

we did that to avoid the EuiDatagrid to render with no data because we were getting a weird UX with the EuiDatagrid when we did not have data

)}
</UpdatedFlexGroup>

{!graphEventId && graphOverlay == null && (
Copy link
Contributor

Choose a reason for hiding this comment

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

you do not want this condition anymore???

cancelable: true,
});
const dataGridIsFullScreen = document.querySelector('.euiDataGrid--fullScreen') !== null;
const dataGridFullScreenButtonNew = document.querySelector(
Copy link
Contributor

@XavierM XavierM Sep 1, 2021

Choose a reason for hiding this comment

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

my hacky sense love it, however my gray hair are telling me to not go for it and just ask EUI to create a callback on the full screen action. I really appreciate the ingenuity here.

I am sorry if I disappoint you but a safer bet it is to go with @stephmilovic 's PR to just disable the full screen on the analyzer for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

@paulewing are you ok with that?

@kqualters-elastic
Copy link
Contributor Author

closing this for an infinitely simpler way of doing the same thing 😆 😬

@kqualters-elastic kqualters-elastic deleted the analyzer-full-screen branch September 1, 2021 20:14
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 Feature:RAC label obsolete release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting Security Solution Threat Hunting Team Theme: rac label obsolete v7.15.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants