Skip to content

[Expandable Flyout] - customize default right, left and preview widths for push mode#206155

Merged
PhilippeOberti merged 6 commits intoelastic:mainfrom
PhilippeOberti:expandable-flyout-default-push-widths
Feb 6, 2025
Merged

[Expandable Flyout] - customize default right, left and preview widths for push mode#206155
PhilippeOberti merged 6 commits intoelastic:mainfrom
PhilippeOberti:expandable-flyout-default-push-widths

Conversation

@PhilippeOberti
Copy link
Copy Markdown
Contributor

@PhilippeOberti PhilippeOberti commented Jan 10, 2025

Summary

This PR is making some changes to the Expandable Flyout package. Prior work had added push mode to the package, added custom way to handle the width for multiple resolutions, and added support for the internal section to be resiable by users.

This PR improves the default user experience when using the flyout in push mode. Until now, the default right, left and preview width in push mode and overlay mode were identical. This meant that the flyout rendered in push mode was most of the time using the whole screen, not leaving any room to the rest of the page content (like the alerts table).

The push widths are now calculated in a different way, to leave as much room as possible while still allowing the flyout right and left sections to render their content correctly, at least most of the time. Users can still resize the whole flyout as well as the internal right and left sections. The push widths are generally smaller/narrower than the overlay widths.

The overlay mode default widths have not changed

Screen.Recording.2025-01-09.at.6.21.29.PM.mov

The push mode default widths

Screen.Recording.2025-01-09.at.6.20.27.PM.mov

Checklist

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 it was very smooth!
@PhilippeOberti Will there be separation for the user specified widths as well? I noticed once I adjust a section, push and overlay then use the same width (as expected).

I also left some comments about readability and aims to reduce duplication, let me know what you think!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

consider grouping them into 2 objects for better readability

const Overlay = {
     RIGHT_SECTION_MIN_WIDTH = ...
     RIGHT_SECTION_Max_WIDTH...
     ....
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yup good idea! I went back and worth a ton on how to group them. It's way more complex that I though as some of these values are used in both push and overlay mode, for right and left sections...

I ended up refactoring this file quite a bit. I extracted some of the logic in 2 functions, which I think is a lot more clear as I could document them in details.

Let me know what you think of the new code!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

could you add some comments about BIG_RESOLUTION_BREAKPOINT, FULL_WIDTH_BREAKPOINT, and their difference from MIN_RESOLUTION_BREAKPOINT and MAX_RESOLUTION_BREAKPOINT?

looks like the latter 2 are used exclusively in overlay mode, maybe adding an overlay reference? or put it in the overlay const object if you take the grouping suggestion

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

same comment as I made above, let me know what you think of the new code!

@PhilippeOberti PhilippeOberti force-pushed the expandable-flyout-default-push-widths branch from 975af82 to 6295a8e Compare January 23, 2025 22:14
Copy link
Copy Markdown
Contributor

@christineweng christineweng Jan 24, 2025

Choose a reason for hiding this comment

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

what do you think about referencing the name of the number (Right panel min) versus actual number? if the number is changed in the future, the dev needs to remember to change all the comments

or vice versa - use numbers in the function directly and matches the comments?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

so I went back and forth on this many times while I was developing. I really did not like using the name of the constant as it makes the documentation extremely hard to read. For me documentation is for devs who want to quickly understand what's happening, so it should be humanly readable, so I like the actual values there.

I understand that updating the values in the code would require an update in the documentation, but I feel that is valid for pretty much any documentation. If you have props or logic change of component or hook, you'll have to manually update the doc accordingly. Here's it's a bit more involved I agree, but I feel like changing these values should not happen too many times (hopefully never 😆)

I did also consider using the values directly in the code (and not have any constants) but I feel like this would go against the patterns of having constants defined at all... That's why I used those constants, but also added code comments directly above their usage to indicate what's happening in a readable way...

This is definitely not a science, it was just what I felt was the most readable...

I did update some more comments to use the values directly instead of the names of the constants. Let me know if you feel strongly against that approach, I'm happy to discuss this with the rest of team to see what everyone else prefers!
Thanks 😄

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@PhilippeOberti I think the revised comments really helped! this is not a section we expect a lot of changes (famous last words lol), so having comprehensive comments, and being able to match the numbers to the constants above are sufficient.

@PhilippeOberti PhilippeOberti force-pushed the expandable-flyout-default-push-widths branch from 6295a8e to 64e04f2 Compare January 29, 2025 21:25
@PhilippeOberti PhilippeOberti marked this pull request as ready for review January 29, 2025 21:25
@PhilippeOberti PhilippeOberti requested a review from a team as a code owner January 29, 2025 21:25
@PhilippeOberti PhilippeOberti added release_note:skip Skip the PR/issue when compiling release notes v9.0.0 Team:Threat Hunting:Investigations Security Solution Threat Hunting Investigations Team backport:version Backport to applied version labels v8.18.0 labels Jan 29, 2025
@elasticmachine
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@PhilippeOberti I think the revised comments really helped! this is not a section we expect a lot of changes (famous last words lol), so having comprehensive comments, and being able to match the numbers to the constants above are sufficient.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: what do you think about matching LEFT and RIGHT naming conventions?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good point, I'm not sure how I missed that, now that I'm seeing it, it bothers me so much 😆

I will improve before merging!

@PhilippeOberti PhilippeOberti force-pushed the expandable-flyout-default-push-widths branch from bfcc166 to 7030902 Compare February 5, 2025 22:41
@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Feb 6, 2025

💔 Build Failed

Failed CI Steps

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 21.6MB 21.6MB +3.4KB

History

  • 💔 Build #271793 failed 64e04f2b03732671ec0dd7a7055da16f3e4c1bcb

@PhilippeOberti PhilippeOberti merged commit e7140ff into elastic:main Feb 6, 2025
7 checks passed
@PhilippeOberti PhilippeOberti deleted the expandable-flyout-default-push-widths branch February 6, 2025 21:57
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/13188639909

@kibanamachine
Copy link
Copy Markdown
Contributor

💔 All backports failed

Status Branch Result
8.x Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 206155

Questions ?

Please refer to the Backport tool documentation

PhilippeOberti added a commit to PhilippeOberti/kibana that referenced this pull request Feb 6, 2025
…s for push mode (elastic#206155)

## Summary

This PR is making some changes to the Expandable Flyout package. Prior
work had added [push
mode](elastic#182615) to the package,
added [custom way](elastic#170078) to
handle the width for multiple resolutions, and [added
support](elastic#192906) for the internal
section to be resiable by users.

This PR improves the default user experience when using the flyout in
push mode. Until now, the default `right`, `left` and `preview` width in
`push` mode and `overlay` mode were identical. This meant that the
flyout rendered in `push` mode was most of the time using the whole
screen, not leaving any room to the rest of the page content (like the
alerts table).

The `push` widths are now calculated in a different way, to leave as
much room as possible while still allowing the flyout `right` and `left`
sections to render their content correctly, at least most of the time.
Users can still resize the whole flyout as well as the internal `right`
and `left` sections. The `push` widths are generally smaller/narrower
than the `overlay` widths.

#### The `overlay` mode default widths have not changed

https://github.com/user-attachments/assets/28b6c41e-b12c-45cf-aa3e-026a7acdb7b3

#### The `push` mode default widths

https://github.com/user-attachments/assets/93706f9e-212b-4cb4-8748-552f2daed585

### Checklist

- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit e7140ff)

# Conflicts:
#	x-pack/solutions/security/packages/expandable-flyout/src/components/preview_section.tsx
@PhilippeOberti
Copy link
Copy Markdown
Contributor Author

💚 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

drewdaemon pushed a commit to drewdaemon/kibana that referenced this pull request Feb 6, 2025
…s for push mode (elastic#206155)

## Summary

This PR is making some changes to the Expandable Flyout package. Prior
work had added [push
mode](elastic#182615) to the package,
added [custom way](elastic#170078) to
handle the width for multiple resolutions, and [added
support](elastic#192906) for the internal
section to be resiable by users.

This PR improves the default user experience when using the flyout in
push mode. Until now, the default `right`, `left` and `preview` width in
`push` mode and `overlay` mode were identical. This meant that the
flyout rendered in `push` mode was most of the time using the whole
screen, not leaving any room to the rest of the page content (like the
alerts table).

The `push` widths are now calculated in a different way, to leave as
much room as possible while still allowing the flyout `right` and `left`
sections to render their content correctly, at least most of the time.
Users can still resize the whole flyout as well as the internal `right`
and `left` sections. The `push` widths are generally smaller/narrower
than the `overlay` widths.

#### The `overlay` mode default widths have not changed


https://github.com/user-attachments/assets/28b6c41e-b12c-45cf-aa3e-026a7acdb7b3

#### The `push` mode default widths


https://github.com/user-attachments/assets/93706f9e-212b-4cb4-8748-552f2daed585

### Checklist

- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
PhilippeOberti added a commit that referenced this pull request Feb 7, 2025
… widths for push mode (#206155) (#210117)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Expandable Flyout] - customize default right, left and preview
widths for push mode
(#206155)](#206155)

<!--- Backport version: 9.6.4 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Philippe
Oberti","email":"philippe.oberti@elastic.co"},"sourceCommit":{"committedDate":"2025-02-06T21:57:07Z","message":"[Expandable
Flyout] - customize default right, left and preview widths for push mode
(#206155)\n\n## Summary\r\n\r\nThis PR is making some changes to the
Expandable Flyout package. Prior\r\nwork had added
[push\r\nmode](#182615) to the
package,\r\nadded [custom
way](#170078) to\r\nhandle the
width for multiple resolutions, and
[added\r\nsupport](#192906) for
the internal\r\nsection to be resiable by users.\r\n\r\nThis PR improves
the default user experience when using the flyout in\r\npush mode. Until
now, the default `right`, `left` and `preview` width in\r\n`push` mode
and `overlay` mode were identical. This meant that the\r\nflyout
rendered in `push` mode was most of the time using the whole\r\nscreen,
not leaving any room to the rest of the page content (like the\r\nalerts
table).\r\n\r\nThe `push` widths are now calculated in a different way,
to leave as\r\nmuch room as possible while still allowing the flyout
`right` and `left`\r\nsections to render their content correctly, at
least most of the time.\r\nUsers can still resize the whole flyout as
well as the internal `right`\r\nand `left` sections. The `push` widths
are generally smaller/narrower\r\nthan the `overlay` widths.\r\n\r\n####
The `overlay` mode default widths have not
changed\r\n\r\n\r\nhttps://github.com/user-attachments/assets/28b6c41e-b12c-45cf-aa3e-026a7acdb7b3\r\n\r\n####
The `push` mode default
widths\r\n\r\n\r\nhttps://github.com/user-attachments/assets/93706f9e-212b-4cb4-8748-552f2daed585\r\n\r\n###
Checklist\r\n\r\n- [
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"e7140ff25fbf63f20b930da44aaebb5811b6d1ba","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Threat
Hunting:Investigations","backport:version","v9.1.0","v8.19.0"],"title":"[Expandable
Flyout] - customize default right, left and preview widths for push
mode","number":206155,"url":"https://github.com/elastic/kibana/pull/206155","mergeCommit":{"message":"[Expandable
Flyout] - customize default right, left and preview widths for push mode
(#206155)\n\n## Summary\r\n\r\nThis PR is making some changes to the
Expandable Flyout package. Prior\r\nwork had added
[push\r\nmode](#182615) to the
package,\r\nadded [custom
way](#170078) to\r\nhandle the
width for multiple resolutions, and
[added\r\nsupport](#192906) for
the internal\r\nsection to be resiable by users.\r\n\r\nThis PR improves
the default user experience when using the flyout in\r\npush mode. Until
now, the default `right`, `left` and `preview` width in\r\n`push` mode
and `overlay` mode were identical. This meant that the\r\nflyout
rendered in `push` mode was most of the time using the whole\r\nscreen,
not leaving any room to the rest of the page content (like the\r\nalerts
table).\r\n\r\nThe `push` widths are now calculated in a different way,
to leave as\r\nmuch room as possible while still allowing the flyout
`right` and `left`\r\nsections to render their content correctly, at
least most of the time.\r\nUsers can still resize the whole flyout as
well as the internal `right`\r\nand `left` sections. The `push` widths
are generally smaller/narrower\r\nthan the `overlay` widths.\r\n\r\n####
The `overlay` mode default widths have not
changed\r\n\r\n\r\nhttps://github.com/user-attachments/assets/28b6c41e-b12c-45cf-aa3e-026a7acdb7b3\r\n\r\n####
The `push` mode default
widths\r\n\r\n\r\nhttps://github.com/user-attachments/assets/93706f9e-212b-4cb4-8748-552f2daed585\r\n\r\n###
Checklist\r\n\r\n- [
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"e7140ff25fbf63f20b930da44aaebb5811b6d1ba"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/206155","number":206155,"mergeCommit":{"message":"[Expandable
Flyout] - customize default right, left and preview widths for push mode
(#206155)\n\n## Summary\r\n\r\nThis PR is making some changes to the
Expandable Flyout package. Prior\r\nwork had added
[push\r\nmode](#182615) to the
package,\r\nadded [custom
way](#170078) to\r\nhandle the
width for multiple resolutions, and
[added\r\nsupport](#192906) for
the internal\r\nsection to be resiable by users.\r\n\r\nThis PR improves
the default user experience when using the flyout in\r\npush mode. Until
now, the default `right`, `left` and `preview` width in\r\n`push` mode
and `overlay` mode were identical. This meant that the\r\nflyout
rendered in `push` mode was most of the time using the whole\r\nscreen,
not leaving any room to the rest of the page content (like the\r\nalerts
table).\r\n\r\nThe `push` widths are now calculated in a different way,
to leave as\r\nmuch room as possible while still allowing the flyout
`right` and `left`\r\nsections to render their content correctly, at
least most of the time.\r\nUsers can still resize the whole flyout as
well as the internal `right`\r\nand `left` sections. The `push` widths
are generally smaller/narrower\r\nthan the `overlay` widths.\r\n\r\n####
The `overlay` mode default widths have not
changed\r\n\r\n\r\nhttps://github.com/user-attachments/assets/28b6c41e-b12c-45cf-aa3e-026a7acdb7b3\r\n\r\n####
The `push` mode default
widths\r\n\r\n\r\nhttps://github.com/user-attachments/assets/93706f9e-212b-4cb4-8748-552f2daed585\r\n\r\n###
Checklist\r\n\r\n- [
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"e7140ff25fbf63f20b930da44aaebb5811b6d1ba"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
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.

4 participants