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

[8.x] [Security Solution] ThreeWayDiff UI: Migrate to using `DiffableRule` TS type in `FieldReadOnly` component (#192342) #193333

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

kibanamachine
Copy link
Contributor

Backport

This will backport the following commits from main to 8.x:

Questions ?

Please refer to the Backport tool documentation

…TS type in `FieldReadOnly` component (elastic#192342)

**Partially addresses: elastic#171520
**Is a follow-up PR to: elastic#191499

This is the 2nd of the 3 PRs for `FieldReadOnly`.
- The 1st [PR](elastic#191499) added the
`FieldReadOnly` and a bunch of field components.
- This (2nd) PR moves away from using `DiffableAllFields` type in favour
of `DiffableRule` and splits the large `FieldReadOnly` component into
smaller ones for readability.
 - Next (3rd) PR will add the remaining field components.

## Summary
This PR changes the TS type (`DiffableAllFields` -> `DiffableRule`) used
by the `FieldReadOnly` component. This component displays a read-only
view of a particular rule field, similar to how fields are shown on the
Rule Details page. Using `DiffableRule` type makes the component
compatible with the flyout context and is safer to use than
`DiffableAllFields`.

### Changes
- TS type used in the `FieldReadOnly` component and Storybook stories
changed to `DiffableRule`.
- `FieldReadOnly` field rendering was split into multiple files by rule
type to make it more readable.
- Added rule-mocking functions to Storybook to allow creation of
`DiffableRule` mocks.
 - Added field components for `name`, `description` and `tags` fields.
- Rewrote type narrowing for `Filters` component to a type guard
(`isFilters`).
 - Fixed a couple of outdated code comments.

### Running
`FinalReadOnly` and its field components are not yet integrated into the
flyout, but you can view components in Storybook.
1. Run Storybook: `yarn storybook security_solution`
2. Go to `http://localhost:9001` in browser.

<img width="1062" alt="Scherm­afbeelding 2024-09-03 om 13 05 11"
src="https://github.com/user-attachments/assets/13b227d4-1321-47d9-a0a7-93868c9f4a15">

(cherry picked from commit 70b7d26)
@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 20.3MB 20.3MB +25.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
securitySolution 540 541 +1

Total ESLint disabled count

id before after diff
securitySolution 625 626 +1

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

cc @nikitaindik

@kibanamachine kibanamachine merged commit 076cce8 into elastic:8.x Sep 18, 2024
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants