Skip to content

Commit

Permalink
[Security Solution] [Notes] Enable templated insights with all events…
Browse files Browse the repository at this point in the history
…, not just alerts (#197164)

## Summary

Currently all notes that make use of the markdown based timeline data
providers will render as a timeline template if the note is associated
with an event, and not an alert. Mostly everything is in place to have
everything work for both already, there's just no context that contains
the event document in the tree in the notes list component currently.
This pr adds that context, and everything else works as expected.


![event_insights](https://github.com/user-attachments/assets/72d25ef2-0c2c-4f82-974f-0f005c9b2d77)


### 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
  • Loading branch information
kqualters-elastic authored Oct 22, 2024
1 parent dcd8e0c commit fe79c85
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import {
import { useDocumentDetailsContext } from '../../shared/context';
import { useUserPrivileges } from '../../../../common/components/user_privileges';
import { useWhichFlyout } from '../../shared/hooks/use_which_flyout';
import { BasicAlertDataContext } from './investigation_guide_view';
import { useInvestigationGuide } from '../../shared/hooks/use_investigation_guide';

export const FETCH_NOTES_ERROR = i18n.translate(
'xpack.securitySolution.flyout.left.notes.fetchNotesErrorLabel',
Expand All @@ -55,6 +57,10 @@ export const NotesDetails = memo(() => {
const dispatch = useDispatch();
const { eventId, dataFormattedForFieldBrowser } = useDocumentDetailsContext();
const { kibanaSecuritySolutionsPrivileges } = useUserPrivileges();
const { basicAlertData: basicData } = useInvestigationGuide({
dataFormattedForFieldBrowser,
});

const canCreateNotes = kibanaSecuritySolutionsPrivileges.crud;

// will drive the value we send to the AddNote component
Expand Down Expand Up @@ -130,7 +136,7 @@ export const NotesDetails = memo(() => {
);

return (
<>
<BasicAlertDataContext.Provider value={basicData}>
{fetchStatus === ReqStatus.Loading && (
<EuiLoadingElastic data-test-subj={NOTES_LOADING_TEST_ID} size="xxl" />
)}
Expand All @@ -156,7 +162,7 @@ export const NotesDetails = memo(() => {
</AddNote>
</>
)}
</>
</BasicAlertDataContext.Provider>
);
});

Expand Down

0 comments on commit fe79c85

Please sign in to comment.