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] Embeddable Migrations for By Value Panels #99715

Merged
merged 11 commits into from
May 19, 2021

Conversation

ThomThomson
Copy link
Contributor

@ThomThomson ThomThomson commented May 10, 2021

Summary

Implements a new dashboard migration which runs for all versions that have at least one embeddable migration registered.

This migration loops through all the panels on the dashboard saved object, and if they are by value, it runs them through the embeddable migrate function.

Fixes #98173

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@kibanamachine
Copy link
Contributor

⏳ Build in-progress, with failures

Failed CI Steps

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

@ThomThomson ThomThomson force-pushed the feature/byValueMigrations branch from b389022 to ed47c6e Compare May 14, 2021 14:45
@ThomThomson ThomThomson added Feature:Dashboard Dashboard related features impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. loe:medium Medium Level of Effort Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v7.14.0 v8.0.0 release_note:skip Skip the PR/issue when compiling release notes labels May 14, 2021
@ThomThomson ThomThomson force-pushed the feature/byValueMigrations branch from ed47c6e to 40f3e5b Compare May 14, 2021 16:06
@ThomThomson ThomThomson marked this pull request as ready for review May 14, 2021 18:14
@ThomThomson ThomThomson requested review from a team as code owners May 14, 2021 18:14
@elasticmachine
Copy link
Contributor

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

@ThomThomson
Copy link
Contributor Author

@elasticmachine merge upstream

@botelastic botelastic bot added the Feature:Embedding Embedding content via iFrame label May 14, 2021
@ThomThomson
Copy link
Contributor Author

@elasticmachine merge upstream

@ThomThomson ThomThomson added the auto-backport Deprecated - use backport:version if exact versions are needed label May 17, 2021
@@ -125,4 +127,13 @@ export class EmbeddableServerPlugin implements Plugin<EmbeddableSetup, Embeddabl
}
);
};

private getMigrationVersions = () => {
const uniqueVersions = new Set<string>();
Copy link
Member

Choose a reason for hiding this comment

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

you need to include base embeddable migrations and extention migrations into this, check embeddable migrate function (in the common)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call! Thank you. I've added them in

Copy link
Contributor

@crob611 crob611 left a comment

Choose a reason for hiding this comment

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

Looks good. Real nice work. Left a few minor questions.

): SavedObjectMigrationMap => {
const embeddableMigrations = deps.embeddable
.getMigrationVersions()
.filter((version) => semver.gt(version, '7.12.0'))
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we even need to filter here, since there aren't any embeddable migrations before 7.12?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hum, that is a good point. It could potentially work either way, but maybe it's worth leaving it in just in case an embeddable migration gets added to an older version?

Copy link
Member

Choose a reason for hiding this comment

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

we are not maintaining older versions so i don't think we'll do that

'7.3.0': flow(migrations730),
'7.9.3': flow(migrateMatchAllQuery),
'7.11.0': flow(createExtractPanelReferencesMigration(deps)),
...Object.fromEntries(embeddableMigrations),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any reason to be concerned about the order that these might run in?

I'm thinking about like if we have a dashboard migration and an embeddable migration for the same version is it going to matter the order that they run in? I don't think it's going to matter, just wanted to bring it up though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually this brings up a very important consideration. If a developer adds a saved object migration for dashboard after the embeddable migrations, they could potentially overwrite the embeddable migrations for that version. I've left a comment explaining this, and providing an example of how to work around it. Thanks for bringing this up!

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh yeah, that's a great point.

What about we write a function that wraps the dashboard migrations with the embeddable migrations to avoid that.

So it becomes something like

return wrapWithEmbeddableMigrations({
  '6.7.2': flow(...),
  '7.0.0': flow(...),
  ...
}, embeddableMigrations)

Copy link
Member

Choose a reason for hiding this comment

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

i agree this is a problem. what about moving dashboard migrations to dashboard embeddable ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Either of these suggested solutions would work I believe - I would be hesitant to choose one and implement it in this PR. Perhaps we could do a follow-up PR to make sure we choose the option which will make the DX of adding new dashboard migrations the easiest.

Copy link
Member

@ppisljar ppisljar left a comment

Choose a reason for hiding this comment

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

app services changes LGTM

@kibanamachine
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
embeddable 362 363 +1
Unknown metric groups

API count

id before after diff
embeddable 430 431 +1

History

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

@ThomThomson ThomThomson merged commit 413e2dd into elastic:master May 19, 2021
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request May 19, 2021
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request May 20, 2021
* Implemented embeddable by value migrations

Co-authored-by: Devon Thomson <[email protected]>
yctercero pushed a commit to yctercero/kibana that referenced this pull request May 25, 2021
ThomThomson added a commit to ThomThomson/kibana that referenced this pull request May 26, 2021
ThomThomson added a commit that referenced this pull request May 26, 2021
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 Feature:Dashboard Dashboard related features Feature:Embedding Embedding content via iFrame impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. loe:medium Medium Level of Effort release_note:skip Skip the PR/issue when compiling release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v7.13.1 v7.14.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Dashboard] Embeddable Migrations for By Value Panels
6 participants