Skip to content

[kbn-expandable-flyout] - refactor internal redux store#192644

Merged
PhilippeOberti merged 2 commits intoelastic:mainfrom
PhilippeOberti:expandable-flyout-redux-refactor
Sep 16, 2024
Merged

[kbn-expandable-flyout] - refactor internal redux store#192644
PhilippeOberti merged 2 commits intoelastic:mainfrom
PhilippeOberti:expandable-flyout-redux-refactor

Conversation

@PhilippeOberti
Copy link
Copy Markdown
Contributor

@PhilippeOberti PhilippeOberti commented Sep 11, 2024

Summary

This PR performs a small refactor work on the way the redux store is setup on the kbn-expandable-flyout package. We're currently making changes to the package to save more values to the redux store (see this draft PR for a sneak peak of the final result) and @christineweng had a great idea to refactor the top level properties of the redux store to better reflect the values saved.

The 2 top level properties will be:

  • data: stores all the flyout panels information. This is basically all the flyout was storing until now
  • ui: this is coming soon, it will store all the UI related information (push/overlay, collapsed and expanded widths...)

This is how the store will look once finished:

{
  panels: {};
  ui: {
    pushVsOverlay: {};
    defaultWidths: {};
    widths: {};
    internalPercentages: {};
  };
}

Notes

This PR does not impact any of the places where the package is being used, the changes are purely internal.
Also, there aren't any behavior changes whatsoever. Here are the main code changes:

  • move all the redux related files under a new store folder
  • nest the already existing store state (for panels) under a data level
  • update the rest of the package accordingly (imports...)

2 PRs are incoming:

  • a first PR that will:
    • add the new ui top level property to the redux store
    • convert the current push/overlay function to use the redux store instead of being done via hooks
    • introduce the concept of middleware to save to local storage when the action is dispatched
  • a second PR that will introduce all the new resize logic, leveraging the new ui top level of the redux store

TODO

  • add some of the missing code documentation
  • fix unit tests
  • fix storybook

Checklist

Will help #182526

@PhilippeOberti PhilippeOberti added release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting:Investigations Security Solution Threat Hunting Investigations Team v8.16.0 labels Sep 11, 2024
@PhilippeOberti PhilippeOberti requested a review from a team as a code owner September 11, 2024 20:55
@elasticmachine
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

@logeekal logeekal left a comment

Choose a reason for hiding this comment

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

LGTM 👌

@PhilippeOberti PhilippeOberti force-pushed the expandable-flyout-redux-refactor branch from 3b1d961 to 19a1195 Compare September 16, 2024 18:21
Copy link
Copy Markdown
Contributor

@christineweng christineweng left a comment

Choose a reason for hiding this comment

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

Desk tested and LGTM! Thanks for cleaning up those casting too!

@PhilippeOberti PhilippeOberti force-pushed the expandable-flyout-redux-refactor branch from 19a1195 to 4d58918 Compare September 16, 2024 20:09
@kibana-ci
Copy link
Copy Markdown

💚 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
discover 812.7KB 812.7KB +54.0B
securitySolution 20.4MB 20.4MB +255.0B
total +309.0B

History

  • 💔 Build #234554 failed 19a11957b312748ee9f44bd900543f2dcb428846
  • 💛 Build #233627 was flaky 3b1d961b5cef20d50b78206038bce488ae61aa6f

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

@PhilippeOberti PhilippeOberti merged commit d776e39 into elastic:main Sep 16, 2024
@PhilippeOberti PhilippeOberti deleted the expandable-flyout-redux-refactor branch September 16, 2024 21:37
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Sep 16, 2024
@kibanamachine
Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
8.x

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 Sep 16, 2024
… (#193096)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[kbn-expandable-flyout] - refactor internal redux store
(#192644)](#192644)

<!--- 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-09-16T21:37:36Z","message":"[kbn-expandable-flyout]
- refactor internal redux store
(#192644)","sha":"d776e390b013b57badafa7951c19f279cdf0f59d","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Threat
Hunting:Investigations","v8.16.0"],"title":"[kbn-expandable-flyout] -
refactor internal redux
store","number":192644,"url":"https://github.com/elastic/kibana/pull/192644","mergeCommit":{"message":"[kbn-expandable-flyout]
- refactor internal redux store
(#192644)","sha":"d776e390b013b57badafa7951c19f279cdf0f59d"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/192644","number":192644,"mergeCommit":{"message":"[kbn-expandable-flyout]
- refactor internal redux store
(#192644)","sha":"d776e390b013b57badafa7951c19f279cdf0f59d"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Philippe Oberti <philippe.oberti@elastic.co>
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 Threat Hunting Investigations Team v8.16.0 v9.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants