kibana/examples/portable_dashboards_example/public
Nathan Reese 3d6954e252
[Dashboards as code] remove client transform of panels array to map (#224314)
Closes https://github.com/elastic/kibana/issues/224294

### External team reviewers
@elastic/kibana-presentation team is working on "Dashboards as code"
project where we provide a human readable CRUD API for dashboards. Part
of this work is aligning dashboard client code with the shape of
dashboard server api. As such, we are changing the shape of `panels`
from a Map to an Array - to directly consume what is being returned from
the dashboard server api.

### PR Overview

The goal of this PR is to update dashboard client-side state `panels`
type to match the type from dashboard server api. The dashboard server
api returns panels as an Array, while the dashboard client-side logic is
expecting panels to be a Map keyed by panel id.

This type change required the following changes:
* Refactored dashboard client code to receive panels as an array and
return panels as an array. Biggest work is in layout_manager
`deserializeState` and `serializeState` methods.
* Remove `convertPanelsArrayToPanelSectionMaps` from
`loadDashboardState`. `convertPanelsArrayToPanelSectionMaps` performed 2
tasks
1) Convert panels array to map. This is no longer needed as now
dashboard client code accepts panels in its native shape from the
dashboard server api.
2) Move `id` and `title` fields into embeddable state. This is no longer
needed as now dashboard server api does this transform before sending
the dashboard to the client.
* Remove `convertPanelSectionMapsToPanelsArray` from
`getSerializedState`. `convertPanelSectionMapsToPanelsArray` performed 2
tasks.
1) Convert panels map into panels array. This is no longer needed as now
panels is provided to `getSerializedState` in the shape required for the
dashboard server api.
2) Lift `id` and `title` fields from into top level panel state. This is
no longer needed as all embeddable state should remain under
`panelConfig`.
* Remove a bunch of code in `dashboard/common` as now the client and
server are do not need to depend on shared logic as the client is much
simpler and no longer needs to transform the server response. Much of
this shared logic was copied into server saved object migrations in
https://github.com/elastic/kibana/pull/223980 but can now be removed
from common since its no longer used in the client.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-06-24 08:48:08 -06:00
..
app.tsx [chore] Import common react-use methods in shared bundle (#218640) 2025-04-24 14:13:25 +02:00
constants.ts Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
dashboard_with_controls_example.tsx [Embeddables] Serialized State Only (#215947) 2025-05-06 15:08:34 -06:00
dual_dashboards_example.tsx [embeddable] replace Embeddable ViewMode with presentation-publishing ViewMode (#211960) 2025-03-04 09:05:23 -07:00
filter_debugger_embeddable.tsx [Embeddables] Serialized State Only (#215947) 2025-05-06 15:08:34 -06:00
index.ts Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
plugin.tsx [dashboard] Lazy DashboardRenderer (#192754) 2024-09-17 13:15:50 -06:00
portable_dashboard_image.png Optimize existing image assets with lossless compression (#223998) 2025-06-19 16:44:13 +02:00
static_by_reference_example.tsx [embeddable] replace Embeddable ViewMode with presentation-publishing ViewMode (#211960) 2025-03-04 09:05:23 -07:00
static_by_value_example.tsx [Dashboards as code] remove client transform of panels array to map (#224314) 2025-06-24 08:48:08 -06:00
static_by_value_example_panels.json [Dashboards as code] remove client transform of panels array to map (#224314) 2025-06-24 08:48:08 -06:00