[Security Solution] remove newDataViewPickerEnabled feature flag#238549
[Security Solution] remove newDataViewPickerEnabled feature flag#238549PhilippeOberti wants to merge 1 commit intoelastic:mainfrom
Conversation
2852474 to
b1cca27
Compare
b1cca27 to
677e8b8
Compare
677e8b8 to
94ebf77
Compare
94ebf77 to
21f1137
Compare
3504e7e to
3211e6d
Compare
3211e6d to
96bfa41
Compare
…separate props (#242490) ## Summary This PR makes a small change to the SearchBar component used in many pages in Security Solution. ### Context In the previous version of the code, we were passing the dataView to the component via the `sourcererDataView` prop. There was also some internal logic to fetch the dataView using the `useDataView` hook, as well as some logic to switch between the `sourcererDataView` and the new `dataView` using the `dataViewPickerEnabled` feature flag. The problem is this was not clear, as almost every page using the SearchBar component was also fetching the `experimentalDataView` and the `oldSourcererDataView` and pass only the correct one depending on the value of the `dataViewPickerEnabled` feature flag. That logic was done in so many places, it was very confusing. Also, something that the previous code was not allowing us to do was to pass a dataView for a specific scope. The `useDataView` hook within the `SearchBar` component was using the default scope. For the Attacks page we're currently creating (see skeleton PR [here](#242384)), we need to select the attacks data view (created in [this previous PR](#238750)). ### Changes This PR makes the following small changes: - separate the previous `sourcererDataView` prop into 2 new ones: - `dataView` for the dataView used when the `dataViewPickerEnabled` is `true` - `sourcererDataViewSpec` for the dataView used when the `dataViewPickerEnabled` is `false` - rename `oldSourcererDataView` to `oldSourcererDataViewSpec` to better reflect the type of the variable (`DataViewSpec`) - added TODOs everywhere as we will be removing all the old sourcerer related code soon (most likely January, PR in draft [here](#238549)). > [!NOTE] > This PR should not introduce any behavior or UI changes. A good sign is other than name changes, none of the existing unit tests have been changed 😄 > You'll also notice that the changes are very repetitive between all the files. ### 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 - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels.
96bfa41 to
42e15a4
Compare
…pare the new attacks page (#242312) ## Summary This PR renames the `SourcererScopeName` from `detections` to `alerts`. We will soon need a new scope called `attacks` so we can easily retrieve the new attack dataview (introduced in [this recent PR](#238750)). This renaming will avoid confusion. > [!IMPORTANT] > No UI changes should be introduced by this PR! -------------------------------------------------------------- _Edit: after discussing with the team, I took this opportunity to do one more cleanup: the `DataViewManagerScopeName` enum (which is basically pointing to the `SourcererScopeName` enum are now one. I'm defining this new enum within the `data_view_manager` folder as the sourcerer folder will be soon removed (see this draft [PR](#238549)), and is now named `PageScope`. That way, it is much less confusing what this enum actually does..._ > [!NOTE] > `PageScope` points to the location of the picker (using `useDataView(scope)` returns the current dataview selected in that scope) ## Files by codeowner <details> <summary>Expand to see all files by codeowners</summary> ### elastic/contextual-security-apps * x-pack/solutions/security/plugins/security_solution/public/common/components/sessions_viewer/index.tsx ### elastic/kibana-cases * x-pack/solutions/security/plugins/security_solution/public/cases/components/ease/table.tsx * x-pack/solutions/security/plugins/security_solution/public/cases/pages/use_fetch_alert_data.ts ### elastic/security-detection-engine * x-pack/solutions/security/plugins/security_solution/public/detection_engine/rule_creation_ui/components/rule_preview/preview_histogram.tsx * x-pack/solutions/security/plugins/security_solution/public/detection_engine/rule_creation_ui/components/rule_preview/preview_table_cell_renderer.tsx ### elastic/security-detection-rule-management * x-pack/solutions/security/plugins/security_solution/public/detection_engine/rule_details_ui/pages/rule_details/execution_log_table/execution_log_table.tsx * x-pack/solutions/security/plugins/security_solution/public/detection_engine/rule_details_ui/pages/rule_details/index.tsx ### elastic/security-entity-analytics * x-pack/solutions/security/plugins/security_solution/public/common/components/matrix_histogram/index.tsx * x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/entity_details_flyout/hooks/use_risk_input_actions.ts * x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/risk_score_management/alert_filters_kql_bar.tsx * x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/risk_score_management/risk_score_preview_section.tsx * x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/top_risk_score_contributors_alerts/index.tsx * x-pack/solutions/security/plugins/security_solution/public/entity_analytics/pages/entity_analytics_privileged_user_monitoring_page.tsx * x-pack/solutions/security/plugins/security_solution/public/explore/components/stat_items/metric_embeddable.tsx * x-pack/solutions/security/plugins/security_solution/public/explore/components/stat_items/stat_items.tsx * x-pack/solutions/security/plugins/security_solution/public/explore/hosts/pages/details/index.tsx * x-pack/solutions/security/plugins/security_solution/public/explore/hosts/pages/hosts.tsx * x-pack/solutions/security/plugins/security_solution/public/explore/network/components/details/index.test.tsx * x-pack/solutions/security/plugins/security_solution/public/explore/network/components/details/index.tsx * x-pack/solutions/security/plugins/security_solution/public/explore/network/components/embeddables/embedded_map.tsx * x-pack/solutions/security/plugins/security_solution/public/explore/network/components/embeddables/map_tool_tip/point_tool_tip_content.tsx * x-pack/solutions/security/plugins/security_solution/public/explore/network/components/field_renderers/field_renderers.test.tsx * x-pack/solutions/security/plugins/security_solution/public/explore/network/components/field_renderers/field_renderers.tsx * x-pack/solutions/security/plugins/security_solution/public/explore/network/pages/details/index.tsx * x-pack/solutions/security/plugins/security_solution/public/explore/network/pages/navigation/dns_query_tab_body.tsx * x-pack/solutions/security/plugins/security_solution/public/explore/network/pages/network.tsx * x-pack/solutions/security/plugins/security_solution/public/explore/users/pages/details/index.tsx * x-pack/solutions/security/plugins/security_solution/public/explore/users/pages/navigation/authentications_query_tab_body.tsx * x-pack/solutions/security/plugins/security_solution/public/explore/users/pages/users.tsx ### elastic/security-generative-ai * x-pack/solutions/security/plugins/security_solution/public/assistant/send_to_timeline/index.tsx * x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/results/attack_discovery_panel/tabs/alerts_tab/ease/table.tsx * x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/settings_flyout/alert_selection/alert_selection_query/index.tsx * x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/settings_flyout/alert_selection/preview_tab/index.test.tsx * x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/settings_flyout/alert_selection/preview_tab/index.tsx * x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/settings_flyout/schedule/create_flyout/index.tsx * x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/settings_flyout/schedule/details_flyout/definition/filters.tsx * x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/settings_flyout/schedule/details_flyout/index.tsx * x-pack/solutions/security/plugins/security_solution/public/reports/components/ai_value/alert_filtering_metric.test.tsx * x-pack/solutions/security/plugins/security_solution/public/reports/components/ai_value/alert_filtering_metric.tsx * x-pack/solutions/security/plugins/security_solution/public/reports/components/ai_value/alert_processing_donut_lens.test.tsx * x-pack/solutions/security/plugins/security_solution/public/reports/components/ai_value/alert_processing_donut_lens.tsx * x-pack/solutions/security/plugins/security_solution/public/reports/components/ai_value/cost_savings_metric.tsx * x-pack/solutions/security/plugins/security_solution/public/reports/components/ai_value/cost_savings_trend.tsx * x-pack/solutions/security/plugins/security_solution/public/reports/components/ai_value/time_saved_metric.test.tsx * x-pack/solutions/security/plugins/security_solution/public/reports/components/ai_value/time_saved_metric.tsx ### elastic/security-threat-hunting-investigations * x-pack/solutions/security/plugins/security_solution/public/common/components/events_tab/events_query_tab_body.tsx * x-pack/solutions/security/plugins/security_solution/public/common/components/events_viewer/index.test.tsx * x-pack/solutions/security/plugins/security_solution/public/common/components/events_viewer/index.tsx * x-pack/solutions/security/plugins/security_solution/public/common/components/inspect/modal.tsx * x-pack/solutions/security/plugins/security_solution/public/common/components/markdown_editor/plugins/insight/index.tsx * x-pack/solutions/security/plugins/security_solution/public/common/components/markdown_editor/plugins/insight/use_insight_query.ts * x-pack/solutions/security/plugins/security_solution/public/common/components/top_n/helpers.test.tsx * x-pack/solutions/security/plugins/security_solution/public/common/components/top_n/helpers.ts * x-pack/solutions/security/plugins/security_solution/public/common/components/top_n/top_n.tsx * x-pack/solutions/security/plugins/security_solution/public/common/components/visualization_actions/actions.test.tsx * x-pack/solutions/security/plugins/security_solution/public/common/components/visualization_actions/actions.tsx * x-pack/solutions/security/plugins/security_solution/public/common/components/visualization_actions/lens_embeddable.tsx * x-pack/solutions/security/plugins/security_solution/public/common/components/visualization_actions/types.ts * x-pack/solutions/security/plugins/security_solution/public/common/components/visualization_actions/use_lens_attributes.tsx * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/components/data_view_picker/index.test.tsx * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/components/data_view_picker/index.tsx * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/constants.ts * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_browser_fields.test.ts * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_browser_fields.ts * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_data_view.test.ts * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_data_view.ts * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_data_view_spec.test.ts * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_data_view_spec.ts * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_init_data_view_manager.ts * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_select_data_view.test.ts * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_select_data_view.ts * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_selected_patterns.test.ts * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_selected_patterns.ts * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_sync_url_state.test.ts * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_sync_url_state.ts * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/redux/actions.ts * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/redux/listeners/data_view_selected.test.ts * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/redux/listeners/data_view_selected.ts * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/redux/listeners/init_listener.test.ts * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/redux/listeners/init_listener.ts * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/redux/reducer.ts * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/redux/selectors.ts * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/redux/slices.test.ts * x-pack/solutions/security/plugins/security_solution/public/data_view_manager/redux/slices.ts * x-pack/solutions/security/plugins/security_solution/public/detections/components/alert_summary/table/table.tsx * x-pack/solutions/security/plugins/security_solution/public/detections/components/alerts/wrapper.tsx * x-pack/solutions/security/plugins/security_solution/public/detections/components/alerts_kpis/alerts_count_panel/index.tsx * x-pack/solutions/security/plugins/security_solution/public/detections/components/alerts_kpis/alerts_histogram_panel/index.tsx * x-pack/solutions/security/plugins/security_solution/public/detections/components/alerts_table/additional_toolbar_controls.tsx * x-pack/solutions/security/plugins/security_solution/public/detections/components/alerts_table/alerts_sub_grouping.tsx * x-pack/solutions/security/plugins/security_solution/public/detections/components/alerts_table/index.tsx * x-pack/solutions/security/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/use_add_bulk_to_timeline.tsx * x-pack/solutions/security/plugins/security_solution/public/detections/components/alerts_table/types.ts * x-pack/solutions/security/plugins/security_solution/public/detections/configurations/security_solution_detections/cell_value_context.tsx * x-pack/solutions/security/plugins/security_solution/public/detections/configurations/security_solution_detections/render_cell_value.test.tsx * x-pack/solutions/security/plugins/security_solution/public/detections/hooks/trigger_actions_alert_table/use_bulk_actions.test.tsx * x-pack/solutions/security/plugins/security_solution/public/detections/hooks/trigger_actions_alert_table/use_bulk_actions.tsx * x-pack/solutions/security/plugins/security_solution/public/detections/hooks/trigger_actions_alert_table/use_cell_actions.tsx * x-pack/solutions/security/plugins/security_solution/public/detections/hooks/trigger_actions_alert_table/use_trigger_actions_browser_fields_options.tsx * x-pack/solutions/security/plugins/security_solution/public/detections/hooks/use_rule_from_timeline.tsx * x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/left/components/analyze_graph.tsx * x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/left/components/graph_visualization.tsx * x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/left/components/session_view.tsx * x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/left/hooks/use_threat_intelligence_details.ts * x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/session_view/tabs/alerts_tab.tsx * x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/shared/hooks/use_event_details.ts * x-pack/solutions/security/plugins/security_solution/public/flyout/network_details/components/network_details.tsx * x-pack/solutions/security/plugins/security_solution/public/notes/components/open_flyout_button.tsx * x-pack/solutions/security/plugins/security_solution/public/overview/components/detection_response/hooks/use_navigate_to_timeline.tsx * x-pack/solutions/security/plugins/security_solution/public/overview/components/detection_response/host_alerts_table/host_alerts_table.tsx * x-pack/solutions/security/plugins/security_solution/public/overview/components/detection_response/rule_alerts_table/rule_alerts_table.tsx * x-pack/solutions/security/plugins/security_solution/public/overview/components/detection_response/user_alerts_table/user_alerts_table.tsx * x-pack/solutions/security/plugins/security_solution/public/overview/components/events_by_dataset/index.tsx * x-pack/solutions/security/plugins/security_solution/public/resolver/view/controls/sourcerer_selection.tsx * x-pack/solutions/security/plugins/security_solution/public/sourcerer/components/alerts_sourcerer.test.tsx * x-pack/solutions/security/plugins/security_solution/public/sourcerer/components/index.test.tsx * x-pack/solutions/security/plugins/security_solution/public/sourcerer/components/index.tsx * x-pack/solutions/security/plugins/security_solution/public/sourcerer/components/misc.test.tsx * x-pack/solutions/security/plugins/security_solution/public/sourcerer/components/sourcerer_integration.test.tsx * x-pack/solutions/security/plugins/security_solution/public/sourcerer/components/timeline_sourcerer.test.tsx * x-pack/solutions/security/plugins/security_solution/public/sourcerer/components/use_get_sourcerer_data_view.test.ts * x-pack/solutions/security/plugins/security_solution/public/sourcerer/components/use_get_sourcerer_data_view.tsx * x-pack/solutions/security/plugins/security_solution/public/sourcerer/components/use_pick_index_patterns.tsx * x-pack/solutions/security/plugins/security_solution/public/sourcerer/containers/hooks.test.tsx * x-pack/solutions/security/plugins/security_solution/public/sourcerer/containers/index.tsx * x-pack/solutions/security/plugins/security_solution/public/sourcerer/containers/readme.md * x-pack/solutions/security/plugins/security_solution/public/sourcerer/containers/sourcerer_paths.ts * x-pack/solutions/security/plugins/security_solution/public/sourcerer/containers/use_init_sourcerer.tsx * x-pack/solutions/security/plugins/security_solution/public/sourcerer/containers/use_signal_helpers.tsx * x-pack/solutions/security/plugins/security_solution/public/sourcerer/store/actions.ts * x-pack/solutions/security/plugins/security_solution/public/sourcerer/store/helpers.test.ts * x-pack/solutions/security/plugins/security_solution/public/sourcerer/store/helpers.ts * x-pack/solutions/security/plugins/security_solution/public/sourcerer/store/model.ts * x-pack/solutions/security/plugins/security_solution/public/sourcerer/store/readme.md * x-pack/solutions/security/plugins/security_solution/public/sourcerer/store/reducer.ts * x-pack/solutions/security/plugins/security_solution/public/sourcerer/store/selectors.ts * x-pack/solutions/security/plugins/security_solution/public/timelines/components/field_renderers/more_container/index.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/components/fields_browser/index.test.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/components/fields_browser/index.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/components/modal/header/index.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/components/open_timeline/index.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/components/open_timeline/note_previews/index.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/components/open_timeline/use_update_timeline.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/body/unified_timeline_body.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/data_providers/index.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/index.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/kpi/kpi_container.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/query_bar/eql/index.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/query_bar/index.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/search_or_filter/index.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/search_or_filter/search_or_filter.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/tabs/eql/header/index.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/tabs/eql/index.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/tabs/esql/index.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/tabs/pinned/index.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/tabs/query/events_count.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/tabs/query/index.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/tabs/shared/use_timeline_columns.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/containers/use_timeline_data_filters.test.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/hooks/use_create_timeline.test.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/hooks/use_create_timeline.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/pages/timelines_page.tsx * x-pack/solutions/security/plugins/security_solution/public/timelines/store/middlewares/timeline_save.ts </details> ### 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 - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. #232815
d8911d6 to
b4102c7
Compare
vitaliidm
left a comment
There was a problem hiding this comment.
Detection Engine area LGTM
hop-dev
left a comment
There was a problem hiding this comment.
Tested Entity Analytics screens all working fine 👍
NicholasPeretti
left a comment
There was a problem hiding this comment.
Great effort! 🚀
Thank you for this clean-up! It's really nice to see so much code disappear
I've left a few comments with some NITs but no blockers — up to you if you want address them
Ah, I just realised that my VSCode github integration didn't save the comments... great... 😡 |
x-pack/solutions/security/plugins/security_solution/public/reports/pages/ai_value.tsx
Show resolved
Hide resolved
There was a problem hiding this comment.
Thanks @PhilippeOberti for removing this code throughout the solution!
Local desk testing of the files owned by elastic/security-generative-ai looked good, apart from one error here, though the changes to that file itself look OK.
LGTM 🚀
03b2385 to
ce33aa4
Compare
maximpn
left a comment
There was a problem hiding this comment.
@PhilippeOberti It's nice to see a PR removing a lot of lines 😄
I've tested the PR locally to make sure there are no issues. The testing went good.
...ecurity/plugins/security_solution/public/common/utils/timeline/use_show_timeline_for_path.ts
Outdated
Show resolved
Hide resolved
c44bb71 to
42c111a
Compare
cdb09da to
f16f37d
Compare
1430fea to
b780166
Compare
b780166 to
26e7c1b
Compare
26e7c1b to
93e6f19
Compare
93e6f19 to
4d639d9
Compare
4d639d9 to
ac8ba3e
Compare
...rity_solution/public/attack_discovery/pages/settings_flyout/schedule/create_flyout/index.tsx
Outdated
Show resolved
Hide resolved
x-pack/solutions/security/plugins/security_solution/public/overview/pages/data_quality.test.tsx
Show resolved
Hide resolved
...utions/security/plugins/security_solution/public/sourcerer/containers/use_signal_helpers.tsx
Show resolved
Hide resolved
...utions/security/plugins/security_solution/public/sourcerer/containers/use_signal_helpers.tsx
Show resolved
Hide resolved
...s/security_solution/public/detections/hooks/trigger_actions_alert_table/use_cell_actions.tsx
Outdated
Show resolved
Hide resolved
..._solution/public/entity_analytics/pages/entity_analytics_privileged_user_monitoring_page.tsx
Show resolved
Hide resolved
...s/security/plugins/security_solution/public/flyout/shared/components/graph_visualization.tsx
Outdated
Show resolved
Hide resolved
...plugins/security_solution/public/flyout/entity_details/host_right/hooks/use_observed_host.ts
Show resolved
Hide resolved
.../plugins/security_solution/public/entity_analytics/pages/entity_analytics_home_page.test.tsx
Show resolved
Hide resolved
x-pack/solutions/security/plugins/security_solution/public/reports/pages/ai_value.tsx
Outdated
Show resolved
Hide resolved
.../security_solution/public/flyout/entity_details/watchlists_right/rule_based_source_input.tsx
Outdated
Show resolved
Hide resolved
...utions/security/plugins/security_solution/public/sourcerer/containers/use_signal_helpers.tsx
Outdated
Show resolved
Hide resolved
...lutions/security/plugins/security_solution/public/overview/pages/detection_response.test.tsx
Show resolved
Hide resolved
...plugins/security_solution/public/threat_intelligence/modules/indicators/pages/indicators.tsx
Outdated
Show resolved
Hide resolved
| const { dataView: experimentalDataView } = useDataView(PageScope.alerts); | ||
|
|
||
| const sourcererDataView = newDataViewPickerEnabled ? experimentalDataView : oldSourcererDataView; | ||
| const { dataView } = useDataView(PageScope.alerts); |
There was a problem hiding this comment.
🟢 Low risk_score_management/risk_score_preview_section.tsx:172
RiskEnginePreview destructures only dataView from useDataView(PageScope.alerts) and ignores the status return value. When the dataView is still loading, dataView contains INITIAL_DV with a falsy title, so useRiskScorePreview receives an undefined data_view_id, disables its query, and isLoading becomes false. The component then renders the normal UI with empty data and no loading indicator, misleading users into thinking there are no results while the dataView is still being fetched. Consider checking status === 'ready' before rendering content that depends on dataView, similar to the pattern used in GraphVisualization.
Also found in 1 other location(s)
x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/tabs/query/events_count.tsx:97
The call to
dataView.getRuntimeMappings()on line 97 does not use optional chaining, unlike otherdataViewaccesses in this component (e.g., line 94 usesdataView?.id). BeforeuseDataViewhas loaded (whenstatusis'pristine'or'loading'),dataViewis the initial placeholder valueINITIAL_DV. If this placeholder doesn't properly implementgetRuntimeMappings(), the component will crash on initial render. The previous code usedexperimentalDataView?.getRuntimeMappings() ?? {}with both optional chaining and a fallback, which protected against this.
🤖 Copy this AI Prompt to have your agent fix this:
In file x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/risk_score_management/risk_score_preview_section.tsx around line 172:
`RiskEnginePreview` destructures only `dataView` from `useDataView(PageScope.alerts)` and ignores the `status` return value. When the dataView is still loading, `dataView` contains `INITIAL_DV` with a falsy `title`, so `useRiskScorePreview` receives an undefined `data_view_id`, disables its query, and `isLoading` becomes `false`. The component then renders the normal UI with empty data and no loading indicator, misleading users into thinking there are no results while the dataView is still being fetched. Consider checking `status === 'ready'` before rendering content that depends on `dataView`, similar to the pattern used in `GraphVisualization`.
Evidence trail:
x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/risk_score_management/risk_score_preview_section.tsx:172 - `const { dataView } = useDataView(PageScope.alerts);` shows only dataView destructured, status ignored
x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_data_view.ts:17-20 - `INITIAL_DV = new DataView({ fieldFormats: {} })` has no title
x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_data_view.ts:42 - `useState<DataView>(INITIAL_DV)` initializes with empty DataView
x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_data_view.ts:72-73 - hook returns `{ dataView, status }`
x-pack/solutions/security/plugins/security_solution/public/entity_analytics/api/hooks/use_preview_risk_scores.ts:67 - `{ enabled: !!dataViewId }` disables query when dataViewId is falsy
x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/risk_score_management/risk_score_preview_section.tsx:239 - `isLoading={isLoading}` passed without dataView status check
Also found in 1 other location(s):
- x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/tabs/query/events_count.tsx:97 -- The call to `dataView.getRuntimeMappings()` on line 97 does not use optional chaining, unlike other `dataView` accesses in this component (e.g., line 94 uses `dataView?.id`). Before `useDataView` has loaded (when `status` is `'pristine'` or `'loading'`), `dataView` is the initial placeholder value `INITIAL_DV`. If this placeholder doesn't properly implement `getRuntimeMappings()`, the component will crash on initial render. The previous code used `experimentalDataView?.getRuntimeMappings() ?? {}` with both optional chaining and a fallback, which protected against this.
⏳ Build in-progress, with failures
Failed CI StepsTest Failures
History
|
Warning
This PR changes a lot of files. This change will not make it within
9.3.9.3.0feature freeze is on December 16th 2025, so ideally we'd be merging this PR on December 17th. This should give plenty of time to all the teams involved to do their testing.Summary
The
newDataViewPickerEnabledfeature flag has been turned on in this previous PR. We have not had any issues related to the usage of the data view picker over the old sourcerer code.This PR removes the
newDataViewPickerEnabledas well as all the code related to it and to the old sourcerer implementation. Some hooks are still being used, so a follow up PR will finalize the cleanup.What's included in this PR
Here's a list of high level changes:
newDataViewPickerEnabledfeature flag (some follow up cleanup will be required to fully delete the content of thesourcerer folderexperimentalDataView(and otherexperimental...names) with justdataViewWhat work will remains for follow up PRs
What will be coming after this PR is merged:
sourcererScopetopageScopeuseDataViewand other hooks that are still living throughout Security Solutionsourcererfolder into the newdata_view_managerfolderdata_view_managerfolder into a package and update all imports accordinglyCaution
While the PR should only removed unused code, please take your time looking at the code and testing the pages and feature you own, to make sure that no unwanted code was removed and functionality impacted!
How to test
Checklist
release_note:*label is applied per the guidelinesbackport:*labels.