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][Timeline] extract and cleanup timeline status component #173876

Merged
merged 1 commit into from
Dec 26, 2023

Conversation

PhilippeOberti
Copy link
Contributor

@PhilippeOberti PhilippeOberti commented Dec 21, 2023

Notes

This PR is part of a long-running effort to clean up the timeline code. I originally had opened this one but the file count kept growing and so did the complexity for the reviewers. Of that original PR I will create probably 5-6 smaller ones.

Summary

This very PR focuses on extracting the TimelineStatusInfo component:

  • extract if at the root of the component folder, as in a subsequent PR this component will be used in the timeline modal header and also in the timeline bottom bar (and also because the bottom bar isn't in the flyout...)
  • rename the folder and file to save_status and TimelineSaveStatus respectively to better represent what the component actually does
  • add documentation and more unit tests

Absolutely no visual or behavior changes introduced here!

Checklist

The following PR will extract the FlyoutComponent component.

@PhilippeOberti PhilippeOberti added release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting:Investigations Security Solution Investigations Team labels Dec 21, 2023
@PhilippeOberti PhilippeOberti requested a review from a team as a code owner December 21, 2023 20:11
@PhilippeOberti PhilippeOberti force-pushed the timeline-cleanup-part-1 branch from 1623521 to 04e9684 Compare December 21, 2023 20:30
export const TimelineSaveStatus = React.memo<TimelineSaveStatusProps>(({ timelineId }) => {
const getTimeline = useMemo(() => timelineSelectors.getTimelineByIdSelector(), []);
const {
changed = false,
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like we should initialize this to false in redux. I know you didn't change anything functionally here, but making a note that can be brought up as a potential redux cleanup in the future

status,
updated,
} = useDeepEqualSelector((state) =>
pick(['changed', 'status', 'updated'], getTimeline(state, timelineId) ?? timelineDefaults)
Copy link
Contributor

Choose a reason for hiding this comment

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

Thinking through things, we need to make better use of selectors because we shouldn't need to use pick, but that's a whoooole separate issue

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah I'm not a fan of how it's done here, but it's consistent with the other places... I agree a nice cleanup to bring the code up to the latest redux standards would be really nice! Maybe a future refactor I'll tackle :)

* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

Copy link
Contributor

@michaelolo24 michaelolo24 Dec 26, 2023

Choose a reason for hiding this comment

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

Thanks reminded me of something to test and found a bug, not related to this PR here 😅 #173968

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, pulled down and tested as well. Thanks for the cleanup and updating the jest tests!

@PhilippeOberti PhilippeOberti force-pushed the timeline-cleanup-part-1 branch from 04e9684 to a9f1a18 Compare December 26, 2023 19:51
@kibana-ci
Copy link
Collaborator

💚 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 11.3MB 11.3MB -1.1KB

History

  • 💚 Build #184854 succeeded 04e96841656cf84c5854a795d7974165c32a9185
  • 💔 Build #184852 failed 16235217d77e2429d7197cda0a5370cd4d0068ce

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@PhilippeOberti PhilippeOberti merged commit 4c3f76c into elastic:main Dec 26, 2023
37 checks passed
@PhilippeOberti PhilippeOberti deleted the timeline-cleanup-part-1 branch December 26, 2023 22:35
@kibanamachine kibanamachine added v8.13.0 backport:skip This commit does not require backporting labels Dec 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting:Investigations Security Solution Investigations Team v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants