kibana/examples
Kibana Machine d223cd7df5
[8.x] [Dashboard] [Collapsable Panels] Add embeddable support (#198413) (#203652)
# Backport

This will backport the following commits from `main` to `8.x`:
- [[Dashboard] [Collapsable Panels] Add embeddable support
(#198413)](https://github.com/elastic/kibana/pull/198413)

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

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

<!--BACKPORT [{"author":{"name":"Hannah
Mudge","email":"Heenawter@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-12-10T17:14:31Z","message":"[Dashboard]
[Collapsable Panels] Add embeddable support (#198413)\n\nCloses
https://github.com/elastic/kibana/issues/190379\r\n\r\n##
Summary\r\n\r\nThis PR switches the example grid layout app to render
embeddables as\r\npanels rather than the simplified mock panel we were
using previously.\r\nIn doing so, I had to add the ability for custom
panels to add a custom\r\ndrag handle via the `renderPanelContents`
callback - this required\r\nadding a `setDragHandles` callback to the
`ReactEmbeddableRenderer` that\r\ncould be passed down to the
`PresentationPanel`
component.\r\n\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/9e2c68f9-34af-4360-a978-9113701a5ea2\r\n\r\n\r\n\r\n####
New scroll behaviour\r\n\r\nIn
https://github.com/elastic/kibana/pull/201867, I introduced a
small\r\n\"ease\" to the auto-scroll effect that happens when you drag a
panel to\r\nthe top or bottom of the window. However, in that PR, I was
using the\r\n`smooth` scrolling behaviour, which unfortunately became
**very**\r\njittery once I switched to embeddables rather than simple
panels\r\n(specifically in Chrome - it worked fine in
Firefox).\r\n\r\nThe only way to prevent this jittery scroll was to
switch to the default\r\nscroll behaviour, but this lead to a very
**abrupt** stop when the\r\nscrollbar reached the top and/or bottom of
the page - so, to give the\r\nsame \"gentle\" stop that the `smooth`
scroll had, I decided to recreate\r\nthis effect by adding a slow down
\"ease\" when close to the top or bottom\r\nof the
page:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/cb7bf03f-4a9e-4446-be4f-8f54c0bc88ac\r\n\r\nThis
effect is accomplished via the parabola formula `y = a(x-h)2 + k`\r\nand
can be roughly visualized with the following, which shows that
the\r\n\"speed up\" ease happens at a much slower pace than the \"slow
down\"
ease:\r\n\r\n\r\n![image](https://github.com/user-attachments/assets/02b4389c-fe78-448d-9c02-c4ec5e722d5e)\r\n\r\n\r\n\r\n\r\n####
Notes about parent changes\r\nAs I investigated improving the efficiency
of the grid layout with\r\nembeddables, one of the main things I noticed
was that the grid panel\r\nwas **always** remounted when moving a panel
from one collapsible\r\nsection to another. This lead me (and
@ThomThomson) down a rabbit hole\r\nof React-reparenting, and we
explored a few different options to see if\r\nwe could change the parent
of a component **without** having it remount.\r\n\r\nIn summary, after
various experiments and a whole bunch of research, we\r\ndetermined
that, due to the reconciliation of the React tree, this
is\r\nunfortunately impossible. So our priorities will instead have to
move to\r\nmaking the remount of `ReactEmbeddableRenderer` **as
efficient as\r\npossible** via caching, since the remount is
inevitable.\r\n\r\n### Checklist\r\n\r\n- [x] The PR description
includes the appropriate Release Notes section,\r\nand the correct
`release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n###
Identify risks\r\n\r\nThere are no risks to this PR, since the most
significant work is\r\ncontained in the `examples` plugin. Some changes
were made to the\r\npresentation panel to allow for custom drag handles,
but this isn't\r\nactually used in Dashboard - so for now, this code is
only called in the\r\nexample plugin, as
well.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"2a76fe3ee432d0b6746eae660cfe31fc71d15547","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Dashboard","Feature:Embedding","Team:Presentation","loe:medium","release_note:skip","impact:high","v9.0.0","backport:prev-minor","Project:Collapsable
Panels"],"title":"[Dashboard] [Collapsable Panels] Add embeddable
support","number":198413,"url":"https://github.com/elastic/kibana/pull/198413","mergeCommit":{"message":"[Dashboard]
[Collapsable Panels] Add embeddable support (#198413)\n\nCloses
https://github.com/elastic/kibana/issues/190379\r\n\r\n##
Summary\r\n\r\nThis PR switches the example grid layout app to render
embeddables as\r\npanels rather than the simplified mock panel we were
using previously.\r\nIn doing so, I had to add the ability for custom
panels to add a custom\r\ndrag handle via the `renderPanelContents`
callback - this required\r\nadding a `setDragHandles` callback to the
`ReactEmbeddableRenderer` that\r\ncould be passed down to the
`PresentationPanel`
component.\r\n\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/9e2c68f9-34af-4360-a978-9113701a5ea2\r\n\r\n\r\n\r\n####
New scroll behaviour\r\n\r\nIn
https://github.com/elastic/kibana/pull/201867, I introduced a
small\r\n\"ease\" to the auto-scroll effect that happens when you drag a
panel to\r\nthe top or bottom of the window. However, in that PR, I was
using the\r\n`smooth` scrolling behaviour, which unfortunately became
**very**\r\njittery once I switched to embeddables rather than simple
panels\r\n(specifically in Chrome - it worked fine in
Firefox).\r\n\r\nThe only way to prevent this jittery scroll was to
switch to the default\r\nscroll behaviour, but this lead to a very
**abrupt** stop when the\r\nscrollbar reached the top and/or bottom of
the page - so, to give the\r\nsame \"gentle\" stop that the `smooth`
scroll had, I decided to recreate\r\nthis effect by adding a slow down
\"ease\" when close to the top or bottom\r\nof the
page:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/cb7bf03f-4a9e-4446-be4f-8f54c0bc88ac\r\n\r\nThis
effect is accomplished via the parabola formula `y = a(x-h)2 + k`\r\nand
can be roughly visualized with the following, which shows that
the\r\n\"speed up\" ease happens at a much slower pace than the \"slow
down\"
ease:\r\n\r\n\r\n![image](https://github.com/user-attachments/assets/02b4389c-fe78-448d-9c02-c4ec5e722d5e)\r\n\r\n\r\n\r\n\r\n####
Notes about parent changes\r\nAs I investigated improving the efficiency
of the grid layout with\r\nembeddables, one of the main things I noticed
was that the grid panel\r\nwas **always** remounted when moving a panel
from one collapsible\r\nsection to another. This lead me (and
@ThomThomson) down a rabbit hole\r\nof React-reparenting, and we
explored a few different options to see if\r\nwe could change the parent
of a component **without** having it remount.\r\n\r\nIn summary, after
various experiments and a whole bunch of research, we\r\ndetermined
that, due to the reconciliation of the React tree, this
is\r\nunfortunately impossible. So our priorities will instead have to
move to\r\nmaking the remount of `ReactEmbeddableRenderer` **as
efficient as\r\npossible** via caching, since the remount is
inevitable.\r\n\r\n### Checklist\r\n\r\n- [x] The PR description
includes the appropriate Release Notes section,\r\nand the correct
`release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n###
Identify risks\r\n\r\nThere are no risks to this PR, since the most
significant work is\r\ncontained in the `examples` plugin. Some changes
were made to the\r\npresentation panel to allow for custom drag handles,
but this isn't\r\nactually used in Dashboard - so for now, this code is
only called in the\r\nexample plugin, as
well.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"2a76fe3ee432d0b6746eae660cfe31fc71d15547"}},"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/198413","number":198413,"mergeCommit":{"message":"[Dashboard]
[Collapsable Panels] Add embeddable support (#198413)\n\nCloses
https://github.com/elastic/kibana/issues/190379\r\n\r\n##
Summary\r\n\r\nThis PR switches the example grid layout app to render
embeddables as\r\npanels rather than the simplified mock panel we were
using previously.\r\nIn doing so, I had to add the ability for custom
panels to add a custom\r\ndrag handle via the `renderPanelContents`
callback - this required\r\nadding a `setDragHandles` callback to the
`ReactEmbeddableRenderer` that\r\ncould be passed down to the
`PresentationPanel`
component.\r\n\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/9e2c68f9-34af-4360-a978-9113701a5ea2\r\n\r\n\r\n\r\n####
New scroll behaviour\r\n\r\nIn
https://github.com/elastic/kibana/pull/201867, I introduced a
small\r\n\"ease\" to the auto-scroll effect that happens when you drag a
panel to\r\nthe top or bottom of the window. However, in that PR, I was
using the\r\n`smooth` scrolling behaviour, which unfortunately became
**very**\r\njittery once I switched to embeddables rather than simple
panels\r\n(specifically in Chrome - it worked fine in
Firefox).\r\n\r\nThe only way to prevent this jittery scroll was to
switch to the default\r\nscroll behaviour, but this lead to a very
**abrupt** stop when the\r\nscrollbar reached the top and/or bottom of
the page - so, to give the\r\nsame \"gentle\" stop that the `smooth`
scroll had, I decided to recreate\r\nthis effect by adding a slow down
\"ease\" when close to the top or bottom\r\nof the
page:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/cb7bf03f-4a9e-4446-be4f-8f54c0bc88ac\r\n\r\nThis
effect is accomplished via the parabola formula `y = a(x-h)2 + k`\r\nand
can be roughly visualized with the following, which shows that
the\r\n\"speed up\" ease happens at a much slower pace than the \"slow
down\"
ease:\r\n\r\n\r\n![image](https://github.com/user-attachments/assets/02b4389c-fe78-448d-9c02-c4ec5e722d5e)\r\n\r\n\r\n\r\n\r\n####
Notes about parent changes\r\nAs I investigated improving the efficiency
of the grid layout with\r\nembeddables, one of the main things I noticed
was that the grid panel\r\nwas **always** remounted when moving a panel
from one collapsible\r\nsection to another. This lead me (and
@ThomThomson) down a rabbit hole\r\nof React-reparenting, and we
explored a few different options to see if\r\nwe could change the parent
of a component **without** having it remount.\r\n\r\nIn summary, after
various experiments and a whole bunch of research, we\r\ndetermined
that, due to the reconciliation of the React tree, this
is\r\nunfortunately impossible. So our priorities will instead have to
move to\r\nmaking the remount of `ReactEmbeddableRenderer` **as
efficient as\r\npossible** via caching, since the remount is
inevitable.\r\n\r\n### Checklist\r\n\r\n- [x] The PR description
includes the appropriate Release Notes section,\r\nand the correct
`release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n###
Identify risks\r\n\r\nThere are no risks to this PR, since the most
significant work is\r\ncontained in the `examples` plugin. Some changes
were made to the\r\npresentation panel to allow for custom drag handles,
but this isn't\r\nactually used in Dashboard - so for now, this code is
only called in the\r\nexample plugin, as
well.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"2a76fe3ee432d0b6746eae660cfe31fc71d15547"}}]}]
BACKPORT-->

Co-authored-by: Hannah Mudge <Heenawter@users.noreply.github.com>
2024-12-10 13:12:29 -06:00
..
bfetch_explorer Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
content_management_examples [8.x] [EuiInMemoryTable] Persist table rows per page and sort (#198297) (#200569) 2024-11-18 09:22:33 -06:00
controls_example [8.x] [Embeddable Rebuild] [Controls] Remove non-React controls from &#x60;controls&#x60; plugin (#192017) (#193174) 2024-09-17 10:43:58 -05:00
data_view_field_editor_example Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
developer_examples [8.x] Preparation for High Contrast Mode, Core/SharedUX domains (#202606) (#203147) 2024-12-06 10:02:27 +01:00
discover_customization_examples [8.x] [OneDiscover] Contextual App Menu Extension Point (#195448) (#198320) 2024-10-30 09:25:31 -05:00
embeddable_examples [8.x] [Dashboard] [Collapsable Panels] Add embeddable support (#198413) (#203652) 2024-12-10 13:12:29 -06:00
error_boundary Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
eso_model_version_example Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
esql_ast_inspector [8.x] Sustainable Kibana Architecture: Move modules owned by @elastic/kibana-esql (#202722) (#203390) 2024-12-09 10:20:46 -06:00
esql_validation_example [8.x] Sustainable Kibana Architecture: Move modules owned by @elastic/kibana-esql (#202722) (#203390) 2024-12-09 10:20:46 -06:00
expressions_explorer Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
feature_control_examples [8.x] Added scope field to features config. (#191634) (#193389) 2024-09-19 10:42:43 -05:00
feature_flags_example [8.x] [Feature Flags Example Plugin] Change ctx provider (#201097) (#201356) 2024-11-22 14:57:17 +01:00
field_formats_example Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
files_example Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
grid_example [8.x] [Dashboard] [Collapsable Panels] Add embeddable support (#198413) (#203652) 2024-12-10 13:12:29 -06:00
guided_onboarding_example [8.x] [Expamples][Guided onboarding] - added missing EuiProvider to fix errors (#199070) (#199076) 2024-11-05 22:00:12 -06:00
hello_world Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
locator_examples Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
locator_explorer Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
partial_results_example Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
portable_dashboards_example [8.x] [dashboard] decouple DashboardCreationOptions from DashboardContainer (#194875) (#195322) 2024-10-08 00:50:43 +02:00
preboot_example Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
resizable_layout_examples [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
response_stream [8.x] [ML] AIOps: Log Rate Analysis embeddable (#197943) (#198963) 2024-11-05 10:36:04 -06:00
routing_example [8.x] Preparation for High Contrast Mode, Core/SharedUX domains (#202606) (#203147) 2024-12-06 10:02:27 +01:00
screenshot_mode_example Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
search_examples [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
share_examples [8.x] [Reporting] fix dashboard &quot;Copy Post URL&quot; action (#192530) (#195334) 2024-10-08 03:44:43 +02:00
state_containers_examples Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
ui_action_examples [8.x] Preparation for High Contrast Mode, Core/SharedUX domains (#202606) (#203147) 2024-12-06 10:02:27 +01:00
ui_actions_explorer [8.x] Preparation for High Contrast Mode, Core/SharedUX domains (#202606) (#203147) 2024-12-06 10:02:27 +01:00
unified_doc_viewer Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
unified_field_list_examples [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
user_profile_examples Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
v8_profiler_examples Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
README.asciidoc Adds run without basepath configured to examples readme (#173086) 2023-12-12 11:22:02 -07:00

[[example-plugins]]
== Example plugins

This folder contains example plugins.  To run the plugins in this folder, use the `--run-examples` flag (without a basepath), via

[source,bash]
----
yarn start --run-examples
----