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

[maps] fix Dashboards with by-value maps are broken when copied to new space #125599

Merged
merged 14 commits into from
Feb 17, 2022

Conversation

nreese
Copy link
Contributor

@nreese nreese commented Feb 14, 2022

Closes #125595 and #124976

Changes

  • PR adds maps embeddable migration to migrate existing by-value map embeddable in existing dashboards.
  • This PR updates maps embeddable factory to register extract and inject functions to properly extract and inject references for by value embeddables in client and server.

Test - newly created dashboards

  1. Create dashboard with by-value map that contains documents layer. Save
  2. From Stack management -> Saved objects page, copy dashboard to space
  3. Open dashboard in space and verify map shows data

Test - existing by-value dashboards.

  1. In Cloud instance that is 7.16, or 7.17.0, or 8.0.0, Create dashboard with by-value map that contains documents layer. Save
  2. export dashboard saved objects
  3. Import dashboard into Kibana instance that is running this branch
  4. Open dashboard and verify map shows data
  5. Copy dashboard to space
  6. Open dashboard in space and verify map shows data

@nreese nreese added auto-backport Deprecated - use backport:version if exact versions are needed release_note:fix v7.17.1 v8.0.1 v8.1.0 v8.2.0 [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation labels Feb 14, 2022
@nreese nreese marked this pull request as ready for review February 15, 2022 19:13
@nreese nreese requested review from a team as code owners February 15, 2022 19:13
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-gis (Team:Geo)

@nreese nreese added the Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas label Feb 15, 2022
@elasticmachine
Copy link
Contributor

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

@nreese nreese requested a review from crob611 February 15, 2022 21:40
@nreese nreese removed the Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas label Feb 15, 2022
@nreese
Copy link
Contributor Author

nreese commented Feb 15, 2022

Removing @elastic/kibana-presentation request for review. @ThomThomson chatted offline and suggested moving dashboard migrations to maps embeddable migrations. Because of this, there is no need to change any dashboard code.

@nreese nreese removed request for a team and crob611 February 15, 2022 22:08
Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

I tested this locally in various configurations (single import, first data view import, then maps import, default space / custom space) it works fine everywhere from what I can tell.

I’m not sure whether the 7.17.1 migration is necessary or not - it depends on whether an 8.0.1 cluster upgrading from 7.17.1 will first run all registered 8.0.1 migrations or whether it will first change conflicting ids in all saved objects and then run the migrations. @jportner can you answer this question?

@jportner
Copy link
Contributor

I’m not sure whether the 7.17.1 migration is necessary or not - it depends on whether an 8.0.1 cluster upgrading from 7.17.1 will first run all registered 8.0.1 migrations or whether it will first change conflicting ids in all saved objects and then run the migrations. @jportner can you answer this question?

I'm not certain about embeddable migrations --
As far as regular saved object migrations are concerned, they are all applied in semver order.

So if you have these migrations defined, including the conversion for 8.0:

7.17.1 (migration)
8.0.0 (conversion)
8.0.0 (migration)
8.0.1 (migration)
8.1.0 (migration)

and you upgrade Kibana from 7.16 to 8.1, all five transformations will be applied in order.
It looks like you defined the same embeddable migration function for 7.17.1 and 8.0.1, did you do it with this in mind? Not sure if that's problematic or not.

@flash1293
Copy link
Contributor

@jportner Just to make sure, conversion means renaming of ids in the references array, right? In that case I think we should keep the migration in 7.17. because otherwise this might happen:
8.0.0 (conversion) - changes ids in the dashboard references array
8.0.1 (migration) - "extracts" the outdated ids from the maps panel into the global references array
Now the references of the dashboard are wrong

@nreese
Copy link
Contributor Author

nreese commented Feb 16, 2022

@elasticmachine merge upstream

@nreese nreese removed the v7.17.1 label Feb 16, 2022
Copy link
Member

@nickpeihl nickpeihl left a comment

Choose a reason for hiding this comment

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

lgtm!

tested copying new and existing dashboards from this branch as well as from an 8.0 instance.

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
maps 755 758 +3

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
maps 65.6KB 65.9KB +336.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@nreese nreese merged commit 485ab50 into elastic:main Feb 17, 2022
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Feb 17, 2022
…w space (elastic#125599)

* extract and inject

* add unit tests

* simplify tests

* add extract and inject to server map embeddable

* add dashboard migration

* do not add embeddable prefix

* eslint

* remove embeddable migration from dashboard and put in maps

* clean up comment

* fix jest test

* remove 7.17 migration and harden inject method

* clean-up test

* clean up comment grammer

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 485ab50)
@kibanamachine
Copy link
Contributor

💔 Some backports could not be created

Status Branch Result
8.1
8.0 Backport failed because of merge conflicts

How to fix

Re-run the backport manually:

node scripts/backport --pr 125599

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

Questions ?

Please refer to the Backport tool documentation

@nreese
Copy link
Contributor Author

nreese commented Feb 17, 2022

8.0.1 #125887

kibanamachine added a commit that referenced this pull request Feb 17, 2022
…w space (#125599) (#125886)

* extract and inject

* add unit tests

* simplify tests

* add extract and inject to server map embeddable

* add dashboard migration

* do not add embeddable prefix

* eslint

* remove embeddable migration from dashboard and put in maps

* clean up comment

* fix jest test

* remove 7.17 migration and harden inject method

* clean-up test

* clean up comment grammer

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 485ab50)

Co-authored-by: Nathan Reese <reese.nathan@elastic.co>
nreese added a commit that referenced this pull request Feb 17, 2022
… to new space (#125599) (#125887)

* merge with main

* update expect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation release_note:fix v8.0.1 v8.1.0 v8.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dashboards with by-value maps are broken when copied to new space
7 participants