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] Add VersionPicker component #188302

Merged
merged 4 commits into from
Jul 20, 2024

Conversation

nikitaindik
Copy link
Contributor

@nikitaindik nikitaindik commented Jul 15, 2024

Partially addresses: #171520

Summary

This PR adds the VersionPicker component for the ThreeWayDiff UI. This component is a part of the ComparisonSide component (see it on the Miro diagram). ComparisonSide will display the read-only diff between two selected field versions.

This component is not yet connected to the Upgrade flyout. You can view and test it in Storybook by running yarn storybook security_solution in the root Kibana dir. Go to http://localhost:9001 once the Storybook is up and running.

Scherm­afbeelding 2024-07-19 om 11 21 55

@nikitaindik nikitaindik added release_note:skip Skip the PR/issue when compiling release notes Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Detection Rule Management Security Detection Rule Management Team Feature:Prebuilt Detection Rules Security Solution Prebuilt Detection Rules v8.16.0 labels Jul 15, 2024
@nikitaindik nikitaindik self-assigned this Jul 15, 2024
@nikitaindik nikitaindik changed the title Add VersionPicker component [Security Solution] Add ComparisonSide component Jul 15, 2024
@nikitaindik nikitaindik marked this pull request as ready for review July 19, 2024 09:28
@nikitaindik nikitaindik requested a review from a team as a code owner July 19, 2024 09:28
@nikitaindik nikitaindik requested a review from jpdjere July 19, 2024 09:28
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detections-response (Team:Detections and Resp)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detection-rule-management (Team:Detection Rule Management)

@banderror
Copy link
Contributor

@nikitaindik Can you add a link to this PR to your TODO list in #171520? Eventually there's gonna be lots of PRs we'd probably need revisiting in the future.

@nikitaindik nikitaindik changed the title [Security Solution] Add ComparisonSide component [Security Solution] Add VersionPicker component Jul 19, 2024
@banderror banderror self-requested a review July 19, 2024 12:46
Copy link
Contributor

@banderror banderror left a comment

Choose a reason for hiding this comment

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

Very cool @nikitaindik, thank you for exploring and integrating with Storybook -- reviewing this PR was so easy and nice experience!

Comment on lines 21 to 25
export function VersionsPicker({
hasBaseVersion,
selectedVersions,
onChange,
}: VersionsPickerProps) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: can we agree on a canonical way of defining components? The previous one was defined as an FC<...>:

export const CustomizedPrebuiltRuleBadge: React.FC<CustomizedPrebuiltRuleBadgeProps> = ({

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 don't have a strong preference. One very minor downside of using React.FC is that it adds children prop to type even for childless components like this one. In React v18 children are removed. We are on v17 now.

function-style components are a slightly more readable and can be ordered in any way, so they are a bit more flexible.

In the future we could probably add an ESLint rule to enforce for canonical way if we decide what the way is. But I am fine with either approach.

Copy link
Contributor

Choose a reason for hiding this comment

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

@nikitaindik I'm fine with either too. Could be a bikeshedding topic for Tech Time when we won't have an agenda :)

@elasticmachine
Copy link
Contributor

💔 Build Failed

Failed CI Steps

Metrics [docs]

✅ unchanged

cc @nikitaindik

Copy link
Contributor

@banderror banderror left a comment

Choose a reason for hiding this comment

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

LGTM ✅

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #11 / rules_list component empty hides MaintenanceWindowCallout if filterConsumers does not match the running maintenance window's category

Metrics [docs]

✅ unchanged

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

cc @nikitaindik

@nikitaindik nikitaindik merged commit 77afb68 into elastic:main Jul 20, 2024
44 of 45 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jul 20, 2024
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 Feature:Prebuilt Detection Rules Security Solution Prebuilt Detection Rules release_note:skip Skip the PR/issue when compiling release notes Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants