-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Security Solution][Timeline] Notes management table #187214
[Security Solution][Timeline] Notes management table #187214
Conversation
61c0524
to
0145a48
Compare
- remove ids from pendingDeleteIds on delete success - remove no notes empty prompts and related translations - remove unnecessary index file - change data-test-subj to be more specific - merged deleteNote and deleteNotes - added unit tests
0145a48
to
0b5e41e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall this is amazing! You will see that I took the liberty of pushing one commit to fix a few things. Feel free to revert the commit if you don't like the changes~!
- fix an issue with the translation displayed in the delete note modal
- remove the ids from the
pendingDeleteIds
when thedeleteNotes
action succeeds or the modal was staying open - made some small tweaks to the
data-test-subj
to make them more specific - merged the
deleteNote
anddeleteNotes
actions as we don't really need both (I updated all the code and tests where the olddeleteNote
action was used - added some unit tests for the
notes.slice
file
Here are some things that I found during review that still could/need to be fixed:
- searching requires the full string to be written, you can't search with partial string. I find this annoying but I've seen this behavior in other pages (like the rules page)
- should we display the document ids (
eventId
) and/or the saved object ids (timelineId
) in the notes management table? - deleting a note doesn't update the total number of notes in the pagination section. It also doesn't refresh the table correctly.
@@ -122,10 +212,37 @@ const notesSlice = createSlice({ | |||
.addCase(deleteNote.fulfilled, (state, action) => { | |||
notesAdapter.removeOne(state, action.payload); | |||
state.status.deleteNote = ReqStatus.Succeeded; | |||
state.pendingDeleteIds = state.pendingDeleteIds.filter((id) => id !== action.payload); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added here the code to remove the id from the pendingDeleteIds
property. I originally had cleared everything (state.pendingDeleteIds = []
) but then decided that this action should do just what it's supposed to and nothing more...
|
||
export const selectNotesTableSort = (state: State) => state.notes.sort; | ||
|
||
export const selectNotesTableTotalItems = (state: State) => state.notes.pagination.total; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why this selector is necessary/useful? Why not using the selectNotesPagination
right above? We already use the other one in a few places, and we even destructure the properties (like
const pagination = useSelector(selectNotesPagination);
const { perPage, page } = pagination;
for example)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason @kqualters-elastic?
.../security_solution/public/timelines/components/open_timeline/edit_timeline_batch_actions.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/timelines/components/open_timeline/index.tsx
Outdated
Show resolved
Hide resolved
...lugins/security_solution/public/timelines/components/open_timeline/timelines_table/index.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/timelines/components/open_timeline/types.ts
Outdated
Show resolved
Hide resolved
...k/plugins/security_solution/public/timelines/components/open_timeline/use_timeline_types.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/timelines/pages/index.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/timelines/pages/timelines_page.tsx
Outdated
Show resolved
Hide resolved
Pinging @elastic/security-threat-hunting-investigations (Team:Threat Hunting:Investigations) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the code looks good, I'll do a last round of testing first thing tomorrow morning my time as it's getting late here!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so many tests ❤️
|
||
export const selectNotesTableSort = (state: State) => state.notes.sort; | ||
|
||
export const selectNotesTableTotalItems = (state: State) => state.notes.pagination.total; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason @kqualters-elastic?
@PhilippeOberti no, will remove |
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Management part looks fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the code looks good to me, a few minor UI issues remaining (like total not updating after delete one or multiple notes) but we can fix that in a follow up PR!
Nice job!
Summary
This pr adds a new notes management table, where notes from any timeline + notes not associated with a timeline can be viewed, searched, and deleted (for now). Hidden behind the securitySolutionNotesEnabled feature flag, the new page is a tab of the timelines pages, and will only appear in global search when the flag is enabled. Uses the previously added api from a table, and notes can be deleted individually or a page at a time.
t
Checklis
Delete any items that are not applicable to this PR.