Skip to content

[Security Solution] Replace sourcerer in analyzer#218183

Merged
christineweng merged 4 commits intoelastic:mainfrom
christineweng:dp-analyzer
Apr 18, 2025
Merged

[Security Solution] Replace sourcerer in analyzer#218183
christineweng merged 4 commits intoelastic:mainfrom
christineweng:dp-analyzer

Conversation

@christineweng
Copy link
Contributor

@christineweng christineweng commented Apr 14, 2025

Summary

Replace sourcerer in analyzer to use dataview picker when newDataViewPickerEnabled is on.

image

Checklist

  • Unit or functional tests were updated or added to match the most common scenarios
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines

@christineweng christineweng added release_note:enhancement backport:skip This PR does not require backporting Team:Threat Hunting:Investigations Security Solution Threat Hunting Investigations Team Feature:Sourcerer v9.1.0 labels Apr 14, 2025
@christineweng christineweng self-assigned this Apr 14, 2025
@christineweng christineweng requested review from a team as code owners April 14, 2025 22:09
@elasticmachine
Copy link
Contributor

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

/**
* Optional callback when data view picker is closed
*/
onClosePopover?: () => void;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you provide use cases background on where onClosePopover would be used?

This seems like an odd use case to have a popover open another popover and then having to pass onClosePopover to close these cascading popovers.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just some older design we need to support here I guess

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nreese yeah this was added to fix a UI bug. In analyzer, the dataview picker icon persists after opening any flyout

Screen.Recording.2025-04-15.at.9.57.58.AM.mov

Copy link
Contributor

@nreese nreese Apr 15, 2025

Choose a reason for hiding this comment

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

Since the data view picker is the only thing displayed in the first popover, what about just displaying the change data view popover when users click the original icon button to avoid pop-overs opening other popovers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nreese Thanks! I will consult the UIUX team on this.

Currently the button and the popover content are tightly coupled in change_dataview.tsx. To separate them and exposing both options will require a refactor of that file. Is this what you are suggesting?

Copy link
Contributor

Choose a reason for hiding this comment

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

We actually see lots of similar behaviors throughout Kibana, for example when popover are used in flyouts... Having a onClosePopover callback isn't a new pattern (I'm not saying it is a good one 😉).

It seems that we would have to do some good amount of refactor in order to get this to work without the onClosePopover callback, which increase the risk of breaking existing functionality.

@nreese are you really opposed to adding this callback? Even if it is a temporary solution to get us moving forward? I understand temporary is often a bad word, as things tend to usually be temporary for very long times... but such a callback does seem to me like a lot to maintain right?

Copy link
Contributor

Choose a reason for hiding this comment

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

are you really opposed to adding this callback? Even if it is a temporary solution to get us moving forward? I understand temporary is often a bad word, as things tend to usually be temporary for very long times... but such a callback does seem to me like a lot to maintain right?

No, I just wanted to explore all of the options and better understand the problem space. I am fine with progress over perfection.

Copy link
Contributor

@lgestc lgestc left a comment

Choose a reason for hiding this comment

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

nice:)

Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

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

kibana-presentation changes LGTM
code review only

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
securitySolution 9.0MB 9.0MB -1.8KB
unifiedSearch 352.0KB 352.1KB +143.0B
total -1.7KB

Page load bundle

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

id before after diff
securitySolution 89.4KB 89.4KB +5.0B
Unknown metric groups

API count

id before after diff
unifiedSearch 150 151 +1

History

cc @christineweng

};

const getPanelItems = () => {
const items = useMemo(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

Copy link
Contributor

@michaelolo24 michaelolo24 left a comment

Choose a reason for hiding this comment

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

Nice work!

@christineweng christineweng merged commit 095ee41 into elastic:main Apr 18, 2025
9 checks passed
davismcphee pushed a commit to davismcphee/kibana that referenced this pull request Apr 22, 2025
## Summary

Replace sourcerer in analyzer to use dataview picker when
`newDataViewPickerEnabled` is on.


![image](https://github.com/user-attachments/assets/077329ce-2510-4d6f-bc55-89b6b636df4f)


### 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)
akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request May 29, 2025
## Summary

Replace sourcerer in analyzer to use dataview picker when
`newDataViewPickerEnabled` is on.


![image](https://github.com/user-attachments/assets/077329ce-2510-4d6f-bc55-89b6b636df4f)


### 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)
christineweng added a commit to christineweng/kibana that referenced this pull request Jun 6, 2025
## Summary

Replace sourcerer in analyzer to use dataview picker when
`newDataViewPickerEnabled` is on.


![image](https://github.com/user-attachments/assets/077329ce-2510-4d6f-bc55-89b6b636df4f)


### 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)
christineweng added a commit that referenced this pull request Jun 10, 2025
… Data View Picker (#210585) (#223044)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[Security Solution][Sourcerer] Replace Sourcerer with Discover Data
View Picker (#210585)](#210585)
- [[Security Solution] Rename use_data_view to use_data_view_spec
#216461](#216461)
- [[Security Solution] Rename use full data view hook
#216614](#216614)
- [[Security Solution] Replace sourcerer in global header
#216685](#216685)
- [[Security Solution] Remove .title use in use_selected_patterns
#216994](#216994)
- [[Security Solution] Render default security solution data view with
managed label #216961](#216961)
- [[Security Solution] Replace sourcerer in analyzer
#218183](#218183)
- [[Security Solution] Replace use_sourcerer_data_view
#216997](#216997)
- [[Security Solution] Replace sourcerer in EQL tab with dataview picker
#218897](#218897)
- [[Security Solution][Sourcerer] replace use get scoped data view
#220196](#220196)
- [[Security Solution] renaming dataView to dataViewSpec and adding
types for clarity
#220718](#220718)
- [[Security Solution][Sourcerer] Maintain url sync support
#221737](#221737)
- [[Security Solution][Data View Manager] Allow passing data view to
query bar #220585](#220585)
- [[Security Solution] Fix data view picker privilege
#222122](#222122)



<!--- Backport version: 10.0.0 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Luke
Gmys","email":"11671118+lgestc@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-03-31T12:12:57Z","message":"[Security
Solution][Sourcerer] Replace Sourcerer with Discover Data View Picker
(#210585)\n\n# Unified Data View Picker: Phase 1 Implementation\nPart of
https://github.com/elastic/security-team/issues/11959\n\n## What This PR
Does\nThis PR represents the first step in our transition from the
current\nSourcerer component to the new unified Data View Picker.
Specifically,\nthis implementation:\n- Creates a new Data View Picker
component\n- Implements feature flag protection for all changes\n-
Handles asynchronous effects through Redux listener middleware\n-
Establishes a new Redux store architecture to support ad hoc data\nviews
infrastructure\n- Utilizes ad hoc data views to handle legacy patterns
from series 7\n(replacing the previous upgrade data view flow)\n\nSee
the readme for more info:
\n```x-pack/solutions/security/plugins/security_solution/public/data_view_manager/readme.md```\n\n##
What This PR Does NOT Cover\n- Does not affect screens other than
Timelines\n- Does not modify the existing Sourcerer component in any
way\n- Does not fully support all URL/local storage patterns\n\n##
Implementation Notes\nWe've made several accommodations to support both
Sourcerer and the new Data View Picker simultaneously during this
transition period, including:\n- Some interfaces might look odd,
especially the hooks that return the data view or patterns - this is
intentional to support existing use cases\n- There are feature
flag-based conditional statements throughout the code that will be
removed once the transition is complete\n\n## Testing Instructions\n1.
Add the following feature flag to your configuration:\n ```\n
xpack.securitySolution.enableExperimental:
['newDataViewPickerEnabled']\n ```\n2. Navigate to the Timelines
interface\n3. Test interactions with the new Data View
Picker\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"9679f2941550856d75e00c1faadd8c9669afe917","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","backport:skip","Team:
SecuritySolution","Team:Threat
Hunting:Investigations","Feature:Sourcerer","9.1
candidate","v9.1.0"],"title":"[Security Solution][Sourcerer] Replace
Sourcerer with Discover Data View
Picker","number":210585,"url":"https://github.com/elastic/kibana/pull/210585","mergeCommit":{"message":"[Security
Solution][Sourcerer] Replace Sourcerer with Discover Data View Picker
(#210585)\n\n# Unified Data View Picker: Phase 1 Implementation\nPart of
https://github.com/elastic/security-team/issues/11959\n\n## What This PR
Does\nThis PR represents the first step in our transition from the
current\nSourcerer component to the new unified Data View Picker.
Specifically,\nthis implementation:\n- Creates a new Data View Picker
component\n- Implements feature flag protection for all changes\n-
Handles asynchronous effects through Redux listener middleware\n-
Establishes a new Redux store architecture to support ad hoc data\nviews
infrastructure\n- Utilizes ad hoc data views to handle legacy patterns
from series 7\n(replacing the previous upgrade data view flow)\n\nSee
the readme for more info:
\n```x-pack/solutions/security/plugins/security_solution/public/data_view_manager/readme.md```\n\n##
What This PR Does NOT Cover\n- Does not affect screens other than
Timelines\n- Does not modify the existing Sourcerer component in any
way\n- Does not fully support all URL/local storage patterns\n\n##
Implementation Notes\nWe've made several accommodations to support both
Sourcerer and the new Data View Picker simultaneously during this
transition period, including:\n- Some interfaces might look odd,
especially the hooks that return the data view or patterns - this is
intentional to support existing use cases\n- There are feature
flag-based conditional statements throughout the code that will be
removed once the transition is complete\n\n## Testing Instructions\n1.
Add the following feature flag to your configuration:\n ```\n
xpack.securitySolution.enableExperimental:
['newDataViewPickerEnabled']\n ```\n2. Navigate to the Timelines
interface\n3. Test interactions with the new Data View
Picker\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"9679f2941550856d75e00c1faadd8c9669afe917"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/210585","number":210585,"mergeCommit":{"message":"[Security
Solution][Sourcerer] Replace Sourcerer with Discover Data View Picker
(#210585)\n\n# Unified Data View Picker: Phase 1 Implementation\nPart of
https://github.com/elastic/security-team/issues/11959\n\n## What This PR
Does\nThis PR represents the first step in our transition from the
current\nSourcerer component to the new unified Data View Picker.
Specifically,\nthis implementation:\n- Creates a new Data View Picker
component\n- Implements feature flag protection for all changes\n-
Handles asynchronous effects through Redux listener middleware\n-
Establishes a new Redux store architecture to support ad hoc data\nviews
infrastructure\n- Utilizes ad hoc data views to handle legacy patterns
from series 7\n(replacing the previous upgrade data view flow)\n\nSee
the readme for more info:
\n```x-pack/solutions/security/plugins/security_solution/public/data_view_manager/readme.md```\n\n##
What This PR Does NOT Cover\n- Does not affect screens other than
Timelines\n- Does not modify the existing Sourcerer component in any
way\n- Does not fully support all URL/local storage patterns\n\n##
Implementation Notes\nWe've made several accommodations to support both
Sourcerer and the new Data View Picker simultaneously during this
transition period, including:\n- Some interfaces might look odd,
especially the hooks that return the data view or patterns - this is
intentional to support existing use cases\n- There are feature
flag-based conditional statements throughout the code that will be
removed once the transition is complete\n\n## Testing Instructions\n1.
Add the following feature flag to your configuration:\n ```\n
xpack.securitySolution.enableExperimental:
['newDataViewPickerEnabled']\n ```\n2. Navigate to the Timelines
interface\n3. Test interactions with the new Data View
Picker\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"9679f2941550856d75e00c1faadd8c9669afe917"}}]}]
BACKPORT-->

---------

Co-authored-by: Luke Gmys <11671118+lgestc@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Philippe Oberti <philippe.oberti@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:enhancement Team:Threat Hunting:Investigations Security Solution Threat Hunting Investigations Team v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants