From 306debfb43907e0228ab69bc758f1705cfc6d813 Mon Sep 17 00:00:00 2001 From: Pablo Machado Date: Thu, 21 Dec 2023 14:48:54 +0100 Subject: [PATCH] [Security Solution] Co-locate Frontend Entity Analytics Code (#173499) ## Summary Move all files owned by the Entity Analytics team to `x-pack/plugins/security_solution/public/entity_analytics` Initially, files inside `public/entity_analytics/components` look disorganised because many of them have similar names and do not follow the same conventions. I minimized the PR scope to avoid putting too much of a burden on reviewers. ### Changes * Moves files to the `entity_analytics` folder * Updates imports * Moves the content of some files to a new file inside the `entity_analytics` folder * Inlines copies that were previously inside `translation.ts`. * No changes to the user experience are expected. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- .github/CODEOWNERS | 5 --- .../cti_details/threat_summary_view.tsx | 4 +- .../event_details/cti_details/translations.ts | 4 +- .../event_details/event_details.tsx | 2 +- .../ml/anomaly/use_anomalies_search.ts | 2 +- .../visualization_embeddable.test.tsx | 5 +-- .../public/entity_analytics/api/api.ts | 24 +++++++++++ .../api/hooks/use_risk_score.test.tsx} | 22 +++++----- .../api/hooks/use_risk_score.tsx} | 37 ++++++++-------- .../api/hooks}/use_risk_score_data.test.ts | 6 +-- .../api/hooks}/use_risk_score_data.ts | 4 +- .../use_risk_score_feature_status.test.ts} | 18 ++++---- .../hooks/use_risk_score_feature_status.ts} | 11 ++--- .../api/hooks/use_risk_score_kpi.tsx} | 30 +++++++------ .../public/entity_analytics/api/types.ts | 20 +++++++++ .../public/entity_analytics/common/utils.ts | 12 ++++++ .../components}/enable_risk_score/index.tsx | 8 ++-- .../enable_risk_score/translations.ts | 4 +- .../anomalies_count_link.test.tsx | 10 ++--- .../anomalies_count_link.tsx | 16 +++---- .../columns.test.tsx | 4 +- .../entity_analytics_anomalies}/columns.tsx | 6 +-- .../components/anomalies_tab_link.tsx | 14 +++---- .../components/enable_job.test.tsx | 6 +-- .../components/enable_job.tsx | 6 +-- .../components/total_anomalies.test.tsx | 6 +-- .../components/total_anomalies.tsx | 6 +-- .../index.test.tsx | 18 ++++---- .../entity_analytics_anomalies}/index.tsx | 28 ++++++------- .../query/index.ts | 0 .../translations.ts | 0 .../entity_analytics_header}/index.test.tsx | 19 +++++---- .../entity_analytics_header}/index.tsx | 40 +++++++++--------- .../entity_analytics_header}/translations.ts | 0 .../__mocks__/index.ts | 2 +- .../chart_content.test.tsx | 18 ++++---- .../chart_content.tsx | 27 +++++++----- .../entity_analytics_risk_score}/columns.tsx | 22 +++++----- .../header_content.test.tsx | 10 ++--- .../header_content.tsx | 14 +++---- .../index.test.tsx | 26 ++++++------ .../entity_analytics_risk_score}/index.tsx | 42 +++++++++---------- .../translations.ts | 6 +-- .../use_entity.test.ts | 2 +- .../use_entity.ts | 16 +++---- .../components/action_column.test.tsx | 2 +- .../components/action_column.tsx | 0 .../components/utility_bar.test.tsx | 0 .../components/utility_bar.tsx | 0 .../hooks/use_risk_input_actions.ts | 0 .../use_risk_input_actions_panels.test.tsx | 0 .../hooks/use_risk_input_actions_panels.tsx | 0 .../entity_details_flyout/index.tsx | 26 ++++++++++++ .../entity_details_flyout}/mocks/index.ts | 0 .../tabs/risk_inputs.test.tsx | 2 +- .../tabs/risk_inputs.tsx | 0 .../host_risk_score_table/columns.test.tsx | 2 +- .../host_risk_score_table/columns.tsx | 20 ++++----- .../host_risk_score_table/index.tsx | 26 ++++++------ .../host_risk_score_table/translations.ts | 0 .../risk_details_tab_body/index.test.tsx | 19 ++++----- .../risk_details_tab_body/index.tsx | 35 +++++++--------- .../risk_details_tab_body/translations.ts | 4 +- .../risk_information/index.test.tsx | 4 +- .../components}/risk_information/index.tsx | 4 +- .../risk_information/translations.ts | 4 +- .../components/risk_score/constants.ts | 0 .../components/risk_score/translations.ts | 0 .../risk_score_donut_chart/index.test.tsx} | 8 ++-- .../risk_score_donut_chart/index.tsx} | 23 +++++----- .../use_risk_donut_chart_data.test.ts | 4 +- .../use_risk_donut_chart_data.ts | 10 ++--- .../components/risk_score_enable_section.tsx | 2 +- .../risk_score_doc_link.tsx | 6 +-- .../risk_score_enable_button.test.tsx | 4 +- .../risk_score_enable_button.tsx | 16 +++---- .../risk_score_header_title.tsx | 17 ++++++-- .../risk_score_no_data_detected.tsx | 8 ++-- .../risk_score_restart_button.test.tsx | 4 +- .../risk_score_restart_button.tsx | 10 ++--- .../risk_score_onboarding/translations.ts | 4 +- .../use_risk_score_toast_content.tsx | 2 +- .../risk_score_onboarding/utils.test.ts | 10 ++--- .../risk_score_onboarding/utils.ts | 10 ++--- .../risk_score_over_time/index.test.tsx | 12 +++--- .../risk_score_over_time/index.tsx | 24 +++++------ .../risk_score_over_time/translations.ts | 0 .../components/risk_score_preview_table.tsx | 2 +- .../components}/risk_summary.test.tsx | 8 ++-- .../components}/risk_summary.tsx | 21 ++++++---- .../risk_summary.stories.tsx | 4 +- .../risk_summary.test.tsx | 6 +-- .../risk_summary_flyout}/risk_summary.tsx | 18 ++++---- .../severity/common/index.test.tsx | 6 +-- .../components}/severity/common/index.tsx | 6 +-- .../components}/severity/severity_badges.tsx | 4 +- .../components}/severity/severity_bar.tsx | 4 +- .../severity/severity_filter_group.test.tsx | 8 ++-- .../severity/severity_filter_group.tsx | 8 ++-- .../components}/severity/types.ts | 2 +- .../components}/styled_basic_table.tsx | 0 .../index.test.tsx | 7 ++-- .../top_risk_score_contributors/index.tsx | 8 ++-- .../translations.ts | 0 .../index.tsx | 26 ++++++------ .../translations.ts | 0 .../user_risk_score_tab_body.test.tsx | 16 +++---- .../components}/user_risk_score_tab_body.tsx | 33 +++++++-------- .../user_risk_score_table/columns.test.tsx | 4 +- .../user_risk_score_table/columns.tsx | 22 +++++----- .../user_risk_score_table/index.test.tsx | 8 ++-- .../user_risk_score_table/index.tsx | 28 ++++++------- .../user_risk_score_table/translations.ts | 0 .../deprecated_risk_engine}/api/index.ts | 0 .../api/ingest_pipelines.test.ts | 0 .../api/ingest_pipelines.ts | 0 .../deprecated_risk_engine}/api/onboarding.ts | 4 +- .../api/saved_objects.ts | 6 +-- .../api/stored_scripts.test.ts | 0 .../api/stored_scripts.ts | 2 +- .../api/transforms.test.ts | 0 .../deprecated_risk_engine}/api/transforms.ts | 0 .../api/translations.ts | 0 .../deprecated_risk_engine}/api/types.ts | 0 .../risk_score_donut.test.ts.snap | 0 .../risk_score_over_time_area.test.ts.snap | 0 .../risk_score_summary.test.ts.snap | 0 .../lens_attributes}/risk_score_donut.test.ts | 9 ++-- .../lens_attributes}/risk_score_donut.ts | 2 +- .../risk_score_over_time_area.test.ts | 9 ++-- .../risk_score_over_time_area.ts | 2 +- .../risk_score_summary.test.ts | 10 ++--- .../lens_attributes}/risk_score_summary.ts | 12 ++---- .../pages/entity_analytics_dashboard.tsx} | 11 +++-- .../components/paginated_table/index.tsx | 2 +- .../containers/risk_score/all/translations.ts | 22 ---------- .../risk_score/feature_status/api.ts | 33 --------------- .../explore/containers/risk_score/index.ts | 38 ----------------- .../containers/risk_score/kpi/translations.ts | 15 ------- .../hosts/components/hosts_table/columns.tsx | 6 +-- .../hosts/pages/details/details_tabs.tsx | 2 +- .../host_risk_score_tab_body.test.tsx | 6 ++- .../navigation/host_risk_score_tab_body.tsx | 14 +++---- .../users/components/all_users/index.tsx | 4 +- .../users/pages/details/details_tabs.tsx | 2 +- .../public/explore/users/pages/users_tabs.tsx | 2 +- .../left/components/entities_details.test.tsx | 4 +- .../left/components/host_details.test.tsx | 4 +- .../left/components/host_details.tsx | 4 +- .../left/components/user_details.test.tsx | 4 +- .../left/components/user_details.tsx | 4 +- .../components/entities_overview.test.tsx | 4 +- .../components/host_entity_overview.test.tsx | 4 +- .../right/components/host_entity_overview.tsx | 4 +- .../components/insights_section.test.tsx | 4 +- .../components/user_entity_overview.test.tsx | 4 +- .../right/components/user_entity_overview.tsx | 5 ++- .../content.tsx | 0 .../header.tsx | 0 .../index.tsx | 0 .../tabs.tsx | 16 +------ .../tabs/asset_document.test.tsx | 0 .../tabs/asset_document.tsx | 0 .../tabs/test_ids.ts | 0 .../test_ids.ts | 1 - .../entity_details/user_right/content.tsx | 6 +-- .../entity_details/user_right/index.test.tsx | 2 +- .../entity_details/user_right/index.tsx | 6 +-- .../entity_details/user_right/mocks/index.ts | 2 +- .../security_solution/public/flyout/index.tsx | 4 +- .../public/overview/components/common.tsx | 2 +- .../entity_analytics/common/translations.ts | 26 ------------ .../components/host_overview/index.test.tsx | 4 +- .../components/host_overview/index.tsx | 6 +-- .../components/user_overview/index.test.tsx | 4 +- .../components/user_overview/index.tsx | 6 +-- .../public/overview/pages/overview.test.tsx | 4 +- .../public/overview/routes.tsx | 2 +- .../side_panel/event_details/index.test.tsx | 2 +- .../new_user_detail/managed_user.tsx | 2 +- .../managed_user_accordion.tsx | 2 +- .../new_user_detail/risk_score_field.tsx | 4 +- .../plugins/security_solution/tsconfig.json | 3 +- .../translations/translations/fr-FR.json | 2 - .../translations/translations/ja-JP.json | 2 - .../translations/translations/zh-CN.json | 2 - 186 files changed, 731 insertions(+), 790 deletions(-) rename x-pack/plugins/security_solution/public/{explore/containers/risk_score/all/index.test.tsx => entity_analytics/api/hooks/use_risk_score.test.tsx} (88%) rename x-pack/plugins/security_solution/public/{explore/containers/risk_score/all/index.tsx => entity_analytics/api/hooks/use_risk_score.tsx} (81%) rename x-pack/plugins/security_solution/public/{common/components/event_details => entity_analytics/api/hooks}/use_risk_score_data.test.ts (94%) rename x-pack/plugins/security_solution/public/{common/components/event_details => entity_analytics/api/hooks}/use_risk_score_data.ts (93%) rename x-pack/plugins/security_solution/public/{explore/containers/risk_score/feature_status/index.test.ts => entity_analytics/api/hooks/use_risk_score_feature_status.test.ts} (85%) rename x-pack/plugins/security_solution/public/{explore/containers/risk_score/feature_status/index.ts => entity_analytics/api/hooks/use_risk_score_feature_status.ts} (83%) rename x-pack/plugins/security_solution/public/{explore/containers/risk_score/kpi/index.tsx => entity_analytics/api/hooks/use_risk_score_kpi.tsx} (78%) create mode 100644 x-pack/plugins/security_solution/public/entity_analytics/api/types.ts rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/enable_risk_score/index.tsx (86%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/enable_risk_score/translations.ts (92%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/anomalies => entity_analytics/components/entity_analytics_anomalies}/anomalies_count_link.test.tsx (73%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/anomalies => entity_analytics/components/entity_analytics_anomalies}/anomalies_count_link.tsx (75%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/anomalies => entity_analytics/components/entity_analytics_anomalies}/columns.test.tsx (90%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/anomalies => entity_analytics/components/entity_analytics_anomalies}/columns.tsx (90%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/anomalies => entity_analytics/components/entity_analytics_anomalies}/components/anomalies_tab_link.tsx (75%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/anomalies => entity_analytics/components/entity_analytics_anomalies}/components/enable_job.test.tsx (88%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/anomalies => entity_analytics/components/entity_analytics_anomalies}/components/enable_job.tsx (80%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/anomalies => entity_analytics/components/entity_analytics_anomalies}/components/total_anomalies.test.tsx (81%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/anomalies => entity_analytics/components/entity_analytics_anomalies}/components/total_anomalies.tsx (85%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/anomalies => entity_analytics/components/entity_analytics_anomalies}/index.test.tsx (92%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/anomalies => entity_analytics/components/entity_analytics_anomalies}/index.tsx (85%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/anomalies => entity_analytics/components/entity_analytics_anomalies}/query/index.ts (100%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/anomalies => entity_analytics/components/entity_analytics_anomalies}/translations.ts (100%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/header => entity_analytics/components/entity_analytics_header}/index.test.tsx (84%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/header => entity_analytics/components/entity_analytics_header}/index.tsx (82%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/header => entity_analytics/components/entity_analytics_header}/translations.ts (100%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/risk_score => entity_analytics/components/entity_analytics_risk_score}/__mocks__/index.ts (82%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/risk_score => entity_analytics/components/entity_analytics_risk_score}/chart_content.test.tsx (79%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/risk_score => entity_analytics/components/entity_analytics_risk_score}/chart_content.tsx (66%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/risk_score => entity_analytics/components/entity_analytics_risk_score}/columns.tsx (85%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/risk_score => entity_analytics/components/entity_analytics_risk_score}/header_content.test.tsx (86%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/risk_score => entity_analytics/components/entity_analytics_risk_score}/header_content.tsx (80%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/risk_score => entity_analytics/components/entity_analytics_risk_score}/index.test.tsx (87%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/risk_score => entity_analytics/components/entity_analytics_risk_score}/index.tsx (77%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/risk_score => entity_analytics/components/entity_analytics_risk_score}/translations.ts (82%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/risk_score => entity_analytics/components/entity_analytics_risk_score}/use_entity.test.ts (93%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/risk_score => entity_analytics/components/entity_analytics_risk_score}/use_entity.ts (71%) rename x-pack/plugins/security_solution/public/{flyout/entity_details/user_detais_left => entity_analytics/components/entity_details_flyout}/components/action_column.test.tsx (100%) rename x-pack/plugins/security_solution/public/{flyout/entity_details/user_detais_left => entity_analytics/components/entity_details_flyout}/components/action_column.tsx (100%) rename x-pack/plugins/security_solution/public/{flyout/entity_details/user_detais_left => entity_analytics/components/entity_details_flyout}/components/utility_bar.test.tsx (100%) rename x-pack/plugins/security_solution/public/{flyout/entity_details/user_detais_left => entity_analytics/components/entity_details_flyout}/components/utility_bar.tsx (100%) rename x-pack/plugins/security_solution/public/{flyout/entity_details/user_detais_left => entity_analytics/components/entity_details_flyout}/hooks/use_risk_input_actions.ts (100%) rename x-pack/plugins/security_solution/public/{flyout/entity_details/user_detais_left => entity_analytics/components/entity_details_flyout}/hooks/use_risk_input_actions_panels.test.tsx (100%) rename x-pack/plugins/security_solution/public/{flyout/entity_details/user_detais_left => entity_analytics/components/entity_details_flyout}/hooks/use_risk_input_actions_panels.tsx (100%) create mode 100644 x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/index.tsx rename x-pack/plugins/security_solution/public/{flyout/entity_details/user_detais_left => entity_analytics/components/entity_details_flyout}/mocks/index.ts (100%) rename x-pack/plugins/security_solution/public/{flyout/entity_details/user_detais_left => entity_analytics/components/entity_details_flyout}/tabs/risk_inputs.test.tsx (100%) rename x-pack/plugins/security_solution/public/{flyout/entity_details/user_detais_left => entity_analytics/components/entity_details_flyout}/tabs/risk_inputs.tsx (100%) rename x-pack/plugins/security_solution/public/{explore/hosts => entity_analytics}/components/host_risk_score_table/columns.test.tsx (94%) rename x-pack/plugins/security_solution/public/{explore/hosts => entity_analytics}/components/host_risk_score_table/columns.tsx (78%) rename x-pack/plugins/security_solution/public/{explore/hosts => entity_analytics}/components/host_risk_score_table/index.tsx (85%) rename x-pack/plugins/security_solution/public/{explore/hosts => entity_analytics}/components/host_risk_score_table/translations.ts (100%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/risk_details_tab_body/index.test.tsx (84%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/risk_details_tab_body/index.tsx (85%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/risk_details_tab_body/translations.ts (83%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/risk_information/index.test.tsx (92%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/risk_information/index.tsx (98%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/risk_information/translations.ts (91%) rename x-pack/plugins/security_solution/public/{explore => entity_analytics}/components/risk_score/constants.ts (100%) rename x-pack/plugins/security_solution/public/{explore => entity_analytics}/components/risk_score/translations.ts (100%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/common/risk_score_donut_chart.test.tsx => entity_analytics/components/risk_score_donut_chart/index.test.tsx} (78%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/common/risk_score_donut_chart.tsx => entity_analytics/components/risk_score_donut_chart/index.tsx} (67%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/common => entity_analytics/components/risk_score_donut_chart}/use_risk_donut_chart_data.test.ts (88%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/common => entity_analytics/components/risk_score_donut_chart}/use_risk_donut_chart_data.ts (70%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/risk_score_onboarding/risk_score_doc_link.tsx (85%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/risk_score_onboarding/risk_score_enable_button.test.tsx (89%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/risk_score_onboarding/risk_score_enable_button.tsx (81%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/risk_score_onboarding/risk_score_header_title.tsx (53%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/risk_score_onboarding/risk_score_no_data_detected.tsx (84%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/risk_score_onboarding/risk_score_restart_button.test.tsx (94%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/risk_score_onboarding/risk_score_restart_button.tsx (83%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/risk_score_onboarding/translations.ts (93%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/risk_score_onboarding/use_risk_score_toast_content.tsx (94%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/risk_score_onboarding/utils.test.ts (94%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/risk_score_onboarding/utils.ts (96%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/risk_score_over_time/index.test.tsx (85%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/risk_score_over_time/index.tsx (87%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/risk_score_over_time/translations.ts (100%) rename x-pack/plugins/security_solution/public/{common/components/event_details/cti_details => entity_analytics/components}/risk_summary.test.tsx (89%) rename x-pack/plugins/security_solution/public/{common/components/event_details/cti_details => entity_analytics/components}/risk_summary.tsx (80%) rename x-pack/plugins/security_solution/public/{flyout/entity_details/shared/components => entity_analytics/components/risk_summary_flyout}/risk_summary.stories.tsx (86%) rename x-pack/plugins/security_solution/public/{flyout/entity_details/shared/components => entity_analytics/components/risk_summary_flyout}/risk_summary.test.tsx (90%) rename x-pack/plugins/security_solution/public/{flyout/entity_details/shared/components => entity_analytics/components/risk_summary_flyout}/risk_summary.tsx (90%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/severity/common/index.test.tsx (93%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/severity/common/index.tsx (87%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/severity/severity_badges.tsx (91%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/severity/severity_bar.tsx (90%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/severity/severity_filter_group.test.tsx (91%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/severity/severity_filter_group.tsx (94%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/severity/types.ts (80%) rename x-pack/plugins/security_solution/public/{overview/components/entity_analytics/common => entity_analytics/components}/styled_basic_table.tsx (100%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/top_risk_score_contributors/index.test.tsx (91%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/top_risk_score_contributors/index.tsx (91%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/top_risk_score_contributors/translations.ts (100%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/top_risk_score_contributors_alerts/index.tsx (78%) rename x-pack/plugins/security_solution/public/{explore/components/risk_score => entity_analytics/components}/top_risk_score_contributors_alerts/translations.ts (100%) rename x-pack/plugins/security_solution/public/{explore/users/pages/navigation => entity_analytics/components}/user_risk_score_tab_body.test.tsx (81%) rename x-pack/plugins/security_solution/public/{explore/users/pages/navigation => entity_analytics/components}/user_risk_score_tab_body.tsx (76%) rename x-pack/plugins/security_solution/public/{explore/users => entity_analytics}/components/user_risk_score_table/columns.test.tsx (93%) rename x-pack/plugins/security_solution/public/{explore/users => entity_analytics}/components/user_risk_score_table/columns.tsx (77%) rename x-pack/plugins/security_solution/public/{explore/users => entity_analytics}/components/user_risk_score_table/index.test.tsx (83%) rename x-pack/plugins/security_solution/public/{explore/users => entity_analytics}/components/user_risk_score_table/index.tsx (83%) rename x-pack/plugins/security_solution/public/{explore/users => entity_analytics}/components/user_risk_score_table/translations.ts (100%) rename x-pack/plugins/security_solution/public/{explore/containers/risk_score/onboarding => entity_analytics/deprecated_risk_engine}/api/index.ts (100%) rename x-pack/plugins/security_solution/public/{explore/containers/risk_score/onboarding => entity_analytics/deprecated_risk_engine}/api/ingest_pipelines.test.ts (100%) rename x-pack/plugins/security_solution/public/{explore/containers/risk_score/onboarding => entity_analytics/deprecated_risk_engine}/api/ingest_pipelines.ts (100%) rename x-pack/plugins/security_solution/public/{explore/containers/risk_score/onboarding => entity_analytics/deprecated_risk_engine}/api/onboarding.ts (94%) rename x-pack/plugins/security_solution/public/{explore/containers/risk_score/onboarding => entity_analytics/deprecated_risk_engine}/api/saved_objects.ts (96%) rename x-pack/plugins/security_solution/public/{explore/containers/risk_score/onboarding => entity_analytics/deprecated_risk_engine}/api/stored_scripts.test.ts (100%) rename x-pack/plugins/security_solution/public/{explore/containers/risk_score/onboarding => entity_analytics/deprecated_risk_engine}/api/stored_scripts.ts (97%) rename x-pack/plugins/security_solution/public/{explore/containers/risk_score/onboarding => entity_analytics/deprecated_risk_engine}/api/transforms.test.ts (100%) rename x-pack/plugins/security_solution/public/{explore/containers/risk_score/onboarding => entity_analytics/deprecated_risk_engine}/api/transforms.ts (100%) rename x-pack/plugins/security_solution/public/{explore/containers/risk_score/onboarding => entity_analytics/deprecated_risk_engine}/api/translations.ts (100%) rename x-pack/plugins/security_solution/public/{explore/containers/risk_score/onboarding => entity_analytics/deprecated_risk_engine}/api/types.ts (100%) rename x-pack/plugins/security_solution/public/{common/components/visualization_actions/lens_attributes/common/risk_scores => entity_analytics/lens_attributes}/__snapshots__/risk_score_donut.test.ts.snap (100%) rename x-pack/plugins/security_solution/public/{common/components/visualization_actions/lens_attributes/common/risk_scores => entity_analytics/lens_attributes}/__snapshots__/risk_score_over_time_area.test.ts.snap (100%) rename x-pack/plugins/security_solution/public/{common/components/visualization_actions/lens_attributes/common/risk_scores => entity_analytics/lens_attributes}/__snapshots__/risk_score_summary.test.ts.snap (100%) rename x-pack/plugins/security_solution/public/{common/components/visualization_actions/lens_attributes/common/risk_scores => entity_analytics/lens_attributes}/risk_score_donut.test.ts (82%) rename x-pack/plugins/security_solution/public/{common/components/visualization_actions/lens_attributes/common/risk_scores => entity_analytics/lens_attributes}/risk_score_donut.ts (98%) rename x-pack/plugins/security_solution/public/{common/components/visualization_actions/lens_attributes/common/risk_scores => entity_analytics/lens_attributes}/risk_score_over_time_area.test.ts (89%) rename x-pack/plugins/security_solution/public/{common/components/visualization_actions/lens_attributes/common/risk_scores => entity_analytics/lens_attributes}/risk_score_over_time_area.ts (98%) rename x-pack/plugins/security_solution/public/{common/components/visualization_actions/lens_attributes/common/risk_scores => entity_analytics/lens_attributes}/risk_score_summary.test.ts (85%) rename x-pack/plugins/security_solution/public/{common/components/visualization_actions/lens_attributes/common/risk_scores => entity_analytics/lens_attributes}/risk_score_summary.ts (93%) rename x-pack/plugins/security_solution/public/{overview/pages/entity_analytics.tsx => entity_analytics/pages/entity_analytics_dashboard.tsx} (92%) delete mode 100644 x-pack/plugins/security_solution/public/explore/containers/risk_score/all/translations.ts delete mode 100644 x-pack/plugins/security_solution/public/explore/containers/risk_score/feature_status/api.ts delete mode 100644 x-pack/plugins/security_solution/public/explore/containers/risk_score/index.ts delete mode 100644 x-pack/plugins/security_solution/public/explore/containers/risk_score/kpi/translations.ts rename x-pack/plugins/security_solution/public/flyout/entity_details/{user_detais_left => user_details_left}/content.tsx (100%) rename x-pack/plugins/security_solution/public/flyout/entity_details/{user_detais_left => user_details_left}/header.tsx (100%) rename x-pack/plugins/security_solution/public/flyout/entity_details/{user_detais_left => user_details_left}/index.tsx (100%) rename x-pack/plugins/security_solution/public/flyout/entity_details/{user_detais_left => user_details_left}/tabs.tsx (84%) rename x-pack/plugins/security_solution/public/flyout/entity_details/{user_detais_left => user_details_left}/tabs/asset_document.test.tsx (100%) rename x-pack/plugins/security_solution/public/flyout/entity_details/{user_detais_left => user_details_left}/tabs/asset_document.tsx (100%) rename x-pack/plugins/security_solution/public/flyout/entity_details/{user_detais_left => user_details_left}/tabs/test_ids.ts (100%) rename x-pack/plugins/security_solution/public/flyout/entity_details/{user_detais_left => user_details_left}/test_ids.ts (85%) delete mode 100644 x-pack/plugins/security_solution/public/overview/components/entity_analytics/common/translations.ts diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 9ec0cc7fab0a4..7d95257248bfc 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1497,17 +1497,12 @@ x-pack/test/threat_intelligence_cypress @elastic/protections-experience x-pack/plugins/security_solution/common/entity_analytics @elastic/security-entity-analytics x-pack/plugins/security_solution/common/search_strategy/security_solution/risk_score @elastic/security-entity-analytics x-pack/plugins/security_solution/public/entity_analytics @elastic/security-entity-analytics -x-pack/plugins/security_solution/public/explore/components/risk_score @elastic/security-entity-analytics -x-pack/plugins/security_solution/public/overview/pages/entity_analytics.tsx @elastic/security-entity-analytics -x-pack/plugins/security_solution/public/overview/components/entity_analytics x-pack/plugins/security_solution/server/lib/entity_analytics @elastic/security-entity-analytics x-pack/plugins/security_solution/server/lib/risk_score @elastic/security-entity-analytics x-pack/test/security_solution_api_integration/test_suites/entity_analytics @elastic/security-entity-analytics x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics @elastic/security-entity-analytics x-pack/plugins/security_solution/public/flyout/entity_details @elastic/security-entity-analytics x-pack/plugins/security_solution/common/api/entity_analytics @elastic/security-entity-analytics -/x-pack/plugins/security_solution/public/entity_analytics @elastic/security-entity-analytics -/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics @elastic/security-entity-analytics # Security Defend Workflows - OSQuery Ownership /x-pack/plugins/security_solution/common/api/detection_engine/model/rule_response_actions @elastic/security-defend-workflows diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/threat_summary_view.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/threat_summary_view.tsx index 4f5e1f847ad83..ce22e6e09b433 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/threat_summary_view.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/threat_summary_view.tsx @@ -8,6 +8,7 @@ import styled from 'styled-components'; import React from 'react'; import { EuiTitle, EuiHorizontalRule, EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; +import type { HostRisk, UserRisk } from '../../../../entity_analytics/api/types'; import * as i18n from './translations'; import type { CtiEnrichment } from '../../../../../common/search_strategy/security_solution/cti'; @@ -16,9 +17,8 @@ import type { TimelineEventsDetailsItem, RiskSeverity, } from '../../../../../common/search_strategy'; -import { RiskSummary } from './risk_summary'; +import { RiskSummary } from '../../../../entity_analytics/components/risk_summary'; import { EnrichmentSummary } from './enrichment_summary'; -import type { HostRisk, UserRisk } from '../../../../explore/containers/risk_score'; import { RiskScoreEntity } from '../../../../../common/search_strategy'; import { useHasSecurityCapability } from '../../../../helper_hooks'; import { RiskScoreInfoTooltip } from '../../../../overview/components/common'; diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/translations.ts b/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/translations.ts index 0ba5a464dc9d5..973b438c866c3 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/translations.ts +++ b/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/translations.ts @@ -6,9 +6,9 @@ */ import { i18n } from '@kbn/i18n'; -import { getRiskEntityTranslation } from '../../../../explore/components/risk_score/translations'; +import { getRiskEntityTranslation } from '../../../../entity_analytics/components/risk_score/translations'; import type { RiskScoreEntity } from '../../../../../common/search_strategy'; -export * from '../../../../explore/components/risk_score/translations'; +export * from '../../../../entity_analytics/components/risk_score/translations'; export const FEED_NAME_PREPOSITION = i18n.translate( 'xpack.securitySolution.eventDetails.ctiSummary.feedNamePreposition', diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/event_details.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/event_details.tsx index 2273389e53733..6c1dd9bce910a 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/event_details.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/event_details.tsx @@ -55,7 +55,7 @@ import { EnrichmentRangePicker } from './cti_details/enrichment_range_picker'; import { InvestigationGuideView } from './investigation_guide_view'; import { Overview } from './overview'; import { Insights } from './insights/insights'; -import { useRiskScoreData } from './use_risk_score_data'; +import { useRiskScoreData } from '../../../entity_analytics/api/hooks/use_risk_score_data'; import { getRowRenderer } from '../../../timelines/components/timeline/body/renderers/get_row_renderer'; import { DETAILS_CLASS_NAME } from '../../../timelines/components/timeline/body/renderers/helpers'; import { defaultRowRenderers } from '../../../timelines/components/timeline/body/renderers'; diff --git a/x-pack/plugins/security_solution/public/common/components/ml/anomaly/use_anomalies_search.ts b/x-pack/plugins/security_solution/public/common/components/ml/anomaly/use_anomalies_search.ts index d21e7a8087cbc..88b03516e5aa8 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml/anomaly/use_anomalies_search.ts +++ b/x-pack/plugins/security_solution/public/common/components/ml/anomaly/use_anomalies_search.ts @@ -8,12 +8,12 @@ import { useState, useEffect, useMemo } from 'react'; import { has, sortBy } from 'lodash/fp'; +import { getAggregatedAnomaliesQuery } from '../../../../entity_analytics/components/entity_analytics_anomalies/query'; import { DEFAULT_ANOMALY_SCORE } from '../../../../../common/constants'; import * as i18n from './translations'; import { useUiSetting$ } from '../../../lib/kibana'; import { useAppToasts } from '../../../hooks/use_app_toasts'; import { anomaliesSearch } from '../api/anomalies_search'; -import { getAggregatedAnomaliesQuery } from '../../../../overview/components/entity_analytics/anomalies/query'; import type { inputsModel } from '../../../store'; import { useSecurityJobs } from '../../ml_popover/hooks/use_security_jobs'; import type { SecurityJob } from '../../ml_popover/types'; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/visualization_embeddable.test.tsx b/x-pack/plugins/security_solution/public/common/components/visualization_actions/visualization_embeddable.test.tsx index ee77776e60a91..8d5ef1a3b6e84 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/visualization_embeddable.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/visualization_embeddable.test.tsx @@ -22,8 +22,7 @@ import { import { createStore } from '../../store'; import type { State } from '../../store'; import { useRefetchByRestartingSession } from '../page/use_refetch_by_session'; -import { getRiskScoreDonutAttributes } from './lens_attributes/common/risk_scores/risk_score_donut'; -import { TOTAL_LABEL } from '../../../overview/components/entity_analytics/common/translations'; +import { getRiskScoreDonutAttributes } from '../../../entity_analytics/lens_attributes/risk_score_donut'; jest.mock('./lens_embeddable'); jest.mock('../page/use_refetch_by_session', () => ({ @@ -183,7 +182,7 @@ describe('VisualizationEmbeddable', () => { getLensAttributes={getRiskScoreDonutAttributes} id="testId" isDonut={true} - label={TOTAL_LABEL} + label={'Total'} timerange={{ from: '2022-10-27T23:00:00.000Z', to: '2022-11-04T10:46:16.204Z' }} /> diff --git a/x-pack/plugins/security_solution/public/entity_analytics/api/api.ts b/x-pack/plugins/security_solution/public/entity_analytics/api/api.ts index 73cb1cbd57ff0..9f2b7bb319f7d 100644 --- a/x-pack/plugins/security_solution/public/entity_analytics/api/api.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/api/api.ts @@ -5,6 +5,7 @@ * 2.0. */ +import type { RiskScoreEntity } from '../../../common/search_strategy'; import { RISK_ENGINE_STATUS_URL, RISK_SCORE_PREVIEW_URL, @@ -13,6 +14,7 @@ import { RISK_ENGINE_INIT_URL, RISK_ENGINE_PRIVILEGES_URL, ASSET_CRITICALITY_PRIVILEGES_URL, + RISK_SCORE_INDEX_STATUS_API_URL, } from '../../../common/constants'; import type { @@ -101,6 +103,27 @@ export const useEntityAnalyticsRoutes = () => { method: 'GET', }); + const getRiskScoreIndexStatus = ({ + query, + signal, + }: { + query: { + indexName: string; + entity: RiskScoreEntity; + }; + signal?: AbortSignal; + }): Promise<{ + isDeprecated: boolean; + isEnabled: boolean; + }> => + http.fetch<{ isDeprecated: boolean; isEnabled: boolean }>(RISK_SCORE_INDEX_STATUS_API_URL, { + version: '1', + method: 'GET', + query, + asSystemRequest: true, + signal, + }); + return { fetchRiskScorePreview, fetchRiskEngineStatus, @@ -109,5 +132,6 @@ export const useEntityAnalyticsRoutes = () => { disableRiskEngine, fetchRiskEnginePrivileges, fetchAssetCriticalityPrivileges, + getRiskScoreIndexStatus, }; }; diff --git a/x-pack/plugins/security_solution/public/explore/containers/risk_score/all/index.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_score.test.tsx similarity index 88% rename from x-pack/plugins/security_solution/public/explore/containers/risk_score/all/index.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_score.test.tsx index dfbba68e25c97..8f61796f0861b 100644 --- a/x-pack/plugins/security_solution/public/explore/containers/risk_score/all/index.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_score.test.tsx @@ -5,25 +5,25 @@ * 2.0. */ import { renderHook } from '@testing-library/react-hooks'; -import { useRiskScore } from '.'; -import { TestProviders } from '../../../../common/mock'; +import { useRiskScore } from './use_risk_score'; +import { TestProviders } from '../../../common/mock'; -import { useSearchStrategy } from '../../../../common/containers/use_search_strategy'; -import { useAppToasts } from '../../../../common/hooks/use_app_toasts'; -import { useAppToastsMock } from '../../../../common/hooks/use_app_toasts.mock'; -import { useRiskScoreFeatureStatus } from '../feature_status'; -import { RiskScoreEntity } from '../../../../../common/search_strategy'; +import { useSearchStrategy } from '../../../common/containers/use_search_strategy'; +import { useAppToasts } from '../../../common/hooks/use_app_toasts'; +import { useAppToastsMock } from '../../../common/hooks/use_app_toasts.mock'; +import { useRiskScoreFeatureStatus } from './use_risk_score_feature_status'; +import { RiskScoreEntity } from '../../../../common/search_strategy'; -jest.mock('../../../../common/containers/use_search_strategy', () => ({ +jest.mock('../../../common/containers/use_search_strategy', () => ({ useSearchStrategy: jest.fn(), })); -jest.mock('../../../../common/hooks/use_space_id', () => ({ +jest.mock('../../../common/hooks/use_space_id', () => ({ useSpaceId: jest.fn().mockReturnValue('default'), })); -jest.mock('../../../../common/hooks/use_app_toasts'); -jest.mock('../feature_status'); +jest.mock('../../../common/hooks/use_app_toasts'); +jest.mock('./use_risk_score_feature_status'); const mockUseRiskScoreFeatureStatus = useRiskScoreFeatureStatus as jest.Mock; const mockUseSearchStrategy = useSearchStrategy as jest.Mock; diff --git a/x-pack/plugins/security_solution/public/explore/containers/risk_score/all/index.tsx b/x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_score.tsx similarity index 81% rename from x-pack/plugins/security_solution/public/explore/containers/risk_score/all/index.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_score.tsx index b2be80f74ab71..3038e33d4bfab 100644 --- a/x-pack/plugins/security_solution/public/explore/containers/risk_score/all/index.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_score.tsx @@ -7,28 +7,25 @@ import { useCallback, useEffect, useMemo } from 'react'; -import { useRiskScoreFeatureStatus } from '../feature_status'; -import { createFilter } from '../../../../common/containers/helpers'; -import type { - RiskScoreSortField, - StrategyResponseType, -} from '../../../../../common/search_strategy'; +import { i18n } from '@kbn/i18n'; +import { useRiskScoreFeatureStatus } from './use_risk_score_feature_status'; +import { createFilter } from '../../../common/containers/helpers'; +import type { RiskScoreSortField, StrategyResponseType } from '../../../../common/search_strategy'; import { RiskQueries, getUserRiskIndex, RiskScoreEntity, getHostRiskIndex, -} from '../../../../../common/search_strategy'; -import type { ESQuery } from '../../../../../common/typed_json'; - -import * as i18n from './translations'; -import type { InspectResponse } from '../../../../types'; -import { useAppToasts } from '../../../../common/hooks/use_app_toasts'; -import { isIndexNotFoundError } from '../../../../common/utils/exceptions'; -import type { inputsModel } from '../../../../common/store'; -import { useSpaceId } from '../../../../common/hooks/use_space_id'; -import { useSearchStrategy } from '../../../../common/containers/use_search_strategy'; -import { useIsNewRiskScoreModuleInstalled } from '../../../../entity_analytics/api/hooks/use_risk_engine_status'; +} from '../../../../common/search_strategy'; +import type { ESQuery } from '../../../../common/typed_json'; + +import type { InspectResponse } from '../../../types'; +import { useAppToasts } from '../../../common/hooks/use_app_toasts'; +import { isIndexNotFoundError } from '../../../common/utils/exceptions'; +import type { inputsModel } from '../../../common/store'; +import { useSpaceId } from '../../../common/hooks/use_space_id'; +import { useSearchStrategy } from '../../../common/containers/use_search_strategy'; +import { useIsNewRiskScoreModuleInstalled } from './use_risk_engine_status'; export interface RiskScoreState { data: @@ -181,7 +178,11 @@ export const useRiskScore = { if (error) { if (!isIndexNotFoundError(error)) { - addError(error, { title: i18n.FAIL_RISK_SCORE }); + addError(error, { + title: i18n.translate('xpack.securitySolution.riskScore.failSearchDescription', { + defaultMessage: `Failed to run search on risk score`, + }), + }); } } }, [addError, error]); diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/use_risk_score_data.test.ts b/x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_score_data.test.ts similarity index 94% rename from x-pack/plugins/security_solution/public/common/components/event_details/use_risk_score_data.test.ts rename to x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_score_data.test.ts index 656c13b22d856..123d4662768c1 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/use_risk_score_data.test.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_score_data.test.ts @@ -6,13 +6,13 @@ */ import { renderHook } from '@testing-library/react-hooks'; -import { TestProviders } from '../../mock'; +import { TestProviders } from '../../../common/mock'; import { ONLY_FIRST_ITEM_PAGINATION, useRiskScoreData } from './use_risk_score_data'; -import { useRiskScore } from '../../../explore/containers/risk_score'; import { useBasicDataFromDetailsData } from '../../../timelines/components/side_panel/event_details/helpers'; import { RiskScoreEntity } from '../../../../common/search_strategy'; +import { useRiskScore } from './use_risk_score'; -jest.mock('../../../explore/containers/risk_score'); +jest.mock('./use_risk_score'); jest.mock('../../../timelines/components/side_panel/event_details/helpers'); const mockUseRiskScore = useRiskScore as jest.Mock; const mockUseBasicDataFromDetailsData = useBasicDataFromDetailsData as jest.Mock; diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/use_risk_score_data.ts b/x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_score_data.ts similarity index 93% rename from x-pack/plugins/security_solution/public/common/components/event_details/use_risk_score_data.ts rename to x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_score_data.ts index 8ac02b1ce47e4..545d12d0851f7 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/use_risk_score_data.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_score_data.ts @@ -12,8 +12,8 @@ import { buildUserNamesFilter, RiskScoreEntity, } from '../../../../common/search_strategy'; -import type { HostRisk, UserRisk } from '../../../explore/containers/risk_score'; -import { useRiskScore } from '../../../explore/containers/risk_score'; +import { useRiskScore } from './use_risk_score'; +import type { HostRisk, UserRisk } from '../types'; export const ONLY_FIRST_ITEM_PAGINATION = { cursorStart: 0, diff --git a/x-pack/plugins/security_solution/public/explore/containers/risk_score/feature_status/index.test.ts b/x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_score_feature_status.test.ts similarity index 85% rename from x-pack/plugins/security_solution/public/explore/containers/risk_score/feature_status/index.test.ts rename to x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_score_feature_status.test.ts index 9464ecb9d8380..30719d1559f54 100644 --- a/x-pack/plugins/security_solution/public/explore/containers/risk_score/feature_status/index.test.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_score_feature_status.test.ts @@ -5,17 +5,17 @@ * 2.0. */ import { act, renderHook } from '@testing-library/react-hooks'; -import { TestProviders } from '../../../../common/mock'; +import { TestProviders } from '../../../common/mock'; -import { useRiskScoreFeatureStatus } from '.'; -import { RiskScoreEntity } from '../../../../../common/search_strategy'; -import { useFetch } from '../../../../common/hooks/use_fetch'; -import { useMlCapabilities } from '../../../../common/components/ml/hooks/use_ml_capabilities'; -import { useHasSecurityCapability } from '../../../../helper_hooks'; +import { useRiskScoreFeatureStatus } from './use_risk_score_feature_status'; +import { RiskScoreEntity } from '../../../../common/search_strategy'; +import { useFetch } from '../../../common/hooks/use_fetch'; +import { useMlCapabilities } from '../../../common/components/ml/hooks/use_ml_capabilities'; +import { useHasSecurityCapability } from '../../../helper_hooks'; -jest.mock('../../../../common/hooks/use_fetch'); -jest.mock('../../../../common/components/ml/hooks/use_ml_capabilities'); -jest.mock('../../../../helper_hooks'); +jest.mock('../../../common/hooks/use_fetch'); +jest.mock('../../../common/components/ml/hooks/use_ml_capabilities'); +jest.mock('../../../helper_hooks'); const mockFetch = jest.fn(); const mockUseMlCapabilities = useMlCapabilities as jest.Mock; diff --git a/x-pack/plugins/security_solution/public/explore/containers/risk_score/feature_status/index.ts b/x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_score_feature_status.ts similarity index 83% rename from x-pack/plugins/security_solution/public/explore/containers/risk_score/feature_status/index.ts rename to x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_score_feature_status.ts index 97994f58295c1..03fb48f56559a 100644 --- a/x-pack/plugins/security_solution/public/explore/containers/risk_score/feature_status/index.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_score_feature_status.ts @@ -6,11 +6,11 @@ */ import { useCallback, useEffect, useMemo } from 'react'; -import { useMlCapabilities } from '../../../../common/components/ml/hooks/use_ml_capabilities'; -import { REQUEST_NAMES, useFetch } from '../../../../common/hooks/use_fetch'; -import type { RiskScoreEntity } from '../../../../../common/search_strategy'; -import { getRiskScoreIndexStatus } from './api'; -import { useHasSecurityCapability } from '../../../../helper_hooks'; +import { useMlCapabilities } from '../../../common/components/ml/hooks/use_ml_capabilities'; +import { REQUEST_NAMES, useFetch } from '../../../common/hooks/use_fetch'; +import type { RiskScoreEntity } from '../../../../common/search_strategy'; +import { useHasSecurityCapability } from '../../../helper_hooks'; +import { useEntityAnalyticsRoutes } from '../api'; interface RiskScoresFeatureStatus { error: unknown; @@ -31,6 +31,7 @@ export const useRiskScoreFeatureStatus = ( const { isPlatinumOrTrialLicense, capabilitiesFetched } = useMlCapabilities(); const hasEntityAnalyticsCapability = useHasSecurityCapability('entity-analytics'); const isAuthorized = isPlatinumOrTrialLicense && hasEntityAnalyticsCapability; + const { getRiskScoreIndexStatus } = useEntityAnalyticsRoutes(); const { fetch, data, isLoading, error } = useFetch( REQUEST_NAMES.GET_RISK_SCORE_DEPRECATED, diff --git a/x-pack/plugins/security_solution/public/explore/containers/risk_score/kpi/index.tsx b/x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_score_kpi.tsx similarity index 78% rename from x-pack/plugins/security_solution/public/explore/containers/risk_score/kpi/index.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_score_kpi.tsx index 2197d5553c431..4105dfc28d83d 100644 --- a/x-pack/plugins/security_solution/public/explore/containers/risk_score/kpi/index.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_score_kpi.tsx @@ -7,6 +7,7 @@ import { useCallback, useEffect, useMemo } from 'react'; +import { i18n } from '@kbn/i18n'; import { getHostRiskIndex, getUserRiskIndex, @@ -14,18 +15,17 @@ import { RiskSeverity, RiskScoreEntity, EMPTY_SEVERITY_COUNT, -} from '../../../../../common/search_strategy'; -import * as i18n from './translations'; -import { isIndexNotFoundError } from '../../../../common/utils/exceptions'; -import type { ESQuery } from '../../../../../common/typed_json'; -import type { SeverityCount } from '../../../components/risk_score/severity/types'; -import { useSpaceId } from '../../../../common/hooks/use_space_id'; -import { useSearchStrategy } from '../../../../common/containers/use_search_strategy'; -import type { InspectResponse } from '../../../../types'; -import type { inputsModel } from '../../../../common/store'; -import { useAppToasts } from '../../../../common/hooks/use_app_toasts'; -import { useIsNewRiskScoreModuleInstalled } from '../../../../entity_analytics/api/hooks/use_risk_engine_status'; -import { useRiskScoreFeatureStatus } from '../feature_status'; +} from '../../../../common/search_strategy'; +import { isIndexNotFoundError } from '../../../common/utils/exceptions'; +import type { ESQuery } from '../../../../common/typed_json'; +import type { SeverityCount } from '../../components/severity/types'; +import { useSpaceId } from '../../../common/hooks/use_space_id'; +import { useSearchStrategy } from '../../../common/containers/use_search_strategy'; +import type { InspectResponse } from '../../../types'; +import type { inputsModel } from '../../../common/store'; +import { useAppToasts } from '../../../common/hooks/use_app_toasts'; +import { useIsNewRiskScoreModuleInstalled } from './use_risk_engine_status'; +import { useRiskScoreFeatureStatus } from './use_risk_score_feature_status'; interface RiskScoreKpi { error: unknown; @@ -123,7 +123,11 @@ export const useRiskScoreKpi = ({ useEffect(() => { if (error) { if (!isIndexNotFoundError(error)) { - addError(error, { title: i18n.FAIL_RISK_SCORE }); + addError(error, { + title: i18n.translate('xpack.securitySolution.riskScore.kpi.failSearchDescription', { + defaultMessage: `Failed to run search on risk score`, + }), + }); } } }, [addError, error]); diff --git a/x-pack/plugins/security_solution/public/entity_analytics/api/types.ts b/x-pack/plugins/security_solution/public/entity_analytics/api/types.ts new file mode 100644 index 0000000000000..419ebc60c4923 --- /dev/null +++ b/x-pack/plugins/security_solution/public/entity_analytics/api/types.ts @@ -0,0 +1,20 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { HostRiskScore, UserRiskScore } from '../../../common/search_strategy'; + +export interface HostRisk { + loading: boolean; + isModuleEnabled: boolean; + result?: HostRiskScore[]; +} + +export interface UserRisk { + loading: boolean; + isModuleEnabled: boolean; + result?: UserRiskScore[]; +} diff --git a/x-pack/plugins/security_solution/public/entity_analytics/common/utils.ts b/x-pack/plugins/security_solution/public/entity_analytics/common/utils.ts index 361d6d133a93d..ee343526ea2b0 100644 --- a/x-pack/plugins/security_solution/public/entity_analytics/common/utils.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/common/utils.ts @@ -32,3 +32,15 @@ export const RISK_SCORE_RANGES = { [RiskSeverity.high]: { start: 70, stop: 90 }, [RiskSeverity.critical]: { start: 90, stop: 100 }, }; + +export enum UserRiskScoreQueryId { + USERS_BY_RISK = 'UsersByRisk', + USER_DETAILS_RISK_SCORE = 'UserDetailsRiskScore', +} + +export enum HostRiskScoreQueryId { + DEFAULT = 'HostRiskScore', + HOST_DETAILS_RISK_SCORE = 'HostDetailsRiskScore', + OVERVIEW_RISKY_HOSTS = 'OverviewRiskyHosts', + HOSTS_BY_RISK = 'HostsByRisk', +} diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/enable_risk_score/index.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/enable_risk_score/index.tsx similarity index 86% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/enable_risk_score/index.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/enable_risk_score/index.tsx index ac064feb35f04..994158104df5b 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/enable_risk_score/index.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/enable_risk_score/index.tsx @@ -6,11 +6,11 @@ */ import { EuiEmptyPrompt, EuiPanel, EuiToolTip } from '@elastic/eui'; import React from 'react'; -import type { RiskScoreEntity } from '../../../../../common/search_strategy'; -import { useCheckSignalIndex } from '../../../../detections/containers/detection_engine/alerts/use_check_signal_index'; -import type { inputsModel } from '../../../../common/store'; +import type { RiskScoreEntity } from '../../../../common/search_strategy'; +import { useCheckSignalIndex } from '../../../detections/containers/detection_engine/alerts/use_check_signal_index'; +import type { inputsModel } from '../../../common/store'; import { RiskScoreHeaderTitle } from '../risk_score_onboarding/risk_score_header_title'; -import { HeaderSection } from '../../../../common/components/header_section'; +import { HeaderSection } from '../../../common/components/header_section'; import { RiskScoreDocLink } from '../risk_score_onboarding/risk_score_doc_link'; import { RiskScoreEnableButton } from '../risk_score_onboarding/risk_score_enable_button'; import * as i18n from './translations'; diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/enable_risk_score/translations.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/enable_risk_score/translations.ts similarity index 92% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/enable_risk_score/translations.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/enable_risk_score/translations.ts index 4c4d7073ed1db..c109c403a091e 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/enable_risk_score/translations.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/enable_risk_score/translations.ts @@ -5,8 +5,8 @@ * 2.0. */ import { i18n } from '@kbn/i18n'; -import type { RiskScoreEntity } from '../../../../../common/search_strategy'; -import { getRiskEntityTranslation } from '../translations'; +import type { RiskScoreEntity } from '../../../../common/search_strategy'; +import { getRiskEntityTranslation } from '../risk_score/translations'; export const ENABLE_RISK_SCORE_POPOVER = i18n.translate( 'xpack.securitySolution.enableRiskScore.enableRiskScorePopoverTitle', diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/anomalies_count_link.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/anomalies_count_link.test.tsx similarity index 73% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/anomalies_count_link.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/anomalies_count_link.test.tsx index 4ce4b6810ec98..8400578b85c4f 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/anomalies_count_link.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/anomalies_count_link.test.tsx @@ -6,14 +6,14 @@ */ import { fireEvent, render } from '@testing-library/react'; import React from 'react'; -import { AnomalyEntity } from '../../../../common/components/ml/anomaly/use_anomalies_search'; -import { createTelemetryServiceMock } from '../../../../common/lib/telemetry/telemetry_service.mock'; -import { TestProviders } from '../../../../common/mock'; +import { AnomalyEntity } from '../../../common/components/ml/anomaly/use_anomalies_search'; +import { createTelemetryServiceMock } from '../../../common/lib/telemetry/telemetry_service.mock'; +import { TestProviders } from '../../../common/mock'; import { AnomaliesCountLink } from './anomalies_count_link'; const mockedTelemetry = createTelemetryServiceMock(); -jest.mock('../../../../common/lib/kibana', () => { - const original = jest.requireActual('../../../../common/lib/kibana'); +jest.mock('../../../common/lib/kibana', () => { + const original = jest.requireActual('../../../common/lib/kibana'); return { ...original, diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/anomalies_count_link.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/anomalies_count_link.tsx similarity index 75% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/anomalies_count_link.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/anomalies_count_link.tsx index 529f197c62e44..bb32564acb1b9 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/anomalies_count_link.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/anomalies_count_link.tsx @@ -6,15 +6,15 @@ */ import { useDispatch } from 'react-redux'; import React, { useCallback } from 'react'; -import { AnomalyEntity } from '../../../../common/components/ml/anomaly/use_anomalies_search'; -import { SecuritySolutionLinkAnchor } from '../../../../common/components/links'; -import { SecurityPageName } from '../../../../app/types'; -import { usersActions } from '../../../../explore/users/store'; -import { hostsActions } from '../../../../explore/hosts/store'; -import { HostsType } from '../../../../explore/hosts/store/model'; -import { UsersType } from '../../../../explore/users/store/model'; +import { AnomalyEntity } from '../../../common/components/ml/anomaly/use_anomalies_search'; +import { SecuritySolutionLinkAnchor } from '../../../common/components/links'; +import { SecurityPageName } from '../../../app/types'; +import { usersActions } from '../../../explore/users/store'; +import { hostsActions } from '../../../explore/hosts/store'; +import { HostsType } from '../../../explore/hosts/store/model'; +import { UsersType } from '../../../explore/users/store/model'; -import { useKibana } from '../../../../common/lib/kibana'; +import { useKibana } from '../../../common/lib/kibana'; export const AnomaliesCountLink = ({ count, diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/columns.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/columns.test.tsx similarity index 90% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/columns.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/columns.test.tsx index f4349df20dc51..6083c18dfb38d 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/columns.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/columns.test.tsx @@ -6,8 +6,8 @@ */ import { renderHook } from '@testing-library/react-hooks'; -import { AnomalyEntity } from '../../../../common/components/ml/anomaly/use_anomalies_search'; -import type { SecurityJob } from '../../../../common/components/ml_popover/types'; +import { AnomalyEntity } from '../../../common/components/ml/anomaly/use_anomalies_search'; +import type { SecurityJob } from '../../../common/components/ml_popover/types'; import { useAnomaliesColumns } from './columns'; describe('useAnomaliesColumns', () => { diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/columns.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/columns.tsx similarity index 90% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/columns.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/columns.tsx index 9faabf8d43f1c..6574f6a566b15 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/columns.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/columns.tsx @@ -8,11 +8,11 @@ import React, { useMemo } from 'react'; import styled from 'styled-components'; import type { EuiTableFieldDataColumnType } from '@elastic/eui'; import * as i18n from './translations'; -import type { SecurityJob } from '../../../../common/components/ml_popover/types'; -import { isJobStarted } from '../../../../../common/machine_learning/helpers'; +import type { SecurityJob } from '../../../common/components/ml_popover/types'; +import { isJobStarted } from '../../../../common/machine_learning/helpers'; import { TotalAnomalies } from './components/total_anomalies'; -import type { AnomaliesCount } from '../../../../common/components/ml/anomaly/use_anomalies_search'; +import type { AnomaliesCount } from '../../../common/components/ml/anomaly/use_anomalies_search'; type AnomaliesColumns = Array>; diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/components/anomalies_tab_link.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/components/anomalies_tab_link.tsx similarity index 75% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/components/anomalies_tab_link.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/components/anomalies_tab_link.tsx index 80f78ee50331e..9f515d8439a66 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/components/anomalies_tab_link.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/components/anomalies_tab_link.tsx @@ -7,13 +7,13 @@ import React, { useCallback } from 'react'; import { useDispatch } from 'react-redux'; -import { SecuritySolutionLinkAnchor } from '../../../../../common/components/links'; -import { SecurityPageName } from '../../../../../app/types'; -import { usersActions } from '../../../../../explore/users/store'; -import { hostsActions } from '../../../../../explore/hosts/store'; -import { HostsType } from '../../../../../explore/hosts/store/model'; -import { UsersType } from '../../../../../explore/users/store/model'; -import { AnomalyEntity } from '../../../../../common/components/ml/anomaly/use_anomalies_search'; +import { SecuritySolutionLinkAnchor } from '../../../../common/components/links'; +import { SecurityPageName } from '../../../../app/types'; +import { usersActions } from '../../../../explore/users/store'; +import { hostsActions } from '../../../../explore/hosts/store'; +import { HostsType } from '../../../../explore/hosts/store/model'; +import { UsersType } from '../../../../explore/users/store/model'; +import { AnomalyEntity } from '../../../../common/components/ml/anomaly/use_anomalies_search'; export const AnomaliesTabLink = ({ count, diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/components/enable_job.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/components/enable_job.test.tsx similarity index 88% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/components/enable_job.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/components/enable_job.test.tsx index c5c199b79df09..1fe70e558cbdc 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/components/enable_job.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/components/enable_job.test.tsx @@ -7,11 +7,11 @@ import React from 'react'; import { render, fireEvent, waitFor } from '@testing-library/react'; -import { useEnableDataFeed } from '../../../../../common/components/ml_popover/hooks/use_enable_data_feed'; -import type { SecurityJob } from '../../../../../common/components/ml_popover/types'; +import { useEnableDataFeed } from '../../../../common/components/ml_popover/hooks/use_enable_data_feed'; +import type { SecurityJob } from '../../../../common/components/ml_popover/types'; import { EnableJob } from './enable_job'; -jest.mock('../../../../../common/components/ml_popover/hooks/use_enable_data_feed', () => ({ +jest.mock('../../../../common/components/ml_popover/hooks/use_enable_data_feed', () => ({ useEnableDataFeed: jest.fn(() => ({ enableDatafeed: jest.fn(), isLoading: false })), })); diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/components/enable_job.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/components/enable_job.tsx similarity index 80% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/components/enable_job.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/components/enable_job.tsx index 533a0eddcbc1a..b98933a34e09c 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/components/enable_job.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/components/enable_job.tsx @@ -7,10 +7,10 @@ import React, { useCallback } from 'react'; import { EuiLoadingSpinner } from '@elastic/eui'; -import type { SecurityJob } from '../../../../../common/components/ml_popover/types'; -import { LinkAnchor } from '../../../../../common/components/links'; +import type { SecurityJob } from '../../../../common/components/ml_popover/types'; +import { LinkAnchor } from '../../../../common/components/links'; import * as i18n from '../translations'; -import { useEnableDataFeed } from '../../../../../common/components/ml_popover/hooks/use_enable_data_feed'; +import { useEnableDataFeed } from '../../../../common/components/ml_popover/hooks/use_enable_data_feed'; export const EnableJob = ({ job, diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/components/total_anomalies.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/components/total_anomalies.test.tsx similarity index 81% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/components/total_anomalies.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/components/total_anomalies.test.tsx index 3cd8e25869763..4d064682f5c8d 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/components/total_anomalies.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/components/total_anomalies.test.tsx @@ -6,11 +6,11 @@ */ import React from 'react'; -import { AnomalyEntity } from '../../../../../common/components/ml/anomaly/use_anomalies_search'; -import type { SecurityJob } from '../../../../../common/components/ml_popover/types'; +import { AnomalyEntity } from '../../../../common/components/ml/anomaly/use_anomalies_search'; +import type { SecurityJob } from '../../../../common/components/ml_popover/types'; import { render } from '@testing-library/react'; import { TotalAnomalies } from './total_anomalies'; -import { TestProviders } from '../../../../../common/mock'; +import { TestProviders } from '../../../../common/mock'; const defaultProps = { count: 0, diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/components/total_anomalies.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/components/total_anomalies.tsx similarity index 85% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/components/total_anomalies.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/components/total_anomalies.tsx index 8311b28177a08..b72f1ef8879bb 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/components/total_anomalies.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/components/total_anomalies.tsx @@ -11,9 +11,9 @@ import { isJobFailed, isJobLoading, isJobStarted, -} from '../../../../../../common/machine_learning/helpers'; -import type { AnomalyEntity } from '../../../../../common/components/ml/anomaly/use_anomalies_search'; -import type { SecurityJob } from '../../../../../common/components/ml_popover/types'; +} from '../../../../../common/machine_learning/helpers'; +import type { AnomalyEntity } from '../../../../common/components/ml/anomaly/use_anomalies_search'; +import type { SecurityJob } from '../../../../common/components/ml_popover/types'; import * as i18n from '../translations'; import { AnomaliesTabLink } from './anomalies_tab_link'; import { EnableJob } from './enable_job'; diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/index.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/index.test.tsx similarity index 92% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/index.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/index.test.tsx index 3e6b85d7beca9..ee3c4cfd022d8 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/index.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/index.test.tsx @@ -8,13 +8,13 @@ import { act, fireEvent, render, waitFor } from '@testing-library/react'; import React from 'react'; import { EntityAnalyticsAnomalies } from '.'; -import type { AnomaliesCount } from '../../../../common/components/ml/anomaly/use_anomalies_search'; -import { AnomalyEntity } from '../../../../common/components/ml/anomaly/use_anomalies_search'; +import type { AnomaliesCount } from '../../../common/components/ml/anomaly/use_anomalies_search'; +import { AnomalyEntity } from '../../../common/components/ml/anomaly/use_anomalies_search'; -import { TestProviders } from '../../../../common/mock'; -import type { SecurityJob } from '../../../../common/components/ml_popover/types'; +import { TestProviders } from '../../../common/mock'; +import type { SecurityJob } from '../../../common/components/ml_popover/types'; -jest.mock('../../../../common/components/ml_popover/hooks/use_enable_data_feed', () => ({ +jest.mock('../../../common/components/ml_popover/hooks/use_enable_data_feed', () => ({ useEnableDataFeed: () => ({ loading: false, enableDatafeed: jest.fn().mockResolvedValue({ enabled: true }), @@ -22,7 +22,7 @@ jest.mock('../../../../common/components/ml_popover/hooks/use_enable_data_feed', })); // Query toggle only works if pageName.lenght > 0 -jest.mock('../../../../common/utils/route/use_route_spy', () => ({ +jest.mock('../../../common/utils/route/use_route_spy', () => ({ useRouteSpy: jest.fn().mockReturnValue([ { pageName: 'not_empty', @@ -45,10 +45,8 @@ jest.mock( } ); -jest.mock('../../../../common/components/ml/anomaly/use_anomalies_search', () => { - const original = jest.requireActual( - '../../../../common/components/ml/anomaly/use_anomalies_search' - ); +jest.mock('../../../common/components/ml/anomaly/use_anomalies_search', () => { + const original = jest.requireActual('../../../common/components/ml/anomaly/use_anomalies_search'); return { ...original, useAggregatedAnomaliesByJob: () => mockUseAggregatedAnomaliesByJob(), diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/index.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/index.tsx similarity index 85% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/index.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/index.tsx index 3e6f2e570cc22..d841e59aeb67a 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/index.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/index.tsx @@ -16,26 +16,26 @@ import { import { MLJobsAwaitingNodeWarning, ML_PAGES, useMlHref } from '@kbn/ml-plugin/public'; import { FormattedMessage } from '@kbn/i18n-react'; -import { HeaderSection } from '../../../../common/components/header_section'; -import { useQueryToggle } from '../../../../common/containers/query_toggle'; -import { LastUpdatedAt } from '../../../../common/components/last_updated_at'; +import { HeaderSection } from '../../../common/components/header_section'; +import { useQueryToggle } from '../../../common/containers/query_toggle'; +import { LastUpdatedAt } from '../../../common/components/last_updated_at'; import * as i18n from './translations'; -import { useAggregatedAnomaliesByJob } from '../../../../common/components/ml/anomaly/use_anomalies_search'; +import { useAggregatedAnomaliesByJob } from '../../../common/components/ml/anomaly/use_anomalies_search'; import { useAnomaliesColumns } from './columns'; -import { useQueryInspector } from '../../../../common/components/page/manage_query'; -import { useGlobalTime } from '../../../../common/containers/use_global_time'; +import { useQueryInspector } from '../../../common/components/page/manage_query'; +import { useGlobalTime } from '../../../common/containers/use_global_time'; import { LinkAnchor, LinkButton, useGetSecuritySolutionLinkProps, -} from '../../../../common/components/links'; -import { HostsTableType } from '../../../../explore/hosts/store/model'; -import { getTabsOnHostsUrl } from '../../../../common/components/link_to/redirect_to_hosts'; -import { SecurityPageName } from '../../../../app/types'; -import { getTabsOnUsersUrl } from '../../../../common/components/link_to/redirect_to_users'; -import { UsersTableType } from '../../../../explore/users/store/model'; -import { useKibana } from '../../../../common/lib/kibana'; -import type { SecurityJob } from '../../../../common/components/ml_popover/types'; +} from '../../../common/components/links'; +import { HostsTableType } from '../../../explore/hosts/store/model'; +import { getTabsOnHostsUrl } from '../../../common/components/link_to/redirect_to_hosts'; +import { SecurityPageName } from '../../../app/types'; +import { getTabsOnUsersUrl } from '../../../common/components/link_to/redirect_to_users'; +import { UsersTableType } from '../../../explore/users/store/model'; +import { useKibana } from '../../../common/lib/kibana'; +import type { SecurityJob } from '../../../common/components/ml_popover/types'; const TABLE_QUERY_ID = 'entityAnalyticsDashboardAnomaliesTable'; diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/query/index.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/query/index.ts similarity index 100% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/query/index.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/query/index.ts diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/translations.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/translations.ts similarity index 100% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/translations.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_anomalies/translations.ts diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/header/index.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_header/index.test.tsx similarity index 84% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/header/index.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_header/index.test.tsx index 62820ee2c0de9..392656402c63e 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/header/index.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_header/index.test.tsx @@ -8,13 +8,14 @@ import { act, fireEvent, render, waitFor } from '@testing-library/react'; import React from 'react'; import { EntityAnalyticsHeader } from '.'; -import { Direction, RiskScoreFields, RiskSeverity } from '../../../../../common/search_strategy'; -import type { SeverityCount } from '../../../../explore/components/risk_score/severity/types'; -import { TestProviders } from '../../../../common/mock'; -import { hostsActions } from '../../../../explore/hosts/store'; -import { HostsType } from '../../../../explore/hosts/store/model'; -import { usersActions } from '../../../../explore/users/store'; -import { UsersTableType } from '../../../../explore/users/store/model'; +import { Direction, RiskScoreFields, RiskSeverity } from '../../../../common/search_strategy'; +import { TestProviders } from '../../../common/mock'; +import { hostsActions } from '../../../explore/hosts/store'; +import { HostsType } from '../../../explore/hosts/store/model'; +import { usersActions } from '../../../explore/users/store'; +import { UsersTableType } from '../../../explore/users/store/model'; + +import type { SeverityCount } from '../severity/types'; const mockSeverityCount: SeverityCount = { [RiskSeverity.low]: 1, @@ -24,11 +25,11 @@ const mockSeverityCount: SeverityCount = { [RiskSeverity.critical]: 99, }; -jest.mock('../../../../common/components/ml/hooks/use_ml_capabilities', () => ({ +jest.mock('../../../common/components/ml/hooks/use_ml_capabilities', () => ({ useMlCapabilities: () => ({ isPlatinumOrTrialLicense: true, capabilities: {} }), })); -jest.mock('../../../../explore/containers/risk_score', () => { +jest.mock('../../api/hooks/use_risk_score_kpi', () => { return { useRiskScoreKpi: () => ({ severityCount: mockSeverityCount }), }; diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/header/index.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_header/index.tsx similarity index 82% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/header/index.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_header/index.tsx index 3be1dd65f48eb..8a814a1ee5a2e 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/header/index.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_header/index.tsx @@ -9,34 +9,34 @@ import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiTitle, EuiLink } from '@elastic import styled from 'styled-components'; import { useDispatch } from 'react-redux'; import { sumBy } from 'lodash/fp'; -import { useRiskScoreKpi } from '../../../../explore/containers/risk_score'; -import { LinkAnchor, useGetSecuritySolutionLinkProps } from '../../../../common/components/links'; +import { SEVERITY_COLOR } from '../../../overview/components/detection_response/utils'; +import { LinkAnchor, useGetSecuritySolutionLinkProps } from '../../../common/components/links'; import { Direction, RiskScoreEntity, RiskScoreFields, RiskSeverity, -} from '../../../../../common/search_strategy'; +} from '../../../../common/search_strategy'; import * as i18n from './translations'; -import { getTabsOnHostsUrl } from '../../../../common/components/link_to/redirect_to_hosts'; -import { SecurityPageName } from '../../../../app/types'; -import { HostsTableType, HostsType } from '../../../../explore/hosts/store/model'; -import { hostsActions } from '../../../../explore/hosts/store'; -import { usersActions } from '../../../../explore/users/store'; -import { getTabsOnUsersUrl } from '../../../../common/components/link_to/redirect_to_users'; -import { UsersTableType } from '../../../../explore/users/store/model'; -import { useAggregatedAnomaliesByJob } from '../../../../common/components/ml/anomaly/use_anomalies_search'; -import { useGlobalTime } from '../../../../common/containers/use_global_time'; -import { useMlCapabilities } from '../../../../common/components/ml/hooks/use_ml_capabilities'; -import { useQueryInspector } from '../../../../common/components/page/manage_query'; -import { ENTITY_ANALYTICS_ANOMALIES_PANEL } from '../anomalies'; -import { isJobStarted } from '../../../../../common/machine_learning/helpers'; -import { FormattedCount } from '../../../../common/components/formatted_number'; -import { SEVERITY_COLOR } from '../../detection_response/utils'; -import { useGlobalFilterQuery } from '../../../../common/hooks/use_global_filter_query'; +import { getTabsOnHostsUrl } from '../../../common/components/link_to/redirect_to_hosts'; +import { SecurityPageName } from '../../../app/types'; +import { HostsTableType, HostsType } from '../../../explore/hosts/store/model'; +import { hostsActions } from '../../../explore/hosts/store'; +import { usersActions } from '../../../explore/users/store'; +import { getTabsOnUsersUrl } from '../../../common/components/link_to/redirect_to_users'; +import { UsersTableType } from '../../../explore/users/store/model'; +import { useAggregatedAnomaliesByJob } from '../../../common/components/ml/anomaly/use_anomalies_search'; +import { useGlobalTime } from '../../../common/containers/use_global_time'; +import { useMlCapabilities } from '../../../common/components/ml/hooks/use_ml_capabilities'; +import { useQueryInspector } from '../../../common/components/page/manage_query'; +import { ENTITY_ANALYTICS_ANOMALIES_PANEL } from '../entity_analytics_anomalies'; +import { isJobStarted } from '../../../../common/machine_learning/helpers'; +import { FormattedCount } from '../../../common/components/formatted_number'; +import { useGlobalFilterQuery } from '../../../common/hooks/use_global_filter_query'; +import { useRiskScoreKpi } from '../../api/hooks/use_risk_score_kpi'; const StyledEuiTitle = styled(EuiTitle)` - color: ${({ theme: { eui } }) => SEVERITY_COLOR.critical}; + color: ${SEVERITY_COLOR.critical}; `; const HOST_RISK_QUERY_ID = 'hostRiskScoreKpiQuery'; diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/header/translations.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_header/translations.ts similarity index 100% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/header/translations.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_header/translations.ts diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/__mocks__/index.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/__mocks__/index.ts similarity index 82% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/__mocks__/index.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/__mocks__/index.ts index bf863d0011ad3..19f3a03e41c03 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/__mocks__/index.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/__mocks__/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RiskSeverity } from '../../../../../../common/search_strategy/security_solution'; +import { RiskSeverity } from '../../../../../common/search_strategy/security_solution'; export const mockSeverityCount = { [RiskSeverity.unknown]: 1, diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/chart_content.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/chart_content.test.tsx similarity index 79% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/chart_content.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/chart_content.test.tsx index 69816567f90ca..e346e999f8bd1 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/chart_content.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/chart_content.test.tsx @@ -7,20 +7,20 @@ import { render } from '@testing-library/react'; import React from 'react'; -import { RiskScoreEntity, RiskSeverity } from '../../../../../common/search_strategy'; -import { VisualizationEmbeddable } from '../../../../common/components/visualization_actions/visualization_embeddable'; -import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features'; -import { useSpaceId } from '../../../../common/hooks/use_space_id'; -import { TestProviders } from '../../../../common/mock'; -import { generateSeverityFilter } from '../../../../explore/hosts/store/helpers'; +import { RiskScoreEntity, RiskSeverity } from '../../../../common/search_strategy'; +import { VisualizationEmbeddable } from '../../../common/components/visualization_actions/visualization_embeddable'; +import { useIsExperimentalFeatureEnabled } from '../../../common/hooks/use_experimental_features'; +import { useSpaceId } from '../../../common/hooks/use_space_id'; +import { TestProviders } from '../../../common/mock'; +import { generateSeverityFilter } from '../../../explore/hosts/store/helpers'; import { ChartContent } from './chart_content'; import { mockSeverityCount } from './__mocks__'; -jest.mock('../../../../common/components/visualization_actions/visualization_embeddable'); -jest.mock('../../../../common/hooks/use_experimental_features', () => ({ +jest.mock('../../../common/components/visualization_actions/visualization_embeddable'); +jest.mock('../../../common/hooks/use_experimental_features', () => ({ useIsExperimentalFeatureEnabled: jest.fn(), })); -jest.mock('../../../../common/hooks/use_space_id', () => ({ +jest.mock('../../../common/hooks/use_space_id', () => ({ useSpaceId: jest.fn(), })); describe('ChartContent', () => { diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/chart_content.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/chart_content.tsx similarity index 66% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/chart_content.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/chart_content.tsx index 8f03cb08594aa..78828b1c76972 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/chart_content.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/chart_content.tsx @@ -6,16 +6,16 @@ */ import React, { useMemo } from 'react'; -import type { RiskScoreEntity, RiskSeverity } from '../../../../../common/search_strategy'; -import { EMPTY_SEVERITY_COUNT } from '../../../../../common/search_strategy'; -import { getRiskScoreDonutAttributes } from '../../../../common/components/visualization_actions/lens_attributes/common/risk_scores/risk_score_donut'; -import { VisualizationEmbeddable } from '../../../../common/components/visualization_actions/visualization_embeddable'; -import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features'; -import { useSpaceId } from '../../../../common/hooks/use_space_id'; -import type { SeverityCount } from '../../../../explore/components/risk_score/severity/types'; -import { generateSeverityFilter } from '../../../../explore/hosts/store/helpers'; -import { RiskScoreDonutChart } from '../common/risk_score_donut_chart'; -import { TOTAL_LABEL } from '../common/translations'; +import { i18n } from '@kbn/i18n'; +import type { RiskScoreEntity, RiskSeverity } from '../../../../common/search_strategy'; +import { EMPTY_SEVERITY_COUNT } from '../../../../common/search_strategy'; +import { VisualizationEmbeddable } from '../../../common/components/visualization_actions/visualization_embeddable'; +import { useIsExperimentalFeatureEnabled } from '../../../common/hooks/use_experimental_features'; +import { useSpaceId } from '../../../common/hooks/use_space_id'; +import type { SeverityCount } from '../severity/types'; +import { generateSeverityFilter } from '../../../explore/hosts/store/helpers'; +import { RiskScoreDonutChart } from '../risk_score_donut_chart'; +import { getRiskScoreDonutAttributes } from '../../lens_attributes/risk_score_donut'; const CHART_HEIGHT = 180; const ChartContentComponent = ({ @@ -56,7 +56,12 @@ const ChartContentComponent = ({ height={CHART_HEIGHT} id={`${kpiQueryId}-donut`} isDonut={true} - label={TOTAL_LABEL} + label={i18n.translate( + 'xpack.securitySolution.entityAnalytics.riskScore.chart.totalLabel', + { + defaultMessage: 'Total', + } + )} stackByField={riskEntity} timerange={timerange} width="270px" diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/columns.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/columns.tsx similarity index 85% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/columns.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/columns.tsx index 120a4cf3d4c7f..e5926c2df7b4f 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/columns.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/columns.tsx @@ -9,28 +9,28 @@ import React from 'react'; import type { EuiBasicTableColumn } from '@elastic/eui'; import { EuiLink } from '@elastic/eui'; import styled from 'styled-components'; -import { UsersTableType } from '../../../../explore/users/store/model'; -import { getEmptyTagValue } from '../../../../common/components/empty_value'; -import { HostDetailsLink, UserDetailsLink } from '../../../../common/components/links'; -import { HostsTableType } from '../../../../explore/hosts/store/model'; -import { RiskScoreLevel } from '../../../../explore/components/risk_score/severity/common'; -import { CELL_ACTIONS_TELEMETRY } from '../../../../explore/components/risk_score/constants'; +import { UsersTableType } from '../../../explore/users/store/model'; +import { getEmptyTagValue } from '../../../common/components/empty_value'; +import { HostDetailsLink, UserDetailsLink } from '../../../common/components/links'; +import { HostsTableType } from '../../../explore/hosts/store/model'; +import { RiskScoreLevel } from '../severity/common'; +import { CELL_ACTIONS_TELEMETRY } from '../risk_score/constants'; import type { HostRiskScore, Maybe, RiskSeverity, UserRiskScore, -} from '../../../../../common/search_strategy'; -import { RiskScoreEntity, RiskScoreFields } from '../../../../../common/search_strategy'; +} from '../../../../common/search_strategy'; +import { RiskScoreEntity, RiskScoreFields } from '../../../../common/search_strategy'; import * as i18n from './translations'; -import { FormattedCount } from '../../../../common/components/formatted_number'; +import { FormattedCount } from '../../../common/components/formatted_number'; import { SecurityCellActions, CellActionsMode, SecurityCellActionsTrigger, SecurityCellActionType, -} from '../../../../common/components/cell_actions'; -import { FormattedRelativePreferenceDate } from '../../../../common/components/formatted_date'; +} from '../../../common/components/cell_actions'; +import { FormattedRelativePreferenceDate } from '../../../common/components/formatted_date'; type HostRiskScoreColumns = Array>; diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/header_content.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/header_content.test.tsx similarity index 86% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/header_content.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/header_content.test.tsx index d6e7c39b4fada..b4f24e0d27d6f 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/header_content.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/header_content.test.tsx @@ -7,14 +7,14 @@ import type { RenderResult } from '@testing-library/react'; import { render } from '@testing-library/react'; import React from 'react'; -import { SecurityPageName } from '../../../../../common/constants'; -import { RiskScoreEntity } from '../../../../../common/search_strategy'; -import { useGetSecuritySolutionLinkProps } from '../../../../common/components/links'; +import { SecurityPageName } from '../../../../common/constants'; +import { RiskScoreEntity } from '../../../../common/search_strategy'; +import { useGetSecuritySolutionLinkProps } from '../../../common/components/links'; import { RiskScoreHeaderContent } from './header_content'; import { mockSeverityCount } from './__mocks__'; -jest.mock('../../../../common/components/links', () => { - const actual = jest.requireActual('../../../../common/components/links'); +jest.mock('../../../common/components/links', () => { + const actual = jest.requireActual('../../../common/components/links'); return { ...actual, useGetSecuritySolutionLinkProps: jest.fn(), diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/header_content.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/header_content.tsx similarity index 80% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/header_content.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/header_content.tsx index e9b1f56c6e0ec..10b94b95a886f 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/header_content.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/header_content.tsx @@ -6,14 +6,14 @@ */ import React, { useMemo } from 'react'; import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import type { RiskSeverity, RiskScoreEntity } from '../../../../../common/search_strategy'; -import { SeverityFilterGroup } from '../../../../explore/components/risk_score/severity/severity_filter_group'; -import type { SeverityCount } from '../../../../explore/components/risk_score/severity/types'; -import { EMPTY_SEVERITY_COUNT } from '../../../../../common/search_strategy'; -import { LinkButton, useGetSecuritySolutionLinkProps } from '../../../../common/components/links'; -import type { SecurityPageName } from '../../../../../common/constants'; +import type { RiskSeverity, RiskScoreEntity } from '../../../../common/search_strategy'; +import { SeverityFilterGroup } from '../severity/severity_filter_group'; +import type { SeverityCount } from '../severity/types'; +import { EMPTY_SEVERITY_COUNT } from '../../../../common/search_strategy'; +import { LinkButton, useGetSecuritySolutionLinkProps } from '../../../common/components/links'; +import type { SecurityPageName } from '../../../../common/constants'; import * as i18n from './translations'; -import { RiskInformationButtonEmpty } from '../../../../explore/components/risk_score/risk_information'; +import { RiskInformationButtonEmpty } from '../risk_information'; const RiskScoreHeaderContentComponent = ({ entityLinkProps, diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/index.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/index.test.tsx similarity index 87% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/index.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/index.test.tsx index 8af9349d9bcea..d9a265e662a7e 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/index.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/index.test.tsx @@ -7,18 +7,19 @@ import { render, fireEvent, waitFor } from '@testing-library/react'; import React from 'react'; -import { TestProviders } from '../../../../common/mock'; +import { TestProviders } from '../../../common/mock'; import { EntityAnalyticsRiskScores } from '.'; -import { RiskScoreEntity, RiskSeverity } from '../../../../../common/search_strategy'; -import type { SeverityCount } from '../../../../explore/components/risk_score/severity/types'; -import { useRiskScore, useRiskScoreKpi } from '../../../../explore/containers/risk_score'; -import { useKibana as mockUseKibana } from '../../../../common/lib/kibana/__mocks__'; -import { createTelemetryServiceMock } from '../../../../common/lib/telemetry/telemetry_service.mock'; +import { RiskScoreEntity, RiskSeverity } from '../../../../common/search_strategy'; +import type { SeverityCount } from '../severity/types'; +import { useKibana as mockUseKibana } from '../../../common/lib/kibana/__mocks__'; +import { createTelemetryServiceMock } from '../../../common/lib/telemetry/telemetry_service.mock'; +import { useRiskScore } from '../../api/hooks/use_risk_score'; +import { useRiskScoreKpi } from '../../api/hooks/use_risk_score_kpi'; const mockedTelemetry = createTelemetryServiceMock(); const mockedUseKibana = mockUseKibana(); -jest.mock('../../../../common/lib/kibana', () => { - const original = jest.requireActual('../../../../common/lib/kibana'); +jest.mock('../../../common/lib/kibana', () => { + const original = jest.requireActual('../../../common/lib/kibana'); return { ...original, @@ -43,7 +44,7 @@ const mockSeverityCount: SeverityCount = { const mockUseQueryToggle = jest .fn() .mockReturnValue({ toggleStatus: false, setToggleStatus: jest.fn() }); -jest.mock('../../../../common/containers/query_toggle', () => { +jest.mock('../../../common/containers/query_toggle', () => { return { useQueryToggle: () => mockUseQueryToggle(), }; @@ -58,16 +59,17 @@ const defaultProps = { }; const mockUseRiskScore = useRiskScore as jest.Mock; const mockUseRiskScoreKpi = useRiskScoreKpi as jest.Mock; -jest.mock('../../../../explore/containers/risk_score'); +jest.mock('../../api/hooks/use_risk_score'); +jest.mock('../../api/hooks/use_risk_score_kpi'); const mockOpenAlertsPageWithFilters = jest.fn(); -jest.mock('../../../../common/hooks/use_navigate_to_alerts_page_with_filters', () => { +jest.mock('../../../common/hooks/use_navigate_to_alerts_page_with_filters', () => { return { useNavigateToAlertsPageWithFilters: () => mockOpenAlertsPageWithFilters, }; }); -jest.mock('../../../../common/components/hover_actions', () => ({ HoverActions: () => null })); +jest.mock('../../../common/components/hover_actions', () => ({ HoverActions: () => null })); describe.each([RiskScoreEntity.host, RiskScoreEntity.user])( 'EntityAnalyticsRiskScores entityType: %s', diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/index.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/index.tsx similarity index 77% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/index.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/index.tsx index 97cf4363f690d..ce695e75f58f1 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/index.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/index.tsx @@ -7,32 +7,32 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import { EnableRiskScore } from '../../../../explore/components/risk_score/enable_risk_score'; +import { EnableRiskScore } from '../enable_risk_score'; import { getRiskScoreColumns } from './columns'; -import { LastUpdatedAt } from '../../../../common/components/last_updated_at'; -import { HeaderSection } from '../../../../common/components/header_section'; -import { useRiskScore, useRiskScoreKpi } from '../../../../explore/containers/risk_score'; - -import type { RiskSeverity } from '../../../../../common/search_strategy'; -import { RiskScoreEntity } from '../../../../../common/search_strategy'; -import { generateSeverityFilter } from '../../../../explore/hosts/store/helpers'; -import { useQueryInspector } from '../../../../common/components/page/manage_query'; -import { useGlobalTime } from '../../../../common/containers/use_global_time'; -import { InspectButtonContainer } from '../../../../common/components/inspect'; -import { useQueryToggle } from '../../../../common/containers/query_toggle'; -import { StyledBasicTable } from '../common/styled_basic_table'; -import { RiskScoreHeaderTitle } from '../../../../explore/components/risk_score/risk_score_onboarding/risk_score_header_title'; -import { RiskScoresNoDataDetected } from '../../../../explore/components/risk_score/risk_score_onboarding/risk_score_no_data_detected'; -import { useRefetchQueries } from '../../../../common/hooks/use_refetch_queries'; -import { Loader } from '../../../../common/components/loader'; -import { Panel } from '../../../../common/components/panel'; +import { LastUpdatedAt } from '../../../common/components/last_updated_at'; +import { HeaderSection } from '../../../common/components/header_section'; +import type { RiskSeverity } from '../../../../common/search_strategy'; +import { RiskScoreEntity } from '../../../../common/search_strategy'; +import { generateSeverityFilter } from '../../../explore/hosts/store/helpers'; +import { useQueryInspector } from '../../../common/components/page/manage_query'; +import { useGlobalTime } from '../../../common/containers/use_global_time'; +import { InspectButtonContainer } from '../../../common/components/inspect'; +import { useQueryToggle } from '../../../common/containers/query_toggle'; +import { StyledBasicTable } from '../styled_basic_table'; +import { RiskScoreHeaderTitle } from '../risk_score_onboarding/risk_score_header_title'; +import { RiskScoresNoDataDetected } from '../risk_score_onboarding/risk_score_no_data_detected'; +import { useRefetchQueries } from '../../../common/hooks/use_refetch_queries'; +import { Loader } from '../../../common/components/loader'; +import { Panel } from '../../../common/components/panel'; import { useEntityInfo } from './use_entity'; import { RiskScoreHeaderContent } from './header_content'; import { ChartContent } from './chart_content'; -import { useNavigateToAlertsPageWithFilters } from '../../../../common/hooks/use_navigate_to_alerts_page_with_filters'; +import { useNavigateToAlertsPageWithFilters } from '../../../common/hooks/use_navigate_to_alerts_page_with_filters'; import { getRiskEntityTranslation } from './translations'; -import { useKibana } from '../../../../common/lib/kibana'; -import { useGlobalFilterQuery } from '../../../../common/hooks/use_global_filter_query'; +import { useKibana } from '../../../common/lib/kibana'; +import { useGlobalFilterQuery } from '../../../common/hooks/use_global_filter_query'; +import { useRiskScoreKpi } from '../../api/hooks/use_risk_score_kpi'; +import { useRiskScore } from '../../api/hooks/use_risk_score'; const EntityAnalyticsRiskScoresComponent = ({ riskEntity }: { riskEntity: RiskScoreEntity }) => { const { deleteQuery, setQuery, from, to } = useGlobalTime(); diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/translations.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/translations.ts similarity index 82% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/translations.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/translations.ts index 22fe8a3d52823..5816accea220a 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/translations.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/translations.ts @@ -6,9 +6,9 @@ */ import { i18n } from '@kbn/i18n'; -import { getRiskEntityTranslation } from '../../../../explore/components/risk_score/translations'; -import type { RiskScoreEntity } from '../../../../../common/search_strategy'; -export * from '../../../../explore/components/risk_score/translations'; +import { getRiskEntityTranslation } from '../risk_score/translations'; +import type { RiskScoreEntity } from '../../../../common/search_strategy'; +export * from '../risk_score/translations'; export const ENTITY_NAME = (riskEntity: RiskScoreEntity) => i18n.translate('xpack.securitySolution.entityAnalytics.riskDashboard.nameTitle', { diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/use_entity.test.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/use_entity.test.ts similarity index 93% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/use_entity.test.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/use_entity.test.ts index 3e0f475d47fa9..25d772c26762c 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/use_entity.test.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/use_entity.test.ts @@ -6,7 +6,7 @@ */ import { renderHook } from '@testing-library/react-hooks'; -import { RiskScoreEntity } from '../../../../../common/search_strategy/security_solution/risk_score'; +import { RiskScoreEntity } from '../../../../common/search_strategy/security_solution/risk_score'; import { useEntityInfo } from './use_entity'; jest.mock('react-redux', () => { diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/use_entity.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/use_entity.ts similarity index 71% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/use_entity.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/use_entity.ts index dc5d947ad4495..3b3640a7cecae 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/use_entity.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_analytics_risk_score/use_entity.ts @@ -5,16 +5,16 @@ * 2.0. */ import { useDispatch } from 'react-redux'; -import { getTabsOnUsersUrl } from '../../../../common/components/link_to/redirect_to_users'; -import { UsersTableType } from '../../../../explore/users/store/model'; +import { getTabsOnUsersUrl } from '../../../common/components/link_to/redirect_to_users'; +import { UsersTableType } from '../../../explore/users/store/model'; -import { getTabsOnHostsUrl } from '../../../../common/components/link_to/redirect_to_hosts'; -import { HostsTableType, HostsType } from '../../../../explore/hosts/store/model'; +import { getTabsOnHostsUrl } from '../../../common/components/link_to/redirect_to_hosts'; +import { HostsTableType, HostsType } from '../../../explore/hosts/store/model'; -import { RiskScoreEntity } from '../../../../../common/search_strategy/security_solution/risk_score'; -import { usersActions } from '../../../../explore/users/store'; -import { hostsActions } from '../../../../explore/hosts/store'; -import { SecurityPageName } from '../../../../app/types'; +import { RiskScoreEntity } from '../../../../common/search_strategy/security_solution/risk_score'; +import { usersActions } from '../../../explore/users/store'; +import { hostsActions } from '../../../explore/hosts/store'; +import { SecurityPageName } from '../../../app/types'; const HOST_RISK_TABLE_QUERY_ID = 'hostRiskDashboardTable'; const HOST_RISK_KPI_QUERY_ID = 'headerHostRiskScoreKpiQuery'; diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/components/action_column.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/components/action_column.test.tsx similarity index 100% rename from x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/components/action_column.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/components/action_column.test.tsx index 9df74c2d60846..d5ff5425ccaa6 100644 --- a/x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/components/action_column.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/components/action_column.test.tsx @@ -8,8 +8,8 @@ import { fireEvent, render } from '@testing-library/react'; import React from 'react'; import { TestProviders } from '../../../../common/mock'; -import { ActionColumn } from './action_column'; import { alertDataMock } from '../mocks'; +import { ActionColumn } from './action_column'; describe('ActionColumn', () => { it('renders', () => { diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/components/action_column.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/components/action_column.tsx similarity index 100% rename from x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/components/action_column.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/components/action_column.tsx diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/components/utility_bar.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/components/utility_bar.test.tsx similarity index 100% rename from x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/components/utility_bar.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/components/utility_bar.test.tsx diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/components/utility_bar.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/components/utility_bar.tsx similarity index 100% rename from x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/components/utility_bar.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/components/utility_bar.tsx diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/hooks/use_risk_input_actions.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/hooks/use_risk_input_actions.ts similarity index 100% rename from x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/hooks/use_risk_input_actions.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/hooks/use_risk_input_actions.ts diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/hooks/use_risk_input_actions_panels.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/hooks/use_risk_input_actions_panels.test.tsx similarity index 100% rename from x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/hooks/use_risk_input_actions_panels.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/hooks/use_risk_input_actions_panels.test.tsx diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/hooks/use_risk_input_actions_panels.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/hooks/use_risk_input_actions_panels.tsx similarity index 100% rename from x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/hooks/use_risk_input_actions_panels.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/hooks/use_risk_input_actions_panels.tsx diff --git a/x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/index.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/index.tsx new file mode 100644 index 0000000000000..428f98530d55f --- /dev/null +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/index.tsx @@ -0,0 +1,26 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { FormattedMessage } from '@kbn/i18n-react'; +import { PREFIX } from '../../../flyout/shared/test_ids'; +import { UserDetailsLeftPanelTab } from '../../../flyout/entity_details/user_details_left/tabs'; +import { RiskInputsTab } from './tabs/risk_inputs'; + +export const RISK_INPUTS_TAB_TEST_ID = `${PREFIX}RiskInputsTab` as const; + +export const getRiskInputTab = (alertIds: string[]) => ({ + id: UserDetailsLeftPanelTab.RISK_INPUTS, + 'data-test-subj': RISK_INPUTS_TAB_TEST_ID, + name: ( + + ), + content: , +}); diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/mocks/index.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/mocks/index.ts similarity index 100% rename from x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/mocks/index.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/mocks/index.ts diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/tabs/risk_inputs.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/tabs/risk_inputs.test.tsx similarity index 100% rename from x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/tabs/risk_inputs.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/tabs/risk_inputs.test.tsx index efd47e50009c9..038d6f7d622d4 100644 --- a/x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/tabs/risk_inputs.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/tabs/risk_inputs.test.tsx @@ -9,8 +9,8 @@ import { fireEvent, render } from '@testing-library/react'; import React from 'react'; import { TestProviders } from '../../../../common/mock'; import { times } from 'lodash/fp'; -import { alertDataMock } from '../mocks'; import { RiskInputsTab } from './risk_inputs'; +import { alertDataMock } from '../mocks'; const mockUseAlertsByIds = jest.fn().mockReturnValue({ loading: false, data: [] }); diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/tabs/risk_inputs.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/tabs/risk_inputs.tsx similarity index 100% rename from x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/tabs/risk_inputs.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/tabs/risk_inputs.tsx diff --git a/x-pack/plugins/security_solution/public/explore/hosts/components/host_risk_score_table/columns.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/host_risk_score_table/columns.test.tsx similarity index 94% rename from x-pack/plugins/security_solution/public/explore/hosts/components/host_risk_score_table/columns.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/host_risk_score_table/columns.test.tsx index 98cfa4895fbd4..d439c627365a0 100644 --- a/x-pack/plugins/security_solution/public/explore/hosts/components/host_risk_score_table/columns.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/host_risk_score_table/columns.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { render } from '@testing-library/react'; import { getHostRiskScoreColumns } from './columns'; -import { TestProviders } from '../../../../common/mock'; +import { TestProviders } from '../../../common/mock'; import type { HostRiskScoreColumns } from '.'; describe('getHostRiskScoreColumns', () => { diff --git a/x-pack/plugins/security_solution/public/explore/hosts/components/host_risk_score_table/columns.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/host_risk_score_table/columns.tsx similarity index 78% rename from x-pack/plugins/security_solution/public/explore/hosts/components/host_risk_score_table/columns.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/host_risk_score_table/columns.tsx index af6c0d502351e..e1509a03a9a90 100644 --- a/x-pack/plugins/security_solution/public/explore/hosts/components/host_risk_score_table/columns.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/host_risk_score_table/columns.tsx @@ -11,18 +11,18 @@ import { SecurityCellActions, CellActionsMode, SecurityCellActionsTrigger, -} from '../../../../common/components/cell_actions'; -import { getEmptyTagValue } from '../../../../common/components/empty_value'; -import { HostDetailsLink } from '../../../../common/components/links'; +} from '../../../common/components/cell_actions'; +import { getEmptyTagValue } from '../../../common/components/empty_value'; +import { HostDetailsLink } from '../../../common/components/links'; import type { HostRiskScoreColumns } from '.'; import * as i18n from './translations'; -import { HostsTableType } from '../../store/model'; -import type { Maybe, RiskSeverity } from '../../../../../common/search_strategy'; -import { RiskScoreFields, RiskScoreEntity } from '../../../../../common/search_strategy'; -import { RiskScoreLevel } from '../../../components/risk_score/severity/common'; -import { ENTITY_RISK_LEVEL } from '../../../components/risk_score/translations'; -import { CELL_ACTIONS_TELEMETRY } from '../../../components/risk_score/constants'; -import { FormattedRelativePreferenceDate } from '../../../../common/components/formatted_date'; +import { HostsTableType } from '../../../explore/hosts/store/model'; +import type { Maybe, RiskSeverity } from '../../../../common/search_strategy'; +import { RiskScoreFields, RiskScoreEntity } from '../../../../common/search_strategy'; +import { RiskScoreLevel } from '../severity/common'; +import { ENTITY_RISK_LEVEL } from '../risk_score/translations'; +import { CELL_ACTIONS_TELEMETRY } from '../risk_score/constants'; +import { FormattedRelativePreferenceDate } from '../../../common/components/formatted_date'; export const getHostRiskScoreColumns = ({ dispatchSeverityUpdate, diff --git a/x-pack/plugins/security_solution/public/explore/hosts/components/host_risk_score_table/index.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/host_risk_score_table/index.tsx similarity index 85% rename from x-pack/plugins/security_solution/public/explore/hosts/components/host_risk_score_table/index.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/host_risk_score_table/index.tsx index 9c486c96fdece..5dca054f013cd 100644 --- a/x-pack/plugins/security_solution/public/explore/hosts/components/host_risk_score_table/index.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/host_risk_score_table/index.tsx @@ -9,10 +9,10 @@ import React, { useMemo, useCallback } from 'react'; import { useDispatch } from 'react-redux'; import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import type { Columns, Criteria, ItemsPerRow } from '../../../components/paginated_table'; -import { PaginatedTable } from '../../../components/paginated_table'; -import { useDeepEqualSelector } from '../../../../common/hooks/use_selector'; -import { hostsActions, hostsModel, hostsSelectors } from '../../store'; +import type { Columns, Criteria, ItemsPerRow } from '../../../explore/components/paginated_table'; +import { PaginatedTable } from '../../../explore/components/paginated_table'; +import { useDeepEqualSelector } from '../../../common/hooks/use_selector'; +import { hostsActions, hostsModel, hostsSelectors } from '../../../explore/hosts/store'; import { getHostRiskScoreColumns } from './columns'; import type { HostRiskScore, @@ -20,18 +20,18 @@ import type { RiskScoreSortField, RiskSeverity, RiskScoreFields, -} from '../../../../../common/search_strategy'; -import { RiskScoreEntity } from '../../../../../common/search_strategy'; -import type { State } from '../../../../common/store'; -import * as i18n from '../hosts_table/translations'; +} from '../../../../common/search_strategy'; +import { RiskScoreEntity } from '../../../../common/search_strategy'; +import type { State } from '../../../common/store'; +import * as i18n from '../../../explore/hosts/components/hosts_table/translations'; import * as i18nHosts from './translations'; -import { SeverityBadges } from '../../../components/risk_score/severity/severity_badges'; -import { SeverityBar } from '../../../components/risk_score/severity/severity_bar'; -import { SeverityFilterGroup } from '../../../components/risk_score/severity/severity_filter_group'; +import { SeverityBadges } from '../severity/severity_badges'; +import { SeverityBar } from '../severity/severity_bar'; +import { SeverityFilterGroup } from '../severity/severity_filter_group'; -import type { SeverityCount } from '../../../components/risk_score/severity/types'; -import { RiskInformationButtonEmpty } from '../../../components/risk_score/risk_information'; +import type { SeverityCount } from '../severity/types'; +import { RiskInformationButtonEmpty } from '../risk_information'; export const rowItems: ItemsPerRow[] = [ { diff --git a/x-pack/plugins/security_solution/public/explore/hosts/components/host_risk_score_table/translations.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/host_risk_score_table/translations.ts similarity index 100% rename from x-pack/plugins/security_solution/public/explore/hosts/components/host_risk_score_table/translations.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/host_risk_score_table/translations.ts diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_details_tab_body/index.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_details_tab_body/index.test.tsx similarity index 84% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/risk_details_tab_body/index.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_details_tab_body/index.test.tsx index d446645a739da..c521542f1f7b1 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_details_tab_body/index.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_details_tab_body/index.test.tsx @@ -7,18 +7,17 @@ import React from 'react'; import { render } from '@testing-library/react'; -import { TestProviders } from '../../../../common/mock'; -import { useQueryToggle } from '../../../../common/containers/query_toggle'; - -import { useRiskScore } from '../../../containers/risk_score'; +import { TestProviders } from '../../../common/mock'; +import { useQueryToggle } from '../../../common/containers/query_toggle'; import { RiskDetailsTabBody } from '.'; -import { RiskScoreEntity } from '../../../../../common/search_strategy'; -import { HostsType } from '../../../hosts/store/model'; -import { UsersType } from '../../../users/store/model'; +import { RiskScoreEntity } from '../../../../common/search_strategy'; +import { HostsType } from '../../../explore/hosts/store/model'; +import { UsersType } from '../../../explore/users/store/model'; +import { useRiskScore } from '../../api/hooks/use_risk_score'; -jest.mock('../../../containers/risk_score'); -jest.mock('../../../../common/containers/query_toggle'); -jest.mock('../../../../common/lib/kibana'); +jest.mock('../../api/hooks/use_risk_score'); +jest.mock('../../../common/containers/query_toggle'); +jest.mock('../../../common/lib/kibana'); describe.each([RiskScoreEntity.host, RiskScoreEntity.user])( 'Risk Tab Body entityType: %s', diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_details_tab_body/index.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_details_tab_body/index.tsx similarity index 85% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/risk_details_tab_body/index.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_details_tab_body/index.tsx index 37b61a86fbea3..ed132ade204dd 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_details_tab_body/index.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_details_tab_body/index.tsx @@ -9,33 +9,30 @@ import { EuiButton, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import React, { useCallback, useMemo } from 'react'; import styled from 'styled-components'; -import { RISKY_HOSTS_DASHBOARD_TITLE, RISKY_USERS_DASHBOARD_TITLE } from '../constants'; +import { RISKY_HOSTS_DASHBOARD_TITLE, RISKY_USERS_DASHBOARD_TITLE } from '../risk_score/constants'; import { EnableRiskScore } from '../enable_risk_score'; -import { useDeepEqualSelector } from '../../../../common/hooks/use_selector'; -import type { State } from '../../../../common/store'; -import { hostsModel, hostsSelectors } from '../../../hosts/store'; -import { usersSelectors } from '../../../users/store'; +import { useDeepEqualSelector } from '../../../common/hooks/use_selector'; +import type { State } from '../../../common/store'; +import { hostsModel, hostsSelectors } from '../../../explore/hosts/store'; +import { usersSelectors } from '../../../explore/users/store'; import { RiskInformationButtonEmpty } from '../risk_information'; import * as i18n from './translations'; -import { useQueryInspector } from '../../../../common/components/page/manage_query'; +import { useQueryInspector } from '../../../common/components/page/manage_query'; import { RiskScoreOverTime } from '../risk_score_over_time'; import { TopRiskScoreContributors } from '../top_risk_score_contributors'; import { TopRiskScoreContributorsAlerts } from '../top_risk_score_contributors_alerts'; -import { useQueryToggle } from '../../../../common/containers/query_toggle'; -import { - HostRiskScoreQueryId, - UserRiskScoreQueryId, - useRiskScore, -} from '../../../containers/risk_score'; -import type { HostRiskScore, UserRiskScore } from '../../../../../common/search_strategy'; -import { buildEntityNameFilter, RiskScoreEntity } from '../../../../../common/search_strategy'; -import type { UsersComponentsQueryProps } from '../../../users/pages/navigation/types'; -import type { HostsComponentsQueryProps } from '../../../hosts/pages/navigation/types'; -import { useDashboardHref } from '../../../../common/hooks/use_dashboard_href'; +import { useQueryToggle } from '../../../common/containers/query_toggle'; +import type { HostRiskScore, UserRiskScore } from '../../../../common/search_strategy'; +import { buildEntityNameFilter, RiskScoreEntity } from '../../../../common/search_strategy'; +import type { UsersComponentsQueryProps } from '../../../explore/users/pages/navigation/types'; +import type { HostsComponentsQueryProps } from '../../../explore/hosts/pages/navigation/types'; +import { useDashboardHref } from '../../../common/hooks/use_dashboard_href'; import { RiskScoresNoDataDetected } from '../risk_score_onboarding/risk_score_no_data_detected'; -import { useRiskEngineStatus } from '../../../../entity_analytics/api/hooks/use_risk_engine_status'; -import { RiskScoreUpdatePanel } from '../../../../entity_analytics/components/risk_score_update_panel'; +import { useRiskEngineStatus } from '../../api/hooks/use_risk_engine_status'; +import { RiskScoreUpdatePanel } from '../risk_score_update_panel'; +import { HostRiskScoreQueryId, UserRiskScoreQueryId } from '../../common/utils'; +import { useRiskScore } from '../../api/hooks/use_risk_score'; const StyledEuiFlexGroup = styled(EuiFlexGroup)` margin-top: ${({ theme }) => theme.eui.euiSizeL}; diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_details_tab_body/translations.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_details_tab_body/translations.ts similarity index 83% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/risk_details_tab_body/translations.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_details_tab_body/translations.ts index 4a98a8fc749d4..f24f0716e4eb8 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_details_tab_body/translations.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_details_tab_body/translations.ts @@ -6,8 +6,8 @@ */ import { i18n } from '@kbn/i18n'; -import type { RiskScoreEntity } from '../../../../../common/search_strategy'; -import { getRiskEntityTranslation } from '../translations'; +import type { RiskScoreEntity } from '../../../../common/search_strategy'; +import { getRiskEntityTranslation } from '../risk_score/translations'; export const RISK_SCORE_OVER_TIME = (riskEntity: RiskScoreEntity) => i18n.translate('xpack.securitySolution.riskTabBody.scoreOverTimeTitle', { diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_information/index.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_information/index.test.tsx similarity index 92% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/risk_information/index.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_information/index.test.tsx index 19e21a57e5559..44aee022f2f53 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_information/index.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_information/index.test.tsx @@ -8,8 +8,8 @@ import { render, fireEvent } from '@testing-library/react'; import React from 'react'; import { RiskInformationButtonEmpty, RiskInformationButtonIcon } from '.'; -import { TestProviders } from '../../../../common/mock'; -import { RiskScoreEntity } from '../../../../../common/search_strategy'; +import { TestProviders } from '../../../common/mock'; +import { RiskScoreEntity } from '../../../../common/search_strategy'; describe.each([RiskScoreEntity.host, RiskScoreEntity.user])( 'Risk Information entityType: %s', diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_information/index.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_information/index.tsx similarity index 98% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/risk_information/index.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_information/index.tsx index bd099341419f0..888854cebeb51 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_information/index.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_information/index.tsx @@ -30,9 +30,9 @@ import { FormattedMessage } from '@kbn/i18n-react'; import { css } from '@emotion/react'; import * as i18n from './translations'; -import { useOnOpenCloseHandler } from '../../../../helper_hooks'; +import { useOnOpenCloseHandler } from '../../../helper_hooks'; import { RiskScoreLevel } from '../severity/common'; -import { RiskScoreEntity, RiskSeverity } from '../../../../../common/search_strategy'; +import { RiskScoreEntity, RiskSeverity } from '../../../../common/search_strategy'; import { RiskScoreDocLink } from '../risk_score_onboarding/risk_score_doc_link'; import { BETA } from '../risk_score_onboarding/translations'; diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_information/translations.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_information/translations.ts similarity index 91% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/risk_information/translations.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_information/translations.ts index 20fa22bbc26f5..114da512b9974 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_information/translations.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_information/translations.ts @@ -6,8 +6,8 @@ */ import { i18n } from '@kbn/i18n'; -import type { RiskScoreEntity } from '../../../../../common/search_strategy'; -import { getRiskEntityTranslation } from '../translations'; +import type { RiskScoreEntity } from '../../../../common/search_strategy'; +import { getRiskEntityTranslation } from '../risk_score/translations'; export const INFORMATION_LEVEL_HEADER = i18n.translate( 'xpack.securitySolution.riskInformation.levelHeader', diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/constants.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score/constants.ts similarity index 100% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/constants.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_score/constants.ts diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/translations.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score/translations.ts similarity index 100% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/translations.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_score/translations.ts diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/common/risk_score_donut_chart.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_donut_chart/index.test.tsx similarity index 78% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/common/risk_score_donut_chart.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_donut_chart/index.test.tsx index 1b93d6545d838..30a05bcfef126 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/common/risk_score_donut_chart.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_donut_chart/index.test.tsx @@ -5,12 +5,12 @@ * 2.0. */ -import { RiskSeverity } from '../../../../../common/search_strategy'; -import type { SeverityCount } from '../../../../explore/components/risk_score/severity/types'; +import { RiskSeverity } from '../../../../common/search_strategy'; +import type { SeverityCount } from '../severity/types'; import { render } from '@testing-library/react'; import React from 'react'; -import { RiskScoreDonutChart } from './risk_score_donut_chart'; -import { TestProviders } from '../../../../common/mock'; +import { RiskScoreDonutChart } from '.'; +import { TestProviders } from '../../../common/mock'; const severityCount: SeverityCount = { [RiskSeverity.low]: 1, diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/common/risk_score_donut_chart.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_donut_chart/index.tsx similarity index 67% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/common/risk_score_donut_chart.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_donut_chart/index.tsx index 2bb850e0c312c..92ae592368ba5 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/common/risk_score_donut_chart.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_donut_chart/index.tsx @@ -8,16 +8,16 @@ import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import React from 'react'; import styled from 'styled-components'; -import { RISK_SEVERITY_COLOUR } from '../../../../entity_analytics/common/utils'; -import type { SeverityCount } from '../../../../explore/components/risk_score/severity/types'; +import { i18n } from '@kbn/i18n'; +import { ChartLabel } from '../../../overview/components/detection_response/alerts_by_status/chart_label'; +import { RISK_SEVERITY_COLOUR } from '../../common/utils'; +import type { SeverityCount } from '../severity/types'; import { useRiskDonutChartData } from './use_risk_donut_chart_data'; -import type { FillColor } from '../../../../common/components/charts/donutchart'; -import { emptyDonutColor } from '../../../../common/components/charts/donutchart_empty'; -import { DonutChart } from '../../../../common/components/charts/donutchart'; -import { Legend } from '../../../../common/components/charts/legend'; -import { ChartLabel } from '../../detection_response/alerts_by_status/chart_label'; -import * as i18n from './translations'; -import type { RiskSeverity } from '../../../../../common/search_strategy'; +import type { FillColor } from '../../../common/components/charts/donutchart'; +import { emptyDonutColor } from '../../../common/components/charts/donutchart_empty'; +import { DonutChart } from '../../../common/components/charts/donutchart'; +import { Legend } from '../../../common/components/charts/legend'; +import type { RiskSeverity } from '../../../../common/search_strategy'; const DONUT_HEIGHT = 120; @@ -53,7 +53,10 @@ export const RiskScoreDonutChart = ({ severityCount }: RiskScoreDonutChartProps) data={donutChartData ?? null} fillColor={fillColor} height={DONUT_HEIGHT} - label={i18n.TOTAL_LABEL} + label={i18n.translate( + 'xpack.securitySolution.entityAnalytics.riskScore.donut_chart.totalLabel', + { defaultMessage: 'Total' } + )} title={} totalCount={total} /> diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/common/use_risk_donut_chart_data.test.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_donut_chart/use_risk_donut_chart_data.test.ts similarity index 88% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/common/use_risk_donut_chart_data.test.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_donut_chart/use_risk_donut_chart_data.test.ts index 2a7af3c2a28aa..933a9f98b5bea 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/common/use_risk_donut_chart_data.test.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_donut_chart/use_risk_donut_chart_data.test.ts @@ -6,9 +6,9 @@ */ import { renderHook } from '@testing-library/react-hooks'; -import { RiskSeverity } from '../../../../../common/search_strategy'; +import { RiskSeverity } from '../../../../common/search_strategy'; import { useRiskDonutChartData } from './use_risk_donut_chart_data'; -import type { SeverityCount } from '../../../../explore/components/risk_score/severity/types'; +import type { SeverityCount } from '../severity/types'; describe('useRiskDonutChartData', () => { it('returns the total', () => { diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/common/use_risk_donut_chart_data.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_donut_chart/use_risk_donut_chart_data.ts similarity index 70% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/common/use_risk_donut_chart_data.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_donut_chart/use_risk_donut_chart_data.ts index 4b31142aef3c9..8505f229d893f 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/common/use_risk_donut_chart_data.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_donut_chart/use_risk_donut_chart_data.ts @@ -6,11 +6,11 @@ */ import { sum } from 'lodash/fp'; import { useMemo } from 'react'; -import { RISK_SEVERITY_COLOUR } from '../../../../entity_analytics/common/utils'; -import type { LegendItem } from '../../../../common/components/charts/legend_item'; -import type { SeverityCount } from '../../../../explore/components/risk_score/severity/types'; -import type { DonutChartProps } from '../../../../common/components/charts/donutchart'; -import type { RiskSeverity } from '../../../../../common/search_strategy'; +import { RISK_SEVERITY_COLOUR } from '../../common/utils'; +import type { LegendItem } from '../../../common/components/charts/legend_item'; +import type { SeverityCount } from '../severity/types'; +import type { DonutChartProps } from '../../../common/components/charts/donutchart'; +import type { RiskSeverity } from '../../../../common/search_strategy'; const legendField = 'kibana.alert.severity'; diff --git a/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_enable_section.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_enable_section.tsx index fa61a6c15b9e8..8e49e90c4cadd 100644 --- a/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_enable_section.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_enable_section.tsx @@ -37,7 +37,7 @@ import { useEnableRiskEngineMutation } from '../api/hooks/use_enable_risk_engine import { useDisableRiskEngineMutation } from '../api/hooks/use_disable_risk_engine_mutation'; import { RiskEngineStatus, MAX_SPACES_COUNT } from '../../../common/entity_analytics/risk_engine'; -import { RiskInformationFlyout } from '../../explore/components/risk_score/risk_information'; +import { RiskInformationFlyout } from './risk_information'; import { useOnOpenCloseHandler } from '../../helper_hooks'; import type { RiskEngineMissingPrivilegesResponse } from '../hooks/use_missing_risk_engine_privileges'; diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_doc_link.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/risk_score_doc_link.tsx similarity index 85% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_doc_link.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/risk_score_doc_link.tsx index a54bb9e627626..ca7b67134b29d 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_doc_link.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/risk_score_doc_link.tsx @@ -7,9 +7,9 @@ import { EuiLink } from '@elastic/eui'; import React, { useMemo } from 'react'; -import { RiskScoreEntity } from '../../../../../common/search_strategy'; -import { LEARN_MORE } from '../../../../overview/components/entity_analytics/risk_score/translations'; -import { useKibana } from '../../../../common/lib/kibana'; +import { RiskScoreEntity } from '../../../../common/search_strategy'; +import { useKibana } from '../../../common/lib/kibana'; +import { LEARN_MORE } from '../entity_analytics_risk_score/translations'; const useLearnMoreLinkForEntity = (riskScoreEntity?: RiskScoreEntity) => { const { docLinks } = useKibana().services; diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_enable_button.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/risk_score_enable_button.test.tsx similarity index 89% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_enable_button.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/risk_score_enable_button.test.tsx index a92496316c3ce..92e022b55aeeb 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_enable_button.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/risk_score_enable_button.test.tsx @@ -6,8 +6,8 @@ */ import { render, screen } from '@testing-library/react'; import React from 'react'; -import { RiskScoreEntity } from '../../../../../common/search_strategy'; -import { TestProviders } from '../../../../common/mock'; +import { RiskScoreEntity } from '../../../../common/search_strategy'; +import { TestProviders } from '../../../common/mock'; import { RiskScoreEnableButton } from './risk_score_enable_button'; diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_enable_button.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/risk_score_enable_button.tsx similarity index 81% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_enable_button.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/risk_score_enable_button.tsx index 6e84308911edd..e6242e75677c1 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_enable_button.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/risk_score_enable_button.tsx @@ -9,16 +9,16 @@ import { EuiButton } from '@elastic/eui'; import React, { useCallback } from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; -import type { RiskScoreEntity } from '../../../../../common/search_strategy'; -import { useSpaceId } from '../../../../common/hooks/use_space_id'; -import { useKibana } from '../../../../common/lib/kibana'; -import type { inputsModel } from '../../../../common/store'; -import { REQUEST_NAMES, useFetch } from '../../../../common/hooks/use_fetch'; +import type { RiskScoreEntity } from '../../../../common/search_strategy'; +import { useSpaceId } from '../../../common/hooks/use_space_id'; +import { useKibana } from '../../../common/lib/kibana'; +import type { inputsModel } from '../../../common/store'; +import { REQUEST_NAMES, useFetch } from '../../../common/hooks/use_fetch'; import { useRiskScoreToastContent } from './use_risk_score_toast_content'; import { installRiskScoreModule } from './utils'; -import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features'; -import { SecuritySolutionLinkButton } from '../../../../common/components/links'; -import { SecurityPageName } from '../../../../../common/constants'; +import { useIsExperimentalFeatureEnabled } from '../../../common/hooks/use_experimental_features'; +import { SecuritySolutionLinkButton } from '../../../common/components/links'; +import { SecurityPageName } from '../../../../common/constants'; const RiskScoreEnableButtonComponent = ({ refetch, diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_header_title.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/risk_score_header_title.tsx similarity index 53% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_header_title.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/risk_score_header_title.tsx index 741469833f92d..1ec4edd65fe3b 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_header_title.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/risk_score_header_title.tsx @@ -4,10 +4,11 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ + import React from 'react'; +import { FormattedMessage } from '@kbn/i18n-react'; -import { RiskScoreEntity } from '../../../../../common/search_strategy'; -import * as i18n from '../../../../overview/components/entity_analytics/common/translations'; +import { RiskScoreEntity } from '../../../../common/search_strategy'; const RiskScoreHeaderTitleComponent = ({ riskScoreEntity, @@ -18,7 +19,17 @@ const RiskScoreHeaderTitleComponent = ({ }) => ( <> {title ?? - (riskScoreEntity === RiskScoreEntity.user ? i18n.USER_RISK_TITLE : i18n.HOST_RISK_TITLE)} + (riskScoreEntity === RiskScoreEntity.user ? ( + + ) : ( + + ))} ); diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_no_data_detected.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/risk_score_no_data_detected.tsx similarity index 84% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_no_data_detected.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/risk_score_no_data_detected.tsx index 533a7d00729cd..c7bd233c7030a 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_no_data_detected.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/risk_score_no_data_detected.tsx @@ -7,14 +7,14 @@ import { EuiEmptyPrompt, EuiPanel, EuiToolTip } from '@elastic/eui'; import React, { useMemo } from 'react'; -import { RiskScoreEntity } from '../../../../../common/search_strategy'; +import { RiskScoreEntity } from '../../../../common/search_strategy'; -import { HeaderSection } from '../../../../common/components/header_section'; +import { HeaderSection } from '../../../common/components/header_section'; import * as i18n from './translations'; import { RiskScoreHeaderTitle } from './risk_score_header_title'; import { RiskScoreRestartButton } from './risk_score_restart_button'; -import type { inputsModel } from '../../../../common/store'; -import { useIsNewRiskScoreModuleInstalled } from '../../../../entity_analytics/api/hooks/use_risk_engine_status'; +import type { inputsModel } from '../../../common/store'; +import { useIsNewRiskScoreModuleInstalled } from '../../api/hooks/use_risk_engine_status'; const RiskScoresNoDataDetectedComponent = ({ entityType, diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_restart_button.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/risk_score_restart_button.test.tsx similarity index 94% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_restart_button.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/risk_score_restart_button.test.tsx index d6785847cd833..dbccdd9a0c085 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_restart_button.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/risk_score_restart_button.test.tsx @@ -7,8 +7,8 @@ import { act, render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import React from 'react'; -import { RiskScoreEntity } from '../../../../../common/search_strategy'; -import { TestProviders } from '../../../../common/mock'; +import { RiskScoreEntity } from '../../../../common/search_strategy'; +import { TestProviders } from '../../../common/mock'; import { RiskScoreRestartButton } from './risk_score_restart_button'; import { restartRiskScoreTransforms } from './utils'; diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_restart_button.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/risk_score_restart_button.tsx similarity index 83% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_restart_button.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/risk_score_restart_button.tsx index be1f5b5d16621..7f4316b77ee97 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_restart_button.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/risk_score_restart_button.tsx @@ -9,11 +9,11 @@ import { EuiButton } from '@elastic/eui'; import React, { useCallback } from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; -import type { RiskScoreEntity } from '../../../../../common/search_strategy'; -import { useSpaceId } from '../../../../common/hooks/use_space_id'; -import { useKibana } from '../../../../common/lib/kibana'; -import type { inputsModel } from '../../../../common/store'; -import { REQUEST_NAMES, useFetch } from '../../../../common/hooks/use_fetch'; +import type { RiskScoreEntity } from '../../../../common/search_strategy'; +import { useSpaceId } from '../../../common/hooks/use_space_id'; +import { useKibana } from '../../../common/lib/kibana'; +import type { inputsModel } from '../../../common/store'; +import { REQUEST_NAMES, useFetch } from '../../../common/hooks/use_fetch'; import { useRiskScoreToastContent } from './use_risk_score_toast_content'; import { restartRiskScoreTransforms } from './utils'; diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/translations.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/translations.ts similarity index 93% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/translations.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/translations.ts index 105036bd1be33..f8bcbf29725f9 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/translations.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/translations.ts @@ -5,8 +5,8 @@ * 2.0. */ import { i18n } from '@kbn/i18n'; -import type { RiskScoreEntity } from '../../../../../common/entity_analytics/risk_engine'; -import { getRiskEntityTranslation } from '../translations'; +import type { RiskScoreEntity } from '../../../../common/entity_analytics/risk_engine'; +import { getRiskEntityTranslation } from '../risk_score/translations'; export const BETA = i18n.translate('xpack.securitySolution.riskScore.technicalPreviewLabel', { defaultMessage: 'Beta', diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/use_risk_score_toast_content.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/use_risk_score_toast_content.tsx similarity index 94% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/use_risk_score_toast_content.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/use_risk_score_toast_content.tsx index 60c00ab9d8cb6..7df01d9f8bd86 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/use_risk_score_toast_content.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/use_risk_score_toast_content.tsx @@ -10,7 +10,7 @@ import React, { useCallback, useMemo } from 'react'; import styled from 'styled-components'; import { FormattedMessage } from '@kbn/i18n-react'; -import type { RiskScoreEntity } from '../../../../../common/search_strategy'; +import type { RiskScoreEntity } from '../../../../common/search_strategy'; import { RiskScoreDocLink } from './risk_score_doc_link'; const StyledButton = styled(EuiButton)` diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/utils.test.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/utils.test.ts similarity index 94% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/utils.test.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/utils.test.ts index 770c5b8caf72d..816ba871249d2 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/utils.test.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/utils.test.ts @@ -5,26 +5,26 @@ * 2.0. */ import type { HttpSetup } from '@kbn/core/public'; -import { RiskScoreEntity } from '../../../../../common/search_strategy'; +import { RiskScoreEntity } from '../../../../common/search_strategy'; import { getIngestPipelineName, getLegacyIngestPipelineName, getRiskScoreLatestTransformId, getRiskScorePivotTransformId, -} from '../../../../../common/utils/risk_score_modules'; +} from '../../../../common/utils/risk_score_modules'; import { bulkDeletePrebuiltSavedObjects, bulkCreatePrebuiltSavedObjects, -} from '../../../containers/risk_score/onboarding/api'; +} from '../../deprecated_risk_engine/api'; -import * as api from '../../../containers/risk_score/onboarding/api'; +import * as api from '../../deprecated_risk_engine/api'; import { installRiskScoreModule, restartRiskScoreTransforms, uninstallRiskScoreModule, } from './utils'; -jest.mock('../../../containers/risk_score/onboarding/api'); +jest.mock('../../deprecated_risk_engine/api'); const mockHttp = { post: jest.fn(), diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/utils.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/utils.ts similarity index 96% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/utils.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/utils.ts index 65677900f979e..f1e582e1ed847 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/utils.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_onboarding/utils.ts @@ -6,9 +6,9 @@ */ import type { HttpSetup, NotificationsStart, ThemeServiceStart } from '@kbn/core/public'; import type { DashboardStart } from '@kbn/dashboard-plugin/public'; -import { RiskScoreEntity } from '../../../../../common/search_strategy'; -import * as utils from '../../../../../common/utils/risk_score_modules'; -import type { inputsModel } from '../../../../common/store'; +import { RiskScoreEntity } from '../../../../common/search_strategy'; +import * as utils from '../../../../common/utils/risk_score_modules'; +import type { inputsModel } from '../../../common/store'; import { deleteStoredScripts, @@ -19,12 +19,12 @@ import { bulkCreatePrebuiltSavedObjects, stopTransforms, startTransforms, -} from '../../../containers/risk_score/onboarding/api'; +} from '../../deprecated_risk_engine/api'; import { INGEST_PIPELINE_DELETION_ERROR_MESSAGE, TRANSFORM_DELETION_ERROR_MESSAGE, UNINSTALLATION_ERROR, -} from '../../../containers/risk_score/onboarding/api/translations'; +} from '../../deprecated_risk_engine/api/translations'; interface InstallRiskScoreModule { dashboard?: DashboardStart; diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_over_time/index.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_over_time/index.test.tsx similarity index 85% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_over_time/index.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_over_time/index.test.tsx index 109a51c1a829c..22458a6d00fd1 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_over_time/index.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_over_time/index.test.tsx @@ -8,10 +8,10 @@ import { render } from '@testing-library/react'; import React from 'react'; import { RiskScoreOverTime, scoreFormatter } from '.'; -import { TestProviders } from '../../../../common/mock'; +import { TestProviders } from '../../../common/mock'; import { LineSeries } from '@elastic/charts'; -import { RiskScoreEntity } from '../../../../../common/search_strategy'; -import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features'; +import { RiskScoreEntity } from '../../../../common/search_strategy'; +import { useIsExperimentalFeatureEnabled } from '../../../common/hooks/use_experimental_features'; const mockLineSeries = LineSeries as jest.Mock; const mockUseIsExperimentalFeatureEnabled = useIsExperimentalFeatureEnabled as jest.Mock; @@ -23,11 +23,11 @@ jest.mock('@elastic/charts', () => { }; }); -jest.mock('../../../../common/hooks/use_experimental_features', () => ({ +jest.mock('../../../common/hooks/use_experimental_features', () => ({ useIsExperimentalFeatureEnabled: jest.fn(), })); -jest.mock('../../../../common/components/visualization_actions/visualization_embeddable'); -jest.mock('../../../../common/hooks/use_space_id', () => ({ +jest.mock('../../../common/components/visualization_actions/visualization_embeddable'); +jest.mock('../../../common/hooks/use_space_id', () => ({ useSpaceId: jest.fn().mockReturnValue('default'), })); diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_over_time/index.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_over_time/index.tsx similarity index 87% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_over_time/index.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_over_time/index.tsx index 96381b3681c8b..210f578b36ad7 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_over_time/index.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_over_time/index.tsx @@ -22,23 +22,23 @@ import { EuiFlexGroup, EuiFlexItem, EuiLoadingChart, EuiText, EuiPanel } from '@ import styled from 'styled-components'; import { euiThemeVars } from '@kbn/ui-theme'; import { i18n } from '@kbn/i18n'; -import { chartDefaultSettings, useThemes } from '../../../../common/components/charts/common'; -import { useTimeZone } from '../../../../common/lib/kibana'; -import { histogramDateTimeFormatter } from '../../../../common/components/utils'; -import { HeaderSection } from '../../../../common/components/header_section'; -import { InspectButton, InspectButtonContainer } from '../../../../common/components/inspect'; +import { chartDefaultSettings, useThemes } from '../../../common/components/charts/common'; +import { useTimeZone } from '../../../common/lib/kibana'; +import { histogramDateTimeFormatter } from '../../../common/components/utils'; +import { HeaderSection } from '../../../common/components/header_section'; +import { InspectButton, InspectButtonContainer } from '../../../common/components/inspect'; import * as translations from './translations'; -import { PreferenceFormattedDate } from '../../../../common/components/formatted_date'; +import { PreferenceFormattedDate } from '../../../common/components/formatted_date'; import type { HostRiskScore, RiskScoreEntity, UserRiskScore, -} from '../../../../../common/search_strategy'; -import { isUserRiskScore } from '../../../../../common/search_strategy'; -import { useSpaceId } from '../../../../common/hooks/use_space_id'; -import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features'; -import { VisualizationEmbeddable } from '../../../../common/components/visualization_actions/visualization_embeddable'; -import { getRiskScoreOverTimeAreaAttributes } from '../../../../common/components/visualization_actions/lens_attributes/common/risk_scores/risk_score_over_time_area'; +} from '../../../../common/search_strategy'; +import { isUserRiskScore } from '../../../../common/search_strategy'; +import { useSpaceId } from '../../../common/hooks/use_space_id'; +import { useIsExperimentalFeatureEnabled } from '../../../common/hooks/use_experimental_features'; +import { VisualizationEmbeddable } from '../../../common/components/visualization_actions/visualization_embeddable'; +import { getRiskScoreOverTimeAreaAttributes } from '../../lens_attributes/risk_score_over_time_area'; export interface RiskScoreOverTimeProps { from: string; diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_over_time/translations.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_over_time/translations.ts similarity index 100% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_over_time/translations.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_over_time/translations.ts diff --git a/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_preview_table.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_preview_table.tsx index 05fa3c18809a6..9b3a362e63495 100644 --- a/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_preview_table.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_preview_table.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { EuiInMemoryTable } from '@elastic/eui'; import type { EuiBasicTableColumn } from '@elastic/eui'; import type { RiskSeverity } from '../../../common/search_strategy'; -import { RiskScoreLevel } from '../../explore/components/risk_score/severity/common'; +import { RiskScoreLevel } from './severity/common'; import { HostDetailsLink, UserDetailsLink } from '../../common/components/links'; import { diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/risk_summary.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_summary.test.tsx similarity index 89% rename from x-pack/plugins/security_solution/public/common/components/event_details/cti_details/risk_summary.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_summary.test.tsx index a02c7729f4e0a..9bb495118385f 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/risk_summary.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_summary.test.tsx @@ -8,12 +8,12 @@ import React from 'react'; import { render } from '@testing-library/react'; -import { TestProviders } from '../../../mock'; +import { TestProviders } from '../../common/mock'; import type { RiskEntity } from './risk_summary'; -import * as i18n from './translations'; +import * as i18n from '../../common/components/event_details/cti_details/translations'; import { RiskSummary } from './risk_summary'; -import { RiskScoreEntity, RiskSeverity } from '../../../../../common/search_strategy'; -import { getEmptyValue } from '../../empty_value'; +import { RiskScoreEntity, RiskSeverity } from '../../../common/search_strategy'; +import { getEmptyValue } from '../../common/components/empty_value'; describe.each([RiskScoreEntity.host, RiskScoreEntity.user])( 'RiskSummary entityType: %s', diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/risk_summary.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_summary.tsx similarity index 80% rename from x-pack/plugins/security_solution/public/common/components/event_details/cti_details/risk_summary.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_summary.tsx index e0bc4637ea54b..df3933ae50e5b 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/risk_summary.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_summary.tsx @@ -8,15 +8,18 @@ import React from 'react'; import { EuiLoadingSpinner, EuiPanel } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; -import * as i18n from './translations'; -import { EnrichedDataRow, ThreatSummaryPanelHeader } from './threat_summary_view'; -import { RiskScoreLevel } from '../../../../explore/components/risk_score/severity/common'; -import type { RiskSeverity } from '../../../../../common/search_strategy'; -import { RiskScoreEntity } from '../../../../../common/search_strategy'; -import type { HostRisk, UserRisk } from '../../../../explore/containers/risk_score'; -import { getEmptyValue } from '../../empty_value'; -import { RiskScoreDocLink } from '../../../../explore/components/risk_score/risk_score_onboarding/risk_score_doc_link'; -import { RiskScoreHeaderTitle } from '../../../../explore/components/risk_score/risk_score_onboarding/risk_score_header_title'; +import * as i18n from '../../common/components/event_details/cti_details/translations'; +import { + EnrichedDataRow, + ThreatSummaryPanelHeader, +} from '../../common/components/event_details/cti_details/threat_summary_view'; +import { RiskScoreLevel } from './severity/common'; +import type { RiskSeverity } from '../../../common/search_strategy'; +import { RiskScoreEntity } from '../../../common/search_strategy'; +import { getEmptyValue } from '../../common/components/empty_value'; +import { RiskScoreDocLink } from './risk_score_onboarding/risk_score_doc_link'; +import { RiskScoreHeaderTitle } from './risk_score_onboarding/risk_score_header_title'; +import type { HostRisk, UserRisk } from '../api/types'; interface HostRiskEntity { originalRisk?: RiskSeverity | undefined; diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/shared/components/risk_summary.stories.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_summary_flyout/risk_summary.stories.tsx similarity index 86% rename from x-pack/plugins/security_solution/public/flyout/entity_details/shared/components/risk_summary.stories.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_summary_flyout/risk_summary.stories.tsx index 06828be073f32..0f00959845ff3 100644 --- a/x-pack/plugins/security_solution/public/flyout/entity_details/shared/components/risk_summary.stories.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_summary_flyout/risk_summary.stories.tsx @@ -9,8 +9,8 @@ import React from 'react'; import type { Story } from '@storybook/react'; import type { ExpandableFlyoutContextValue } from '@kbn/expandable-flyout/src/context'; import { ExpandableFlyoutContext } from '@kbn/expandable-flyout/src/context'; -import { StorybookProviders } from '../../../../common/mock/storybook_providers'; -import { mockRiskScoreState } from '../../../../timelines/components/side_panel/new_user_detail/__mocks__'; +import { StorybookProviders } from '../../../common/mock/storybook_providers'; +import { mockRiskScoreState } from '../../../timelines/components/side_panel/new_user_detail/__mocks__'; import { RiskSummary } from './risk_summary'; export default { diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/shared/components/risk_summary.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_summary_flyout/risk_summary.test.tsx similarity index 90% rename from x-pack/plugins/security_solution/public/flyout/entity_details/shared/components/risk_summary.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_summary_flyout/risk_summary.test.tsx index fb89ef61ad79f..5862ac7cd9464 100644 --- a/x-pack/plugins/security_solution/public/flyout/entity_details/shared/components/risk_summary.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_summary_flyout/risk_summary.test.tsx @@ -7,11 +7,11 @@ import { render } from '@testing-library/react'; import React from 'react'; -import { TestProviders } from '../../../../common/mock'; -import { mockRiskScoreState } from '../../user_right/mocks'; +import { TestProviders } from '../../../common/mock'; +import { mockRiskScoreState } from '../../../flyout/entity_details/user_right/mocks'; import { RiskSummary } from './risk_summary'; -jest.mock('../../../../common/components/visualization_actions/visualization_embeddable'); +jest.mock('../../../common/components/visualization_actions/visualization_embeddable'); describe('RiskSummary', () => { it('renders risk summary table', () => { diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/shared/components/risk_summary.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_summary_flyout/risk_summary.tsx similarity index 90% rename from x-pack/plugins/security_solution/public/flyout/entity_details/shared/components/risk_summary.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/risk_summary_flyout/risk_summary.tsx index 09c57cc61e02b..50259cd6ca134 100644 --- a/x-pack/plugins/security_solution/public/flyout/entity_details/shared/components/risk_summary.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_summary_flyout/risk_summary.tsx @@ -21,15 +21,15 @@ import { css } from '@emotion/react'; import { FormattedMessage } from '@kbn/i18n-react'; import { euiThemeVars } from '@kbn/ui-theme'; import { i18n } from '@kbn/i18n'; -import { InspectButton, InspectButtonContainer } from '../../../../common/components/inspect'; -import { ONE_WEEK_IN_HOURS } from '../../../../timelines/components/side_panel/new_user_detail/constants'; -import { FormattedRelativePreferenceDate } from '../../../../common/components/formatted_date'; -import { RiskScoreEntity } from '../../../../../common/entity_analytics/risk_engine'; -import type { RiskScoreState } from '../../../../explore/containers/risk_score'; -import { VisualizationEmbeddable } from '../../../../common/components/visualization_actions/visualization_embeddable'; -import { getRiskScoreSummaryAttributes } from '../../../../common/components/visualization_actions/lens_attributes/common/risk_scores/risk_score_summary'; -import { ExpandablePanel } from '../../../shared/components/expandable_panel'; -import { UserDetailsLeftPanelTab } from '../../user_detais_left/tabs'; +import { UserDetailsLeftPanelTab } from '../../../flyout/entity_details/user_details_left/tabs'; +import { InspectButton, InspectButtonContainer } from '../../../common/components/inspect'; +import { ONE_WEEK_IN_HOURS } from '../../../timelines/components/side_panel/new_user_detail/constants'; +import { FormattedRelativePreferenceDate } from '../../../common/components/formatted_date'; +import { RiskScoreEntity } from '../../../../common/entity_analytics/risk_engine'; +import { VisualizationEmbeddable } from '../../../common/components/visualization_actions/visualization_embeddable'; +import { ExpandablePanel } from '../../../flyout/shared/components/expandable_panel'; +import type { RiskScoreState } from '../../api/hooks/use_risk_score'; +import { getRiskScoreSummaryAttributes } from '../../lens_attributes/risk_score_summary'; export interface RiskSummaryProps { riskScoreData: RiskScoreState; diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/severity/common/index.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/severity/common/index.test.tsx similarity index 93% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/severity/common/index.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/severity/common/index.test.tsx index 9068c01a760ca..c9b75129bb0a2 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/severity/common/index.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/severity/common/index.test.tsx @@ -8,15 +8,15 @@ import { render } from '@testing-library/react'; import React from 'react'; -import { TestProviders } from '../../../../../common/mock'; +import { TestProviders } from '../../../../common/mock'; import type { EuiHealthProps } from '@elastic/eui'; import { EuiHealth } from '@elastic/eui'; import { euiThemeVars } from '@kbn/ui-theme'; -import { RiskSeverity } from '../../../../../../common/search_strategy'; +import { RiskSeverity } from '../../../../../common/search_strategy'; import { RiskScoreLevel } from '.'; -import { SEVERITY_COLOR } from '../../../../../overview/components/detection_response/utils'; +import { SEVERITY_COLOR } from '../../../../overview/components/detection_response/utils'; jest.mock('@elastic/eui', () => { const original = jest.requireActual('@elastic/eui'); diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/severity/common/index.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/severity/common/index.tsx similarity index 87% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/severity/common/index.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/severity/common/index.tsx index 9430690394b49..0706eb117c5d7 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/severity/common/index.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/severity/common/index.tsx @@ -12,9 +12,9 @@ import { EuiHealth, transparentize } from '@elastic/eui'; import styled, { css } from 'styled-components'; import { euiLightVars } from '@kbn/ui-theme'; -import { RISK_SEVERITY_COLOUR } from '../../../../../entity_analytics/common/utils'; -import { WithHoverActions } from '../../../../../common/components/with_hover_actions'; -import type { RiskSeverity } from '../../../../../../common/search_strategy'; +import { RISK_SEVERITY_COLOUR } from '../../../common/utils'; +import { WithHoverActions } from '../../../../common/components/with_hover_actions'; +import type { RiskSeverity } from '../../../../../common/search_strategy'; const RiskBadge = styled.div<{ $severity: RiskSeverity; $hideBackgroundColor: boolean }>` ${({ theme, $severity, $hideBackgroundColor }) => css` diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/severity/severity_badges.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/severity/severity_badges.tsx similarity index 91% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/severity/severity_badges.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/severity/severity_badges.tsx index 53c7e270f2e31..373a8dd5a5693 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/severity/severity_badges.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/severity/severity_badges.tsx @@ -7,8 +7,8 @@ import { EuiFlexGroup, EuiNotificationBadge, EuiFlexItem } from '@elastic/eui'; import React from 'react'; -import { RISK_SEVERITY_COLOUR } from '../../../../entity_analytics/common/utils'; -import type { RiskSeverity } from '../../../../../common/search_strategy'; +import { RISK_SEVERITY_COLOUR } from '../../common/utils'; +import type { RiskSeverity } from '../../../../common/search_strategy'; import { RiskScoreLevel } from './common'; import type { SeverityCount } from './types'; diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/severity/severity_bar.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/severity/severity_bar.tsx similarity index 90% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/severity/severity_bar.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/severity/severity_bar.tsx index 847488869bcd3..149d8f2cf74b9 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/severity/severity_bar.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/severity/severity_bar.tsx @@ -9,8 +9,8 @@ import styled from 'styled-components'; import { EuiColorPaletteDisplay } from '@elastic/eui'; import React, { useMemo } from 'react'; -import { RISK_SEVERITY_COLOUR } from '../../../../entity_analytics/common/utils'; -import type { RiskSeverity } from '../../../../../common/search_strategy'; +import { RISK_SEVERITY_COLOUR } from '../../common/utils'; +import type { RiskSeverity } from '../../../../common/search_strategy'; import type { SeverityCount } from './types'; const StyledEuiColorPaletteDisplay = styled(EuiColorPaletteDisplay)` diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/severity/severity_filter_group.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/severity/severity_filter_group.test.tsx similarity index 91% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/severity/severity_filter_group.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/severity/severity_filter_group.test.tsx index 07297f9af4042..ef978fdf80546 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/severity/severity_filter_group.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/severity/severity_filter_group.test.tsx @@ -7,12 +7,12 @@ import React from 'react'; import { render, fireEvent } from '@testing-library/react'; import { SeverityFilterGroup } from './severity_filter_group'; -import { RiskScoreEntity, RiskSeverity } from '../../../../../common/search_strategy'; -import { TestProviders } from '../../../../common/mock'; -import { createTelemetryServiceMock } from '../../../../common/lib/telemetry/telemetry_service.mock'; +import { RiskScoreEntity, RiskSeverity } from '../../../../common/search_strategy'; +import { TestProviders } from '../../../common/mock'; +import { createTelemetryServiceMock } from '../../../common/lib/telemetry/telemetry_service.mock'; const mockedTelemetry = createTelemetryServiceMock(); -jest.mock('../../../../common/lib/kibana', () => { +jest.mock('../../../common/lib/kibana', () => { return { useKibana: () => ({ services: { diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/severity/severity_filter_group.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/severity/severity_filter_group.tsx similarity index 94% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/severity/severity_filter_group.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/severity/severity_filter_group.tsx index 1ca7020bc818d..c5373199192a4 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/severity/severity_filter_group.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/severity/severity_filter_group.tsx @@ -16,12 +16,12 @@ import { useEuiTheme, } from '@elastic/eui'; -import { SEVERITY_UI_SORT_ORDER } from '../../../../entity_analytics/common/utils'; -import type { RiskScoreEntity, RiskSeverity } from '../../../../../common/search_strategy'; +import { SEVERITY_UI_SORT_ORDER } from '../../common/utils'; +import type { RiskScoreEntity, RiskSeverity } from '../../../../common/search_strategy'; import type { SeverityCount } from './types'; import { RiskScoreLevel } from './common'; -import { ENTITY_RISK_LEVEL } from '../translations'; -import { useKibana } from '../../../../common/lib/kibana'; +import { ENTITY_RISK_LEVEL } from '../risk_score/translations'; +import { useKibana } from '../../../common/lib/kibana'; interface SeverityItems { risk: RiskSeverity; diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/severity/types.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/severity/types.ts similarity index 80% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/severity/types.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/severity/types.ts index c4760b55b6a83..0c161ddd81470 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/severity/types.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/severity/types.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { RiskSeverity } from '../../../../../common/search_strategy'; +import type { RiskSeverity } from '../../../../common/search_strategy'; export type SeverityCount = { [k in RiskSeverity]: number; diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/common/styled_basic_table.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/styled_basic_table.tsx similarity index 100% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/common/styled_basic_table.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/styled_basic_table.tsx diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/top_risk_score_contributors/index.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/top_risk_score_contributors/index.test.tsx similarity index 91% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/top_risk_score_contributors/index.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/top_risk_score_contributors/index.test.tsx index 8b1f3e7cfffff..710b5427a7479 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/top_risk_score_contributors/index.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/top_risk_score_contributors/index.test.tsx @@ -8,11 +8,10 @@ import { render } from '@testing-library/react'; import React from 'react'; import { TopRiskScoreContributors } from '.'; -import { TestProviders } from '../../../../common/mock'; -import type { RuleRisk } from '../../../../../common/search_strategy'; +import { TestProviders } from '../../../common/mock'; +import type { RuleRisk } from '../../../../common/search_strategy'; -jest.mock('../../../../common/containers/query_toggle'); -jest.mock('../../../containers/risk_score'); +jest.mock('../../../common/containers/query_toggle'); const testProps = { riskScore: [], setQuery: jest.fn(), diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/top_risk_score_contributors/index.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/top_risk_score_contributors/index.tsx similarity index 91% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/top_risk_score_contributors/index.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/top_risk_score_contributors/index.tsx index 9f33fc9b7bc27..587f3a6082469 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/top_risk_score_contributors/index.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/top_risk_score_contributors/index.tsx @@ -10,13 +10,13 @@ import React, { useMemo } from 'react'; import type { EuiTableFieldDataColumnType } from '@elastic/eui'; import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiInMemoryTable } from '@elastic/eui'; -import { HeaderSection } from '../../../../common/components/header_section'; -import { InspectButton, InspectButtonContainer } from '../../../../common/components/inspect'; +import { HeaderSection } from '../../../common/components/header_section'; +import { InspectButton, InspectButtonContainer } from '../../../common/components/inspect'; import * as i18n from './translations'; -import type { RuleRisk } from '../../../../../common/search_strategy'; +import type { RuleRisk } from '../../../../common/search_strategy'; -import { RuleLink } from '../../../../detection_engine/rule_management_ui/components/rules_table/use_columns'; +import { RuleLink } from '../../../detection_engine/rule_management_ui/components/rules_table/use_columns'; export interface TopRiskScoreContributorsProps { loading: boolean; diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/top_risk_score_contributors/translations.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/top_risk_score_contributors/translations.ts similarity index 100% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/top_risk_score_contributors/translations.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/top_risk_score_contributors/translations.ts diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/top_risk_score_contributors_alerts/index.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/top_risk_score_contributors_alerts/index.tsx similarity index 78% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/top_risk_score_contributors_alerts/index.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/top_risk_score_contributors_alerts/index.tsx index 4223acb1f44d4..eac4de0fecf1c 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/top_risk_score_contributors_alerts/index.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/top_risk_score_contributors_alerts/index.tsx @@ -10,21 +10,21 @@ import { TableId } from '@kbn/securitysolution-data-table'; import { EuiFlexGroup, EuiFlexItem, EuiPanel } from '@elastic/eui'; import type { Filter } from '@kbn/es-query'; -import { HeaderSection } from '../../../../common/components/header_section'; +import { HeaderSection } from '../../../common/components/header_section'; import * as i18n from './translations'; -import type { RiskInputs } from '../../../../../common/entity_analytics/risk_engine'; -import { RiskScoreEntity } from '../../../../../common/entity_analytics/risk_engine'; -import type { HostRiskScore, UserRiskScore } from '../../../../../common/search_strategy'; -import { ALERTS_TABLE_REGISTRY_CONFIG_IDS } from '../../../../../common/constants'; -import { AlertsTableComponent } from '../../../../detections/components/alerts_table'; -import { GroupedAlertsTable } from '../../../../detections/components/alerts_table/alerts_grouping'; -import { useGlobalTime } from '../../../../common/containers/use_global_time'; -import { useDeepEqualSelector } from '../../../../common/hooks/use_selector'; -import { inputsSelectors } from '../../../../common/store/inputs'; -import { useUserData } from '../../../../detections/components/user_info'; -import { useSourcererDataView } from '../../../../common/containers/sourcerer'; -import { SourcererScopeName } from '../../../../common/store/sourcerer/model'; +import type { RiskInputs } from '../../../../common/entity_analytics/risk_engine'; +import { RiskScoreEntity } from '../../../../common/entity_analytics/risk_engine'; +import type { HostRiskScore, UserRiskScore } from '../../../../common/search_strategy'; +import { ALERTS_TABLE_REGISTRY_CONFIG_IDS } from '../../../../common/constants'; +import { AlertsTableComponent } from '../../../detections/components/alerts_table'; +import { GroupedAlertsTable } from '../../../detections/components/alerts_table/alerts_grouping'; +import { useGlobalTime } from '../../../common/containers/use_global_time'; +import { useDeepEqualSelector } from '../../../common/hooks/use_selector'; +import { inputsSelectors } from '../../../common/store/inputs'; +import { useUserData } from '../../../detections/components/user_info'; +import { useSourcererDataView } from '../../../common/containers/sourcerer'; +import { SourcererScopeName } from '../../../common/store/sourcerer/model'; import { RiskInformationButtonEmpty } from '../risk_information'; export interface TopRiskScoreContributorsAlertsProps { diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/top_risk_score_contributors_alerts/translations.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/top_risk_score_contributors_alerts/translations.ts similarity index 100% rename from x-pack/plugins/security_solution/public/explore/components/risk_score/top_risk_score_contributors_alerts/translations.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/top_risk_score_contributors_alerts/translations.ts diff --git a/x-pack/plugins/security_solution/public/explore/users/pages/navigation/user_risk_score_tab_body.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/user_risk_score_tab_body.test.tsx similarity index 81% rename from x-pack/plugins/security_solution/public/explore/users/pages/navigation/user_risk_score_tab_body.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/user_risk_score_tab_body.test.tsx index 78406353fb477..3103a8437f384 100644 --- a/x-pack/plugins/security_solution/public/explore/users/pages/navigation/user_risk_score_tab_body.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/user_risk_score_tab_body.test.tsx @@ -7,15 +7,17 @@ import React from 'react'; import { render } from '@testing-library/react'; -import { TestProviders } from '../../../../common/mock'; -import { useRiskScore, useRiskScoreKpi } from '../../../containers/risk_score'; -import { useQueryToggle } from '../../../../common/containers/query_toggle'; +import { TestProviders } from '../../common/mock'; +import { useQueryToggle } from '../../common/containers/query_toggle'; import { UserRiskScoreQueryTabBody } from './user_risk_score_tab_body'; -import { UsersType } from '../../store/model'; +import { UsersType } from '../../explore/users/store/model'; +import { useRiskScore } from '../api/hooks/use_risk_score'; +import { useRiskScoreKpi } from '../api/hooks/use_risk_score_kpi'; -jest.mock('../../../containers/risk_score'); -jest.mock('../../../../common/containers/query_toggle'); -jest.mock('../../../../common/lib/kibana'); +jest.mock('../api/hooks/use_risk_score_kpi'); +jest.mock('../api/hooks/use_risk_score'); +jest.mock('../../common/containers/query_toggle'); +jest.mock('../../common/lib/kibana'); describe('All users query tab body', () => { const mockUseRiskScore = useRiskScore as jest.Mock; diff --git a/x-pack/plugins/security_solution/public/explore/users/pages/navigation/user_risk_score_tab_body.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/user_risk_score_tab_body.tsx similarity index 76% rename from x-pack/plugins/security_solution/public/explore/users/pages/navigation/user_risk_score_tab_body.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/user_risk_score_tab_body.tsx index 4097d673f3982..c216d3786434e 100644 --- a/x-pack/plugins/security_solution/public/explore/users/pages/navigation/user_risk_score_tab_body.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/user_risk_score_tab_body.tsx @@ -8,24 +8,21 @@ import React, { useEffect, useMemo, useState } from 'react'; import { noop } from 'lodash/fp'; -import { EnableRiskScore } from '../../../components/risk_score/enable_risk_score'; -import type { UsersComponentsQueryProps } from './types'; -import { manageQuery } from '../../../../common/components/page/manage_query'; -import { useDeepEqualSelector } from '../../../../common/hooks/use_selector'; -import type { State } from '../../../../common/store'; - -import { UserRiskScoreTable } from '../../components/user_risk_score_table'; -import { usersSelectors } from '../../store'; -import { - UserRiskScoreQueryId, - useRiskScore, - useRiskScoreKpi, -} from '../../../containers/risk_score'; -import { useQueryToggle } from '../../../../common/containers/query_toggle'; -import { EMPTY_SEVERITY_COUNT, RiskScoreEntity } from '../../../../../common/search_strategy'; -import { RiskScoresNoDataDetected } from '../../../components/risk_score/risk_score_onboarding/risk_score_no_data_detected'; -import { useRiskEngineStatus } from '../../../../entity_analytics/api/hooks/use_risk_engine_status'; -import { RiskScoreUpdatePanel } from '../../../../entity_analytics/components/risk_score_update_panel'; +import { useRiskScoreKpi } from '../api/hooks/use_risk_score_kpi'; +import { useRiskScore } from '../api/hooks/use_risk_score'; +import { UserRiskScoreQueryId } from '../common/utils'; +import { EnableRiskScore } from './enable_risk_score'; +import type { UsersComponentsQueryProps } from '../../explore/users/pages/navigation/types'; +import { manageQuery } from '../../common/components/page/manage_query'; +import { useDeepEqualSelector } from '../../common/hooks/use_selector'; +import type { State } from '../../common/store'; +import { UserRiskScoreTable } from './user_risk_score_table'; +import { usersSelectors } from '../../explore/users/store'; +import { useQueryToggle } from '../../common/containers/query_toggle'; +import { EMPTY_SEVERITY_COUNT, RiskScoreEntity } from '../../../common/search_strategy'; +import { RiskScoresNoDataDetected } from './risk_score_onboarding/risk_score_no_data_detected'; +import { useRiskEngineStatus } from '../api/hooks/use_risk_engine_status'; +import { RiskScoreUpdatePanel } from './risk_score_update_panel'; const UserRiskScoreTableManage = manageQuery(UserRiskScoreTable); diff --git a/x-pack/plugins/security_solution/public/explore/users/components/user_risk_score_table/columns.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/user_risk_score_table/columns.test.tsx similarity index 93% rename from x-pack/plugins/security_solution/public/explore/users/components/user_risk_score_table/columns.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/user_risk_score_table/columns.test.tsx index 3f9fe12981509..5fbbcf30d13bf 100644 --- a/x-pack/plugins/security_solution/public/explore/users/components/user_risk_score_table/columns.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/user_risk_score_table/columns.test.tsx @@ -8,8 +8,8 @@ import React from 'react'; import { render } from '@testing-library/react'; import type { UserRiskScoreColumns } from '.'; import { getUserRiskScoreColumns } from './columns'; -import { TestProviders } from '../../../../common/mock'; -import { RiskScoreFields } from '../../../../../common/search_strategy'; +import { TestProviders } from '../../../common/mock'; +import { RiskScoreFields } from '../../../../common/search_strategy'; describe('getUserRiskScoreColumns', () => { const defaultProps = { diff --git a/x-pack/plugins/security_solution/public/explore/users/components/user_risk_score_table/columns.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/user_risk_score_table/columns.tsx similarity index 77% rename from x-pack/plugins/security_solution/public/explore/users/components/user_risk_score_table/columns.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/user_risk_score_table/columns.tsx index a23d62d0e83d5..49eaf7b3cc26b 100644 --- a/x-pack/plugins/security_solution/public/explore/users/components/user_risk_score_table/columns.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/user_risk_score_table/columns.tsx @@ -11,19 +11,19 @@ import { SecurityCellActions, SecurityCellActionsTrigger, CellActionsMode, -} from '../../../../common/components/cell_actions'; -import { escapeDataProviderId } from '../../../../common/components/drag_and_drop/helpers'; -import { getEmptyTagValue } from '../../../../common/components/empty_value'; +} from '../../../common/components/cell_actions'; +import { escapeDataProviderId } from '../../../common/components/drag_and_drop/helpers'; +import { getEmptyTagValue } from '../../../common/components/empty_value'; import type { UserRiskScoreColumns } from '.'; import * as i18n from './translations'; -import { RiskScoreLevel } from '../../../components/risk_score/severity/common'; -import type { Maybe, RiskSeverity } from '../../../../../common/search_strategy'; -import { RiskScoreEntity, RiskScoreFields } from '../../../../../common/search_strategy'; -import { UserDetailsLink } from '../../../../common/components/links'; -import { UsersTableType } from '../../store/model'; -import { ENTITY_RISK_LEVEL } from '../../../components/risk_score/translations'; -import { CELL_ACTIONS_TELEMETRY } from '../../../components/risk_score/constants'; -import { FormattedRelativePreferenceDate } from '../../../../common/components/formatted_date'; +import { RiskScoreLevel } from '../severity/common'; +import type { Maybe, RiskSeverity } from '../../../../common/search_strategy'; +import { RiskScoreEntity, RiskScoreFields } from '../../../../common/search_strategy'; +import { UserDetailsLink } from '../../../common/components/links'; +import { UsersTableType } from '../../../explore/users/store/model'; +import { ENTITY_RISK_LEVEL } from '../risk_score/translations'; +import { CELL_ACTIONS_TELEMETRY } from '../risk_score/constants'; +import { FormattedRelativePreferenceDate } from '../../../common/components/formatted_date'; export const getUserRiskScoreColumns = ({ dispatchSeverityUpdate, diff --git a/x-pack/plugins/security_solution/public/explore/users/components/user_risk_score_table/index.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/user_risk_score_table/index.test.tsx similarity index 83% rename from x-pack/plugins/security_solution/public/explore/users/components/user_risk_score_table/index.test.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/user_risk_score_table/index.test.tsx index 2d3cedad6bea1..87905b248a7d9 100644 --- a/x-pack/plugins/security_solution/public/explore/users/components/user_risk_score_table/index.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/user_risk_score_table/index.test.tsx @@ -9,10 +9,10 @@ import { render } from '@testing-library/react'; import { noop } from 'lodash'; import React from 'react'; import { UserRiskScoreTable } from '.'; -import type { UserRiskScore } from '../../../../../common/search_strategy'; -import { RiskSeverity } from '../../../../../common/search_strategy'; -import { TestProviders } from '../../../../common/mock'; -import { UsersType } from '../../store/model'; +import type { UserRiskScore } from '../../../../common/search_strategy'; +import { RiskSeverity } from '../../../../common/search_strategy'; +import { TestProviders } from '../../../common/mock'; +import { UsersType } from '../../../explore/users/store/model'; describe('UserRiskScoreTable', () => { const username = 'test_user_name'; diff --git a/x-pack/plugins/security_solution/public/explore/users/components/user_risk_score_table/index.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/user_risk_score_table/index.tsx similarity index 83% rename from x-pack/plugins/security_solution/public/explore/users/components/user_risk_score_table/index.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/components/user_risk_score_table/index.tsx index 01a2df82b40c9..6a99e64d04b27 100644 --- a/x-pack/plugins/security_solution/public/explore/users/components/user_risk_score_table/index.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/user_risk_score_table/index.tsx @@ -9,29 +9,29 @@ import React, { useMemo, useCallback } from 'react'; import { useDispatch } from 'react-redux'; import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import type { Columns, Criteria, ItemsPerRow } from '../../../components/paginated_table'; -import { PaginatedTable } from '../../../components/paginated_table'; +import type { Columns, Criteria, ItemsPerRow } from '../../../explore/components/paginated_table'; +import { PaginatedTable } from '../../../explore/components/paginated_table'; import { getUserRiskScoreColumns } from './columns'; -import * as i18nUsers from '../../pages/translations'; +import * as i18nUsers from '../../../explore/users/pages/translations'; import * as i18n from './translations'; -import { usersModel, usersSelectors, usersActions } from '../../store'; -import type { UserRiskScoreItem } from '../../../../../common/search_strategy/security_solution/users/common'; -import type { SeverityCount } from '../../../components/risk_score/severity/types'; -import { SeverityBadges } from '../../../components/risk_score/severity/severity_badges'; -import { SeverityBar } from '../../../components/risk_score/severity/severity_bar'; -import { SeverityFilterGroup } from '../../../components/risk_score/severity/severity_filter_group'; -import { useDeepEqualSelector } from '../../../../common/hooks/use_selector'; -import type { State } from '../../../../common/store'; +import { usersModel, usersSelectors, usersActions } from '../../../explore/users/store'; +import type { UserRiskScoreItem } from '../../../../common/search_strategy/security_solution/users/common'; +import type { SeverityCount } from '../severity/types'; +import { SeverityBadges } from '../severity/severity_badges'; +import { SeverityBar } from '../severity/severity_bar'; +import { SeverityFilterGroup } from '../severity/severity_filter_group'; +import { useDeepEqualSelector } from '../../../common/hooks/use_selector'; +import type { State } from '../../../common/store'; import type { RiskScoreFields, RiskScoreSortField, RiskSeverity, UserRiskScore, -} from '../../../../../common/search_strategy'; -import { RiskScoreEntity } from '../../../../../common/search_strategy'; -import { RiskInformationButtonEmpty } from '../../../components/risk_score/risk_information'; +} from '../../../../common/search_strategy'; +import { RiskScoreEntity } from '../../../../common/search_strategy'; +import { RiskInformationButtonEmpty } from '../risk_information'; export const rowItems: ItemsPerRow[] = [ { diff --git a/x-pack/plugins/security_solution/public/explore/users/components/user_risk_score_table/translations.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/user_risk_score_table/translations.ts similarity index 100% rename from x-pack/plugins/security_solution/public/explore/users/components/user_risk_score_table/translations.ts rename to x-pack/plugins/security_solution/public/entity_analytics/components/user_risk_score_table/translations.ts diff --git a/x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/index.ts b/x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/index.ts similarity index 100% rename from x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/index.ts rename to x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/index.ts diff --git a/x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/ingest_pipelines.test.ts b/x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/ingest_pipelines.test.ts similarity index 100% rename from x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/ingest_pipelines.test.ts rename to x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/ingest_pipelines.test.ts diff --git a/x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/ingest_pipelines.ts b/x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/ingest_pipelines.ts similarity index 100% rename from x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/ingest_pipelines.ts rename to x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/ingest_pipelines.ts diff --git a/x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/onboarding.ts b/x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/onboarding.ts similarity index 94% rename from x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/onboarding.ts rename to x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/onboarding.ts index a8578d4d53f7e..ff6344679455f 100644 --- a/x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/onboarding.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/onboarding.ts @@ -7,9 +7,9 @@ import type { HttpSetup, NotificationsStart } from '@kbn/core/public'; -import { INTERNAL_RISK_SCORE_URL } from '../../../../../../common/constants'; +import { INTERNAL_RISK_SCORE_URL } from '../../../../common/constants'; -import { RiskScoreEntity } from '../../../../../../common/search_strategy'; +import { RiskScoreEntity } from '../../../../common/search_strategy'; import { HOST_RISK_SCORES_ENABLED_TITLE, INSTALLATION_ERROR, diff --git a/x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/saved_objects.ts b/x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/saved_objects.ts similarity index 96% rename from x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/saved_objects.ts rename to x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/saved_objects.ts index 6e5369f2337f9..4c3f863ddbeae 100644 --- a/x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/saved_objects.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/saved_objects.ts @@ -11,13 +11,13 @@ import type { DashboardStart } from '@kbn/dashboard-plugin/public'; import { RISKY_HOSTS_DASHBOARD_TITLE, RISKY_USERS_DASHBOARD_TITLE, -} from '../../../../components/risk_score/constants'; +} from '../../components/risk_score/constants'; import { prebuiltSavedObjectsBulkCreateUrl, prebuiltSavedObjectsBulkDeleteUrl, -} from '../../../../../../common/constants'; +} from '../../../../common/constants'; -import { RiskScoreEntity } from '../../../../../../common/search_strategy'; +import { RiskScoreEntity } from '../../../../common/search_strategy'; import { DELETE_SAVED_OBJECTS_FAILURE, diff --git a/x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/stored_scripts.test.ts b/x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/stored_scripts.test.ts similarity index 100% rename from x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/stored_scripts.test.ts rename to x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/stored_scripts.test.ts diff --git a/x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/stored_scripts.ts b/x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/stored_scripts.ts similarity index 97% rename from x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/stored_scripts.ts rename to x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/stored_scripts.ts index 6a7fa486bc729..243106325982a 100644 --- a/x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/stored_scripts.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/stored_scripts.ts @@ -9,7 +9,7 @@ import { toMountPoint } from '@kbn/kibana-react-plugin/public'; import { RISK_SCORE_CREATE_STORED_SCRIPT, RISK_SCORE_DELETE_STORED_SCRIPT, -} from '../../../../../../common/constants'; +} from '../../../../common/constants'; import { STORED_SCRIPT_CREATION_ERROR_MESSAGE, STORED_SCRIPT_DELETION_ERROR_MESSAGE, diff --git a/x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/transforms.test.ts b/x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/transforms.test.ts similarity index 100% rename from x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/transforms.test.ts rename to x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/transforms.test.ts diff --git a/x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/transforms.ts b/x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/transforms.ts similarity index 100% rename from x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/transforms.ts rename to x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/transforms.ts diff --git a/x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/translations.ts b/x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/translations.ts similarity index 100% rename from x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/translations.ts rename to x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/translations.ts diff --git a/x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/types.ts b/x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/types.ts similarity index 100% rename from x-pack/plugins/security_solution/public/explore/containers/risk_score/onboarding/api/types.ts rename to x-pack/plugins/security_solution/public/entity_analytics/deprecated_risk_engine/api/types.ts diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/__snapshots__/risk_score_donut.test.ts.snap b/x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/__snapshots__/risk_score_donut.test.ts.snap similarity index 100% rename from x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/__snapshots__/risk_score_donut.test.ts.snap rename to x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/__snapshots__/risk_score_donut.test.ts.snap diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/__snapshots__/risk_score_over_time_area.test.ts.snap b/x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/__snapshots__/risk_score_over_time_area.test.ts.snap similarity index 100% rename from x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/__snapshots__/risk_score_over_time_area.test.ts.snap rename to x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/__snapshots__/risk_score_over_time_area.test.ts.snap diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/__snapshots__/risk_score_summary.test.ts.snap b/x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/__snapshots__/risk_score_summary.test.ts.snap similarity index 100% rename from x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/__snapshots__/risk_score_summary.test.ts.snap rename to x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/__snapshots__/risk_score_summary.test.ts.snap diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/risk_score_donut.test.ts b/x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/risk_score_donut.test.ts similarity index 82% rename from x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/risk_score_donut.test.ts rename to x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/risk_score_donut.test.ts index df536a7e33d17..00b91ceb44e2b 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/risk_score_donut.test.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/risk_score_donut.test.ts @@ -6,13 +6,12 @@ */ import { renderHook } from '@testing-library/react-hooks'; -import { wrapper } from '../../../mocks'; - -import { useLensAttributes } from '../../../use_lens_attributes'; +import { wrapper } from '../../common/components/visualization_actions/mocks'; +import { useLensAttributes } from '../../common/components/visualization_actions/use_lens_attributes'; import { getRiskScoreDonutAttributes } from './risk_score_donut'; -jest.mock('../../../../../containers/sourcerer', () => ({ +jest.mock('../../common/containers/sourcerer', () => ({ useSourcererDataView: jest.fn().mockReturnValue({ selectedPatterns: ['auditbeat-mytest-*'], dataViewId: 'security-solution-my-test', @@ -20,7 +19,7 @@ jest.mock('../../../../../containers/sourcerer', () => ({ }), })); -jest.mock('../../../../../utils/route/use_route_spy', () => ({ +jest.mock('../../common/utils/route/use_route_spy', () => ({ useRouteSpy: jest.fn().mockReturnValue([ { detailName: 'undefined', diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/risk_score_donut.ts b/x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/risk_score_donut.ts similarity index 98% rename from x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/risk_score_donut.ts rename to x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/risk_score_donut.ts index 5260a98c5b874..dccdab8984607 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/risk_score_donut.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/risk_score_donut.ts @@ -6,7 +6,7 @@ */ import { v4 as uuidv4 } from 'uuid'; -import type { GetLensAttributes } from '../../../types'; +import type { GetLensAttributes } from '../../common/components/visualization_actions/types'; const internalReferenceIdMapping: Record = { host: uuidv4(), user: uuidv4() }; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/risk_score_over_time_area.test.ts b/x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/risk_score_over_time_area.test.ts similarity index 89% rename from x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/risk_score_over_time_area.test.ts rename to x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/risk_score_over_time_area.test.ts index 97dbe4ea17e48..5a642e804befd 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/risk_score_over_time_area.test.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/risk_score_over_time_area.test.ts @@ -7,13 +7,12 @@ import { renderHook } from '@testing-library/react-hooks'; import type { XYState } from '@kbn/lens-plugin/public'; -import { wrapper } from '../../../mocks'; - -import { useLensAttributes } from '../../../use_lens_attributes'; import { getRiskScoreOverTimeAreaAttributes } from './risk_score_over_time_area'; +import { useLensAttributes } from '../../common/components/visualization_actions/use_lens_attributes'; +import { wrapper } from '../../common/components/visualization_actions/mocks'; -jest.mock('../../../../../containers/sourcerer', () => ({ +jest.mock('../../common/containers/sourcerer', () => ({ useSourcererDataView: jest.fn().mockReturnValue({ selectedPatterns: ['auditbeat-mytest-*'], dataViewId: 'security-solution-my-test', @@ -21,7 +20,7 @@ jest.mock('../../../../../containers/sourcerer', () => ({ }), })); -jest.mock('../../../../../utils/route/use_route_spy', () => ({ +jest.mock('../../common/utils/route/use_route_spy', () => ({ useRouteSpy: jest.fn().mockReturnValue([ { detailName: 'mockHost', diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/risk_score_over_time_area.ts b/x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/risk_score_over_time_area.ts similarity index 98% rename from x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/risk_score_over_time_area.ts rename to x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/risk_score_over_time_area.ts index b100e5042a33a..af76c9282873d 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/risk_score_over_time_area.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/risk_score_over_time_area.ts @@ -6,7 +6,7 @@ */ import { v4 as uuidv4 } from 'uuid'; -import type { GetLensAttributes } from '../../../types'; +import type { GetLensAttributes } from '../../common/components/visualization_actions/types'; const internalReferenceIdMapping: Record = { host: uuidv4(), user: uuidv4() }; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/risk_score_summary.test.ts b/x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/risk_score_summary.test.ts similarity index 85% rename from x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/risk_score_summary.test.ts rename to x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/risk_score_summary.test.ts index e8af897c51cea..6ef0abbf77693 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/risk_score_summary.test.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/risk_score_summary.test.ts @@ -5,15 +5,15 @@ * 2.0. */ -import { RiskScoreEntity } from '../../../../../../../common/entity_analytics/risk_engine'; +import { RiskScoreEntity } from '../../../common/entity_analytics/risk_engine'; import { renderHook } from '@testing-library/react-hooks'; -import { wrapper } from '../../../mocks'; -import { useLensAttributes } from '../../../use_lens_attributes'; import { getRiskScoreSummaryAttributes } from './risk_score_summary'; -import { RiskSeverity } from '../../../../../../../common/search_strategy'; +import { RiskSeverity } from '../../../common/search_strategy'; import type { MetricVisualizationState } from '@kbn/lens-plugin/public'; +import { wrapper } from '../../common/components/visualization_actions/mocks'; +import { useLensAttributes } from '../../common/components/visualization_actions/use_lens_attributes'; -jest.mock('../../../../../containers/sourcerer', () => ({ +jest.mock('../../common/containers/sourcerer', () => ({ useSourcererDataView: jest.fn().mockReturnValue({ selectedPatterns: ['auditbeat-mytest-*'], dataViewId: 'security-solution-my-test', diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/risk_score_summary.ts b/x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/risk_score_summary.ts similarity index 93% rename from x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/risk_score_summary.ts rename to x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/risk_score_summary.ts index 728c6e1771373..544badd18b5e9 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/risk_scores/risk_score_summary.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/risk_score_summary.ts @@ -6,14 +6,10 @@ */ import { v4 as uuidv4 } from 'uuid'; -import { - SEVERITY_UI_SORT_ORDER, - RISK_SEVERITY_COLOUR, - RISK_SCORE_RANGES, -} from '../../../../../../entity_analytics/common/utils'; -import type { RiskSeverity } from '../../../../../../../common/search_strategy'; -import { RiskScoreEntity, RiskScoreFields } from '../../../../../../../common/search_strategy'; -import type { LensAttributes } from '../../../types'; +import type { LensAttributes } from '@kbn/lens-embeddable-utils'; +import { SEVERITY_UI_SORT_ORDER, RISK_SEVERITY_COLOUR, RISK_SCORE_RANGES } from '../common/utils'; +import type { RiskSeverity } from '../../../common/search_strategy'; +import { RiskScoreEntity, RiskScoreFields } from '../../../common/search_strategy'; interface GetRiskScoreSummaryAttributesProps { query?: string; diff --git a/x-pack/plugins/security_solution/public/overview/pages/entity_analytics.tsx b/x-pack/plugins/security_solution/public/entity_analytics/pages/entity_analytics_dashboard.tsx similarity index 92% rename from x-pack/plugins/security_solution/public/overview/pages/entity_analytics.tsx rename to x-pack/plugins/security_solution/public/entity_analytics/pages/entity_analytics_dashboard.tsx index 96476c90aa180..76efd79b4d63d 100644 --- a/x-pack/plugins/security_solution/public/overview/pages/entity_analytics.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/pages/entity_analytics_dashboard.tsx @@ -7,7 +7,6 @@ import React from 'react'; import { EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner } from '@elastic/eui'; -import { EntityAnalyticsRiskScores } from '../components/entity_analytics/risk_score'; import { RiskScoreEntity } from '../../../common/search_strategy'; import { ENTITY_ANALYTICS } from '../../app/translations'; import { SpyRoute } from '../../common/utils/route/spy_routes'; @@ -16,15 +15,15 @@ import { useSourcererDataView } from '../../common/containers/sourcerer'; import { SecuritySolutionPageWrapper } from '../../common/components/page_wrapper'; import { HeaderPage } from '../../common/components/header_page'; import { LandingPageComponent } from '../../common/components/landing_page'; - -import { EntityAnalyticsHeader } from '../components/entity_analytics/header'; -import { EntityAnalyticsAnomalies } from '../components/entity_analytics/anomalies'; import { SiemSearchBar } from '../../common/components/search_bar'; import { InputsModelId } from '../../common/store/inputs/constants'; import { FiltersGlobal } from '../../common/components/filters_global'; -import { useRiskEngineStatus } from '../../entity_analytics/api/hooks/use_risk_engine_status'; -import { RiskScoreUpdatePanel } from '../../entity_analytics/components/risk_score_update_panel'; +import { useRiskEngineStatus } from '../api/hooks/use_risk_engine_status'; +import { RiskScoreUpdatePanel } from '../components/risk_score_update_panel'; import { useHasSecurityCapability } from '../../helper_hooks'; +import { EntityAnalyticsHeader } from '../components/entity_analytics_header'; +import { EntityAnalyticsAnomalies } from '../components/entity_analytics_anomalies'; +import { EntityAnalyticsRiskScores } from '../components/entity_analytics_risk_score'; const EntityAnalyticsComponent = () => { const { data: riskScoreEngineStatus } = useRiskEngineStatus(); diff --git a/x-pack/plugins/security_solution/public/explore/components/paginated_table/index.tsx b/x-pack/plugins/security_solution/public/explore/components/paginated_table/index.tsx index 6c870c313a412..cbee7c586bbf5 100644 --- a/x-pack/plugins/security_solution/public/explore/components/paginated_table/index.tsx +++ b/x-pack/plugins/security_solution/public/explore/components/paginated_table/index.tsx @@ -41,7 +41,7 @@ import type { } from '../../network/components/network_top_countries_table/columns'; import type { TlsColumns } from '../../network/components/tls_table/columns'; import type { UncommonProcessTableColumns } from '../../hosts/components/uncommon_process_table'; -import type { HostRiskScoreColumns } from '../../hosts/components/host_risk_score_table'; +import type { HostRiskScoreColumns } from '../../../entity_analytics/components/host_risk_score_table'; import type { UsersColumns } from '../../network/components/users_table/columns'; import { HeaderSection } from '../../../common/components/header_section'; diff --git a/x-pack/plugins/security_solution/public/explore/containers/risk_score/all/translations.ts b/x-pack/plugins/security_solution/public/explore/containers/risk_score/all/translations.ts deleted file mode 100644 index 8cc275674d4e9..0000000000000 --- a/x-pack/plugins/security_solution/public/explore/containers/risk_score/all/translations.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { i18n } from '@kbn/i18n'; - -export const ERROR_RISK_SCORE = i18n.translate( - 'xpack.securitySolution.riskScore.errorSearchDescription', - { - defaultMessage: `An error has occurred on risk score search`, - } -); - -export const FAIL_RISK_SCORE = i18n.translate( - 'xpack.securitySolution.riskScore.failSearchDescription', - { - defaultMessage: `Failed to run search on risk score`, - } -); diff --git a/x-pack/plugins/security_solution/public/explore/containers/risk_score/feature_status/api.ts b/x-pack/plugins/security_solution/public/explore/containers/risk_score/feature_status/api.ts deleted file mode 100644 index 2cfaa2265f527..0000000000000 --- a/x-pack/plugins/security_solution/public/explore/containers/risk_score/feature_status/api.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { KibanaServices } from '../../../../common/lib/kibana'; -import { RISK_SCORE_INDEX_STATUS_API_URL } from '../../../../../common/constants'; -import type { RiskScoreEntity } from '../../../../../common/search_strategy'; - -export const getRiskScoreIndexStatus = async (params: { - query: { - indexName: string; - entity: RiskScoreEntity; - }; - signal?: AbortSignal; -}): Promise<{ - isDeprecated: boolean; - isEnabled: boolean; -}> => { - const { indexName, entity } = params.query; - return KibanaServices.get().http.fetch<{ isDeprecated: boolean; isEnabled: boolean }>( - RISK_SCORE_INDEX_STATUS_API_URL, - { - method: 'GET', - version: '1', - query: { indexName, entity }, - asSystemRequest: true, - signal: params.signal, - } - ); -}; diff --git a/x-pack/plugins/security_solution/public/explore/containers/risk_score/index.ts b/x-pack/plugins/security_solution/public/explore/containers/risk_score/index.ts deleted file mode 100644 index 892bcd24dee74..0000000000000 --- a/x-pack/plugins/security_solution/public/explore/containers/risk_score/index.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import type { - HostRiskScore, - UserRiskScore, -} from '../../../../common/search_strategy/security_solution/risk_score'; - -export * from './all'; -export * from './kpi'; - -export enum UserRiskScoreQueryId { - USERS_BY_RISK = 'UsersByRisk', - USER_DETAILS_RISK_SCORE = 'UserDetailsRiskScore', -} - -export enum HostRiskScoreQueryId { - DEFAULT = 'HostRiskScore', - HOST_DETAILS_RISK_SCORE = 'HostDetailsRiskScore', - OVERVIEW_RISKY_HOSTS = 'OverviewRiskyHosts', - HOSTS_BY_RISK = 'HostsByRisk', -} - -export interface HostRisk { - loading: boolean; - isModuleEnabled: boolean; - result?: HostRiskScore[]; -} - -export interface UserRisk { - loading: boolean; - isModuleEnabled: boolean; - result?: UserRiskScore[]; -} diff --git a/x-pack/plugins/security_solution/public/explore/containers/risk_score/kpi/translations.ts b/x-pack/plugins/security_solution/public/explore/containers/risk_score/kpi/translations.ts deleted file mode 100644 index 83b402220f3d4..0000000000000 --- a/x-pack/plugins/security_solution/public/explore/containers/risk_score/kpi/translations.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { i18n } from '@kbn/i18n'; - -export const FAIL_RISK_SCORE = i18n.translate( - 'xpack.securitySolution.riskScore.kpi.failSearchDescription', - { - defaultMessage: `Failed to run search on risk score`, - } -); diff --git a/x-pack/plugins/security_solution/public/explore/hosts/components/hosts_table/columns.tsx b/x-pack/plugins/security_solution/public/explore/hosts/components/hosts_table/columns.tsx index 292e106fa5d4d..270a10b52155a 100644 --- a/x-pack/plugins/security_solution/public/explore/hosts/components/hosts_table/columns.tsx +++ b/x-pack/plugins/security_solution/public/explore/hosts/components/hosts_table/columns.tsx @@ -19,9 +19,9 @@ import type { HostsTableColumns } from '.'; import * as i18n from './translations'; import type { Maybe, RiskSeverity } from '../../../../../common/search_strategy'; import { RiskScoreEntity } from '../../../../../common/search_strategy'; -import { VIEW_HOSTS_BY_SEVERITY } from '../host_risk_score_table/translations'; -import { RiskScoreLevel } from '../../../components/risk_score/severity/common'; -import { ENTITY_RISK_LEVEL } from '../../../components/risk_score/translations'; +import { VIEW_HOSTS_BY_SEVERITY } from '../../../../entity_analytics/components/host_risk_score_table/translations'; +import { RiskScoreLevel } from '../../../../entity_analytics/components/severity/common'; +import { ENTITY_RISK_LEVEL } from '../../../../entity_analytics/components/risk_score/translations'; export const getHostsColumns = ( showRiskColumn: boolean, diff --git a/x-pack/plugins/security_solution/public/explore/hosts/pages/details/details_tabs.tsx b/x-pack/plugins/security_solution/public/explore/hosts/pages/details/details_tabs.tsx index cc21c96ac9405..4a758dadc5cbd 100644 --- a/x-pack/plugins/security_solution/public/explore/hosts/pages/details/details_tabs.tsx +++ b/x-pack/plugins/security_solution/public/explore/hosts/pages/details/details_tabs.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { Routes, Route } from '@kbn/shared-ux-router'; import { TableId } from '@kbn/securitysolution-data-table'; import { RiskScoreEntity } from '../../../../../common/search_strategy'; -import { RiskDetailsTabBody } from '../../../components/risk_score/risk_details_tab_body'; +import { RiskDetailsTabBody } from '../../../../entity_analytics/components/risk_details_tab_body'; import { HostsType, HostsTableType } from '../../store/model'; import { AnomaliesQueryTabBody } from '../../../../common/containers/anomalies/anomalies_query_tab_body'; import { useGlobalTime } from '../../../../common/containers/use_global_time'; diff --git a/x-pack/plugins/security_solution/public/explore/hosts/pages/navigation/host_risk_score_tab_body.test.tsx b/x-pack/plugins/security_solution/public/explore/hosts/pages/navigation/host_risk_score_tab_body.test.tsx index 0ea63088628bf..30083b2452d94 100644 --- a/x-pack/plugins/security_solution/public/explore/hosts/pages/navigation/host_risk_score_tab_body.test.tsx +++ b/x-pack/plugins/security_solution/public/explore/hosts/pages/navigation/host_risk_score_tab_body.test.tsx @@ -8,12 +8,14 @@ import React from 'react'; import { render } from '@testing-library/react'; import { TestProviders } from '../../../../common/mock'; -import { useRiskScore, useRiskScoreKpi } from '../../../containers/risk_score'; import { useQueryToggle } from '../../../../common/containers/query_toggle'; import { HostRiskScoreQueryTabBody } from './host_risk_score_tab_body'; import { HostsType } from '../../store/model'; +import { useRiskScore } from '../../../../entity_analytics/api/hooks/use_risk_score'; +import { useRiskScoreKpi } from '../../../../entity_analytics/api/hooks/use_risk_score_kpi'; -jest.mock('../../../containers/risk_score'); +jest.mock('../../../../entity_analytics/api/hooks/use_risk_score_kpi'); +jest.mock('../../../../entity_analytics/api/hooks/use_risk_score'); jest.mock('../../../../common/containers/query_toggle'); jest.mock('../../../../common/lib/kibana'); diff --git a/x-pack/plugins/security_solution/public/explore/hosts/pages/navigation/host_risk_score_tab_body.tsx b/x-pack/plugins/security_solution/public/explore/hosts/pages/navigation/host_risk_score_tab_body.tsx index 7139102bd35a5..c9ab211c8dc07 100644 --- a/x-pack/plugins/security_solution/public/explore/hosts/pages/navigation/host_risk_score_tab_body.tsx +++ b/x-pack/plugins/security_solution/public/explore/hosts/pages/navigation/host_risk_score_tab_body.tsx @@ -8,21 +8,19 @@ import React, { useEffect, useMemo, useState } from 'react'; import { EuiPanel } from '@elastic/eui'; import { noop } from 'lodash/fp'; -import { EnableRiskScore } from '../../../components/risk_score/enable_risk_score'; +import { HostRiskScoreQueryId } from '../../../../entity_analytics/common/utils'; +import { useRiskScoreKpi } from '../../../../entity_analytics/api/hooks/use_risk_score_kpi'; +import { useRiskScore } from '../../../../entity_analytics/api/hooks/use_risk_score'; +import { EnableRiskScore } from '../../../../entity_analytics/components/enable_risk_score'; import type { HostsComponentsQueryProps } from './types'; import { manageQuery } from '../../../../common/components/page/manage_query'; -import { HostRiskScoreTable } from '../../components/host_risk_score_table'; +import { HostRiskScoreTable } from '../../../../entity_analytics/components/host_risk_score_table'; import { useDeepEqualSelector } from '../../../../common/hooks/use_selector'; import { hostsModel, hostsSelectors } from '../../store'; import type { State } from '../../../../common/store'; -import { - HostRiskScoreQueryId, - useRiskScore, - useRiskScoreKpi, -} from '../../../containers/risk_score'; import { useQueryToggle } from '../../../../common/containers/query_toggle'; import { EMPTY_SEVERITY_COUNT, RiskScoreEntity } from '../../../../../common/search_strategy'; -import { RiskScoresNoDataDetected } from '../../../components/risk_score/risk_score_onboarding/risk_score_no_data_detected'; +import { RiskScoresNoDataDetected } from '../../../../entity_analytics/components/risk_score_onboarding/risk_score_no_data_detected'; import { useRiskEngineStatus } from '../../../../entity_analytics/api/hooks/use_risk_engine_status'; import { RiskScoreUpdatePanel } from '../../../../entity_analytics/components/risk_score_update_panel'; diff --git a/x-pack/plugins/security_solution/public/explore/users/components/all_users/index.tsx b/x-pack/plugins/security_solution/public/explore/users/components/all_users/index.tsx index 7cf90c41fd7c3..6948009ebb188 100644 --- a/x-pack/plugins/security_solution/public/explore/users/components/all_users/index.tsx +++ b/x-pack/plugins/security_solution/public/explore/users/components/all_users/index.tsx @@ -27,9 +27,9 @@ import { usersActions, usersModel, usersSelectors } from '../../store'; import type { User } from '../../../../../common/search_strategy/security_solution/users/all'; import type { SortUsersField } from '../../../../../common/search_strategy/security_solution/users/common'; import type { RiskSeverity } from '../../../../../common/search_strategy'; -import { RiskScoreLevel } from '../../../components/risk_score/severity/common'; +import { RiskScoreLevel } from '../../../../entity_analytics/components/severity/common'; import { useMlCapabilities } from '../../../../common/components/ml/hooks/use_ml_capabilities'; -import { VIEW_USERS_BY_SEVERITY } from '../user_risk_score_table/translations'; +import { VIEW_USERS_BY_SEVERITY } from '../../../../entity_analytics/components/user_risk_score_table/translations'; import { SecurityPageName } from '../../../../app/types'; import { UsersTableType } from '../../store/model'; import { useNavigateTo } from '../../../../common/lib/kibana'; diff --git a/x-pack/plugins/security_solution/public/explore/users/pages/details/details_tabs.tsx b/x-pack/plugins/security_solution/public/explore/users/pages/details/details_tabs.tsx index d2649a3329204..9719dc0844e4a 100644 --- a/x-pack/plugins/security_solution/public/explore/users/pages/details/details_tabs.tsx +++ b/x-pack/plugins/security_solution/public/explore/users/pages/details/details_tabs.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { Routes, Route } from '@kbn/shared-ux-router'; import { TableId } from '@kbn/securitysolution-data-table'; -import { RiskDetailsTabBody } from '../../../components/risk_score/risk_details_tab_body'; +import { RiskDetailsTabBody } from '../../../../entity_analytics/components/risk_details_tab_body'; import { RiskScoreEntity } from '../../../../../common/search_strategy'; import { UsersTableType } from '../../store/model'; import { AnomaliesUserTable } from '../../../../common/components/ml/tables/anomalies_user_table'; diff --git a/x-pack/plugins/security_solution/public/explore/users/pages/users_tabs.tsx b/x-pack/plugins/security_solution/public/explore/users/pages/users_tabs.tsx index 034ee2a71ab9d..bc6dd85e21e25 100644 --- a/x-pack/plugins/security_solution/public/explore/users/pages/users_tabs.tsx +++ b/x-pack/plugins/security_solution/public/explore/users/pages/users_tabs.tsx @@ -16,7 +16,7 @@ import { AllUsersQueryTabBody, AuthenticationsQueryTabBody } from './navigation' import { AnomaliesQueryTabBody } from '../../../common/containers/anomalies/anomalies_query_tab_body'; import { AnomaliesUserTable } from '../../../common/components/ml/tables/anomalies_user_table'; -import { UserRiskScoreQueryTabBody } from './navigation/user_risk_score_tab_body'; +import { UserRiskScoreQueryTabBody } from '../../../entity_analytics/components/user_risk_score_tab_body'; import { EventsQueryTabBody } from '../../../common/components/events_tab'; import { userNameExistsFilter } from './details/helpers'; diff --git a/x-pack/plugins/security_solution/public/flyout/document_details/left/components/entities_details.test.tsx b/x-pack/plugins/security_solution/public/flyout/document_details/left/components/entities_details.test.tsx index 0a8807b2fb75a..b6aacd491a055 100644 --- a/x-pack/plugins/security_solution/public/flyout/document_details/left/components/entities_details.test.tsx +++ b/x-pack/plugins/security_solution/public/flyout/document_details/left/components/entities_details.test.tsx @@ -16,12 +16,12 @@ import { mockContextValue } from '../mocks/mock_context'; import { EXPANDABLE_PANEL_CONTENT_TEST_ID } from '../../../shared/components/test_ids'; import type { Anomalies } from '../../../../common/components/ml/types'; import { useMlCapabilities } from '../../../../common/components/ml/hooks/use_ml_capabilities'; -import { useRiskScore } from '../../../../explore/containers/risk_score'; import { mockAnomalies } from '../../../../common/components/ml/mock'; import { useHostDetails } from '../../../../explore/hosts/containers/hosts/details'; import { useHostRelatedUsers } from '../../../../common/containers/related_entities/related_users'; import { useObservedUserDetails } from '../../../../explore/users/containers/users/observed_details'; import { useUserRelatedHosts } from '../../../../common/containers/related_entities/related_hosts'; +import { useRiskScore } from '../../../../entity_analytics/api/hooks/use_risk_score'; jest.mock('react-router-dom', () => { const actual = jest.requireActual('react-router-dom'); @@ -86,7 +86,7 @@ const mockUseHostDetails = useHostDetails as jest.Mock; jest.mock('../../../../common/containers/related_entities/related_users'); const mockUseHostsRelatedUsers = useHostRelatedUsers as jest.Mock; -jest.mock('../../../../explore/containers/risk_score'); +jest.mock('../../../../entity_analytics/api/hooks/use_risk_score'); const mockUseRiskScore = useRiskScore as jest.Mock; jest.mock('../../../../explore/users/containers/users/observed_details'); diff --git a/x-pack/plugins/security_solution/public/flyout/document_details/left/components/host_details.test.tsx b/x-pack/plugins/security_solution/public/flyout/document_details/left/components/host_details.test.tsx index b711e6d3d5f7e..e8dfa71d0b4c2 100644 --- a/x-pack/plugins/security_solution/public/flyout/document_details/left/components/host_details.test.tsx +++ b/x-pack/plugins/security_solution/public/flyout/document_details/left/components/host_details.test.tsx @@ -11,7 +11,6 @@ import type { Anomalies } from '../../../../common/components/ml/types'; import { TestProviders } from '../../../../common/mock'; import { HostDetails } from './host_details'; import { useMlCapabilities } from '../../../../common/components/ml/hooks/use_ml_capabilities'; -import { useRiskScore } from '../../../../explore/containers/risk_score'; import { mockAnomalies } from '../../../../common/components/ml/mock'; import { useHostDetails } from '../../../../explore/hosts/containers/hosts/details'; import { useHostRelatedUsers } from '../../../../common/containers/related_entities/related_users'; @@ -22,6 +21,7 @@ import { HOST_DETAILS_RELATED_USERS_TABLE_TEST_ID, } from './test_ids'; import { EXPANDABLE_PANEL_CONTENT_TEST_ID } from '../../../shared/components/test_ids'; +import { useRiskScore } from '../../../../entity_analytics/api/hooks/use_risk_score'; jest.mock('react-router-dom', () => { const actual = jest.requireActual('react-router-dom'); @@ -83,7 +83,7 @@ const mockUseHostDetails = useHostDetails as jest.Mock; jest.mock('../../../../common/containers/related_entities/related_users'); const mockUseHostsRelatedUsers = useHostRelatedUsers as jest.Mock; -jest.mock('../../../../explore/containers/risk_score'); +jest.mock('../../../../entity_analytics/api/hooks/use_risk_score'); const mockUseRiskScore = useRiskScore as jest.Mock; const timestamp = '2022-07-25T08:20:18.966Z'; diff --git a/x-pack/plugins/security_solution/public/flyout/document_details/left/components/host_details.tsx b/x-pack/plugins/security_solution/public/flyout/document_details/left/components/host_details.tsx index 3f68ef15956ed..711eb2a6500f1 100644 --- a/x-pack/plugins/security_solution/public/flyout/document_details/left/components/host_details.tsx +++ b/x-pack/plugins/security_solution/public/flyout/document_details/left/components/host_details.tsx @@ -30,7 +30,7 @@ import { AnomalyTableProvider } from '../../../../common/components/ml/anomaly/a import { InspectButton, InspectButtonContainer } from '../../../../common/components/inspect'; import { NetworkDetailsLink } from '../../../../common/components/links'; import { RiskScoreEntity } from '../../../../../common/search_strategy'; -import { RiskScoreLevel } from '../../../../explore/components/risk_score/severity/common'; +import { RiskScoreLevel } from '../../../../entity_analytics/components/severity/common'; import { DefaultFieldRenderer } from '../../../../timelines/components/field_renderers/field_renderers'; import { InputsModelId } from '../../../../common/store/inputs/constants'; import { @@ -49,7 +49,7 @@ import { useHostRelatedUsers } from '../../../../common/containers/related_entit import { useMlCapabilities } from '../../../../common/components/ml/hooks/use_ml_capabilities'; import { getEmptyTagValue } from '../../../../common/components/empty_value'; import { HOST_DETAILS_TEST_ID, HOST_DETAILS_RELATED_USERS_TABLE_TEST_ID } from './test_ids'; -import { ENTITY_RISK_LEVEL } from '../../../../explore/components/risk_score/translations'; +import { ENTITY_RISK_LEVEL } from '../../../../entity_analytics/components/risk_score/translations'; import { useHasSecurityCapability } from '../../../../helper_hooks'; const HOST_DETAILS_ID = 'entities-hosts-details'; diff --git a/x-pack/plugins/security_solution/public/flyout/document_details/left/components/user_details.test.tsx b/x-pack/plugins/security_solution/public/flyout/document_details/left/components/user_details.test.tsx index 1f2d5b464d4e9..77e42400001f3 100644 --- a/x-pack/plugins/security_solution/public/flyout/document_details/left/components/user_details.test.tsx +++ b/x-pack/plugins/security_solution/public/flyout/document_details/left/components/user_details.test.tsx @@ -11,7 +11,6 @@ import type { Anomalies } from '../../../../common/components/ml/types'; import { TestProviders } from '../../../../common/mock'; import { UserDetails } from './user_details'; import { useMlCapabilities } from '../../../../common/components/ml/hooks/use_ml_capabilities'; -import { useRiskScore } from '../../../../explore/containers/risk_score'; import { mockAnomalies } from '../../../../common/components/ml/mock'; import { useObservedUserDetails } from '../../../../explore/users/containers/users/observed_details'; import { useUserRelatedHosts } from '../../../../common/containers/related_entities/related_hosts'; @@ -22,6 +21,7 @@ import { USER_DETAILS_RELATED_HOSTS_TABLE_TEST_ID, } from './test_ids'; import { EXPANDABLE_PANEL_CONTENT_TEST_ID } from '../../../shared/components/test_ids'; +import { useRiskScore } from '../../../../entity_analytics/api/hooks/use_risk_score'; jest.mock('react-router-dom', () => { const actual = jest.requireActual('react-router-dom'); @@ -80,7 +80,7 @@ const mockUseObservedUserDetails = useObservedUserDetails as jest.Mock; jest.mock('../../../../common/containers/related_entities/related_hosts'); const mockUseUsersRelatedHosts = useUserRelatedHosts as jest.Mock; -jest.mock('../../../../explore/containers/risk_score'); +jest.mock('../../../../entity_analytics/api/hooks/use_risk_score'); const mockUseRiskScore = useRiskScore as jest.Mock; const timestamp = '2022-07-25T08:20:18.966Z'; diff --git a/x-pack/plugins/security_solution/public/flyout/document_details/left/components/user_details.tsx b/x-pack/plugins/security_solution/public/flyout/document_details/left/components/user_details.tsx index 1758bbc5b05d8..0aa2624f202ff 100644 --- a/x-pack/plugins/security_solution/public/flyout/document_details/left/components/user_details.tsx +++ b/x-pack/plugins/security_solution/public/flyout/document_details/left/components/user_details.tsx @@ -30,7 +30,7 @@ import { AnomalyTableProvider } from '../../../../common/components/ml/anomaly/a import { InspectButton, InspectButtonContainer } from '../../../../common/components/inspect'; import { NetworkDetailsLink } from '../../../../common/components/links'; import { RiskScoreEntity } from '../../../../../common/search_strategy'; -import { RiskScoreLevel } from '../../../../explore/components/risk_score/severity/common'; +import { RiskScoreLevel } from '../../../../entity_analytics/components/severity/common'; import { DefaultFieldRenderer } from '../../../../timelines/components/field_renderers/field_renderers'; import { SecurityCellActions, @@ -49,7 +49,7 @@ import { useUserRelatedHosts } from '../../../../common/containers/related_entit import { useMlCapabilities } from '../../../../common/components/ml/hooks/use_ml_capabilities'; import { getEmptyTagValue } from '../../../../common/components/empty_value'; import { USER_DETAILS_RELATED_HOSTS_TABLE_TEST_ID, USER_DETAILS_TEST_ID } from './test_ids'; -import { ENTITY_RISK_LEVEL } from '../../../../explore/components/risk_score/translations'; +import { ENTITY_RISK_LEVEL } from '../../../../entity_analytics/components/risk_score/translations'; import { useHasSecurityCapability } from '../../../../helper_hooks'; const USER_DETAILS_ID = 'entities-users-details'; diff --git a/x-pack/plugins/security_solution/public/flyout/document_details/right/components/entities_overview.test.tsx b/x-pack/plugins/security_solution/public/flyout/document_details/right/components/entities_overview.test.tsx index 117420358ded5..6388d5f8fb85d 100644 --- a/x-pack/plugins/security_solution/public/flyout/document_details/right/components/entities_overview.test.tsx +++ b/x-pack/plugins/security_solution/public/flyout/document_details/right/components/entities_overview.test.tsx @@ -15,7 +15,6 @@ import { } from './test_ids'; import { EntitiesOverview } from './entities_overview'; import { TestProviders } from '../../../../common/mock'; -import { useRiskScore } from '../../../../explore/containers/risk_score'; import { useFirstLastSeen } from '../../../../common/containers/use_first_last_seen'; import { useObservedUserDetails } from '../../../../explore/users/containers/users/observed_details'; import { useHostDetails } from '../../../../explore/hosts/containers/hosts/details'; @@ -26,6 +25,7 @@ import { EXPANDABLE_PANEL_HEADER_TITLE_TEXT_TEST_ID, EXPANDABLE_PANEL_TOGGLE_ICON_TEST_ID, } from '../../../shared/components/test_ids'; +import { useRiskScore } from '../../../../entity_analytics/api/hooks/use_risk_score'; const from = '2022-04-05T12:00:00.000Z'; const to = '2022-04-08T12:00:00.;000Z'; @@ -49,7 +49,7 @@ const mockUseUserDetails = useObservedUserDetails as jest.Mock; jest.mock('../../../../explore/users/containers/users/observed_details'); const mockUseRiskScore = useRiskScore as jest.Mock; -jest.mock('../../../../explore/containers/risk_score'); +jest.mock('../../../../entity_analytics/api/hooks/use_risk_score'); const mockUseFirstLastSeen = useFirstLastSeen as jest.Mock; jest.mock('../../../../common/containers/use_first_last_seen'); diff --git a/x-pack/plugins/security_solution/public/flyout/document_details/right/components/host_entity_overview.test.tsx b/x-pack/plugins/security_solution/public/flyout/document_details/right/components/host_entity_overview.test.tsx index 36fb3731943c4..f7fc4c2a22d90 100644 --- a/x-pack/plugins/security_solution/public/flyout/document_details/right/components/host_entity_overview.test.tsx +++ b/x-pack/plugins/security_solution/public/flyout/document_details/right/components/host_entity_overview.test.tsx @@ -8,7 +8,6 @@ import React from 'react'; import { render } from '@testing-library/react'; import { TestProviders } from '../../../../common/mock'; import { HostEntityOverview } from './host_entity_overview'; -import { useRiskScore } from '../../../../explore/containers/risk_score'; import { useHostDetails } from '../../../../explore/hosts/containers/hosts/details'; import { useFirstLastSeen } from '../../../../common/containers/use_first_last_seen'; import { @@ -25,6 +24,7 @@ import type { ExpandableFlyoutContextValue } from '@kbn/expandable-flyout/src/co import { ExpandableFlyoutContext } from '@kbn/expandable-flyout/src/context'; import { LeftPanelInsightsTab, DocumentDetailsLeftPanelKey } from '../../left'; import { ENTITIES_TAB_ID } from '../../left/components/entities_details'; +import { useRiskScore } from '../../../../entity_analytics/api/hooks/use_risk_score'; const hostName = 'host'; const osFamily = 'Windows'; @@ -63,7 +63,7 @@ const mockUseHostDetails = useHostDetails as jest.Mock; jest.mock('../../../../explore/hosts/containers/hosts/details'); const mockUseRiskScore = useRiskScore as jest.Mock; -jest.mock('../../../../explore/containers/risk_score'); +jest.mock('../../../../entity_analytics/api/hooks/use_risk_score'); const mockUseFirstLastSeen = useFirstLastSeen as jest.Mock; jest.mock('../../../../common/containers/use_first_last_seen'); diff --git a/x-pack/plugins/security_solution/public/flyout/document_details/right/components/host_entity_overview.tsx b/x-pack/plugins/security_solution/public/flyout/document_details/right/components/host_entity_overview.tsx index a1d42871a42e4..dd90245a97f70 100644 --- a/x-pack/plugins/security_solution/public/flyout/document_details/right/components/host_entity_overview.tsx +++ b/x-pack/plugins/security_solution/public/flyout/document_details/right/components/host_entity_overview.tsx @@ -19,6 +19,7 @@ import { css } from '@emotion/css'; import { getOr } from 'lodash/fp'; import { i18n } from '@kbn/i18n'; import { useExpandableFlyoutContext } from '@kbn/expandable-flyout'; +import { useRiskScore } from '../../../../entity_analytics/api/hooks/use_risk_score'; import { useRightPanelContext } from '../context'; import type { DescriptionList } from '../../../../../common/utility_types'; import { @@ -30,10 +31,9 @@ import { getEmptyTagValue } from '../../../../common/components/empty_value'; import { DefaultFieldRenderer } from '../../../../timelines/components/field_renderers/field_renderers'; import { DescriptionListStyled } from '../../../../common/components/page'; import { OverviewDescriptionList } from '../../../../common/components/overview_description_list'; -import { RiskScoreLevel } from '../../../../explore/components/risk_score/severity/common'; +import { RiskScoreLevel } from '../../../../entity_analytics/components/severity/common'; import { useSourcererDataView } from '../../../../common/containers/sourcerer'; import { useGlobalTime } from '../../../../common/containers/use_global_time'; -import { useRiskScore } from '../../../../explore/containers/risk_score'; import { useHostDetails } from '../../../../explore/hosts/containers/hosts/details'; import { FAMILY, diff --git a/x-pack/plugins/security_solution/public/flyout/document_details/right/components/insights_section.test.tsx b/x-pack/plugins/security_solution/public/flyout/document_details/right/components/insights_section.test.tsx index bb776547d2a9f..bef0118295470 100644 --- a/x-pack/plugins/security_solution/public/flyout/document_details/right/components/insights_section.test.tsx +++ b/x-pack/plugins/security_solution/public/flyout/document_details/right/components/insights_section.test.tsx @@ -10,7 +10,6 @@ import { render } from '@testing-library/react'; import { RightPanelContext } from '../context'; import { INSIGHTS_HEADER_TEST_ID } from './test_ids'; import { TestProviders } from '../../../../common/mock'; -import { useRiskScore } from '../../../../explore/containers/risk_score'; import { useFirstLastSeen } from '../../../../common/containers/use_first_last_seen'; import { useObservedUserDetails } from '../../../../explore/users/containers/users/observed_details'; import { useHostDetails } from '../../../../explore/hosts/containers/hosts/details'; @@ -20,6 +19,7 @@ import { mockGetFieldsData } from '../../shared/mocks/mock_get_fields_data'; import { mockDataFormattedForFieldBrowser } from '../../shared/mocks/mock_data_formatted_for_field_browser'; import { InsightsSection } from './insights_section'; import { useAlertPrevalence } from '../../../../common/containers/alerts/use_alert_prevalence'; +import { useRiskScore } from '../../../../entity_analytics/api/hooks/use_risk_score'; jest.mock('../../../../common/containers/alerts/use_alert_prevalence'); @@ -69,7 +69,7 @@ const mockUseUserDetails = useObservedUserDetails as jest.Mock; jest.mock('../../../../explore/users/containers/users/observed_details'); const mockUseRiskScore = useRiskScore as jest.Mock; -jest.mock('../../../../explore/containers/risk_score'); +jest.mock('../../../../entity_analytics/api/hooks/use_risk_score'); const mockUseFirstLastSeen = useFirstLastSeen as jest.Mock; jest.mock('../../../../common/containers/use_first_last_seen'); diff --git a/x-pack/plugins/security_solution/public/flyout/document_details/right/components/user_entity_overview.test.tsx b/x-pack/plugins/security_solution/public/flyout/document_details/right/components/user_entity_overview.test.tsx index c8673f41376f4..b36c21faf3f73 100644 --- a/x-pack/plugins/security_solution/public/flyout/document_details/right/components/user_entity_overview.test.tsx +++ b/x-pack/plugins/security_solution/public/flyout/document_details/right/components/user_entity_overview.test.tsx @@ -8,7 +8,6 @@ import React from 'react'; import { render } from '@testing-library/react'; import { TestProviders } from '../../../../common/mock'; import { UserEntityOverview } from './user_entity_overview'; -import { useRiskScore } from '../../../../explore/containers/risk_score'; import { useFirstLastSeen } from '../../../../common/containers/use_first_last_seen'; import { ENTITIES_USER_OVERVIEW_DOMAIN_TEST_ID, @@ -25,6 +24,7 @@ import { ExpandableFlyoutContext } from '@kbn/expandable-flyout/src/context'; import { RightPanelContext } from '../context'; import { LeftPanelInsightsTab, DocumentDetailsLeftPanelKey } from '../../left'; import { ENTITIES_TAB_ID } from '../../left/components/entities_details'; +import { useRiskScore } from '../../../../entity_analytics/api/hooks/use_risk_score'; const userName = 'user'; const domain = 'n54bg2lfc7'; @@ -63,7 +63,7 @@ const mockUseUserDetails = useObservedUserDetails as jest.Mock; jest.mock('../../../../explore/users/containers/users/observed_details'); const mockUseRiskScore = useRiskScore as jest.Mock; -jest.mock('../../../../explore/containers/risk_score'); +jest.mock('../../../../entity_analytics/api/hooks/use_risk_score'); const mockUseFirstLastSeen = useFirstLastSeen as jest.Mock; jest.mock('../../../../common/containers/use_first_last_seen'); diff --git a/x-pack/plugins/security_solution/public/flyout/document_details/right/components/user_entity_overview.tsx b/x-pack/plugins/security_solution/public/flyout/document_details/right/components/user_entity_overview.tsx index 313719ec1c0ba..34768540e9337 100644 --- a/x-pack/plugins/security_solution/public/flyout/document_details/right/components/user_entity_overview.tsx +++ b/x-pack/plugins/security_solution/public/flyout/document_details/right/components/user_entity_overview.tsx @@ -32,10 +32,11 @@ import { getEmptyTagValue } from '../../../../common/components/empty_value'; import { DefaultFieldRenderer } from '../../../../timelines/components/field_renderers/field_renderers'; import { DescriptionListStyled } from '../../../../common/components/page'; import { OverviewDescriptionList } from '../../../../common/components/overview_description_list'; -import { RiskScoreLevel } from '../../../../explore/components/risk_score/severity/common'; +import { RiskScoreLevel } from '../../../../entity_analytics/components/severity/common'; import { useSourcererDataView } from '../../../../common/containers/sourcerer'; import { useGlobalTime } from '../../../../common/containers/use_global_time'; -import { useRiskScore } from '../../../../explore/containers/risk_score'; +import { useRiskScore } from '../../../../entity_analytics/api/hooks/use_risk_score'; + import { USER_DOMAIN, LAST_SEEN, diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/content.tsx b/x-pack/plugins/security_solution/public/flyout/entity_details/user_details_left/content.tsx similarity index 100% rename from x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/content.tsx rename to x-pack/plugins/security_solution/public/flyout/entity_details/user_details_left/content.tsx diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/header.tsx b/x-pack/plugins/security_solution/public/flyout/entity_details/user_details_left/header.tsx similarity index 100% rename from x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/header.tsx rename to x-pack/plugins/security_solution/public/flyout/entity_details/user_details_left/header.tsx diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/index.tsx b/x-pack/plugins/security_solution/public/flyout/entity_details/user_details_left/index.tsx similarity index 100% rename from x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/index.tsx rename to x-pack/plugins/security_solution/public/flyout/entity_details/user_details_left/index.tsx diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/tabs.tsx b/x-pack/plugins/security_solution/public/flyout/entity_details/user_details_left/tabs.tsx similarity index 84% rename from x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/tabs.tsx rename to x-pack/plugins/security_solution/public/flyout/entity_details/user_details_left/tabs.tsx index f86dc25ffe219..61f408a5c0ade 100644 --- a/x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/tabs.tsx +++ b/x-pack/plugins/security_solution/public/flyout/entity_details/user_details_left/tabs.tsx @@ -9,14 +9,14 @@ import type { ReactElement } from 'react'; import React, { useMemo } from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; +import { getRiskInputTab } from '../../../entity_analytics/components/entity_details_flyout'; import { UserAssetTableType } from '../../../explore/users/store/model'; import { ManagedUserDatasetKey } from '../../../../common/search_strategy/security_solution/users/managed_details'; import type { ManagedUserHits, ManagedUserHit, } from '../../../../common/search_strategy/security_solution/users/managed_details'; -import { ENTRA_TAB_TEST_ID, OKTA_TAB_TEST_ID, RISK_INPUTS_TAB_TEST_ID } from './test_ids'; -import { RiskInputsTab } from './tabs/risk_inputs'; +import { ENTRA_TAB_TEST_ID, OKTA_TAB_TEST_ID } from './test_ids'; import { AssetDocumentTab } from './tabs/asset_document'; import { RightPanelProvider } from '../../document_details/right/context'; @@ -54,18 +54,6 @@ export const useTabs = (managedUser: ManagedUserHits, alertIds: string[]): LeftP return tabs; }, [alertIds, managedUser]); -const getRiskInputTab = (alertIds: string[]) => ({ - id: UserDetailsLeftPanelTab.RISK_INPUTS, - 'data-test-subj': RISK_INPUTS_TAB_TEST_ID, - name: ( - - ), - content: , -}); - const getOktaTab = (oktaManagedUser: ManagedUserHit) => ({ id: UserDetailsLeftPanelTab.OKTA, 'data-test-subj': OKTA_TAB_TEST_ID, diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/tabs/asset_document.test.tsx b/x-pack/plugins/security_solution/public/flyout/entity_details/user_details_left/tabs/asset_document.test.tsx similarity index 100% rename from x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/tabs/asset_document.test.tsx rename to x-pack/plugins/security_solution/public/flyout/entity_details/user_details_left/tabs/asset_document.test.tsx diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/tabs/asset_document.tsx b/x-pack/plugins/security_solution/public/flyout/entity_details/user_details_left/tabs/asset_document.tsx similarity index 100% rename from x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/tabs/asset_document.tsx rename to x-pack/plugins/security_solution/public/flyout/entity_details/user_details_left/tabs/asset_document.tsx diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/tabs/test_ids.ts b/x-pack/plugins/security_solution/public/flyout/entity_details/user_details_left/tabs/test_ids.ts similarity index 100% rename from x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/tabs/test_ids.ts rename to x-pack/plugins/security_solution/public/flyout/entity_details/user_details_left/tabs/test_ids.ts diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/test_ids.ts b/x-pack/plugins/security_solution/public/flyout/entity_details/user_details_left/test_ids.ts similarity index 85% rename from x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/test_ids.ts rename to x-pack/plugins/security_solution/public/flyout/entity_details/user_details_left/test_ids.ts index b67efe48dca67..1b1bf00b48401 100644 --- a/x-pack/plugins/security_solution/public/flyout/entity_details/user_detais_left/test_ids.ts +++ b/x-pack/plugins/security_solution/public/flyout/entity_details/user_details_left/test_ids.ts @@ -7,6 +7,5 @@ import { PREFIX } from '../../shared/test_ids'; -export const RISK_INPUTS_TAB_TEST_ID = `${PREFIX}RiskInputsTab` as const; export const OKTA_TAB_TEST_ID = `${PREFIX}OktaTab` as const; export const ENTRA_TAB_TEST_ID = `${PREFIX}EntraTab` as const; diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/user_right/content.tsx b/x-pack/plugins/security_solution/public/flyout/entity_details/user_right/content.tsx index d782849ce5ee4..9b99c42aeac7a 100644 --- a/x-pack/plugins/security_solution/public/flyout/entity_details/user_right/content.tsx +++ b/x-pack/plugins/security_solution/public/flyout/entity_details/user_right/content.tsx @@ -8,6 +8,8 @@ import { EuiHorizontalRule } from '@elastic/eui'; import React from 'react'; +import { RiskSummary } from '../../../entity_analytics/components/risk_summary_flyout/risk_summary'; +import type { RiskScoreState } from '../../../entity_analytics/api/hooks/use_risk_score'; import { ManagedUser } from '../../../timelines/components/side_panel/new_user_detail/managed_user'; import type { ManagedUserData, @@ -15,11 +17,9 @@ import type { } from '../../../timelines/components/side_panel/new_user_detail/types'; import { ObservedUser } from '../../../timelines/components/side_panel/new_user_detail/observed_user'; import type { RiskScoreEntity } from '../../../../common/search_strategy'; -import type { RiskScoreState } from '../../../explore/containers/risk_score'; -import { RiskSummary } from '../shared/components/risk_summary'; import { USER_PANEL_RISK_SCORE_QUERY_ID } from '.'; import { FlyoutBody } from '../../shared/components/flyout_body'; -import type { UserDetailsLeftPanelTab } from '../user_detais_left/tabs'; +import type { UserDetailsLeftPanelTab } from '../user_details_left/tabs'; interface UserPanelContentProps { observedUser: ObservedUserData; diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/user_right/index.test.tsx b/x-pack/plugins/security_solution/public/flyout/entity_details/user_right/index.test.tsx index 5ac5495c3a19f..1c74e4ed23ea5 100644 --- a/x-pack/plugins/security_solution/public/flyout/entity_details/user_right/index.test.tsx +++ b/x-pack/plugins/security_solution/public/flyout/entity_details/user_right/index.test.tsx @@ -27,7 +27,7 @@ const mockProps: UserPanelProps = { jest.mock('../../../common/components/visualization_actions/visualization_embeddable'); const mockedUseRiskScore = jest.fn().mockReturnValue(mockRiskScoreState); -jest.mock('../../../explore/containers/risk_score', () => ({ +jest.mock('../../../entity_analytics/api/hooks/use_risk_score', () => ({ useRiskScore: () => mockedUseRiskScore(), })); diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/user_right/index.tsx b/x-pack/plugins/security_solution/public/flyout/entity_details/user_right/index.tsx index fdc4c9fa70352..76168bc01c842 100644 --- a/x-pack/plugins/security_solution/public/flyout/entity_details/user_right/index.tsx +++ b/x-pack/plugins/security_solution/public/flyout/entity_details/user_right/index.tsx @@ -8,6 +8,7 @@ import React, { useCallback, useMemo } from 'react'; import type { FlyoutPanelProps } from '@kbn/expandable-flyout'; import { useExpandableFlyoutContext } from '@kbn/expandable-flyout'; +import { useRiskScore } from '../../../entity_analytics/api/hooks/use_risk_score'; import { ManagedUserDatasetKey } from '../../../../common/search_strategy/security_solution/users/managed_details'; import { useManagedUser } from '../../../timelines/components/side_panel/new_user_detail/hooks/use_managed_user'; import { useObservedUser } from '../../../timelines/components/side_panel/new_user_detail/hooks/use_observed_user'; @@ -17,14 +18,13 @@ import { getCriteriaFromUsersType } from '../../../common/components/ml/criteria import { useGlobalTime } from '../../../common/containers/use_global_time'; import { AnomalyTableProvider } from '../../../common/components/ml/anomaly/anomaly_table_provider'; import { buildUserNamesFilter } from '../../../../common/search_strategy'; -import { useRiskScore } from '../../../explore/containers/risk_score'; import { RiskScoreEntity } from '../../../../common/entity_analytics/risk_engine'; import { FlyoutLoading } from '../../shared/components/flyout_loading'; import { FlyoutNavigation } from '../../shared/components/flyout_navigation'; import { UserPanelContent } from './content'; import { UserPanelHeader } from './header'; -import { UserDetailsPanelKey } from '../user_detais_left'; -import type { UserDetailsLeftPanelTab } from '../user_detais_left/tabs'; +import { UserDetailsPanelKey } from '../user_details_left'; +import type { UserDetailsLeftPanelTab } from '../user_details_left/tabs'; export interface UserPanelProps extends Record { contextID: string; diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/user_right/mocks/index.ts b/x-pack/plugins/security_solution/public/flyout/entity_details/user_right/mocks/index.ts index d677f79ca4322..88ab3c10241cb 100644 --- a/x-pack/plugins/security_solution/public/flyout/entity_details/user_right/mocks/index.ts +++ b/x-pack/plugins/security_solution/public/flyout/entity_details/user_right/mocks/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { RiskScoreState } from '../../../../explore/containers/risk_score'; +import type { RiskScoreState } from '../../../../entity_analytics/api/hooks/use_risk_score'; import type { RiskScoreEntity, UserRiskScore } from '../../../../../common/search_strategy'; import { RiskSeverity } from '../../../../../common/search_strategy'; import { RiskCategories } from '../../../../../common/entity_analytics/risk_engine'; diff --git a/x-pack/plugins/security_solution/public/flyout/index.tsx b/x-pack/plugins/security_solution/public/flyout/index.tsx index 01c14b3d3ed29..ef7e182324c63 100644 --- a/x-pack/plugins/security_solution/public/flyout/index.tsx +++ b/x-pack/plugins/security_solution/public/flyout/index.tsx @@ -24,8 +24,8 @@ import { PreviewPanel, DocumentDetailsPreviewPanelKey } from './document_details import { PreviewPanelProvider } from './document_details/preview/context'; import type { UserPanelExpandableFlyoutProps } from './entity_details/user_right'; import { UserPanel, UserPanelKey } from './entity_details/user_right'; -import type { UserDetailsPanelProps } from './entity_details/user_detais_left'; -import { UserDetailsPanel, UserDetailsPanelKey } from './entity_details/user_detais_left'; +import type { UserDetailsPanelProps } from './entity_details/user_details_left'; +import { UserDetailsPanel, UserDetailsPanelKey } from './entity_details/user_details_left'; /** * List of all panels that will be used within the document details expandable flyout. * This needs to be passed to the expandable flyout registeredPanels property. diff --git a/x-pack/plugins/security_solution/public/overview/components/common.tsx b/x-pack/plugins/security_solution/public/overview/components/common.tsx index f9068a4507b75..fcf4072db1afd 100644 --- a/x-pack/plugins/security_solution/public/overview/components/common.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/common.tsx @@ -8,7 +8,7 @@ import { EuiButtonIcon, EuiPopover, EuiPopoverTitle, EuiText } from '@elastic/eui'; import React, { useCallback, useState } from 'react'; import * as i18n from './translations'; -import { RiskScoreDocLink } from '../../explore/components/risk_score/risk_score_onboarding/risk_score_doc_link'; +import { RiskScoreDocLink } from '../../entity_analytics/components/risk_score_onboarding/risk_score_doc_link'; import type { RiskScoreEntity } from '../../../common/entity_analytics/risk_engine'; export const RiskScoreInfoTooltip: React.FC<{ diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/common/translations.ts b/x-pack/plugins/security_solution/public/overview/components/entity_analytics/common/translations.ts deleted file mode 100644 index cc538bedae1ea..0000000000000 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/common/translations.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { i18n } from '@kbn/i18n'; - -export const TOTAL_LABEL = i18n.translate('xpack.securitySolution.entityAnalytics.totalLabel', { - defaultMessage: 'Total', -}); - -export const HOST_RISK_TITLE = i18n.translate( - 'xpack.securitySolution.entityAnalytics.hostsRiskDashboard.title', - { - defaultMessage: 'Host Risk Scores', - } -); - -export const USER_RISK_TITLE = i18n.translate( - 'xpack.securitySolution.entityAnalytics.usersRiskDashboard.title', - { - defaultMessage: 'User Risk Scores', - } -); diff --git a/x-pack/plugins/security_solution/public/overview/components/host_overview/index.test.tsx b/x-pack/plugins/security_solution/public/overview/components/host_overview/index.test.tsx index edbb6d03bf9a9..b1714aace87a5 100644 --- a/x-pack/plugins/security_solution/public/overview/components/host_overview/index.test.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/host_overview/index.test.tsx @@ -14,7 +14,7 @@ import { TestProviders } from '../../../common/mock'; import { HostOverview } from '.'; import { mockData } from './mock'; import { mockAnomalies } from '../../../common/components/ml/mock'; -import { useRiskScore } from '../../../explore/containers/risk_score/all'; +import { useRiskScore } from '../../../entity_analytics/api/hooks/use_risk_score'; const defaultProps = { data: undefined, @@ -25,7 +25,7 @@ const defaultProps = { loading: true, }; -jest.mock('../../../explore/containers/risk_score/all'); +jest.mock('../../../entity_analytics/api/hooks/use_risk_score'); const mockUseRiskScore = useRiskScore as jest.Mock; diff --git a/x-pack/plugins/security_solution/public/overview/components/host_overview/index.tsx b/x-pack/plugins/security_solution/public/overview/components/host_overview/index.tsx index 686828412977a..a6409c587e0a6 100644 --- a/x-pack/plugins/security_solution/public/overview/components/host_overview/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/host_overview/index.tsx @@ -10,6 +10,7 @@ import { euiDarkVars as darkTheme, euiLightVars as lightTheme } from '@kbn/ui-th import { getOr } from 'lodash/fp'; import React, { useCallback, useMemo } from 'react'; import styled from 'styled-components'; +import { useRiskScore } from '../../../entity_analytics/api/hooks/use_risk_score'; import type { HostItem } from '../../../../common/search_strategy'; import { buildHostNamesFilter, RiskScoreEntity } from '../../../../common/search_strategy'; import { DEFAULT_DARK_MODE } from '../../../../common/constants'; @@ -35,9 +36,8 @@ import { DescriptionListStyled, OverviewWrapper } from '../../../common/componen import * as i18n from './translations'; import { EndpointOverview } from './endpoint_overview'; import { OverviewDescriptionList } from '../../../common/components/overview_description_list'; -import { useRiskScore } from '../../../explore/containers/risk_score'; -import { RiskScoreLevel } from '../../../explore/components/risk_score/severity/common'; -import { RiskScoreHeaderTitle } from '../../../explore/components/risk_score/risk_score_onboarding/risk_score_header_title'; +import { RiskScoreLevel } from '../../../entity_analytics/components/severity/common'; +import { RiskScoreHeaderTitle } from '../../../entity_analytics/components/risk_score_onboarding/risk_score_header_title'; import type { SourcererScopeName } from '../../../common/store/sourcerer/model'; import { RiskScoreDocTooltip } from '../common'; diff --git a/x-pack/plugins/security_solution/public/overview/components/user_overview/index.test.tsx b/x-pack/plugins/security_solution/public/overview/components/user_overview/index.test.tsx index 185f2a0fc17b5..74d78af12fde4 100644 --- a/x-pack/plugins/security_solution/public/overview/components/user_overview/index.test.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/user_overview/index.test.tsx @@ -12,7 +12,7 @@ import '../../../common/mock/match_media'; import { TestProviders } from '../../../common/mock'; import { mockAnomalies } from '../../../common/components/ml/mock'; -import { useRiskScore } from '../../../explore/containers/risk_score/all'; +import { useRiskScore } from '../../../entity_analytics/api/hooks/use_risk_score'; import type { UserSummaryProps } from '.'; import { UserOverview } from '.'; @@ -25,7 +25,7 @@ const defaultProps = { loading: false, }; -jest.mock('../../../explore/containers/risk_score/all'); +jest.mock('../../../entity_analytics/api/hooks/use_risk_score'); const mockRiskScore = useRiskScore as jest.Mock; diff --git a/x-pack/plugins/security_solution/public/overview/components/user_overview/index.tsx b/x-pack/plugins/security_solution/public/overview/components/user_overview/index.tsx index 446fe215a695a..572e4aab7e6df 100644 --- a/x-pack/plugins/security_solution/public/overview/components/user_overview/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/user_overview/index.tsx @@ -10,6 +10,7 @@ import { euiDarkVars as darkTheme, euiLightVars as lightTheme } from '@kbn/ui-th import { getOr } from 'lodash/fp'; import React, { useCallback, useMemo } from 'react'; import styled from 'styled-components'; +import { useRiskScore } from '../../../entity_analytics/api/hooks/use_risk_score'; import { buildUserNamesFilter, RiskScoreEntity } from '../../../../common/search_strategy'; import { DEFAULT_DARK_MODE } from '../../../../common/constants'; import type { DescriptionList } from '../../../../common/utility_types'; @@ -32,10 +33,9 @@ import { DescriptionListStyled, OverviewWrapper } from '../../../common/componen import * as i18n from './translations'; import { OverviewDescriptionList } from '../../../common/components/overview_description_list'; -import { useRiskScore } from '../../../explore/containers/risk_score'; -import { RiskScoreLevel } from '../../../explore/components/risk_score/severity/common'; +import { RiskScoreLevel } from '../../../entity_analytics/components/severity/common'; import type { UserItem } from '../../../../common/search_strategy/security_solution/users/common'; -import { RiskScoreHeaderTitle } from '../../../explore/components/risk_score/risk_score_onboarding/risk_score_header_title'; +import { RiskScoreHeaderTitle } from '../../../entity_analytics/components/risk_score_onboarding/risk_score_header_title'; import type { SourcererScopeName } from '../../../common/store/sourcerer/model'; import { RiskScoreDocTooltip } from '../common'; diff --git a/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx b/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx index c98dbc74d5a2c..b4abb38331952 100644 --- a/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx +++ b/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx @@ -24,8 +24,8 @@ import { useCtiDashboardLinks } from '../containers/overview_cti_links'; import { useIsExperimentalFeatureEnabled } from '../../common/hooks/use_experimental_features'; import { initialUserPrivilegesState } from '../../common/components/user_privileges/user_privileges_context'; import type { EndpointPrivileges } from '../../../common/endpoint/types'; -import { useRiskScore } from '../../explore/containers/risk_score'; import { mockCasesContract } from '@kbn/cases-plugin/public/mocks'; +import { useRiskScore } from '../../entity_analytics/api/hooks/use_risk_score'; const mockNavigateToApp = jest.fn(); jest.mock('../../common/components/landing_page'); @@ -97,7 +97,7 @@ jest.mock('../containers/overview_cti_links/use_all_ti_data_sources'); const useAllTiDataSourcesMock = useAllTiDataSources as jest.Mock; useAllTiDataSourcesMock.mockReturnValue(mockTiDataSources); -jest.mock('../../explore/containers/risk_score'); +jest.mock('../../entity_analytics/api/hooks/use_risk_score'); const useRiskScoreMock = useRiskScore as jest.Mock; useRiskScoreMock.mockReturnValue({ loading: false, data: [], isModuleEnabled: false }); diff --git a/x-pack/plugins/security_solution/public/overview/routes.tsx b/x-pack/plugins/security_solution/public/overview/routes.tsx index 560daf686242e..82214b2463bdf 100644 --- a/x-pack/plugins/security_solution/public/overview/routes.tsx +++ b/x-pack/plugins/security_solution/public/overview/routes.tsx @@ -21,7 +21,7 @@ import { StatefulOverview } from './pages/overview'; import { DataQuality } from './pages/data_quality'; import { DetectionResponse } from './pages/detection_response'; import { PluginTemplateWrapper } from '../common/components/plugin_template_wrapper'; -import { EntityAnalyticsPage } from './pages/entity_analytics'; +import { EntityAnalyticsPage } from '../entity_analytics/pages/entity_analytics_dashboard'; import { SecurityRoutePageWrapper } from '../common/components/security_route_page_wrapper'; import { LandingPage } from './pages/landing'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/side_panel/event_details/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/side_panel/event_details/index.test.tsx index 3f7702d490e9d..f50142177ba8b 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/side_panel/event_details/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/side_panel/event_details/index.test.tsx @@ -116,7 +116,7 @@ jest.mock( } ); jest.mock('../../../../detections/components/alerts_table/actions'); -jest.mock('../../../../explore/containers/risk_score', () => { +jest.mock('../../../../entity_analytics/api/hooks/use_risk_score', () => { return { useRiskScore: jest.fn().mockReturnValue({ loading: true, diff --git a/x-pack/plugins/security_solution/public/timelines/components/side_panel/new_user_detail/managed_user.tsx b/x-pack/plugins/security_solution/public/timelines/components/side_panel/new_user_detail/managed_user.tsx index a208a9ae3f41f..590f120b19687 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/side_panel/new_user_detail/managed_user.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/side_panel/new_user_detail/managed_user.tsx @@ -18,7 +18,7 @@ import { import React, { useMemo } from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; import { css } from '@emotion/css'; -import type { UserDetailsLeftPanelTab } from '../../../../flyout/entity_details/user_detais_left/tabs'; +import type { UserDetailsLeftPanelTab } from '../../../../flyout/entity_details/user_details_left/tabs'; import { UserAssetTableType } from '../../../../explore/users/store/model'; import type { ManagedUserFields } from '../../../../../common/search_strategy/security_solution/users/managed_details'; import { ManagedUserDatasetKey } from '../../../../../common/search_strategy/security_solution/users/managed_details'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/side_panel/new_user_detail/managed_user_accordion.tsx b/x-pack/plugins/security_solution/public/timelines/components/side_panel/new_user_detail/managed_user_accordion.tsx index 9ae5a6433f041..a03775f61cf26 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/side_panel/new_user_detail/managed_user_accordion.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/side_panel/new_user_detail/managed_user_accordion.tsx @@ -11,7 +11,7 @@ import React from 'react'; import { css } from '@emotion/react'; import { FormattedMessage } from '@kbn/i18n-react'; import { get } from 'lodash/fp'; -import { UserDetailsLeftPanelTab } from '../../../../flyout/entity_details/user_detais_left/tabs'; +import { UserDetailsLeftPanelTab } from '../../../../flyout/entity_details/user_details_left/tabs'; import { ExpandablePanel } from '../../../../flyout/shared/components/expandable_panel'; import type { ManagedUserFields } from '../../../../../common/search_strategy/security_solution/users/managed_details'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/side_panel/new_user_detail/risk_score_field.tsx b/x-pack/plugins/security_solution/public/timelines/components/side_panel/new_user_detail/risk_score_field.tsx index 798588928bb77..fab77b92582f6 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/side_panel/new_user_detail/risk_score_field.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/side_panel/new_user_detail/risk_score_field.tsx @@ -15,8 +15,8 @@ import * as i18n from './translations'; import { RiskScoreEntity } from '../../../../../common/search_strategy'; import { getEmptyTagValue } from '../../../../common/components/empty_value'; -import { RiskScoreLevel } from '../../../../explore/components/risk_score/severity/common'; -import type { RiskScoreState } from '../../../../explore/containers/risk_score'; +import { RiskScoreLevel } from '../../../../entity_analytics/components/severity/common'; +import type { RiskScoreState } from '../../../../entity_analytics/api/hooks/use_risk_score'; import { RiskScoreDocTooltip } from '../../../../overview/components/common'; export const TooltipContainer = styled.div` diff --git a/x-pack/plugins/security_solution/tsconfig.json b/x-pack/plugins/security_solution/tsconfig.json index 2158fe97996dc..35767b63dab75 100644 --- a/x-pack/plugins/security_solution/tsconfig.json +++ b/x-pack/plugins/security_solution/tsconfig.json @@ -185,6 +185,7 @@ "@kbn/core-http-common", "@kbn/search-errors", "@kbn/stack-connectors-plugin", - "@kbn/elastic-assistant-common" + "@kbn/elastic-assistant-common", + "@kbn/lens-embeddable-utils" ] } diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 1f97750f40911..d47d3add7fd8b 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -34810,7 +34810,6 @@ "xpack.securitySolution.entityAnalytics.hostsRiskDashboard.title": "Scores de risque de l'hôte", "xpack.securitySolution.entityAnalytics.riskDashboard.viewAllLabel": "Afficher tout", "xpack.securitySolution.entityAnalytics.technicalPreviewLabel": "Version d'évaluation technique", - "xpack.securitySolution.entityAnalytics.totalLabel": "Total", "xpack.securitySolution.entityAnalytics.usersRiskDashboard.title": "Scores de risque de l'utilisateur", "xpack.securitySolution.event.module.linkToElasticEndpointSecurityDescription": "Ouvrir dans Endpoint Security", "xpack.securitySolution.event.summary.threat_indicator.modal.allMatches": "Toutes les correspondances d'indicateur", @@ -35969,7 +35968,6 @@ "xpack.securitySolution.riskScore.errorPanel.errors": "Erreurs", "xpack.securitySolution.riskScore.errorPanel.message": "Un problème est survenu. Réessayez plus tard.", "xpack.securitySolution.riskScore.errorPanel.title": "Désolé, une erreur est survenue.", - "xpack.securitySolution.riskScore.errorSearchDescription": "Une erreur s'est produite sur la recherche du score de risque", "xpack.securitySolution.riskScore.failSearchDescription": "Impossible de lancer une recherche sur le score de risque", "xpack.securitySolution.riskScore.hostRiskScoresEnabledTitle": "Scores de risque de l'hôte activés", "xpack.securitySolution.riskScore.hostsDashboardWarningPanelBody": "Nous n’avons pas trouvé de données de score de risque de l’hôte. Vérifiez si vous avez des filtres globaux dans la barre de recherche KQL globale. Si vous venez d’activer le module de risque de l’hôte, le moteur de risque peut mettre une heure à générer les données de score de risque de l’hôte et les afficher dans ce panneau.", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 0bcc41300dc7b..71ebe72b93025 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -34809,7 +34809,6 @@ "xpack.securitySolution.entityAnalytics.hostsRiskDashboard.title": "ホストリスクスコア", "xpack.securitySolution.entityAnalytics.riskDashboard.viewAllLabel": "すべて表示", "xpack.securitySolution.entityAnalytics.technicalPreviewLabel": "テクニカルプレビュー", - "xpack.securitySolution.entityAnalytics.totalLabel": "合計", "xpack.securitySolution.entityAnalytics.usersRiskDashboard.title": "ユーザーリスクスコア", "xpack.securitySolution.event.module.linkToElasticEndpointSecurityDescription": "Endpoint Securityで開く", "xpack.securitySolution.event.summary.threat_indicator.modal.allMatches": "すべてのインジケーター一致", @@ -35968,7 +35967,6 @@ "xpack.securitySolution.riskScore.errorPanel.errors": "エラー", "xpack.securitySolution.riskScore.errorPanel.message": "何か問題が発生しましたしばらくたってから再試行してください。", "xpack.securitySolution.riskScore.errorPanel.title": "申し訳ございません、エラーが発生しました", - "xpack.securitySolution.riskScore.errorSearchDescription": "リスクスコア検索でエラーが発生しました", "xpack.securitySolution.riskScore.failSearchDescription": "リスクスコアで検索を実行できませんでした", "xpack.securitySolution.riskScore.hostRiskScoresEnabledTitle": "ホストリスクスコア有効", "xpack.securitySolution.riskScore.hostsDashboardWarningPanelBody": "ホストリスクスコアデータが見つかりません。グローバルKQL検索バーにグローバルフィルターがあるかどうかを確認してください。ホストリスクモジュールを有効にしたばかりの場合は、リスクエンジンがホストリスクスコアデータを生成し、このパネルに表示するまでに1時間かかることがあります。", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 9e283e2a5fe0b..ff583c718ddf8 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -34804,7 +34804,6 @@ "xpack.securitySolution.entityAnalytics.hostsRiskDashboard.title": "主机风险分数", "xpack.securitySolution.entityAnalytics.riskDashboard.viewAllLabel": "查看全部", "xpack.securitySolution.entityAnalytics.technicalPreviewLabel": "技术预览", - "xpack.securitySolution.entityAnalytics.totalLabel": "合计", "xpack.securitySolution.entityAnalytics.usersRiskDashboard.title": "用户风险分数", "xpack.securitySolution.event.module.linkToElasticEndpointSecurityDescription": "在 Endpoint Security 中打开", "xpack.securitySolution.event.summary.threat_indicator.modal.allMatches": "所有指标匹配", @@ -35963,7 +35962,6 @@ "xpack.securitySolution.riskScore.errorPanel.errors": "错误", "xpack.securitySolution.riskScore.errorPanel.message": "出问题了。请稍后重试。", "xpack.securitySolution.riskScore.errorPanel.title": "抱歉,有错误", - "xpack.securitySolution.riskScore.errorSearchDescription": "搜索风险分数时发生错误", "xpack.securitySolution.riskScore.failSearchDescription": "无法对风险分数执行搜索", "xpack.securitySolution.riskScore.hostRiskScoresEnabledTitle": "已启用主机风险分数", "xpack.securitySolution.riskScore.hostsDashboardWarningPanelBody": "找不到任何主机风险分数数据。检查全局 KQL 搜索栏中是否具有任何全局筛选。如果刚刚启用了主机风险模块,风险引擎可能需要一小时才能生成并在此面板中显示主机风险分数数据。",