-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Migrate legacy maps service to NP & update refs #60942
Migrate legacy maps service to NP & update refs #60942
Conversation
Pinging @elastic/kibana-gis (Team:Geo) |
c7c88cf
to
a0307fc
Compare
…caldwell/kibana into np-update-and-migrate-legacy-maps
retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
I think there's two things to look at:
- as discussed in person, there seems to be a regression in the display of attribution
Note that this is a limitation of Leaflet-attribution control and requires the raw HTML to display as-is. This seems to escape it first.
- the x-pack
tilemap
plugin (kibana/x-pack/legacy/plugins/tilemap
) no longer extends the URL-params of the service-settings. This plugin's only purpose is to add a license-key to the URL-params using theServiceSettings#addQueryParams
method (kibana/x-pack/legacy/plugins/tilemap/public/vis_type_enhancers/update_tilemap_settings.js
Lines 21 to 22 in c2c1253
serviceSettings.addQueryParams({ license: tileMapPluginInfo.license.uid }); serviceSettings.disableZoomMessage();
As we later discussed, I removed sanitation. Since we're in control of the
This plugin should be migrated but we should do that in a separate PR. I've updated #60325 to account for this. I experimented with handling licensing logic in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few SCSS files were moved to a different folder. The changes LGMT! 🎉
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested both region and coordinate maps and works!
wrt sanitize removal, is there a possible equivalent already available? (otherwise consider using a regex to parse out href and contents and sanitize separately).
wrt
This plugin should be migrated but we should do that in a separate PR. I've updated #60325 to account for this. I experimented with handling licensing logic in MapsLegacy directly. This seemed to work in Basic but failed in OSS since there's no way to specify a conditional dependency like "only depend on licensing if x-pack is available" in an NP plugin's kibana.json. For now I was able to fix it by obtaining a reference to MapsLegacy via an npSetup import, this works as expected in both OSS and Basic+ and is a good fix until we migrate it.
+1 on doing this in separate PR.
I think we discussed doing this in the Maps
plugin. Maps is loaded in basic+ anyway. It'd bloat the purpose of the Maps-plugin a little bit, but a fair trade-off imho if it can remove an entire plugin.
@@ -319,8 +319,6 @@ | |||
"common.ui.stateManagement.unableToStoreHistoryInSessionErrorMessage": "セッションがいっぱいで安全に削除できるアイテムが見つからないため、Kibana は履歴アイテムを保存できません。\n\nこれは大抵新規タブに移動することで解決されますが、より大きな問題が原因である可能性もあります。このメッセージが定期的に表示される場合は、{gitHubIssuesUrl} で問題を報告してください。", | |||
"common.ui.url.replacementFailedErrorMessage": "置換に失敗、未解決の表現式: {expr}", | |||
"common.ui.url.savedObjectIsMissingNotificationMessage": "保存されたオブジェクトがありません", | |||
"common.ui.vis.kibanaMap.leaflet.fitDataBoundsAriaLabel": "データバウンドを合わせる", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are these gone?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran both an i18n
check w/ fix flag and an extract. Neither of these indicated anything missing or out of place wrt maps_legacy
. i18n did complain a few commits back about adding the new plugin directory, which I did here. It's likely that some translations require manual translation and are flagged in a separate documentation process. Unfortunately it's not as easy as just updating the dot path to its new location since this would just be wiped out by the next node scripts/i18n_extract
command someone runs. I did notice when running node scripts/i18n_extract
that both of these paths were correctly grabbed for the english (untracked) file here:
So they are tracked correctly and should be translated in a later process
We did indeed. I keep going back and forth on this but I'm (at least currently) in favor of keeping it as a separate plugin providing data to this new |
As discussed offline, tracking this here: #63399 |
* Get legacy maps into basic NP plugin form. Swap out legacy services for NP * Pull service settings from injected vars. Return new instance of service settings from setup * Use NP service settings in vega maps. Clean up legacy shim * Use NP maps service in region maps. Clean up shim. Add exports to NP service * Pull zoom precision out to separate module since it's dependent on config * Update paths to point to NP resources * More path updates, clean up, use IServiceSettings * Remove dependency on legacy service settings. Add tile_map dependency ng-sanitize * More path cleanup. Use zoomPrecision provided through plugin inteface * Move getPrecision into contract-provided function since it depends on config * Move tests to new service location, remove vis dir * Update test paths. Move origin const declaration into public * Clean up, fixes * Fix type errors. General cleaning * Inject toast service into map when needed * Fix typo in regionmap config * i18n fixes * Update jest test path * Fix karma tests * i18n fixes * Type updates. Add mapsLegacy to np karma mock * Remove html sanitizer * Fix vega test that depends on serviceSettings * Revise xpack license handling to use NP serviceSettings. Remove angular bindings Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* master: (132 commits) document code splitting for client code (elastic#62593) Escape single quotes surrounded by double quotes (elastic#63229) [Endpoint] Update cli mapping to match endpoint package (elastic#63372) update in-app links to metricbeat configuration docs (elastic#63295) investigation notes field (documentation / metadata) (elastic#63386) [Maps] fix bug where toggling Scaling type does not re-fetch data (elastic#63326) [Alerting] set correct parameter for unauthented email action (elastic#63086) [Telemetry] force staging urls in tests (elastic#63356) Migrate legacy maps service to NP & update refs (elastic#60942) Fix task manager query to return tasks to retry (elastic#63360) [Endpoint] Policy list support for URL pagination state (elastic#63291) [Canvas] Migrate saved object mappings and migrations to Kibana Platform (elastic#58891) [DOCS] Add ILM tutorial (elastic#59502) [Maps] Add SOURCE_TYPES enumeration (elastic#62975) [Maps] update geospatial filters to use geo_shape query for geo_point fields (elastic#62966) Move away from npStart for embeddables in canvas (elastic#62680) Use MapInput type from Maps plugin (elastic#61539) Update to pagination for workpad and templates (elastic#62050) [SIEM] Fix AlertsTable id (elastic#63368) Consistent terminology around cypress test data (elastic#63279) ...
* master: document code splitting for client code (elastic#62593) Escape single quotes surrounded by double quotes (elastic#63229) [Endpoint] Update cli mapping to match endpoint package (elastic#63372) update in-app links to metricbeat configuration docs (elastic#63295) investigation notes field (documentation / metadata) (elastic#63386) [Maps] fix bug where toggling Scaling type does not re-fetch data (elastic#63326) [Alerting] set correct parameter for unauthented email action (elastic#63086) [Telemetry] force staging urls in tests (elastic#63356) Migrate legacy maps service to NP & update refs (elastic#60942) Fix task manager query to return tasks to retry (elastic#63360) [Endpoint] Policy list support for URL pagination state (elastic#63291) [Canvas] Migrate saved object mappings and migrations to Kibana Platform (elastic#58891) [DOCS] Add ILM tutorial (elastic#59502) [Maps] Add SOURCE_TYPES enumeration (elastic#62975) [Maps] update geospatial filters to use geo_shape query for geo_point fields (elastic#62966) Move away from npStart for embeddables in canvas (elastic#62680)
* Get legacy maps into basic NP plugin form. Swap out legacy services for NP * Pull service settings from injected vars. Return new instance of service settings from setup * Use NP service settings in vega maps. Clean up legacy shim * Use NP maps service in region maps. Clean up shim. Add exports to NP service * Pull zoom precision out to separate module since it's dependent on config * Update paths to point to NP resources * More path updates, clean up, use IServiceSettings * Remove dependency on legacy service settings. Add tile_map dependency ng-sanitize * More path cleanup. Use zoomPrecision provided through plugin inteface * Move getPrecision into contract-provided function since it depends on config * Move tests to new service location, remove vis dir * Update test paths. Move origin const declaration into public * Clean up, fixes * Fix type errors. General cleaning * Inject toast service into map when needed * Fix typo in regionmap config * i18n fixes * Update jest test path * Fix karma tests * i18n fixes * Type updates. Add mapsLegacy to np karma mock * Remove html sanitizer * Fix vega test that depends on serviceSettings * Revise xpack license handling to use NP serviceSettings. Remove angular bindings Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* Get legacy maps into basic NP plugin form. Swap out legacy services for NP * Pull service settings from injected vars. Return new instance of service settings from setup * Use NP service settings in vega maps. Clean up legacy shim * Use NP maps service in region maps. Clean up shim. Add exports to NP service * Pull zoom precision out to separate module since it's dependent on config * Update paths to point to NP resources * More path updates, clean up, use IServiceSettings * Remove dependency on legacy service settings. Add tile_map dependency ng-sanitize * More path cleanup. Use zoomPrecision provided through plugin inteface * Move getPrecision into contract-provided function since it depends on config * Move tests to new service location, remove vis dir * Update test paths. Move origin const declaration into public * Clean up, fixes * Fix type errors. General cleaning * Inject toast service into map when needed * Fix typo in regionmap config * i18n fixes * Update jest test path * Fix karma tests * i18n fixes * Type updates. Add mapsLegacy to np karma mock * Remove html sanitizer * Fix vega test that depends on serviceSettings * Revise xpack license handling to use NP serviceSettings. Remove angular bindings Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Migrates the legacy maps service from an angular service in
ui/vis
to themaps_legacy
plugin. This service is a dependency of the Coordinate, Region and Vega maps plugins. This PR accomplishes the followingmapsLegacy
service_settings
kibana_services
file similar to how new Maps is doneA few things to note:
kibana_map
is very nearly a static file that can be provided without any external kibana services, with the exception thenotification.toast
service leveraged inmap_messages
. I attempted to supply new instances ofkibana_map
via a factory function in theplugin
>setup
method but ran into issues with the Leaflet Draw control that appear to be unrelated to the code changes, and more related to providing Leaflet via an Angular-based pipeline. There were no easy workarounds to make this work as we'd like. For this reason,kibana_map
is served as a static file and leveraging plugins can optionally inject thetoast
service. Since we're only creatingKibanaMap
instances in 2 places (vega_map_view
,base_maps_visualization
) and there are no plans to leverage our legacy maps elsewhere, I believe this is the right solution for now.getZoomPrecision
andgetPrecision
were broken out into the separate fileprecision.ts
since they were some of the few functions requiring kibana servicesSince the legacy maps visualizations are hidden by default in Kibana versions Basic and above (although the sample data includes Region Maps) the best way to test this out is to use Kibana OSS:
yarn es snapshot --license oss
node scripts/kibana --dev --oss