Skip to content

[Security Solution][THI] replace deprecated styled-components within detections folder#210942

Closed
PhilippeOberti wants to merge 1 commit intoelastic:mainfrom
PhilippeOberti:styled-components-3
Closed

[Security Solution][THI] replace deprecated styled-components within detections folder#210942
PhilippeOberti wants to merge 1 commit intoelastic:mainfrom
PhilippeOberti:styled-components-3

Conversation

@PhilippeOberti
Copy link
Contributor

@PhilippeOberti PhilippeOberti commented Feb 12, 2025

Summary

This PR is a follow up of this one and that one, aiming at replacing the usages styled-components with @emotion/react or @emotion/styled in the security_solution/public/detections folder.
Similar to the previous PRs, along side the replacement of the deprecated styled-components, this PR performs some cleanup of unused props/translations/...


Absolutely no UI or behavior logic changes should be introduced by this PR.

There are more changes coming, but having all of these in a single PR would have been too much to review. I decided to keep the changes focused to a single area as much as possible, to facilitate reviewing that the UI has not changed.


You will notice different approaches while removing the tokens:

  • for some cases, the changes were done using css from '@emotions/react' as the components using the tokens were already using euiTheme or adding it was necessary or straightforward and required the minimal amount of changes
  • for some cases, simply changing styled-components to @emotion/styled was enough and required no further code changes
  • finally for other cases, for the most complex cases, components were created

Some screenshots:
Screenshot 2025-01-15 at 5 23 55 PM
Screenshot 2025-01-15 at 5 38 05 PM
Screenshot 2025-01-15 at 6 05 37 PM
Screenshot 2025-01-16 at 2 53 22 PM
Screenshot 2025-01-16 at 11 51 19 AM
Screenshot 2025-01-16 at 12 18 17 PM

Checklist

@PhilippeOberti PhilippeOberti added release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting:Investigations Security Solution Threat Hunting Investigations Team backport:version Backport to applied version labels v9.1.0 v8.19.0 labels Feb 12, 2025
@elastic elastic deleted a comment from elasticmachine Feb 12, 2025
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 7092 7091 -1

Async chunks

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

id before after diff
securitySolution 8.9MB 8.9MB -4.0KB

Page load bundle

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

id before after diff
securitySolution 85.2KB 85.2KB -1.0B

History

  • 💔 Build #275793 failed 80cb2adb0fc016d97eeee9d3490ad683f8c55213

@PhilippeOberti PhilippeOberti marked this pull request as ready for review February 21, 2025 04:32
@PhilippeOberti PhilippeOberti requested review from a team as code owners February 21, 2025 04:32
@elasticmachine
Copy link
Contributor

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

<DataStatsWrapper>
<div
css={css`
width: 250px;
Copy link
Contributor

Choose a reason for hiding this comment

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

save this as const as well?

display: flex;
flex-direction: column;
position: relative;
overflow: hidden;
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed the scrolling in treemap is gone, we should change it to auto / bring back the prop
image

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see any height changes in the code, but for some reason there is now blank space under the charts. The scroll bar shouldn't appear when all three are on the same row 🤔

image

Copy link
Contributor

@maximpn maximpn left a comment

Choose a reason for hiding this comment

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

@PhilippeOberti Thanks for replacing deprecated styled-components 🙏

Rules Management changes are trivial and testing locally didn't reveal any issues. However, styles changes have been proofed not working in production. Could you resolved conflicts and deploy the PR so we and the other teams are able to test the changes?

filters={alertMergedFilters}
signalIndexName={signalIndexName}
defaultStackByOption={defaultRuleStackByOption}
title={i18n.HISTOGRAM_HEADER}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason for adding a title?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not really adding the title, I just moved it from here

@PhilippeOberti
Copy link
Contributor Author

@PhilippeOberti Thanks for replacing deprecated styled-components 🙏

Rules Management changes are trivial and testing locally didn't reveal any issues. However, styles changes have been proofed not working in production. Could you resolved conflicts and deploy the PR so we and the other teams are able to test the changes?

With the AI for SOC effort I kinda dropped this a bit. I might be a few weeks before I get back to this. I will then rebase, fix all the conflict then deploy the PR for testing and will ping everyone again 👍


import { i18n } from '@kbn/i18n';

export const COUNT_TABLE_COLUMN_TITLE = i18n.translate(
Copy link
Contributor

Choose a reason for hiding this comment

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

It'd be nice to go through file by file and just remove dead code 😞

filters,
}}
getLensAttributes={getLensAttributes}
height={chartHeight ?? CHART_HEIGHT}
Copy link
Contributor

Choose a reason for hiding this comment

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

👍🏾

@PhilippeOberti PhilippeOberti marked this pull request as draft August 1, 2025 12:46
@elasticmachine
Copy link
Contributor

🤖 Jobs for this PR can be triggered through checkboxes. 🚧

ℹ️ To trigger the CI, please tick the checkbox below 👇

  • Click to trigger kibana-pull-request for this PR!
  • Click to trigger kibana-deploy-project-from-pr for this PR!
  • Click to trigger kibana-deploy-cloud-from-pr for this PR!

@PhilippeOberti
Copy link
Contributor Author

Closing as the code has changed too much since last worked on, and this work isn't a high priority right now...

@PhilippeOberti PhilippeOberti deleted the styled-components-3 branch February 6, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting:Investigations Security Solution Threat Hunting Investigations Team v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants