Skip to content

[dashboard] revert 8.17 to 9.1 changes to dashboard/server/dashboard_saved_object/migrations folder#223980

Merged
nreese merged 8 commits intoelastic:mainfrom
nreese:revert_migration_changes
Jun 17, 2025
Merged

[dashboard] revert 8.17 to 9.1 changes to dashboard/server/dashboard_saved_object/migrations folder#223980
nreese merged 8 commits intoelastic:mainfrom
nreese:revert_migration_changes

Conversation

@nreese
Copy link
Contributor

@nreese nreese commented Jun 13, 2025

Saved object migrations should not be modified. They convert legacy saved object shapes into less-legacy shapes. Since legacy saved object shapes are not changing, the code migrating them should not be changing as well.

The following steps where taken to create this PR

  • replaced main dashboard/server/dashboard_saved_object folder with 8.16 branch dashboard/server/dashboard_saved_object folder
  • Replaced dashboard/common imports with copies from dashboard/common 8.16 branch. Moved copied code into dashboard/server/dashboard_saved_object folder so migrations contain independent copies of utility functions and types.
  • Suffixed types with 810 since the migration system was deprecated in 8.10 and this is the version of the saved objects returned from migrations.
  • Fixed typescript errors.

@nreese
Copy link
Contributor Author

nreese commented Jun 13, 2025

/ci

@nreese nreese changed the title Revert migration changes [dashboard] revert 8.17 - main changes to ashboard/server/dashboard_saved_object/migrations Jun 13, 2025
@nreese nreese changed the title [dashboard] revert 8.17 - main changes to ashboard/server/dashboard_saved_object/migrations [dashboard] revert 8.17 to main changes to dashboard/server/dashboard_saved_object/migrations folder Jun 13, 2025
@nreese nreese changed the title [dashboard] revert 8.17 to main changes to dashboard/server/dashboard_saved_object/migrations folder [dashboard] revert 8.17 to 9.1 changes to dashboard/server/dashboard_saved_object/migrations folder Jun 13, 2025
@elasticmachine
Copy link
Contributor

⏳ Build in-progress, with failures

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #2 / extractReferences fails when "type" attribute is missing from a panel
  • [job] [logs] Jest Tests #2 / extractReferences fails when "type" attribute is missing from a panel

@nreese
Copy link
Contributor Author

nreese commented Jun 16, 2025

@elasticmachine merge upstream

@nreese
Copy link
Contributor Author

nreese commented Jun 16, 2025

/ci

@nreese nreese added backport:version Backport to applied version labels v9.1.0 v8.19.0 v9.0.3 v8.18.3 v8.17.8 release_note:skip Skip the PR/issue when compiling release notes Project:Dashboards API labels Jun 16, 2025
@nreese nreese marked this pull request as ready for review June 16, 2025 16:39
@nreese nreese requested a review from a team as a code owner June 16, 2025 16:39
@nreese nreese added the Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// label Jun 16, 2025
@elasticmachine
Copy link
Contributor

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

@nreese
Copy link
Contributor Author

nreese commented Jun 16, 2025

@elasticmachine merge upstream

Copy link
Contributor

@Zacqary Zacqary left a comment

Choose a reason for hiding this comment

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

LGTM once CI passes

Copy link
Contributor

@ThomThomson ThomThomson left a comment

Choose a reason for hiding this comment

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

Changes LGTM! Thanks for isolating all of this code - this should prevent us from confusing migrations & transforms again.

Code review only, as this is mostly copy-pastes of existing code.

@nreese nreese merged commit 6a9b997 into elastic:main Jun 17, 2025
10 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.17, 8.18, 8.19, 9.0

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

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jun 17, 2025
…saved_object/migrations folder (elastic#223980)

Saved object migrations should not be modified. They convert legacy
saved object shapes into less-legacy shapes. Since legacy saved object
shapes are not changing, the code migrating them should not be changing
as well.

The following steps where taken to create this PR
* replaced main `dashboard/server/dashboard_saved_object` folder with
8.16 branch `dashboard/server/dashboard_saved_object` folder
* Replaced `dashboard/common` imports with copies from
`dashboard/common` 8.16 branch. Moved copied code into
`dashboard/server/dashboard_saved_object` folder so migrations contain
independent copies of utility functions and types.
* Suffixed types with `810` since the migration system was deprecated in
8.10 and this is the version of the saved objects returned from
migrations.
* Fixed typescript errors.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
(cherry picked from commit 6a9b997)
@kibanamachine
Copy link
Contributor

💔 Some backports could not be created

Status Branch Result
8.17 Backport failed because of merge conflicts
8.18 Backport failed because of merge conflicts
8.19
9.0 Backport failed because of merge conflicts

Note: Successful backport PRs will be merged automatically after passing CI.

Manual backport

To create the backport manually run:

node scripts/backport --pr 223980

Questions ?

Please refer to the Backport tool documentation

@nreese
Copy link
Contributor Author

nreese commented Jun 17, 2025

Removing 8.17, 8.18, and 9.0 backports since there were lots of conflicts and this is not critical

kibanamachine added a commit that referenced this pull request Jun 17, 2025
…hboard_saved_object/migrations folder (#223980) (#224272)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[dashboard] revert 8.17 to 9.1 changes to
dashboard/server/dashboard_saved_object/migrations folder
(#223980)](#223980)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Nathan
Reese","email":"reese.nathan@elastic.co"},"sourceCommit":{"committedDate":"2025-06-17T14:30:13Z","message":"[dashboard]
revert 8.17 to 9.1 changes to
dashboard/server/dashboard_saved_object/migrations folder
(#223980)\n\nSaved object migrations should not be modified. They
convert legacy\nsaved object shapes into less-legacy shapes. Since
legacy saved object\nshapes are not changing, the code migrating them
should not be changing\nas well.\n\nThe following steps where taken to
create this PR\n* replaced main
`dashboard/server/dashboard_saved_object` folder with\n8.16 branch
`dashboard/server/dashboard_saved_object` folder\n* Replaced
`dashboard/common` imports with copies from\n`dashboard/common` 8.16
branch. Moved copied code
into\n`dashboard/server/dashboard_saved_object` folder so migrations
contain\nindependent copies of utility functions and types.\n* Suffixed
types with `810` since the migration system was deprecated in\n8.10 and
this is the version of the saved objects returned from\nmigrations.\n*
Fixed typescript errors.\n\n---------\n\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"6a9b9979bb1185f175bd20f3c716356459922a5e","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Presentation","release_note:skip","backport:version","Project:Dashboards
API","v9.1.0","v8.19.0","v9.0.3","v8.18.3","v8.17.8"],"title":"[dashboard]
revert 8.17 to 9.1 changes to
dashboard/server/dashboard_saved_object/migrations
folder","number":223980,"url":"https://github.com/elastic/kibana/pull/223980","mergeCommit":{"message":"[dashboard]
revert 8.17 to 9.1 changes to
dashboard/server/dashboard_saved_object/migrations folder
(#223980)\n\nSaved object migrations should not be modified. They
convert legacy\nsaved object shapes into less-legacy shapes. Since
legacy saved object\nshapes are not changing, the code migrating them
should not be changing\nas well.\n\nThe following steps where taken to
create this PR\n* replaced main
`dashboard/server/dashboard_saved_object` folder with\n8.16 branch
`dashboard/server/dashboard_saved_object` folder\n* Replaced
`dashboard/common` imports with copies from\n`dashboard/common` 8.16
branch. Moved copied code
into\n`dashboard/server/dashboard_saved_object` folder so migrations
contain\nindependent copies of utility functions and types.\n* Suffixed
types with `810` since the migration system was deprecated in\n8.10 and
this is the version of the saved objects returned from\nmigrations.\n*
Fixed typescript errors.\n\n---------\n\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"6a9b9979bb1185f175bd20f3c716356459922a5e"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.0","8.18","8.17"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/223980","number":223980,"mergeCommit":{"message":"[dashboard]
revert 8.17 to 9.1 changes to
dashboard/server/dashboard_saved_object/migrations folder
(#223980)\n\nSaved object migrations should not be modified. They
convert legacy\nsaved object shapes into less-legacy shapes. Since
legacy saved object\nshapes are not changing, the code migrating them
should not be changing\nas well.\n\nThe following steps where taken to
create this PR\n* replaced main
`dashboard/server/dashboard_saved_object` folder with\n8.16 branch
`dashboard/server/dashboard_saved_object` folder\n* Replaced
`dashboard/common` imports with copies from\n`dashboard/common` 8.16
branch. Moved copied code
into\n`dashboard/server/dashboard_saved_object` folder so migrations
contain\nindependent copies of utility functions and types.\n* Suffixed
types with `810` since the migration system was deprecated in\n8.10 and
this is the version of the saved objects returned from\nmigrations.\n*
Fixed typescript errors.\n\n---------\n\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"6a9b9979bb1185f175bd20f3c716356459922a5e"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.17","label":"v8.17.8","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Nathan Reese <reese.nathan@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
nreese added a commit that referenced this pull request Jun 24, 2025
…224314)

Closes #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
#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>
nreese added a commit to nreese/kibana that referenced this pull request Jun 24, 2025
…lastic#224314)

Closes elastic#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
elastic#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>
(cherry picked from commit 3d6954e)

# Conflicts:
#	src/platform/plugins/shared/dashboard/public/dashboard_renderer/grid/dashboard_grid_item.tsx
nreese added a commit that referenced this pull request Jun 24, 2025
…o map (#224314) (#225096)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[Dashboards as code] remove client transform of panels array to map
(#224314)](#224314)

<!--- Backport version: 10.0.1 -->

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

<!--BACKPORT [{"author":{"name":"Nathan
Reese","email":"reese.nathan@elastic.co"},"sourceCommit":{"committedDate":"2025-06-24T14:48:08Z","message":"[Dashboards
as code] remove client transform of panels array to map
(#224314)\n\nCloses
https://github.com/elastic/kibana/issues/224294\n\n### External team
reviewers\n@elastic/kibana-presentation team is working on \"Dashboards
as code\"\nproject where we provide a human readable CRUD API for
dashboards. Part\nof this work is aligning dashboard client code with
the shape of\ndashboard server api. As such, we are changing the shape
of `panels`\nfrom a Map to an Array - to directly consume what is being
returned from\nthe dashboard server api.\n\n### PR Overview\n\nThe goal
of this PR is to update dashboard client-side state `panels`\ntype to
match the type from dashboard server api. The dashboard server\napi
returns panels as an Array, while the dashboard client-side logic
is\nexpecting panels to be a Map keyed by panel id.\n\nThis type change
required the following changes:\n* Refactored dashboard client code to
receive panels as an array and\nreturn panels as an array. Biggest work
is in layout_manager\n`deserializeState` and `serializeState`
methods.\n* Remove `convertPanelsArrayToPanelSectionMaps`
from\n`loadDashboardState`. `convertPanelsArrayToPanelSectionMaps`
performed 2\ntasks\n1) Convert panels array to map. This is no longer
needed as now\ndashboard client code accepts panels in its native shape
from the\ndashboard server api.\n2) Move `id` and `title` fields into
embeddable state. This is no longer\nneeded as now dashboard server api
does this transform before sending\nthe dashboard to the client.\n*
Remove `convertPanelSectionMapsToPanelsArray`
from\n`getSerializedState`. `convertPanelSectionMapsToPanelsArray`
performed 2\ntasks.\n1) Convert panels map into panels array. This is no
longer needed as now\npanels is provided to `getSerializedState` in the
shape required for the\ndashboard server api.\n2) Lift `id` and `title`
fields from into top level panel state. This is\nno longer needed as all
embeddable state should remain under\n`panelConfig`.\n* Remove a bunch
of code in `dashboard/common` as now the client and\nserver are do not
need to depend on shared logic as the client is much\nsimpler and no
longer needs to transform the server response. Much of\nthis shared
logic was copied into server saved object migrations
in\nhttps://github.com//pull/223980 but can now be
removed\nfrom common since its no longer used in the
client.\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"3d6954e25284014527209cb8ba50db255cbfe41a","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Presentation","release_note:skip","Team:obs-ux-infra_services","Team:obs-ux-management","backport:version","Project:Dashboards
API","v9.1.0","v8.19.0"],"title":"[Dashboards as code] remove client
transform of panels array to
map","number":224314,"url":"https://github.com/elastic/kibana/pull/224314","mergeCommit":{"message":"[Dashboards
as code] remove client transform of panels array to map
(#224314)\n\nCloses
https://github.com/elastic/kibana/issues/224294\n\n### External team
reviewers\n@elastic/kibana-presentation team is working on \"Dashboards
as code\"\nproject where we provide a human readable CRUD API for
dashboards. Part\nof this work is aligning dashboard client code with
the shape of\ndashboard server api. As such, we are changing the shape
of `panels`\nfrom a Map to an Array - to directly consume what is being
returned from\nthe dashboard server api.\n\n### PR Overview\n\nThe goal
of this PR is to update dashboard client-side state `panels`\ntype to
match the type from dashboard server api. The dashboard server\napi
returns panels as an Array, while the dashboard client-side logic
is\nexpecting panels to be a Map keyed by panel id.\n\nThis type change
required the following changes:\n* Refactored dashboard client code to
receive panels as an array and\nreturn panels as an array. Biggest work
is in layout_manager\n`deserializeState` and `serializeState`
methods.\n* Remove `convertPanelsArrayToPanelSectionMaps`
from\n`loadDashboardState`. `convertPanelsArrayToPanelSectionMaps`
performed 2\ntasks\n1) Convert panels array to map. This is no longer
needed as now\ndashboard client code accepts panels in its native shape
from the\ndashboard server api.\n2) Move `id` and `title` fields into
embeddable state. This is no longer\nneeded as now dashboard server api
does this transform before sending\nthe dashboard to the client.\n*
Remove `convertPanelSectionMapsToPanelsArray`
from\n`getSerializedState`. `convertPanelSectionMapsToPanelsArray`
performed 2\ntasks.\n1) Convert panels map into panels array. This is no
longer needed as now\npanels is provided to `getSerializedState` in the
shape required for the\ndashboard server api.\n2) Lift `id` and `title`
fields from into top level panel state. This is\nno longer needed as all
embeddable state should remain under\n`panelConfig`.\n* Remove a bunch
of code in `dashboard/common` as now the client and\nserver are do not
need to depend on shared logic as the client is much\nsimpler and no
longer needs to transform the server response. Much of\nthis shared
logic was copied into server saved object migrations
in\nhttps://github.com//pull/223980 but can now be
removed\nfrom common since its no longer used in the
client.\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"3d6954e25284014527209cb8ba50db255cbfe41a"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/224314","number":224314,"mergeCommit":{"message":"[Dashboards
as code] remove client transform of panels array to map
(#224314)\n\nCloses
https://github.com/elastic/kibana/issues/224294\n\n### External team
reviewers\n@elastic/kibana-presentation team is working on \"Dashboards
as code\"\nproject where we provide a human readable CRUD API for
dashboards. Part\nof this work is aligning dashboard client code with
the shape of\ndashboard server api. As such, we are changing the shape
of `panels`\nfrom a Map to an Array - to directly consume what is being
returned from\nthe dashboard server api.\n\n### PR Overview\n\nThe goal
of this PR is to update dashboard client-side state `panels`\ntype to
match the type from dashboard server api. The dashboard server\napi
returns panels as an Array, while the dashboard client-side logic
is\nexpecting panels to be a Map keyed by panel id.\n\nThis type change
required the following changes:\n* Refactored dashboard client code to
receive panels as an array and\nreturn panels as an array. Biggest work
is in layout_manager\n`deserializeState` and `serializeState`
methods.\n* Remove `convertPanelsArrayToPanelSectionMaps`
from\n`loadDashboardState`. `convertPanelsArrayToPanelSectionMaps`
performed 2\ntasks\n1) Convert panels array to map. This is no longer
needed as now\ndashboard client code accepts panels in its native shape
from the\ndashboard server api.\n2) Move `id` and `title` fields into
embeddable state. This is no longer\nneeded as now dashboard server api
does this transform before sending\nthe dashboard to the client.\n*
Remove `convertPanelSectionMapsToPanelsArray`
from\n`getSerializedState`. `convertPanelSectionMapsToPanelsArray`
performed 2\ntasks.\n1) Convert panels map into panels array. This is no
longer needed as now\npanels is provided to `getSerializedState` in the
shape required for the\ndashboard server api.\n2) Lift `id` and `title`
fields from into top level panel state. This is\nno longer needed as all
embeddable state should remain under\n`panelConfig`.\n* Remove a bunch
of code in `dashboard/common` as now the client and\nserver are do not
need to depend on shared logic as the client is much\nsimpler and no
longer needs to transform the server response. Much of\nthis shared
logic was copied into server saved object migrations
in\nhttps://github.com//pull/223980 but can now be
removed\nfrom common since its no longer used in the
client.\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"3d6954e25284014527209cb8ba50db255cbfe41a"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request Jun 25, 2025
…lastic#224314)

Closes elastic#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
elastic#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>
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 Project:Dashboards API release_note:skip Skip the PR/issue when compiling release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants