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

[Dashboard][Collapsable Panels] Responsive layout #200771

Merged

Conversation

mbondyra
Copy link
Contributor

@mbondyra mbondyra commented Nov 19, 2024

Summary

Fixes #197714

Key Features

Responsiveness

  1. Adds a responsive view controlled by the accessMode prop.
  2. For the responsive version (in the VIEW mode), panels retain height and are arranged based on screen order (left-to-right, top-to-bottom).
  3. Interactivity (drag/resize) is disabled in view mode.
Screenshot 2024-11-25 at 17 34 56

Maximization

  1. Supports expanded panel view using the expandedPanelId prop.
  2. Interactivity (drag/resize) is disabled when a panel is expanded.
Screenshot 2024-11-25 at 17 35 05

Considerations

  1. CSS elements naming convention: Main component uses kbnGrid class, with modifiers like kbnGrid--nonInteractive. For the drag handle of GridPanel I used kbnGridPanel__dragHandle classname.
  2. Classes vs. Inline Styles: I opted for using kbnGrid--nonInteractive instead of adding one more subscription to GridPanel to modify the styles inline. It's the first time in this package that I used classes instead of inline styles for no-initial styles setting.
  3. Naming Convention: I opted for using the expanded word to describe an expanded panel. Another one could be maximized as it's more used in UI, but less in the legacy code.
  4. Interactivity (drag/resize) is disabled in responsive mode but we could consider to limit this to small viewports only (<768px).

@mbondyra mbondyra added Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas release_note:skip Skip the PR/issue when compiling release notes backport:version Backport to applied version labels labels Nov 19, 2024
@mbondyra mbondyra marked this pull request as ready for review November 19, 2024 20:59
@mbondyra mbondyra requested a review from a team as a code owner November 19, 2024 20:59
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

@mbondyra mbondyra changed the title [Collapsible panels] maximize a panel [Dashboard][Collapsable Panels] maximize a panel Nov 19, 2024
@mbondyra mbondyra force-pushed the dashboard/collapsible_panels/maximize_panel branch 3 times, most recently from 8ad30ee to feada58 Compare November 20, 2024 14:10
@mbondyra mbondyra marked this pull request as draft November 20, 2024 14:10
@mbondyra mbondyra changed the title [Dashboard][Collapsable Panels] maximize a panel [Dashboard][Collapsable Panels] Responsive layout Nov 20, 2024
@Heenawter Heenawter self-requested a review November 20, 2024 15:27
@mbondyra mbondyra force-pushed the dashboard/collapsible_panels/maximize_panel branch 7 times, most recently from ae60f56 to 640252b Compare November 21, 2024 12:44
@mbondyra mbondyra force-pushed the dashboard/collapsible_panels/maximize_panel branch from 640252b to da31420 Compare November 21, 2024 20:37
@mbondyra mbondyra marked this pull request as ready for review November 21, 2024 20:40
examples/grid_example/public/app.tsx Outdated Show resolved Hide resolved
packages/kbn-grid-layout/grid/grid_layout.tsx Outdated Show resolved Hide resolved
packages/kbn-grid-layout/grid/grid_height_smoother.tsx Outdated Show resolved Hide resolved
packages/kbn-grid-layout/grid/grid_height_smoother.tsx Outdated Show resolved Hide resolved
packages/kbn-grid-layout/grid/types.ts Outdated Show resolved Hide resolved
packages/kbn-grid-layout/grid/grid_panel.tsx Outdated Show resolved Hide resolved
packages/kbn-grid-layout/grid/grid_panel.tsx Outdated Show resolved Hide resolved
packages/kbn-grid-layout/grid/grid_row.tsx Outdated Show resolved Hide resolved
@mbondyra mbondyra force-pushed the dashboard/collapsible_panels/maximize_panel branch from d20b9f3 to cd143d7 Compare November 22, 2024 12:22
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/grid-layout 16 17 +1
Unknown metric groups

API count

id before after diff
@kbn/grid-layout 16 17 +1

ESLint disabled line counts

id before after diff
@kbn/grid-layout 10 12 +2

Total ESLint disabled count

id before after diff
@kbn/grid-layout 10 12 +2

History

@Heenawter Heenawter added backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) and removed backport:version Backport to applied version labels labels Nov 27, 2024
@mbondyra mbondyra force-pushed the dashboard/collapsible_panels/maximize_panel branch from 605c841 to 6f40808 Compare November 28, 2024 09:23
@mbondyra mbondyra force-pushed the dashboard/collapsible_panels/maximize_panel branch from 6f40808 to 9583785 Compare November 28, 2024 09:31
@mbondyra mbondyra added Project:Collapsable Panels Related to the project for adding collapsable sections to Dashboards. loe:medium Medium Level of Effort labels Nov 28, 2024
Copy link
Contributor

@Heenawter Heenawter left a comment

Choose a reason for hiding this comment

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

This is working great now!! And the code is super clean 🤌 Thanks so much for your work on this!

@mbondyra mbondyra merged commit d92aa91 into elastic:main Nov 28, 2024
12 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

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

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 28, 2024
## Summary

Fixes elastic#197714

### Key Features

#### Responsiveness

1. Adds a responsive view controlled by the `accessMode` prop.
2. For the responsive version (in the `VIEW` mode), panels retain height
and are arranged based on screen order (left-to-right, top-to-bottom).
3. Interactivity (drag/resize) is disabled in `view` mode.

<img width="514" alt="Screenshot 2024-11-25 at 17 34 56"
src="https://github.com/user-attachments/assets/6a5a97aa-de9b-495a-b1de-301bc935a5ab">

#### Maximization
1. Supports expanded panel view using the `expandedPanelId` prop.
2. Interactivity (drag/resize) is disabled when a panel is expanded.

<img width="1254" alt="Screenshot 2024-11-25 at 17 35 05"
src="https://github.com/user-attachments/assets/c83014f6-18ad-435b-a59d-1d3ba3f80d84">

#### Considerations
1. CSS elements naming convention: Main component uses `kbnGrid` class,
with modifiers like `kbnGrid--nonInteractive`. For the drag handle of
`GridPanel` I used `kbnGridPanel__dragHandle` classname.
2. Classes vs. Inline Styles: I opted for using
`kbnGrid--nonInteractive` instead of adding one more subscription to
`GridPanel` to modify the styles inline. It's the first time in this
package that I used classes instead of inline styles for no-initial
styles setting.
3. Naming Convention: I opted for using the `expanded` word to describe
an expanded panel. Another one could be `maximized` as it's more used in
UI, but less in the legacy code.
4. Interactivity (drag/resize) is disabled in responsive mode but we
could consider to limit this to small viewports only (<768px).

---------

Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit d92aa91)
@kibanamachine
Copy link
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 Nov 29, 2024
…02225)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Dashboard][Collapsable Panels] Responsive layout
(#200771)](#200771)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Marta
Bondyra","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-28T18:31:09Z","message":"[Dashboard][Collapsable
Panels] Responsive layout (#200771)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/197714\r\n\r\n### Key
Features\r\n\r\n#### Responsiveness\r\n\r\n1. Adds a responsive view
controlled by the `accessMode` prop. \r\n2. For the responsive version
(in the `VIEW` mode), panels retain height\r\nand are arranged based on
screen order (left-to-right, top-to-bottom).\r\n3. Interactivity
(drag/resize) is disabled in `view` mode.\r\n\r\n<img width=\"514\"
alt=\"Screenshot 2024-11-25 at 17 34
56\"\r\nsrc=\"https://github.com/user-attachments/assets/6a5a97aa-de9b-495a-b1de-301bc935a5ab\">\r\n\r\n####
Maximization\r\n1. Supports expanded panel view using the
`expandedPanelId` prop.\r\n2. Interactivity (drag/resize) is disabled
when a panel is expanded.\r\n\r\n<img width=\"1254\" alt=\"Screenshot
2024-11-25 at 17 35
05\"\r\nsrc=\"https://github.com/user-attachments/assets/c83014f6-18ad-435b-a59d-1d3ba3f80d84\">\r\n\r\n####
Considerations\r\n1. CSS elements naming convention: Main component uses
`kbnGrid` class,\r\nwith modifiers like `kbnGrid--nonInteractive`. For
the drag handle of\r\n`GridPanel` I used `kbnGridPanel__dragHandle`
classname.\r\n2. Classes vs. Inline Styles: I opted for
using\r\n`kbnGrid--nonInteractive` instead of adding one more
subscription to\r\n`GridPanel` to modify the styles inline. It's the
first time in this\r\npackage that I used classes instead of inline
styles for no-initial\r\nstyles setting.\r\n3. Naming Convention: I
opted for using the `expanded` word to describe\r\nan expanded panel.
Another one could be `maximized` as it's more used in\r\nUI, but less in
the legacy code.\r\n4. Interactivity (drag/resize) is disabled in
responsive mode but we\r\ncould consider to limit this to small
viewports only (<768px).\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"d92aa91c3a8329057a2156ea7f1ecdc94a7a3cc2","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Presentation","loe:medium","release_note:skip","v9.0.0","backport:prev-minor","Project:Collapsable
Panels"],"title":"[Dashboard][Collapsable Panels] Responsive
layout","number":200771,"url":"https://github.com/elastic/kibana/pull/200771","mergeCommit":{"message":"[Dashboard][Collapsable
Panels] Responsive layout (#200771)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/197714\r\n\r\n### Key
Features\r\n\r\n#### Responsiveness\r\n\r\n1. Adds a responsive view
controlled by the `accessMode` prop. \r\n2. For the responsive version
(in the `VIEW` mode), panels retain height\r\nand are arranged based on
screen order (left-to-right, top-to-bottom).\r\n3. Interactivity
(drag/resize) is disabled in `view` mode.\r\n\r\n<img width=\"514\"
alt=\"Screenshot 2024-11-25 at 17 34
56\"\r\nsrc=\"https://github.com/user-attachments/assets/6a5a97aa-de9b-495a-b1de-301bc935a5ab\">\r\n\r\n####
Maximization\r\n1. Supports expanded panel view using the
`expandedPanelId` prop.\r\n2. Interactivity (drag/resize) is disabled
when a panel is expanded.\r\n\r\n<img width=\"1254\" alt=\"Screenshot
2024-11-25 at 17 35
05\"\r\nsrc=\"https://github.com/user-attachments/assets/c83014f6-18ad-435b-a59d-1d3ba3f80d84\">\r\n\r\n####
Considerations\r\n1. CSS elements naming convention: Main component uses
`kbnGrid` class,\r\nwith modifiers like `kbnGrid--nonInteractive`. For
the drag handle of\r\n`GridPanel` I used `kbnGridPanel__dragHandle`
classname.\r\n2. Classes vs. Inline Styles: I opted for
using\r\n`kbnGrid--nonInteractive` instead of adding one more
subscription to\r\n`GridPanel` to modify the styles inline. It's the
first time in this\r\npackage that I used classes instead of inline
styles for no-initial\r\nstyles setting.\r\n3. Naming Convention: I
opted for using the `expanded` word to describe\r\nan expanded panel.
Another one could be `maximized` as it's more used in\r\nUI, but less in
the legacy code.\r\n4. Interactivity (drag/resize) is disabled in
responsive mode but we\r\ncould consider to limit this to small
viewports only (<768px).\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"d92aa91c3a8329057a2156ea7f1ecdc94a7a3cc2"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/200771","number":200771,"mergeCommit":{"message":"[Dashboard][Collapsable
Panels] Responsive layout (#200771)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/197714\r\n\r\n### Key
Features\r\n\r\n#### Responsiveness\r\n\r\n1. Adds a responsive view
controlled by the `accessMode` prop. \r\n2. For the responsive version
(in the `VIEW` mode), panels retain height\r\nand are arranged based on
screen order (left-to-right, top-to-bottom).\r\n3. Interactivity
(drag/resize) is disabled in `view` mode.\r\n\r\n<img width=\"514\"
alt=\"Screenshot 2024-11-25 at 17 34
56\"\r\nsrc=\"https://github.com/user-attachments/assets/6a5a97aa-de9b-495a-b1de-301bc935a5ab\">\r\n\r\n####
Maximization\r\n1. Supports expanded panel view using the
`expandedPanelId` prop.\r\n2. Interactivity (drag/resize) is disabled
when a panel is expanded.\r\n\r\n<img width=\"1254\" alt=\"Screenshot
2024-11-25 at 17 35
05\"\r\nsrc=\"https://github.com/user-attachments/assets/c83014f6-18ad-435b-a59d-1d3ba3f80d84\">\r\n\r\n####
Considerations\r\n1. CSS elements naming convention: Main component uses
`kbnGrid` class,\r\nwith modifiers like `kbnGrid--nonInteractive`. For
the drag handle of\r\n`GridPanel` I used `kbnGridPanel__dragHandle`
classname.\r\n2. Classes vs. Inline Styles: I opted for
using\r\n`kbnGrid--nonInteractive` instead of adding one more
subscription to\r\n`GridPanel` to modify the styles inline. It's the
first time in this\r\npackage that I used classes instead of inline
styles for no-initial\r\nstyles setting.\r\n3. Naming Convention: I
opted for using the `expanded` word to describe\r\nan expanded panel.
Another one could be `maximized` as it's more used in\r\nUI, but less in
the legacy code.\r\n4. Interactivity (drag/resize) is disabled in
responsive mode but we\r\ncould consider to limit this to small
viewports only (<768px).\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"d92aa91c3a8329057a2156ea7f1ecdc94a7a3cc2"}}]}]
BACKPORT-->

Co-authored-by: Marta Bondyra <[email protected]>
Co-authored-by: Hannah Mudge <[email protected]>
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 12, 2024
## Summary

Fixes elastic#197714

### Key Features

#### Responsiveness

1. Adds a responsive view controlled by the `accessMode` prop. 
2. For the responsive version (in the `VIEW` mode), panels retain height
and are arranged based on screen order (left-to-right, top-to-bottom).
3. Interactivity (drag/resize) is disabled in `view` mode.

<img width="514" alt="Screenshot 2024-11-25 at 17 34 56"
src="https://github.com/user-attachments/assets/6a5a97aa-de9b-495a-b1de-301bc935a5ab">

#### Maximization
1. Supports expanded panel view using the `expandedPanelId` prop.
2. Interactivity (drag/resize) is disabled when a panel is expanded.

<img width="1254" alt="Screenshot 2024-11-25 at 17 35 05"
src="https://github.com/user-attachments/assets/c83014f6-18ad-435b-a59d-1d3ba3f80d84">

#### Considerations
1. CSS elements naming convention: Main component uses `kbnGrid` class,
with modifiers like `kbnGrid--nonInteractive`. For the drag handle of
`GridPanel` I used `kbnGridPanel__dragHandle` classname.
2. Classes vs. Inline Styles: I opted for using
`kbnGrid--nonInteractive` instead of adding one more subscription to
`GridPanel` to modify the styles inline. It's the first time in this
package that I used classes instead of inline styles for no-initial
styles setting.
3. Naming Convention: I opted for using the `expanded` word to describe
an expanded panel. Another one could be `maximized` as it's more used in
UI, but less in the legacy code.
4. Interactivity (drag/resize) is disabled in responsive mode but we
could consider to limit this to small viewports only (<768px).

---------

Co-authored-by: kibanamachine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) loe:medium Medium Level of Effort Project:Collapsable Panels Related to the project for adding collapsable sections to Dashboards. release_note:skip Skip the PR/issue when compiling release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Dashboard][Collapsable Panels] Responsive layout
4 participants