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

[Lens] use data plugin migrations for search sources in legacy visualizations #123005

Conversation

drewdaemon
Copy link
Contributor

@drewdaemon drewdaemon commented Jan 13, 2022

Summary

This PR applies (not-yet-existent) search source migrations defined in the data plugin to the embedded search source objects in legacy visualizations.

How to Test

Saved Object Migrations

Search Sources in Legacy Visualizations

  • Add the following dummy search source migration here
const searchSourceMigrations = {
    '8.1.0': (searchSource: SerializedSearchSourceFields) => ({ ...searchSource, migrated: true }),
  };
  • Start and open Kibana
  • Visit "Stack Management" -> "Saved objects"
  • Import these saved objects
  • this will add two objects to verify (plus the index pattern)
    • Dashboard with Visualization with Search Source
      • check that visState.data.searchSource === true in the visualization serialized in attributes.panelsJSON
    • Gauge with Search Source
      • check that JSON.parse(SO.attributes.kibanaSavedObjectMeta.searchSourceJSON).migrated === true

Filters in Lens

(make sure the functionality introduced in #120305 has not regressed)

  • Add the following dummy filter migration here
export const getAllMigrations = (): MigrateFunctionsObject => {
  return {
    '8.1.0': (filters: Filter[]) => filters.map((filter) => ({ ...filter, migrated: true })),
  };
};
  • Start and open Kibana
  • Visit "Stack Management" -> "Saved objects"
  • Import these saved objects
  • this will add three objects to verify (plus the index pattern)
    • Dashboard with Embedded Lens Visualizations with Filters
    • standalone table with filters
    • standalone bar chart with filter
  • Verify that each filter in the visualization states
    1. Has no indexRefName property. Instead, it should have an index property.
    2. Has a migrated: true property.

Checklist

drewdaemon and others added 30 commits December 1, 2021 18:12
[suggestion] statically import filter inject/extract
…ts' of github.com:andrewctate/kibana into 114482/correctly-apply-filter-migrations-in-saved-objects
…-plugin-migrations-for-search-sources-in-legacy-visualizations
@drewdaemon
Copy link
Contributor Author

@elasticmachine merge upstream

kibanamachine and others added 3 commits January 20, 2022 09:21
…-plugin-migrations-for-search-sources-in-legacy-visualizations
…-legacy-visualizations' of github.com:andrewctate/kibana into 114483/use-data-plugin-migrations-for-search-sources-in-legacy-visualizations
@drewdaemon
Copy link
Contributor Author

@elasticmachine merge upstream

kibanamachine and others added 3 commits January 24, 2022 09:13
…-legacy-visualizations' of github.com:andrewctate/kibana into 114483/use-data-plugin-migrations-for-search-sources-in-legacy-visualizations
@drewdaemon
Copy link
Contributor Author

@elasticmachine merge upstream

@flash1293
Copy link
Contributor

@elasticmachine merge upstream

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.

Tested by adding example migrations to by value and by reference lens and visualization SOs as well as search source and filters - everything gets reflected as expected in all places, LGTM

…-plugin-migrations-for-search-sources-in-legacy-visualizations
…-legacy-visualizations' of github.com:andrewctate/kibana into 114483/use-data-plugin-migrations-for-search-sources-in-legacy-visualizations
@drewdaemon drewdaemon requested a review from a team as a code owner January 31, 2022 15:44
@kibana-ci
Copy link
Collaborator

💚 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
core 968 970 +2
visualizations 283 296 +13
total +15

Any counts in public APIs

Total count of every any typed public API. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats any for more detailed information.

id before after diff
visualizations 11 12 +1

Page load bundle

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

id before after diff
data 449.7KB 449.7KB +36.0B
Unknown metric groups

API count

id before after diff
core 2353 2356 +3
visualizations 303 316 +13
total +16

History

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

@drewdaemon
Copy link
Contributor Author

@ppisljar looks like you're the last code-owner reviewer. Do you feel comfortable signing off on this PR?

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.

code LGTM

@drewdaemon drewdaemon merged commit 62c76b9 into elastic:main Feb 1, 2022
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Lens release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants