Skip to content
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][Notes] - ensures that notes are always sorted from newest to oldest in expandable flyout notes tab #188400

Merged
merged 2 commits into from
Jul 19, 2024

Conversation

PhilippeOberti
Copy link
Contributor

@PhilippeOberti PhilippeOberti commented Jul 16, 2024

Summary

This PR fixes an issue in the expandable flyout new Notes tab, where the notes were not always sorted from newest notes at the top to oldest notes at the bottom.

The issue came from the fact that the redux slice of state for notes is shared between the notes displayed throughout Security Solution tables and flyouts as well as the notes management page. When the notes management page fetches notes sorted by a field and a direction, the result comes back sorted from the server, and is saved as is in redux. If a user visited a flyout after having been to the notes management page, there was a chance the notes wouldn't be sorted correctly.

The PR adds a new selector that allows developers to fetch notes by document id, sorted by field and direction.

Screenshot 2024-07-16 at 10 11 14 AM

Checklist

https://github.com/elastic/security-team/issues/9942

@PhilippeOberti PhilippeOberti added release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting:Investigations Security Solution Investigations Team v8.15.0 labels Jul 16, 2024
@PhilippeOberti PhilippeOberti requested a review from a team as a code owner July 16, 2024 08:15
@elasticmachine
Copy link
Contributor

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

return notes
.filter((note: Note) => note.eventId === documentId)
.sort((a: Note, b: Note) =>
// @ts-ignore Object is possibly null or undefined
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: would prefer we remove this, otherwise everything lgtm 👍

@PhilippeOberti PhilippeOberti enabled auto-merge (squash) July 19, 2024 15:24
@PhilippeOberti PhilippeOberti merged commit d58de3d into elastic:main Jul 19, 2024
39 checks passed
@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 17.2MB 17.2MB +624.0B

@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.15

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jul 19, 2024
…ted from newest to oldest in expandable flyout notes tab (#188400) (#188776)

# Backport

This will backport the following commits from `main` to `8.15`:
- [[Security Solution][Notes] - ensures that notes are always sorted
from newest to oldest in expandable flyout notes tab
(#188400)](#188400)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Philippe
Oberti","email":"philippe.oberti@elastic.co"},"sourceCommit":{"committedDate":"2024-07-19T17:13:01Z","message":"[Security
Solution][Notes] - ensures that notes are always sorted from newest to
oldest in expandable flyout notes tab
(#188400)","sha":"d58de3dc317ae57d05c0b03d23b550a01328efb5","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Threat
Hunting:Investigations","v8.15.0","v8.16.0"],"title":"[Security
Solution][Notes] - ensures that notes are always sorted from newest to
oldest in expandable flyout notes
tab","number":188400,"url":"#188400
Solution][Notes] - ensures that notes are always sorted from newest to
oldest in expandable flyout notes tab
(#188400)","sha":"d58de3dc317ae57d05c0b03d23b550a01328efb5"}},"sourceBranch":"main","suggestedTargetBranches":["8.15"],"targetPullRequestStates":[{"branch":"8.15","label":"v8.15.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":true,"state":"MERGED","url":"#188400
Solution][Notes] - ensures that notes are always sorted from newest to
oldest in expandable flyout notes tab
(#188400)","sha":"d58de3dc317ae57d05c0b03d23b550a01328efb5"}}]}]
BACKPORT-->

Co-authored-by: Philippe Oberti <philippe.oberti@elastic.co>
@PhilippeOberti PhilippeOberti deleted the fix-notes-flyout-sorting branch August 1, 2024 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting:Investigations Security Solution Investigations Team v8.15.0 v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants