From 366ad496b73aa5e1aa0eb34dbd98f60ff32513b6 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Mon, 15 Mar 2021 13:44:20 -0400 Subject: [PATCH] [Maps] Isolate maps-setting froms maps_legacy (#92918) (#94588) Creates a new plugins, maps_ems, with `map.*` configs and shared EMS-settings. `maps_legacy` now only supports the `region_map` and `coordinate_map` plugins. # Conflicts: # packages/kbn-optimizer/limits.yml --- docs/developer/plugin-list.asciidoc | 4 + packages/kbn-optimizer/limits.yml | 3 +- src/plugins/maps_ems/README.md | 3 + .../__tests__/map/ems_mocks/sample_files.json | 0 .../map/ems_mocks/sample_manifest.json | 0 .../map/ems_mocks/sample_style_bright.json | 0 .../ems_mocks/sample_style_bright_vector.json | 0 .../sample_style_bright_vector_source.json | 0 .../map/ems_mocks/sample_style_dark.json | 0 .../ems_mocks/sample_style_desaturated.json | 0 .../__tests__/map/ems_mocks/sample_tiles.json | 0 .../common/ems_defaults.ts | 0 .../constants => maps_ems/common}/index.ts | 1 + .../constants => maps_ems/common}/origin.ts | 0 src/plugins/maps_ems/config.ts | 87 +++++++++++++ src/plugins/maps_ems/jest.config.js | 13 ++ src/plugins/maps_ems/kibana.json | 9 ++ src/plugins/maps_ems/public/index.ts | 35 ++++++ .../maps_ems/public/kibana_services.ts | 17 +++ .../lazy_load_bundle}/get_service_settings.ts | 13 +- .../public/lazy_load_bundle/lazy/index.ts | 9 ++ src/plugins/maps_ems/public/plugin.ts | 50 ++++++++ .../public/service_settings}/index.ts | 2 +- .../service_settings.test.js | 12 +- .../service_settings/service_settings.ts} | 119 ++++++++++-------- .../service_settings_types.ts | 21 +++- src/plugins/maps_ems/server/index.ts | 56 +++++++++ src/plugins/maps_ems/tsconfig.json | 12 ++ src/plugins/maps_legacy/config.ts | 76 +---------- src/plugins/maps_legacy/kibana.json | 5 +- .../maps_legacy/public/common/types.ts | 2 +- .../public/components/wms_options.tsx | 2 +- src/plugins/maps_legacy/public/index.ts | 23 +--- .../maps_legacy/public/kibana_services.js | 25 ---- .../maps_legacy/public/kibana_services.ts | 29 +++++ .../public/lazy_load_bundle/index.ts | 4 +- .../public/lazy_load_bundle/lazy/index.ts | 2 - .../public/map/base_maps_visualization.js | 8 +- .../maps_legacy/public/map/kibana_map.js | 2 +- src/plugins/maps_legacy/public/plugin.ts | 35 +++--- src/plugins/maps_legacy/server/index.ts | 14 +-- src/plugins/maps_legacy/tsconfig.json | 3 +- src/plugins/region_map/kibana.json | 2 +- .../region_map/public/components/index.tsx | 2 +- .../public/components/region_map_options.tsx | 2 +- .../region_map/public/kibana_services.ts | 2 +- src/plugins/region_map/public/plugin.ts | 19 ++- .../region_map/public/region_map_type.ts | 7 +- .../region_map/public/region_map_types.ts | 3 +- .../public/region_map_visualization.js | 3 +- src/plugins/region_map/public/util.ts | 3 +- src/plugins/region_map/server/index.ts | 13 -- src/plugins/region_map/tsconfig.json | 1 + src/plugins/tile_map/kibana.json | 2 +- src/plugins/tile_map/public/plugin.ts | 25 ++-- src/plugins/tile_map/public/services.ts | 2 +- src/plugins/tile_map/server/index.ts | 14 --- src/plugins/tile_map/tsconfig.json | 1 + src/plugins/vis_type_vega/kibana.json | 2 +- .../public/data_model/ems_file_parser.ts | 2 +- .../public/data_model/vega_parser.ts | 2 +- src/plugins/vis_type_vega/public/plugin.ts | 10 +- .../public/vega_view/vega_base_view.d.ts | 2 +- .../vega_view/vega_map_view/constants.ts | 2 +- .../map_service_settings.test.ts | 6 +- .../vega_map_view/map_service_settings.ts | 6 +- .../vega_view/vega_map_view/view.test.ts | 5 +- src/plugins/vis_type_vega/tsconfig.json | 2 +- .../plugins/maps/common/ems_settings.test.ts | 2 +- x-pack/plugins/maps/common/ems_settings.ts | 2 +- x-pack/plugins/maps/kibana.json | 2 +- .../kibana_regionmap_source.ts | 4 +- x-pack/plugins/maps/public/kibana_services.ts | 8 +- x-pack/plugins/maps/public/meta.ts | 2 +- x-pack/plugins/maps/public/plugin.ts | 8 +- x-pack/plugins/maps/server/plugin.ts | 20 +-- x-pack/plugins/maps/tsconfig.json | 2 +- .../plugins/maps_legacy_licensing/kibana.json | 2 +- .../maps_legacy_licensing/public/plugin.ts | 11 +- .../maps_legacy_licensing/tsconfig.json | 1 + 80 files changed, 550 insertions(+), 350 deletions(-) create mode 100644 src/plugins/maps_ems/README.md rename src/plugins/{maps_legacy/public => maps_ems}/__tests__/map/ems_mocks/sample_files.json (100%) rename src/plugins/{maps_legacy/public => maps_ems}/__tests__/map/ems_mocks/sample_manifest.json (100%) rename src/plugins/{maps_legacy/public => maps_ems}/__tests__/map/ems_mocks/sample_style_bright.json (100%) rename src/plugins/{maps_legacy/public => maps_ems}/__tests__/map/ems_mocks/sample_style_bright_vector.json (100%) rename src/plugins/{maps_legacy/public => maps_ems}/__tests__/map/ems_mocks/sample_style_bright_vector_source.json (100%) rename src/plugins/{maps_legacy/public => maps_ems}/__tests__/map/ems_mocks/sample_style_dark.json (100%) rename src/plugins/{maps_legacy/public => maps_ems}/__tests__/map/ems_mocks/sample_style_desaturated.json (100%) rename src/plugins/{maps_legacy/public => maps_ems}/__tests__/map/ems_mocks/sample_tiles.json (100%) rename src/plugins/{maps_legacy => maps_ems}/common/ems_defaults.ts (100%) rename src/plugins/{maps_legacy/public/common/constants => maps_ems/common}/index.ts (93%) rename src/plugins/{maps_legacy/public/common/constants => maps_ems/common}/origin.ts (100%) create mode 100644 src/plugins/maps_ems/config.ts create mode 100644 src/plugins/maps_ems/jest.config.js create mode 100644 src/plugins/maps_ems/kibana.json create mode 100644 src/plugins/maps_ems/public/index.ts create mode 100644 src/plugins/maps_ems/public/kibana_services.ts rename src/plugins/{maps_legacy/public => maps_ems/public/lazy_load_bundle}/get_service_settings.ts (61%) create mode 100644 src/plugins/maps_ems/public/lazy_load_bundle/lazy/index.ts create mode 100644 src/plugins/maps_ems/public/plugin.ts rename src/plugins/{maps_legacy/common => maps_ems/public/service_settings}/index.ts (89%) rename src/plugins/{maps_legacy/public/map => maps_ems/public/service_settings}/service_settings.test.js (96%) rename src/plugins/{maps_legacy/public/map/service_settings.js => maps_ems/public/service_settings/service_settings.ts} (67%) rename src/plugins/{maps_legacy/public/map => maps_ems/public/service_settings}/service_settings_types.ts (63%) create mode 100644 src/plugins/maps_ems/server/index.ts create mode 100644 src/plugins/maps_ems/tsconfig.json delete mode 100644 src/plugins/maps_legacy/public/kibana_services.js create mode 100644 src/plugins/maps_legacy/public/kibana_services.ts diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index 183e72d23cb71..d77942627cb98 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -138,6 +138,10 @@ in Kibana, e.g. visualizations. It has the form of a flyout panel. |WARNING: Missing README. +|{kib-repo}blob/{branch}/src/plugins/maps_ems/README.md[mapsEms] +|Configuration of kibana-wide EMS settings and some higher level utilities. + + |{kib-repo}blob/{branch}/src/plugins/maps_legacy/README.md[mapsLegacy] |Internal objects used by the Coordinate, Region, and Vega visualizations. diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index 57da2e7baea42..64c16025c9c62 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -50,7 +50,7 @@ pageLoadAssetSize: logstash: 53548 management: 46112 maps: 183754 - mapsLegacy: 116961 + mapsLegacy: 87859 mapsLegacyLicensing: 20214 ml: 82187 monitoring: 80000 @@ -107,3 +107,4 @@ pageLoadAssetSize: osquery: 107090 fileUpload: 25664 banners: 17946 + mapsEms: 26072 diff --git a/src/plugins/maps_ems/README.md b/src/plugins/maps_ems/README.md new file mode 100644 index 0000000000000..573ca6fa93f93 --- /dev/null +++ b/src/plugins/maps_ems/README.md @@ -0,0 +1,3 @@ +# Maps EMS + +Configuration of kibana-wide EMS settings and some higher level utilities. \ No newline at end of file diff --git a/src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_files.json b/src/plugins/maps_ems/__tests__/map/ems_mocks/sample_files.json similarity index 100% rename from src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_files.json rename to src/plugins/maps_ems/__tests__/map/ems_mocks/sample_files.json diff --git a/src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_manifest.json b/src/plugins/maps_ems/__tests__/map/ems_mocks/sample_manifest.json similarity index 100% rename from src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_manifest.json rename to src/plugins/maps_ems/__tests__/map/ems_mocks/sample_manifest.json diff --git a/src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_style_bright.json b/src/plugins/maps_ems/__tests__/map/ems_mocks/sample_style_bright.json similarity index 100% rename from src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_style_bright.json rename to src/plugins/maps_ems/__tests__/map/ems_mocks/sample_style_bright.json diff --git a/src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_style_bright_vector.json b/src/plugins/maps_ems/__tests__/map/ems_mocks/sample_style_bright_vector.json similarity index 100% rename from src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_style_bright_vector.json rename to src/plugins/maps_ems/__tests__/map/ems_mocks/sample_style_bright_vector.json diff --git a/src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_style_bright_vector_source.json b/src/plugins/maps_ems/__tests__/map/ems_mocks/sample_style_bright_vector_source.json similarity index 100% rename from src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_style_bright_vector_source.json rename to src/plugins/maps_ems/__tests__/map/ems_mocks/sample_style_bright_vector_source.json diff --git a/src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_style_dark.json b/src/plugins/maps_ems/__tests__/map/ems_mocks/sample_style_dark.json similarity index 100% rename from src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_style_dark.json rename to src/plugins/maps_ems/__tests__/map/ems_mocks/sample_style_dark.json diff --git a/src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_style_desaturated.json b/src/plugins/maps_ems/__tests__/map/ems_mocks/sample_style_desaturated.json similarity index 100% rename from src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_style_desaturated.json rename to src/plugins/maps_ems/__tests__/map/ems_mocks/sample_style_desaturated.json diff --git a/src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_tiles.json b/src/plugins/maps_ems/__tests__/map/ems_mocks/sample_tiles.json similarity index 100% rename from src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_tiles.json rename to src/plugins/maps_ems/__tests__/map/ems_mocks/sample_tiles.json diff --git a/src/plugins/maps_legacy/common/ems_defaults.ts b/src/plugins/maps_ems/common/ems_defaults.ts similarity index 100% rename from src/plugins/maps_legacy/common/ems_defaults.ts rename to src/plugins/maps_ems/common/ems_defaults.ts diff --git a/src/plugins/maps_legacy/public/common/constants/index.ts b/src/plugins/maps_ems/common/index.ts similarity index 93% rename from src/plugins/maps_legacy/public/common/constants/index.ts rename to src/plugins/maps_ems/common/index.ts index 28766813d7f1c..20be740ccab3f 100644 --- a/src/plugins/maps_legacy/public/common/constants/index.ts +++ b/src/plugins/maps_ems/common/index.ts @@ -8,4 +8,5 @@ export const TMS_IN_YML_ID = 'TMS in config/kibana.yml'; +export * from './ems_defaults'; export { ORIGIN } from './origin'; diff --git a/src/plugins/maps_legacy/public/common/constants/origin.ts b/src/plugins/maps_ems/common/origin.ts similarity index 100% rename from src/plugins/maps_legacy/public/common/constants/origin.ts rename to src/plugins/maps_ems/common/origin.ts diff --git a/src/plugins/maps_ems/config.ts b/src/plugins/maps_ems/config.ts new file mode 100644 index 0000000000000..e74a8f5cec29c --- /dev/null +++ b/src/plugins/maps_ems/config.ts @@ -0,0 +1,87 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { schema, TypeOf } from '@kbn/config-schema'; + +import { + DEFAULT_EMS_FONT_LIBRARY_URL, + DEFAULT_EMS_LANDING_PAGE_URL, + DEFAULT_EMS_TILE_API_URL, + DEFAULT_EMS_FILE_API_URL, +} from './common'; + +const tileMapConfigOptionsSchema = schema.object({ + attribution: schema.string({ defaultValue: '' }), + minZoom: schema.number({ defaultValue: 0, min: 0 }), + maxZoom: schema.number({ defaultValue: 10 }), + tileSize: schema.maybe(schema.number()), + subdomains: schema.maybe(schema.arrayOf(schema.string())), + errorTileUrl: schema.maybe(schema.string()), + tms: schema.maybe(schema.boolean()), + reuseTiles: schema.maybe(schema.boolean()), + bounds: schema.maybe(schema.arrayOf(schema.number({ min: 2 }))), + default: schema.maybe(schema.boolean()), +}); + +export const tilemapConfigSchema = schema.object({ + url: schema.maybe(schema.string()), + options: tileMapConfigOptionsSchema, +}); + +const layerConfigSchema = schema.object({ + url: schema.string(), + format: schema.object({ + type: schema.string({ defaultValue: 'geojson' }), + }), + meta: schema.object({ + feature_collection_path: schema.string({ defaultValue: 'data' }), + }), + attribution: schema.string(), + name: schema.string(), + fields: schema.arrayOf( + schema.object({ + name: schema.string(), + description: schema.string(), + }) + ), +}); + +export type LayerConfig = TypeOf; + +const regionmapConfigSchema = schema.object({ + includeElasticMapsService: schema.boolean({ defaultValue: true }), + layers: schema.arrayOf(layerConfigSchema, { defaultValue: [] }), +}); + +export const emsConfigSchema = schema.object({ + regionmap: regionmapConfigSchema, + tilemap: tilemapConfigSchema, + includeElasticMapsService: schema.boolean({ defaultValue: true }), + proxyElasticMapsServiceInMaps: schema.boolean({ defaultValue: false }), + manifestServiceUrl: schema.string({ defaultValue: '' }), + emsUrl: schema.conditional( + schema.siblingRef('proxyElasticMapsServiceInMaps'), + true, + schema.never(), + schema.string({ defaultValue: '' }) + ), + emsFileApiUrl: schema.string({ defaultValue: DEFAULT_EMS_FILE_API_URL }), + emsTileApiUrl: schema.string({ defaultValue: DEFAULT_EMS_TILE_API_URL }), + emsLandingPageUrl: schema.string({ defaultValue: DEFAULT_EMS_LANDING_PAGE_URL }), + emsFontLibraryUrl: schema.string({ + defaultValue: DEFAULT_EMS_FONT_LIBRARY_URL, + }), + emsTileLayerId: schema.object({ + bright: schema.string({ defaultValue: 'road_map' }), + desaturated: schema.string({ defaultValue: 'road_map_desaturated' }), + dark: schema.string({ defaultValue: 'dark_map' }), + }), +}); + +export type MapsEmsConfig = TypeOf; +export type TileMapConfig = TypeOf; diff --git a/src/plugins/maps_ems/jest.config.js b/src/plugins/maps_ems/jest.config.js new file mode 100644 index 0000000000000..b7021c9119deb --- /dev/null +++ b/src/plugins/maps_ems/jest.config.js @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../../..', + roots: ['/src/plugins/maps_ems'], +}; diff --git a/src/plugins/maps_ems/kibana.json b/src/plugins/maps_ems/kibana.json new file mode 100644 index 0000000000000..a7cf580becfd5 --- /dev/null +++ b/src/plugins/maps_ems/kibana.json @@ -0,0 +1,9 @@ +{ + "id": "mapsEms", + "version": "8.0.0", + "kibanaVersion": "kibana", + "configPath": ["map"], + "ui": true, + "server": true, + "extraPublicDirs": ["common"] +} diff --git a/src/plugins/maps_ems/public/index.ts b/src/plugins/maps_ems/public/index.ts new file mode 100644 index 0000000000000..0dfe808ca6f62 --- /dev/null +++ b/src/plugins/maps_ems/public/index.ts @@ -0,0 +1,35 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { PluginInitializerContext } from 'kibana/public'; +import { MapsEmsPlugin } from './plugin'; +import { IServiceSettings } from './service_settings'; +import type { MapsEmsConfig } from '../config'; + +/** @public */ +export { + VectorLayer, + FileLayerField, + FileLayer, + TmsLayer, + IServiceSettings, +} from './service_settings'; + +export function plugin(initializerContext: PluginInitializerContext) { + return new MapsEmsPlugin(initializerContext); +} + +export type { MapsEmsConfig, LayerConfig } from '../config'; + +export * from '../common'; + +export interface MapsEmsPluginSetup { + config: MapsEmsConfig; + getServiceSettings: () => Promise; +} +export type MapsEmsPluginStart = ReturnType; diff --git a/src/plugins/maps_ems/public/kibana_services.ts b/src/plugins/maps_ems/public/kibana_services.ts new file mode 100644 index 0000000000000..e63d2e72ab9f3 --- /dev/null +++ b/src/plugins/maps_ems/public/kibana_services.ts @@ -0,0 +1,17 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import type { MapsEmsConfig } from '../config'; + +let kibanaVersion: string; +export const setKibanaVersion = (version: string) => (kibanaVersion = version); +export const getKibanaVersion = (): string => kibanaVersion; + +let mapsEmsConfig: MapsEmsConfig; +export const setMapsEmsConfig = (config: MapsEmsConfig) => (mapsEmsConfig = config); +export const getMapsEmsConfig = () => mapsEmsConfig; diff --git a/src/plugins/maps_legacy/public/get_service_settings.ts b/src/plugins/maps_ems/public/lazy_load_bundle/get_service_settings.ts similarity index 61% rename from src/plugins/maps_legacy/public/get_service_settings.ts rename to src/plugins/maps_ems/public/lazy_load_bundle/get_service_settings.ts index ec5233d1f8af3..6e32ff5d4e41e 100644 --- a/src/plugins/maps_legacy/public/get_service_settings.ts +++ b/src/plugins/maps_ems/public/lazy_load_bundle/get_service_settings.ts @@ -6,10 +6,8 @@ * Side Public License, v 1. */ -import { lazyLoadMapsLegacyModules } from './lazy_load_bundle'; -// @ts-expect-error -import { getMapsLegacyConfig } from './kibana_services'; -import { IServiceSettings } from './map/service_settings_types'; +import type { IServiceSettings } from '../service_settings/service_settings_types'; +import { getMapsEmsConfig } from '../kibana_services'; let loadPromise: Promise; @@ -19,10 +17,9 @@ export async function getServiceSettings(): Promise { } loadPromise = new Promise(async (resolve) => { - const modules = await lazyLoadMapsLegacyModules(); - const config = getMapsLegacyConfig(); - // @ts-expect-error - resolve(new modules.ServiceSettings(config, config.tilemap)); + const { ServiceSettings } = await import('./lazy'); + const config = getMapsEmsConfig(); + resolve(new ServiceSettings(config, config.tilemap)); }); return loadPromise; } diff --git a/src/plugins/maps_ems/public/lazy_load_bundle/lazy/index.ts b/src/plugins/maps_ems/public/lazy_load_bundle/lazy/index.ts new file mode 100644 index 0000000000000..93a12a16556a5 --- /dev/null +++ b/src/plugins/maps_ems/public/lazy_load_bundle/lazy/index.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export { ServiceSettings } from '../../service_settings/service_settings'; diff --git a/src/plugins/maps_ems/public/plugin.ts b/src/plugins/maps_ems/public/plugin.ts new file mode 100644 index 0000000000000..c7ae8c728e672 --- /dev/null +++ b/src/plugins/maps_ems/public/plugin.ts @@ -0,0 +1,50 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +// @ts-ignore +import { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from 'kibana/public'; +// @ts-ignore +import { setKibanaVersion, setMapsEmsConfig } from './kibana_services'; +// @ts-ignore +import { MapsEmsPluginSetup, MapsEmsPluginStart } from './index'; +import type { MapsEmsConfig } from '../config'; +import { getServiceSettings } from './lazy_load_bundle/get_service_settings'; + +/** + * These are the interfaces with your public contracts. You should export these + * for other plugins to use in _their_ `SetupDeps`/`StartDeps` interfaces. + * @public + */ + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface MapsEmsStartDependencies {} +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface MapsEmsSetupDependencies {} + +export class MapsEmsPlugin implements Plugin { + readonly _initializerContext: PluginInitializerContext; + + constructor(initializerContext: PluginInitializerContext) { + this._initializerContext = initializerContext; + } + + public setup(core: CoreSetup, plugins: MapsEmsSetupDependencies) { + const config = this._initializerContext.config.get(); + const kibanaVersion = this._initializerContext.env.packageInfo.version; + + setKibanaVersion(kibanaVersion); + setMapsEmsConfig(config); + + return { + getServiceSettings, + config, + }; + } + + public start(core: CoreStart, plugins: MapsEmsStartDependencies) {} +} diff --git a/src/plugins/maps_legacy/common/index.ts b/src/plugins/maps_ems/public/service_settings/index.ts similarity index 89% rename from src/plugins/maps_legacy/common/index.ts rename to src/plugins/maps_ems/public/service_settings/index.ts index ab0489030a80c..84c8bee955199 100644 --- a/src/plugins/maps_legacy/common/index.ts +++ b/src/plugins/maps_ems/public/service_settings/index.ts @@ -6,4 +6,4 @@ * Side Public License, v 1. */ -export * from './ems_defaults'; +export * from './service_settings_types'; diff --git a/src/plugins/maps_legacy/public/map/service_settings.test.js b/src/plugins/maps_ems/public/service_settings/service_settings.test.js similarity index 96% rename from src/plugins/maps_legacy/public/map/service_settings.test.js rename to src/plugins/maps_ems/public/service_settings/service_settings.test.js index 9c88b92c88735..5bd371aace79b 100644 --- a/src/plugins/maps_legacy/public/map/service_settings.test.js +++ b/src/plugins/maps_ems/public/service_settings/service_settings.test.js @@ -14,12 +14,12 @@ jest.mock('../kibana_services', () => ({ import url from 'url'; -import EMS_FILES from '../__tests__/map/ems_mocks/sample_files.json'; -import EMS_TILES from '../__tests__/map/ems_mocks/sample_tiles.json'; -import EMS_STYLE_ROAD_MAP_BRIGHT from '../__tests__/map/ems_mocks/sample_style_bright'; -import EMS_STYLE_ROAD_MAP_DESATURATED from '../__tests__/map/ems_mocks/sample_style_desaturated'; -import EMS_STYLE_DARK_MAP from '../__tests__/map/ems_mocks/sample_style_dark'; -import { ORIGIN } from '../common/constants/origin'; +import EMS_FILES from '../../__tests__/map/ems_mocks/sample_files.json'; +import EMS_TILES from '../../__tests__/map/ems_mocks/sample_tiles.json'; +import EMS_STYLE_ROAD_MAP_BRIGHT from '../../__tests__/map/ems_mocks/sample_style_bright'; +import EMS_STYLE_ROAD_MAP_DESATURATED from '../../__tests__/map/ems_mocks/sample_style_desaturated'; +import EMS_STYLE_DARK_MAP from '../../__tests__/map/ems_mocks/sample_style_dark'; +import { ORIGIN } from '../../common'; import { ServiceSettings } from './service_settings'; describe('service_settings (FKA tile_map test)', function () { diff --git a/src/plugins/maps_legacy/public/map/service_settings.js b/src/plugins/maps_ems/public/service_settings/service_settings.ts similarity index 67% rename from src/plugins/maps_legacy/public/map/service_settings.js rename to src/plugins/maps_ems/public/service_settings/service_settings.ts index 9fdd2f7030604..f7c735b6c3037 100644 --- a/src/plugins/maps_legacy/public/map/service_settings.js +++ b/src/plugins/maps_ems/public/service_settings/service_settings.ts @@ -8,13 +8,25 @@ import _ from 'lodash'; import MarkdownIt from 'markdown-it'; -import { EMSClient } from '@elastic/ems-client'; +import { EMSClient, FileLayer as EMSFileLayer, TMSService } from '@elastic/ems-client'; import { i18n } from '@kbn/i18n'; import { getKibanaVersion } from '../kibana_services'; -import { ORIGIN, TMS_IN_YML_ID } from '../common/constants'; +import { FileLayer, IServiceSettings, TmsLayer } from './service_settings_types'; +import { ORIGIN, TMS_IN_YML_ID } from '../../common'; +import type { MapsEmsConfig, TileMapConfig } from '../../config'; -export class ServiceSettings { - constructor(mapConfig, tilemapsConfig) { +/** + * This class provides access to the EMS-layers and the kibana.yml configured layers through a single interface. + */ +export class ServiceSettings implements IServiceSettings { + private readonly _mapConfig: MapsEmsConfig; + private readonly _tilemapsConfig: TileMapConfig; + private readonly _hasTmsConfigured: boolean; + private _showZoomMessage: boolean; + private readonly _emsClient: EMSClient; + private readonly tmsOptionsFromConfig: any; + + constructor(mapConfig: MapsEmsConfig, tilemapsConfig: TileMapConfig) { this._mapConfig = mapConfig; this._tilemapsConfig = tilemapsConfig; this._hasTmsConfigured = typeof tilemapsConfig.url === 'string' && tilemapsConfig.url !== ''; @@ -28,14 +40,12 @@ export class ServiceSettings { tileApiUrl: this._mapConfig.emsTileApiUrl, landingPageUrl: this._mapConfig.emsLandingPageUrl, // Wrap to avoid errors passing window fetch - fetchFunction: function (...args) { + fetchFunction(...args: any[]) { + // @ts-expect-error return fetch(...args); }, }); - this.getTMSOptions(); - } - getTMSOptions() { const markdownIt = new MarkdownIt({ html: false, linkify: true, @@ -48,25 +58,29 @@ export class ServiceSettings { }); } - shouldShowZoomMessage({ origin }) { + shouldShowZoomMessage({ origin }: { origin: string }): boolean { return origin === ORIGIN.EMS && this._showZoomMessage; } - enableZoomMessage() { + enableZoomMessage(): void { this._showZoomMessage = true; } - disableZoomMessage() { + disableZoomMessage(): void { this._showZoomMessage = false; } - __debugStubManifestCalls(manifestRetrieval) { + __debugStubManifestCalls(manifestRetrieval: () => Promise): { removeStub: () => void } { const oldGetManifest = this._emsClient.getManifest; + + // This legacy code used for debugging/testing only. + // @ts-expect-error this._emsClient.getManifest = manifestRetrieval; return { removeStub: () => { + // @ts-expect-error delete this._emsClient.getManifest; - //not strictly necessary since this is prototype method + // not strictly necessary since this is prototype method if (this._emsClient.getManifest !== oldGetManifest) { this._emsClient.getManifest = oldGetManifest; } @@ -74,7 +88,7 @@ export class ServiceSettings { }; } - _backfillSettings = (fileLayer) => { + _backfillSettings = (fileLayer: EMSFileLayer): FileLayer => { // Older version of Kibana stored EMS state in the URL-params // Creates object literal with required parameters as key-value pairs const format = fileLayer.getDefaultFormatType(); @@ -87,8 +101,8 @@ export class ServiceSettings { created_at: fileLayer.getCreatedAt(), attribution: getAttributionString(fileLayer), fields: fileLayer.getFieldsInLanguage(), - format: format, //legacy: format and meta are split up - meta: meta, //legacy, format and meta are split up + format, // legacy: format and meta are split up + meta, // legacy, format and meta are split up }; }; @@ -108,25 +122,28 @@ export class ServiceSettings { async getTMSServices() { let allServices = []; if (this._hasTmsConfigured) { - //use tilemap.* settings from yml - const tmsService = _.cloneDeep(this.tmsOptionsFromConfig); - tmsService.id = TMS_IN_YML_ID; - tmsService.origin = ORIGIN.KIBANA_YML; + // use tilemap.* settings from yml + const tmsService: TmsLayer = { + ..._.cloneDeep(this.tmsOptionsFromConfig), + id: TMS_IN_YML_ID, + origin: ORIGIN.KIBANA_YML, + }; + allServices.push(tmsService); } if (this._mapConfig.includeElasticMapsService && !this._mapConfig.emsUrl) { const servicesFromManifest = await this._emsClient.getTMSServices(); - const strippedServiceFromManifest = await Promise.all( + const strippedServiceFromManifest: TmsLayer[] = await Promise.all( servicesFromManifest .filter((tmsService) => tmsService.getId() === this._mapConfig.emsTileLayerId.bright) - .map(async (tmsService) => { - //shim for compatibility + .map(async (tmsService: TMSService) => { + // shim for compatibility return { origin: tmsService.getOrigin(), id: tmsService.getId(), - minZoom: await tmsService.getMinZoom(), - maxZoom: await tmsService.getMaxZoom(), + minZoom: (await tmsService.getMinZoom()) as number, + maxZoom: (await tmsService.getMaxZoom()) as number, attribution: getAttributionString(tmsService), }; }) @@ -142,34 +159,34 @@ export class ServiceSettings { * * @param additionalQueryParams */ - setQueryParams(additionalQueryParams) { + setQueryParams(additionalQueryParams: { [p: string]: string }) { // Functions more as a "set" than an "add" in ems-client this._emsClient.addQueryParams(additionalQueryParams); } - async getFileLayerFromConfig(fileLayerConfig) { + async getFileLayerFromConfig(fileLayerConfig: FileLayer): Promise { const fileLayers = await this._emsClient.getFileLayers(); return fileLayers.find((fileLayer) => { - const hasIdByName = fileLayer.hasId(fileLayerConfig.name); //legacy + const hasIdByName = fileLayer.hasId(fileLayerConfig.name); // legacy const hasIdById = fileLayer.hasId(fileLayerConfig.id); return hasIdByName || hasIdById; }); } - async getEMSHotLink(fileLayerConfig) { + async getEMSHotLink(fileLayerConfig: FileLayer): Promise { const layer = await this.getFileLayerFromConfig(fileLayerConfig); return layer ? layer.getEMSHotLink() : null; } - async loadFileLayerConfig(fileLayerConfig) { + async loadFileLayerConfig(fileLayerConfig: FileLayer): Promise { const fileLayer = await this.getFileLayerFromConfig(fileLayerConfig); return fileLayer ? this._backfillSettings(fileLayer) : null; } - async _getAttributesForEMSTMSLayer(isDesaturated, isDarkMode) { + async _getAttributesForEMSTMSLayer(isDesaturated: boolean, isDarkMode: boolean) { const tmsServices = await this._emsClient.getTMSServices(); const emsTileLayerId = this._mapConfig.emsTileLayerId; - let serviceId; + let serviceId: string; if (isDarkMode) { serviceId = emsTileLayerId.dark; } else { @@ -183,36 +200,40 @@ export class ServiceSettings { return service.getId() === serviceId; }); return { - url: await tmsService.getUrlTemplate(), - minZoom: await tmsService.getMinZoom(), - maxZoom: await tmsService.getMaxZoom(), - attribution: getAttributionString(tmsService), + url: await tmsService!.getUrlTemplate(), + minZoom: await tmsService!.getMinZoom(), + maxZoom: await tmsService!.getMaxZoom(), + attribution: getAttributionString(tmsService!), origin: ORIGIN.EMS, }; } - async getAttributesForTMSLayer(tmsServiceConfig, isDesaturated, isDarkMode) { + async getAttributesForTMSLayer( + tmsServiceConfig: TmsLayer, + isDesaturated: boolean, + isDarkMode: boolean + ) { if (tmsServiceConfig.origin === ORIGIN.EMS) { return this._getAttributesForEMSTMSLayer(isDesaturated, isDarkMode); } else if (tmsServiceConfig.origin === ORIGIN.KIBANA_YML) { const attrs = _.pick(this._tilemapsConfig, ['url', 'minzoom', 'maxzoom', 'attribution']); return { ...attrs, ...{ origin: ORIGIN.KIBANA_YML } }; } else { - //this is an older config. need to resolve this dynamically. + // this is an older config. need to resolve this dynamically. if (tmsServiceConfig.id === TMS_IN_YML_ID) { const attrs = _.pick(this._tilemapsConfig, ['url', 'minzoom', 'maxzoom', 'attribution']); return { ...attrs, ...{ origin: ORIGIN.KIBANA_YML } }; } else { - //assume ems + // assume ems return this._getAttributesForEMSTMSLayer(isDesaturated, isDarkMode); } } } - async _getFileUrlFromEMS(fileLayerConfig) { + async _getFileUrlFromEMS(fileLayerConfig: FileLayer) { const fileLayers = await this._emsClient.getFileLayers(); const layer = fileLayers.find((fileLayer) => { - const hasIdByName = fileLayer.hasId(fileLayerConfig.name); //legacy + const hasIdByName = fileLayer.hasId(fileLayerConfig.name); // legacy const hasIdById = fileLayer.hasId(fileLayerConfig.id); return hasIdByName || hasIdById; }); @@ -224,34 +245,34 @@ export class ServiceSettings { } } - async getUrlForRegionLayer(fileLayerConfig) { + async getUrlForRegionLayer(fileLayerConfig: FileLayer): Promise { let url; if (fileLayerConfig.origin === ORIGIN.EMS) { url = this._getFileUrlFromEMS(fileLayerConfig); } else if (fileLayerConfig.layerId && fileLayerConfig.layerId.startsWith(`${ORIGIN.EMS}.`)) { - //fallback for older saved objects + // fallback for older saved objects url = this._getFileUrlFromEMS(fileLayerConfig); } else if ( fileLayerConfig.layerId && fileLayerConfig.layerId.startsWith(`${ORIGIN.KIBANA_YML}.`) ) { - //fallback for older saved objects + // fallback for older saved objects url = fileLayerConfig.url; } else { - //generic fallback + // generic fallback url = fileLayerConfig.url; } return url; } - async getJsonForRegionLayer(fileLayerConfig) { + async getJsonForRegionLayer(fileLayerConfig: FileLayer) { const url = await this.getUrlForRegionLayer(fileLayerConfig); - const response = await fetch(url); + const response = await fetch(url!); return await response.json(); } } -function getAttributionString(emsService) { +function getAttributionString(emsService: EMSFileLayer | TMSService) { const attributions = emsService.getAttributions(); const attributionSnippets = attributions.map((attribution) => { const anchorTag = document.createElement('a'); @@ -262,5 +283,5 @@ function getAttributionString(emsService) { anchorTag.textContent = attribution.label; return anchorTag.outerHTML; }); - return attributionSnippets.join(' | '); //!!!this is the current convention used in Kibana + return attributionSnippets.join(' | '); // !!!this is the current convention used in Kibana } diff --git a/src/plugins/maps_legacy/public/map/service_settings_types.ts b/src/plugins/maps_ems/public/service_settings/service_settings_types.ts similarity index 63% rename from src/plugins/maps_legacy/public/map/service_settings_types.ts rename to src/plugins/maps_ems/public/service_settings/service_settings_types.ts index d06b4ddc1ea8d..80a9aae835844 100644 --- a/src/plugins/maps_legacy/public/map/service_settings_types.ts +++ b/src/plugins/maps_ems/public/service_settings/service_settings_types.ts @@ -9,7 +9,7 @@ export interface TmsLayer { id: string; origin: string; - minZoom: string; + minZoom: number; maxZoom: number; attribution: string; } @@ -20,6 +20,13 @@ export interface FileLayer { id: string; format: string | { type: string }; fields: FileLayerField[]; + url?: string; + layerId?: string; + created_at?: string; + attribution?: string; + meta?: { + [key: string]: string; + }; } export interface FileLayerField { @@ -34,8 +41,16 @@ export interface VectorLayer extends FileLayer { } export interface IServiceSettings { - getEMSHotLink(layer: FileLayer): Promise; + getEMSHotLink(layer: FileLayer): Promise; getTMSServices(): Promise; getFileLayers(): Promise; - getUrlForRegionLayer(layer: FileLayer): Promise; + getUrlForRegionLayer(layer: FileLayer): Promise; + setQueryParams(params: { [p: string]: string }): void; + enableZoomMessage(): void; + disableZoomMessage(): void; + getAttributesForTMSLayer( + tmsServiceConfig: TmsLayer, + isDesaturated: boolean, + isDarkMode: boolean + ): any; } diff --git a/src/plugins/maps_ems/server/index.ts b/src/plugins/maps_ems/server/index.ts new file mode 100644 index 0000000000000..0bfa68c8edd77 --- /dev/null +++ b/src/plugins/maps_ems/server/index.ts @@ -0,0 +1,56 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { + CoreSetup, + PluginInitializerContext, + Plugin, + PluginConfigDescriptor, +} from 'src/core/server'; +import { MapsEmsConfig, emsConfigSchema } from '../config'; + +export const config: PluginConfigDescriptor = { + exposeToBrowser: { + regionmap: true, + tilemap: true, + includeElasticMapsService: true, + proxyElasticMapsServiceInMaps: true, + manifestServiceUrl: true, + emsUrl: true, + emsFileApiUrl: true, + emsTileApiUrl: true, + emsLandingPageUrl: true, + emsFontLibraryUrl: true, + emsTileLayerId: true, + }, + schema: emsConfigSchema, +}; + +export interface MapsEmsPluginSetup { + config: MapsEmsConfig; +} + +export class MapsEmsPlugin implements Plugin { + readonly _initializerContext: PluginInitializerContext; + + constructor(initializerContext: PluginInitializerContext) { + this._initializerContext = initializerContext; + } + + public setup(core: CoreSetup) { + const emsPluginConfig = this._initializerContext.config.get(); + return { + config: emsPluginConfig, + }; + } + + public start() {} +} + +export const plugin = (initializerContext: PluginInitializerContext) => + new MapsEmsPlugin(initializerContext); diff --git a/src/plugins/maps_ems/tsconfig.json b/src/plugins/maps_ems/tsconfig.json new file mode 100644 index 0000000000000..b85c3da66b83a --- /dev/null +++ b/src/plugins/maps_ems/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": ["common/**/*", "public/**/*", "server/**/*", "./config.ts"], + "references": [{ "path": "../../core/tsconfig.json" }] +} diff --git a/src/plugins/maps_legacy/config.ts b/src/plugins/maps_legacy/config.ts index 417e01c6f2585..41387a07d27cb 100644 --- a/src/plugins/maps_legacy/config.ts +++ b/src/plugins/maps_legacy/config.ts @@ -8,80 +8,6 @@ import { schema, TypeOf } from '@kbn/config-schema'; -import { - DEFAULT_EMS_FONT_LIBRARY_URL, - DEFAULT_EMS_LANDING_PAGE_URL, - DEFAULT_EMS_TILE_API_URL, - DEFAULT_EMS_FILE_API_URL, -} from './common/ems_defaults'; - -export const tilemapConfigSchema = schema.object({ - url: schema.maybe(schema.string()), - options: schema.object({ - attribution: schema.string({ defaultValue: '' }), - minZoom: schema.number({ defaultValue: 0, min: 0 }), - maxZoom: schema.number({ defaultValue: 10 }), - tileSize: schema.maybe(schema.number()), - subdomains: schema.maybe(schema.arrayOf(schema.string())), - errorTileUrl: schema.maybe(schema.string()), - tms: schema.maybe(schema.boolean()), - reuseTiles: schema.maybe(schema.boolean()), - bounds: schema.maybe(schema.arrayOf(schema.number({ min: 2 }))), - default: schema.maybe(schema.boolean()), - }), -}); - -const layerConfigSchema = schema.object({ - url: schema.string(), - format: schema.object({ - type: schema.string({ defaultValue: 'geojson' }), - }), - meta: schema.object({ - feature_collection_path: schema.string({ defaultValue: 'data' }), - }), - attribution: schema.string(), - name: schema.string(), - fields: schema.arrayOf( - schema.object({ - name: schema.string(), - description: schema.string(), - }) - ), -}); - -export type LayerConfig = TypeOf; - -export const regionmapConfigSchema = schema.object({ - includeElasticMapsService: schema.boolean({ defaultValue: true }), - layers: schema.arrayOf(layerConfigSchema, { defaultValue: [] }), -}); - -export const configSchema = schema.object({ - includeElasticMapsService: schema.boolean({ defaultValue: true }), - proxyElasticMapsServiceInMaps: schema.boolean({ defaultValue: false }), - tilemap: tilemapConfigSchema, - regionmap: regionmapConfigSchema, - manifestServiceUrl: schema.string({ defaultValue: '' }), - - emsUrl: schema.conditional( - schema.siblingRef('proxyElasticMapsServiceInMaps'), - true, - schema.never(), - schema.string({ defaultValue: '' }) - ), - - emsFileApiUrl: schema.string({ defaultValue: DEFAULT_EMS_FILE_API_URL }), - emsTileApiUrl: schema.string({ defaultValue: DEFAULT_EMS_TILE_API_URL }), - emsLandingPageUrl: schema.string({ defaultValue: DEFAULT_EMS_LANDING_PAGE_URL }), - emsFontLibraryUrl: schema.string({ - defaultValue: DEFAULT_EMS_FONT_LIBRARY_URL, - }), - - emsTileLayerId: schema.object({ - bright: schema.string({ defaultValue: 'road_map' }), - desaturated: schema.string({ defaultValue: 'road_map_desaturated' }), - dark: schema.string({ defaultValue: 'dark_map' }), - }), -}); +export const configSchema = schema.object({}); export type MapsLegacyConfig = TypeOf; diff --git a/src/plugins/maps_legacy/kibana.json b/src/plugins/maps_legacy/kibana.json index 9d4586ebce53b..8e283288e34b2 100644 --- a/src/plugins/maps_legacy/kibana.json +++ b/src/plugins/maps_legacy/kibana.json @@ -2,9 +2,8 @@ "id": "mapsLegacy", "version": "8.0.0", "kibanaVersion": "kibana", - "configPath": ["map"], "ui": true, "server": true, - "extraPublicDirs": ["common"], - "requiredBundles": ["kibanaReact", "visDefaultEditor"] + "requiredPlugins": ["mapsEms"], + "requiredBundles": ["kibanaReact", "visDefaultEditor", "mapsEms"] } diff --git a/src/plugins/maps_legacy/public/common/types.ts b/src/plugins/maps_legacy/public/common/types.ts index 3e1ebf7a5b478..8ff1753b56c31 100644 --- a/src/plugins/maps_legacy/public/common/types.ts +++ b/src/plugins/maps_legacy/public/common/types.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { TmsLayer } from '..'; +import { TmsLayer } from '../../../maps_ems/public'; export interface WMSOptions { selectedTmsLayer?: TmsLayer; diff --git a/src/plugins/maps_legacy/public/components/wms_options.tsx b/src/plugins/maps_legacy/public/components/wms_options.tsx index d4ed5abd896e4..8f63d205406e9 100644 --- a/src/plugins/maps_legacy/public/components/wms_options.tsx +++ b/src/plugins/maps_legacy/public/components/wms_options.tsx @@ -10,7 +10,7 @@ import React, { useMemo } from 'react'; import { EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { TmsLayer } from '../index'; +import { TmsLayer } from '../../../maps_ems/public'; import { SelectOption, SwitchOption } from '../../../vis_default_editor/public'; import { WmsInternalOptions } from './wms_internal_options'; import { WMSOptions } from '../common/types'; diff --git a/src/plugins/maps_legacy/public/index.ts b/src/plugins/maps_legacy/public/index.ts index 49e29b8bff417..c21aabcf743b9 100644 --- a/src/plugins/maps_legacy/public/index.ts +++ b/src/plugins/maps_legacy/public/index.ts @@ -10,13 +10,6 @@ import { PluginInitializerContext } from 'kibana/public'; import { MapsLegacyPlugin } from './plugin'; import * as colorUtil from './map/color_util'; import { KibanaMapLayer } from './map/kibana_map_layer'; -import { - VectorLayer, - FileLayerField, - FileLayer, - TmsLayer, - IServiceSettings, -} from './map/service_settings_types'; import { mapTooltipProvider } from './tooltip_provider'; import './map/index.scss'; @@ -26,21 +19,9 @@ export function plugin(initializerContext: PluginInitializerContext) { } /** @public */ -export { - colorUtil, - IServiceSettings, - KibanaMapLayer, - VectorLayer, - FileLayerField, - FileLayer, - TmsLayer, - mapTooltipProvider, -}; - -export * from '../common'; -export * from './common/types'; -export { ORIGIN, TMS_IN_YML_ID } from './common/constants'; +export { colorUtil, KibanaMapLayer, mapTooltipProvider }; +export { WMSOptions } from './common/types'; export { WmsOptions } from './components/wms_options'; export { LegacyMapDeprecationMessage } from './components/legacy_map_deprecation_message'; diff --git a/src/plugins/maps_legacy/public/kibana_services.js b/src/plugins/maps_legacy/public/kibana_services.js deleted file mode 100644 index cc4ef3f85021d..0000000000000 --- a/src/plugins/maps_legacy/public/kibana_services.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -let toast; -export const setToasts = (notificationToast) => (toast = notificationToast); -export const getToasts = () => toast; - -let uiSettings; -export const setUiSettings = (coreUiSettings) => (uiSettings = coreUiSettings); -export const getUiSettings = () => uiSettings; - -let kibanaVersion; -export const setKibanaVersion = (version) => (kibanaVersion = version); -export const getKibanaVersion = () => kibanaVersion; - -let mapsLegacyConfig; -export const setMapsLegacyConfig = (config) => (mapsLegacyConfig = config); -export const getMapsLegacyConfig = () => mapsLegacyConfig; - -export const getEmsTileLayerId = () => getMapsLegacyConfig().emsTileLayerId; diff --git a/src/plugins/maps_legacy/public/kibana_services.ts b/src/plugins/maps_legacy/public/kibana_services.ts new file mode 100644 index 0000000000000..1cf02ee06db88 --- /dev/null +++ b/src/plugins/maps_legacy/public/kibana_services.ts @@ -0,0 +1,29 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { IUiSettingsClient, ToastsSetup } from 'kibana/public'; +import type { MapsEmsConfig, IServiceSettings } from '../../maps_ems/public'; + +let toast: ToastsSetup; +export const setToasts = (notificationToast: ToastsSetup) => (toast = notificationToast); +export const getToasts = () => toast; + +let uiSettings: IUiSettingsClient; +export const setUiSettings = (coreUiSettings: IUiSettingsClient) => (uiSettings = coreUiSettings); +export const getUiSettings = () => uiSettings; + +let mapsEmsConfig: MapsEmsConfig; +export const setMapsEmsConfig = (config: MapsEmsConfig) => (mapsEmsConfig = config); +export const getEmsTileLayerId = () => mapsEmsConfig.emsTileLayerId; + +let getServiceSettingsFunction: () => Promise; +export const setGetServiceSettings = (getSS: () => Promise) => + (getServiceSettingsFunction = getSS); +export const getServiceSettings = async (): Promise => { + return await getServiceSettingsFunction(); +}; diff --git a/src/plugins/maps_legacy/public/lazy_load_bundle/index.ts b/src/plugins/maps_legacy/public/lazy_load_bundle/index.ts index 26ba63afd0116..b1509c4effa7a 100644 --- a/src/plugins/maps_legacy/public/lazy_load_bundle/index.ts +++ b/src/plugins/maps_legacy/public/lazy_load_bundle/index.ts @@ -11,7 +11,6 @@ let loadModulesPromise: Promise; interface LazyLoadedMapsLegacyModules { KibanaMap: unknown; L: unknown; - ServiceSettings: unknown; } export async function lazyLoadMapsLegacyModules(): Promise { @@ -20,12 +19,11 @@ export async function lazyLoadMapsLegacyModules(): Promise { - const { KibanaMap, L, ServiceSettings } = await import('./lazy'); + const { KibanaMap, L } = await import('./lazy'); resolve({ KibanaMap, L, - ServiceSettings, }); }); return loadModulesPromise; diff --git a/src/plugins/maps_legacy/public/lazy_load_bundle/lazy/index.ts b/src/plugins/maps_legacy/public/lazy_load_bundle/lazy/index.ts index dd2ec64b5189b..5fb53c1a4f524 100644 --- a/src/plugins/maps_legacy/public/lazy_load_bundle/lazy/index.ts +++ b/src/plugins/maps_legacy/public/lazy_load_bundle/lazy/index.ts @@ -9,6 +9,4 @@ // @ts-expect-error export { KibanaMap } from '../../map/kibana_map'; // @ts-expect-error -export { ServiceSettings } from '../../map/service_settings'; -// @ts-expect-error export { L } from '../../leaflet'; diff --git a/src/plugins/maps_legacy/public/map/base_maps_visualization.js b/src/plugins/maps_legacy/public/map/base_maps_visualization.js index 667a8f108dddb..9cd574c5246e8 100644 --- a/src/plugins/maps_legacy/public/map/base_maps_visualization.js +++ b/src/plugins/maps_legacy/public/map/base_maps_visualization.js @@ -9,9 +9,13 @@ import { i18n } from '@kbn/i18n'; import * as Rx from 'rxjs'; import { filter, first } from 'rxjs/operators'; -import { getEmsTileLayerId, getUiSettings, getToasts } from '../kibana_services'; +import { + getEmsTileLayerId, + getUiSettings, + getToasts, + getServiceSettings, +} from '../kibana_services'; import { lazyLoadMapsLegacyModules } from '../lazy_load_bundle'; -import { getServiceSettings } from '../get_service_settings'; const WMS_MINZOOM = 0; const WMS_MAXZOOM = 22; //increase this to 22. Better for WMS diff --git a/src/plugins/maps_legacy/public/map/kibana_map.js b/src/plugins/maps_legacy/public/map/kibana_map.js index e2874d550525b..eea8315419289 100644 --- a/src/plugins/maps_legacy/public/map/kibana_map.js +++ b/src/plugins/maps_legacy/public/map/kibana_map.js @@ -12,7 +12,7 @@ import $ from 'jquery'; import { get, isEqual, escape } from 'lodash'; import { zoomToPrecision } from './zoom_to_precision'; import { i18n } from '@kbn/i18n'; -import { ORIGIN } from '../common/constants/origin'; +import { ORIGIN } from '../../../maps_ems/common'; import { getToasts } from '../kibana_services'; import { L } from '../leaflet'; diff --git a/src/plugins/maps_legacy/public/plugin.ts b/src/plugins/maps_legacy/public/plugin.ts index 0297e0b0fe5f1..63b3c3845f549 100644 --- a/src/plugins/maps_legacy/public/plugin.ts +++ b/src/plugins/maps_legacy/public/plugin.ts @@ -9,14 +9,19 @@ // @ts-ignore import { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from 'kibana/public'; // @ts-ignore -import { setToasts, setUiSettings, setKibanaVersion, setMapsLegacyConfig } from './kibana_services'; +import { + setToasts, + setUiSettings, + setMapsEmsConfig, + setGetServiceSettings, +} from './kibana_services'; // @ts-ignore import { getPrecision, getZoomPrecision } from './map/precision'; import { MapsLegacyPluginSetup, MapsLegacyPluginStart } from './index'; import { MapsLegacyConfig } from '../config'; // @ts-ignore import { BaseMapsVisualizationProvider } from './map/base_maps_visualization'; -import { getServiceSettings } from './get_service_settings'; +import type { MapsEmsPluginSetup } from '../../maps_ems/public'; /** * These are the interfaces with your public contracts. You should export these @@ -24,19 +29,9 @@ import { getServiceSettings } from './get_service_settings'; * @public */ -export const bindSetupCoreAndPlugins = ( - core: CoreSetup, - config: MapsLegacyConfig, - kibanaVersion: string -) => { - setToasts(core.notifications.toasts); - setUiSettings(core.uiSettings); - setKibanaVersion(kibanaVersion); - setMapsLegacyConfig(config); -}; - -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface MapsLegacySetupDependencies {} +export interface MapsLegacySetupDependencies { + mapsEms: MapsEmsPluginSetup; +} // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface MapsLegacyStartDependencies {} @@ -48,18 +43,16 @@ export class MapsLegacyPlugin implements Plugin(); - const kibanaVersion = this._initializerContext.env.packageInfo.version; - - bindSetupCoreAndPlugins(core, config, kibanaVersion); + setToasts(core.notifications.toasts); + setUiSettings(core.uiSettings); + setMapsEmsConfig(plugins.mapsEms.config); + setGetServiceSettings(plugins.mapsEms.getServiceSettings); const getBaseMapsVis = () => new BaseMapsVisualizationProvider(); return { - getServiceSettings, getZoomPrecision, getPrecision, - config, getBaseMapsVis, }; } diff --git a/src/plugins/maps_legacy/server/index.ts b/src/plugins/maps_legacy/server/index.ts index 4f35c1c1e5fc1..57a7bfdd1828f 100644 --- a/src/plugins/maps_legacy/server/index.ts +++ b/src/plugins/maps_legacy/server/index.ts @@ -12,19 +12,7 @@ import { configSchema, MapsLegacyConfig } from '../config'; import { getUiSettings } from './ui_settings'; export const config: PluginConfigDescriptor = { - exposeToBrowser: { - includeElasticMapsService: true, - proxyElasticMapsServiceInMaps: true, - tilemap: true, - regionmap: true, - manifestServiceUrl: true, - emsUrl: true, - emsFileApiUrl: true, - emsTileApiUrl: true, - emsLandingPageUrl: true, - emsFontLibraryUrl: true, - emsTileLayerId: true, - }, + exposeToBrowser: {}, schema: configSchema, }; diff --git a/src/plugins/maps_legacy/tsconfig.json b/src/plugins/maps_legacy/tsconfig.json index e7ea06706b64f..f757e35f785af 100644 --- a/src/plugins/maps_legacy/tsconfig.json +++ b/src/plugins/maps_legacy/tsconfig.json @@ -7,8 +7,9 @@ "declaration": true, "declarationMap": true }, - "include": ["common/**/*", "public/**/*", "server/**/*", "config.ts"], + "include": ["public/**/*", "server/**/*", "config.ts"], "references": [ { "path": "../vis_default_editor/tsconfig.json" }, + { "path": "../maps_ems/tsconfig.json" } ] } diff --git a/src/plugins/region_map/kibana.json b/src/plugins/region_map/kibana.json index 4815deba6441d..18ae8ec7eec8c 100644 --- a/src/plugins/region_map/kibana.json +++ b/src/plugins/region_map/kibana.json @@ -2,13 +2,13 @@ "id": "regionMap", "version": "8.0.0", "kibanaVersion": "kibana", - "configPath": ["map", "regionmap"], "ui": true, "server": true, "requiredPlugins": [ "visualizations", "expressions", "mapsLegacy", + "mapsEms", "kibanaLegacy", "data", "share" diff --git a/src/plugins/region_map/public/components/index.tsx b/src/plugins/region_map/public/components/index.tsx index 4b6e08b34fe18..55e26ec311c41 100644 --- a/src/plugins/region_map/public/components/index.tsx +++ b/src/plugins/region_map/public/components/index.tsx @@ -7,7 +7,7 @@ */ import React, { lazy } from 'react'; -import { IServiceSettings } from 'src/plugins/maps_legacy/public'; +import { IServiceSettings } from 'src/plugins/maps_ems/public'; import { VisEditorOptionsProps } from 'src/plugins/visualizations/public'; import { RegionMapVisParams } from '../region_map_types'; diff --git a/src/plugins/region_map/public/components/region_map_options.tsx b/src/plugins/region_map/public/components/region_map_options.tsx index 2bf13e46f70de..e3be8f9dcec09 100644 --- a/src/plugins/region_map/public/components/region_map_options.tsx +++ b/src/plugins/region_map/public/components/region_map_options.tsx @@ -12,7 +12,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { VisEditorOptionsProps } from 'src/plugins/visualizations/public'; import { truncatedColorSchemas } from '../../../charts/public'; -import { FileLayerField, VectorLayer, IServiceSettings } from '../../../maps_legacy/public'; +import { FileLayerField, VectorLayer, IServiceSettings } from '../../../maps_ems/public'; import { SelectOption, SwitchOption, NumberInputOption } from '../../../vis_default_editor/public'; import { WmsOptions } from '../../../maps_legacy/public'; import { RegionMapVisParams } from '../region_map_types'; diff --git a/src/plugins/region_map/public/kibana_services.ts b/src/plugins/region_map/public/kibana_services.ts index 77bc472e3b140..030d021006d98 100644 --- a/src/plugins/region_map/public/kibana_services.ts +++ b/src/plugins/region_map/public/kibana_services.ts @@ -12,7 +12,7 @@ import { createGetterSetter } from '../../kibana_utils/public'; import { DataPublicPluginStart } from '../../data/public'; import { KibanaLegacyStart } from '../../kibana_legacy/public'; import { SharePluginStart } from '../../share/public'; -import { VectorLayer, TmsLayer } from '../../maps_legacy/public'; +import { VectorLayer, TmsLayer } from '../../maps_ems/public'; export const [getCoreService, setCoreService] = createGetterSetter('Core'); diff --git a/src/plugins/region_map/public/plugin.ts b/src/plugins/region_map/public/plugin.ts index a3a2331cf8f76..724404849aea8 100644 --- a/src/plugins/region_map/public/plugin.ts +++ b/src/plugins/region_map/public/plugin.ts @@ -20,7 +20,8 @@ import { VisualizationsSetup } from '../../visualizations/public'; import { createRegionMapFn } from './region_map_fn'; // @ts-ignore import { createRegionMapTypeDefinition } from './region_map_type'; -import { IServiceSettings, MapsLegacyPluginSetup } from '../../maps_legacy/public'; +import { MapsLegacyPluginSetup } from '../../maps_legacy/public'; +import { IServiceSettings, MapsEmsPluginSetup } from '../../maps_ems/public'; import { setCoreService, setFormatService, @@ -49,6 +50,7 @@ export interface RegionMapPluginSetupDependencies { expressions: ReturnType; visualizations: VisualizationsSetup; mapsLegacy: MapsLegacyPluginSetup; + mapsEms: MapsEmsPluginSetup; } /** @internal */ @@ -65,9 +67,8 @@ export interface RegionMapsConfig { layers: any[]; } -export interface RegionMapPluginSetup { - config: any; -} +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface RegionMapPluginSetup {} // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface RegionMapPluginStart {} @@ -81,19 +82,19 @@ export class RegionMapPlugin implements Plugin(), // The maps legacy plugin updates the regionmap config directly in service_settings, // future work on how configurations across the different plugins are organized would // ideally constrain regionmap config updates to occur only from this plugin - ...mapsLegacy.config.regionmap, + ...mapsEms.config.regionmap, }; const visualizationDependencies: Readonly = { uiSettings: core.uiSettings, regionmapsConfig: config as RegionMapsConfig, - getServiceSettings: mapsLegacy.getServiceSettings, + getServiceSettings: mapsEms.getServiceSettings, BaseMapsVisualization: mapsLegacy.getBaseMapsVis(), }; @@ -104,9 +105,7 @@ export class RegionMapPlugin implements Plugin !vectorLayers.some((vectorLayer) => vectorLayer.layerId === layer.layerId) + (layer: VectorLayer) => + !vectorLayers.some((vectorLayer) => vectorLayer.layerId === layer.layerId) ); // backfill v1 manifest for now - newLayers.forEach((layer) => { + newLayers.forEach((layer: VectorLayer) => { if (layer.format === 'geojson') { layer.format = { type: 'geojson', diff --git a/src/plugins/region_map/public/region_map_types.ts b/src/plugins/region_map/public/region_map_types.ts index 2555fafbc7fdf..0a9235f1c82df 100644 --- a/src/plugins/region_map/public/region_map_types.ts +++ b/src/plugins/region_map/public/region_map_types.ts @@ -7,7 +7,8 @@ */ import { SchemaConfig } from 'src/plugins/visualizations/public'; -import { VectorLayer, FileLayerField, WMSOptions } from '../../maps_legacy/public/index'; +import { VectorLayer, FileLayerField } from '../../maps_ems/public'; +import { WMSOptions } from '../../maps_legacy/public'; export interface RegionMapVisParams { readonly addTooltip: true; diff --git a/src/plugins/region_map/public/region_map_visualization.js b/src/plugins/region_map/public/region_map_visualization.js index dfc35be71c968..80bee417009a4 100644 --- a/src/plugins/region_map/public/region_map_visualization.js +++ b/src/plugins/region_map/public/region_map_visualization.js @@ -10,7 +10,8 @@ import { i18n } from '@kbn/i18n'; import { getFormatService, getNotifications, getKibanaLegacy } from './kibana_services'; import { truncatedColorMaps } from '../../charts/public'; import { tooltipFormatter } from './tooltip_formatter'; -import { mapTooltipProvider, ORIGIN, lazyLoadMapsLegacyModules } from '../../maps_legacy/public'; +import { mapTooltipProvider, lazyLoadMapsLegacyModules } from '../../maps_legacy/public'; +import { ORIGIN } from '../../maps_ems/public'; export function createRegionMapVisualization({ regionmapsConfig, diff --git a/src/plugins/region_map/public/util.ts b/src/plugins/region_map/public/util.ts index 67d09af54bdb2..8e15a72b0365d 100644 --- a/src/plugins/region_map/public/util.ts +++ b/src/plugins/region_map/public/util.ts @@ -6,8 +6,7 @@ * Side Public License, v 1. */ -import { FileLayer, VectorLayer } from '../../maps_legacy/public'; -import { ORIGIN } from '../../maps_legacy/public'; +import { FileLayer, VectorLayer, ORIGIN } from '../../maps_ems/public'; export const mapToLayerWithId = (prefix: string, layer: FileLayer): VectorLayer => ({ ...layer, diff --git a/src/plugins/region_map/server/index.ts b/src/plugins/region_map/server/index.ts index 3391ff3e91b9c..eb185c773458b 100644 --- a/src/plugins/region_map/server/index.ts +++ b/src/plugins/region_map/server/index.ts @@ -6,22 +6,9 @@ * Side Public License, v 1. */ -import { TypeOf } from '@kbn/config-schema'; -import { PluginConfigDescriptor } from 'kibana/server'; import { CoreSetup } from 'src/core/server'; -import { regionmapConfigSchema } from '../../maps_legacy/config'; import { getUiSettings } from './ui_settings'; -export type RegionmapConfig = TypeOf; - -export const config: PluginConfigDescriptor = { - exposeToBrowser: { - includeElasticMapsService: true, - layers: true, - }, - schema: regionmapConfigSchema, -}; - export const plugin = () => ({ setup(core: CoreSetup) { core.uiSettings.register(getUiSettings()); diff --git a/src/plugins/region_map/tsconfig.json b/src/plugins/region_map/tsconfig.json index 40f76ece2a6ff..899611d027465 100644 --- a/src/plugins/region_map/tsconfig.json +++ b/src/plugins/region_map/tsconfig.json @@ -10,6 +10,7 @@ "include": ["public/**/*", "server/**/*"], "references": [ { "path": "../maps_legacy/tsconfig.json" }, + { "path": "../maps_ems/tsconfig.json" }, { "path": "../vis_default_editor/tsconfig.json" }, ] } diff --git a/src/plugins/tile_map/kibana.json b/src/plugins/tile_map/kibana.json index d65cb65fd3042..16be04b5189de 100644 --- a/src/plugins/tile_map/kibana.json +++ b/src/plugins/tile_map/kibana.json @@ -2,13 +2,13 @@ "id": "tileMap", "version": "8.0.0", "kibanaVersion": "kibana", - "configPath": ["map", "tilemap"], "ui": true, "server": true, "requiredPlugins": [ "visualizations", "expressions", "mapsLegacy", + "mapsEms", "kibanaLegacy", "data", "share" diff --git a/src/plugins/tile_map/public/plugin.ts b/src/plugins/tile_map/public/plugin.ts index 6cb88e7142f6f..78cd12ffbccad 100644 --- a/src/plugins/tile_map/public/plugin.ts +++ b/src/plugins/tile_map/public/plugin.ts @@ -15,7 +15,9 @@ import { } from 'kibana/public'; import { Plugin as ExpressionsPublicPlugin } from '../../expressions/public'; import { VisualizationsSetup } from '../../visualizations/public'; -import { IServiceSettings, MapsLegacyPluginSetup } from '../../maps_legacy/public'; +import { MapsLegacyPluginSetup } from '../../maps_legacy/public'; +import { MapsEmsPluginSetup } from '../../maps_ems/public'; +import { IServiceSettings } from '../../maps_ems/public'; import { DataPublicPluginStart } from '../../data/public'; import { setCoreService, @@ -31,10 +33,6 @@ import { createTileMapFn } from './tile_map_fn'; import { createTileMapTypeDefinition } from './tile_map_type'; import { getTileMapRenderer } from './tile_map_renderer'; -export interface TileMapConfigType { - tilemap: any; -} - /** @private */ export interface TileMapVisualizationDependencies { uiSettings: IUiSettingsClient; @@ -49,6 +47,7 @@ export interface TileMapPluginSetupDependencies { expressions: ReturnType; visualizations: VisualizationsSetup; mapsLegacy: MapsLegacyPluginSetup; + mapsEms: MapsEmsPluginSetup; } /** @internal */ @@ -58,9 +57,8 @@ export interface TileMapPluginStartDependencies { share: SharePluginStart; } -export interface TileMapPluginSetup { - config: any; -} +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface TileMapPluginSetup {} // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface TileMapPluginStart {} @@ -74,15 +72,15 @@ export class TileMapPlugin implements Plugin = { getZoomPrecision, getPrecision, BaseMapsVisualization: mapsLegacy.getBaseMapsVis(), uiSettings: core.uiSettings, - getServiceSettings, + getServiceSettings: mapsEms.getServiceSettings, }; expressions.registerFunction(createTileMapFn); @@ -90,10 +88,7 @@ export class TileMapPlugin implements Plugin(); - return { - config, - }; + return {}; } public start(core: CoreStart, plugins: TileMapPluginStartDependencies) { diff --git a/src/plugins/tile_map/public/services.ts b/src/plugins/tile_map/public/services.ts index af23daf24f7f5..cef4fbae03f38 100644 --- a/src/plugins/tile_map/public/services.ts +++ b/src/plugins/tile_map/public/services.ts @@ -11,7 +11,7 @@ import { createGetterSetter } from '../../kibana_utils/public'; import { DataPublicPluginStart } from '../../data/public'; import { KibanaLegacyStart } from '../../kibana_legacy/public'; import { SharePluginStart } from '../../share/public'; -import { TmsLayer } from '../../maps_legacy/public'; +import { TmsLayer } from '../../maps_ems/public'; export const [getCoreService, setCoreService] = createGetterSetter('Core'); diff --git a/src/plugins/tile_map/server/index.ts b/src/plugins/tile_map/server/index.ts index 10d858134f08e..a7fa77a67d909 100644 --- a/src/plugins/tile_map/server/index.ts +++ b/src/plugins/tile_map/server/index.ts @@ -6,20 +6,6 @@ * Side Public License, v 1. */ -import { TypeOf } from '@kbn/config-schema'; -import { PluginConfigDescriptor } from 'kibana/server'; -import { tilemapConfigSchema } from '../../maps_legacy/config'; - -export type TilemapConfig = TypeOf; - -export const config: PluginConfigDescriptor = { - exposeToBrowser: { - url: true, - options: true, - }, - schema: tilemapConfigSchema, -}; - export const plugin = () => ({ setup() {}, start() {}, diff --git a/src/plugins/tile_map/tsconfig.json b/src/plugins/tile_map/tsconfig.json index 40f76ece2a6ff..899611d027465 100644 --- a/src/plugins/tile_map/tsconfig.json +++ b/src/plugins/tile_map/tsconfig.json @@ -10,6 +10,7 @@ "include": ["public/**/*", "server/**/*"], "references": [ { "path": "../maps_legacy/tsconfig.json" }, + { "path": "../maps_ems/tsconfig.json" }, { "path": "../vis_default_editor/tsconfig.json" }, ] } diff --git a/src/plugins/vis_type_vega/kibana.json b/src/plugins/vis_type_vega/kibana.json index f889db21d7474..747b6862a6901 100644 --- a/src/plugins/vis_type_vega/kibana.json +++ b/src/plugins/vis_type_vega/kibana.json @@ -3,7 +3,7 @@ "version": "kibana", "server": true, "ui": true, - "requiredPlugins": ["data", "visualizations", "mapsLegacy", "expressions", "inspector"], + "requiredPlugins": ["data", "visualizations", "mapsEms", "expressions", "inspector"], "optionalPlugins": ["home","usageCollection"], "requiredBundles": ["kibanaUtils", "kibanaReact", "visDefaultEditor"] } diff --git a/src/plugins/vis_type_vega/public/data_model/ems_file_parser.ts b/src/plugins/vis_type_vega/public/data_model/ems_file_parser.ts index 6bd5ef2c84345..c79ebe02c0d3f 100644 --- a/src/plugins/vis_type_vega/public/data_model/ems_file_parser.ts +++ b/src/plugins/vis_type_vega/public/data_model/ems_file_parser.ts @@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n'; // @ts-ignore import { bypassExternalUrlCheck } from '../vega_view/vega_base_view'; -import { IServiceSettings, FileLayer } from '../../../maps_legacy/public'; +import { IServiceSettings, FileLayer } from '../../../maps_ems/public'; import { Data, UrlObject, EmsQueryRequest } from './types'; /** diff --git a/src/plugins/vis_type_vega/public/data_model/vega_parser.ts b/src/plugins/vis_type_vega/public/data_model/vega_parser.ts index 5a36390dda0a7..cc453922ce180 100644 --- a/src/plugins/vis_type_vega/public/data_model/vega_parser.ts +++ b/src/plugins/vis_type_vega/public/data_model/vega_parser.ts @@ -22,7 +22,7 @@ import { EmsFileParser } from './ems_file_parser'; import { UrlParser } from './url_parser'; import { SearchAPI } from './search_api'; import { TimeCache } from './time_cache'; -import { IServiceSettings } from '../../../maps_legacy/public'; +import { IServiceSettings } from '../../../maps_ems/public'; import { Bool, Data, diff --git a/src/plugins/vis_type_vega/public/plugin.ts b/src/plugins/vis_type_vega/public/plugin.ts index 7cc70f31589c7..0204c2c90b71b 100644 --- a/src/plugins/vis_type_vega/public/plugin.ts +++ b/src/plugins/vis_type_vega/public/plugin.ts @@ -23,7 +23,7 @@ import { import { createVegaFn } from './vega_fn'; import { createVegaTypeDefinition } from './vega_type'; -import { IServiceSettings, MapsLegacyPluginSetup } from '../../maps_legacy/public'; +import { IServiceSettings, MapsEmsPluginSetup } from '../../maps_ems/public'; import { ConfigSchema } from '../config'; import { getVegaInspectorView } from './vega_inspector'; @@ -45,7 +45,7 @@ export interface VegaPluginSetupDependencies { visualizations: VisualizationsSetup; inspector: InspectorSetup; data: DataPublicPluginSetup; - mapsLegacy: MapsLegacyPluginSetup; + mapsEms: MapsEmsPluginSetup; } /** @internal */ @@ -63,7 +63,7 @@ export class VegaPlugin implements Plugin { public setup( core: CoreSetup, - { inspector, data, expressions, visualizations, mapsLegacy }: VegaPluginSetupDependencies + { inspector, data, expressions, visualizations, mapsEms }: VegaPluginSetupDependencies ) { setInjectedVars({ enableExternalUrls: this.initializerContext.config.get().enableExternalUrls, @@ -73,7 +73,7 @@ export class VegaPlugin implements Plugin { setUISettings(core.uiSettings); setMapServiceSettings( - new MapServiceSettings(mapsLegacy.config, this.initializerContext.env.packageInfo.version) + new MapServiceSettings(mapsEms.config, this.initializerContext.env.packageInfo.version) ); const visualizationDependencies: Readonly = { @@ -81,7 +81,7 @@ export class VegaPlugin implements Plugin { plugins: { data, }, - getServiceSettings: mapsLegacy.getServiceSettings, + getServiceSettings: mapsEms.getServiceSettings, }; inspector.registerView(getVegaInspectorView({ uiSettings: core.uiSettings })); diff --git a/src/plugins/vis_type_vega/public/vega_view/vega_base_view.d.ts b/src/plugins/vis_type_vega/public/vega_view/vega_base_view.d.ts index a337670530548..b0ccdbba021ed 100644 --- a/src/plugins/vis_type_vega/public/vega_view/vega_base_view.d.ts +++ b/src/plugins/vis_type_vega/public/vega_view/vega_base_view.d.ts @@ -8,7 +8,7 @@ import { DataPublicPluginStart } from 'src/plugins/data/public'; import { IInterpreterRenderHandlers } from 'src/plugins/expressions'; -import { IServiceSettings } from 'src/plugins/maps_legacy/public'; +import { IServiceSettings } from 'src/plugins/maps_ems/public'; import { VegaParser } from '../data_model/vega_parser'; import { createVegaStateRestorer } from '../lib/vega_state_restorer'; diff --git a/src/plugins/vis_type_vega/public/vega_view/vega_map_view/constants.ts b/src/plugins/vis_type_vega/public/vega_view/vega_map_view/constants.ts index 3dc245f196774..75e3b66a784b3 100644 --- a/src/plugins/vis_type_vega/public/vega_view/vega_map_view/constants.ts +++ b/src/plugins/vis_type_vega/public/vega_view/vega_map_view/constants.ts @@ -7,7 +7,7 @@ */ import type { Style } from 'mapbox-gl'; -import { TMS_IN_YML_ID } from '../../../../maps_legacy/public'; +import { TMS_IN_YML_ID } from '../../../../maps_ems/public'; export const vegaLayerId = 'vega'; export const userConfiguredLayerId = TMS_IN_YML_ID; diff --git a/src/plugins/vis_type_vega/public/vega_view/vega_map_view/map_service_settings.test.ts b/src/plugins/vis_type_vega/public/vega_view/vega_map_view/map_service_settings.test.ts index 3b7406000ea4a..c459220d4aa86 100644 --- a/src/plugins/vis_type_vega/public/vega_view/vega_map_view/map_service_settings.test.ts +++ b/src/plugins/vis_type_vega/public/vega_view/vega_map_view/map_service_settings.test.ts @@ -10,7 +10,7 @@ import { get } from 'lodash'; import { uiSettingsServiceMock } from 'src/core/public/mocks'; import { MapServiceSettings, getAttributionsForTmsService } from './map_service_settings'; -import { MapsLegacyConfig } from '../../../../maps_legacy/config'; +import type { MapsEmsConfig } from '../../../../maps_ems/public'; import { EMSClient, TMSService } from '@elastic/ems-client'; import { setUISettings } from '../../services'; @@ -20,7 +20,7 @@ const getPrivateField = (mapServiceSettings: MapServiceSettings, privateField describe('vega_map_view/map_service_settings', () => { describe('MapServiceSettings', () => { const appVersion = '99'; - let config: MapsLegacyConfig; + let config: MapsEmsConfig; let getUiSettingsMockedValue: any; beforeEach(() => { @@ -29,7 +29,7 @@ describe('vega_map_view/map_service_settings', () => { desaturated: 'road_map_desaturated', dark: 'dark_map', }, - } as MapsLegacyConfig; + } as MapsEmsConfig; setUISettings({ ...uiSettingsServiceMock.createSetupContract(), get: () => getUiSettingsMockedValue, diff --git a/src/plugins/vis_type_vega/public/vega_view/vega_map_view/map_service_settings.ts b/src/plugins/vis_type_vega/public/vega_view/vega_map_view/map_service_settings.ts index 14eb8f476512d..8874db7737a4e 100644 --- a/src/plugins/vis_type_vega/public/vega_view/vega_map_view/map_service_settings.ts +++ b/src/plugins/vis_type_vega/public/vega_view/vega_map_view/map_service_settings.ts @@ -10,11 +10,11 @@ import { i18n } from '@kbn/i18n'; import type { EMSClient, TMSService } from '@elastic/ems-client'; import { getUISettings } from '../../services'; import { userConfiguredLayerId } from './constants'; -import type { MapsLegacyConfig } from '../../../../maps_legacy/config'; +import type { MapsEmsConfig } from '../../../../maps_ems/public'; type EmsClientConfig = ConstructorParameters[0]; -const hasUserConfiguredTmsService = (config: MapsLegacyConfig) => Boolean(config.tilemap?.url); +const hasUserConfiguredTmsService = (config: MapsEmsConfig) => Boolean(config.tilemap?.url); const initEmsClientAsync = async (config: Partial) => { /** @@ -37,7 +37,7 @@ export class MapServiceSettings { private emsClient?: EMSClient; private isDarkMode: boolean = false; - constructor(public config: MapsLegacyConfig, private appVersion: string) {} + constructor(public config: MapsEmsConfig, private appVersion: string) {} private isInitialized() { return Boolean(this.emsClient); diff --git a/src/plugins/vis_type_vega/public/vega_view/vega_map_view/view.test.ts b/src/plugins/vis_type_vega/public/vega_view/vega_map_view/view.test.ts index a760b47bd32ef..d5a67f2eac064 100644 --- a/src/plugins/vis_type_vega/public/vega_view/vega_map_view/view.test.ts +++ b/src/plugins/vis_type_vega/public/vega_view/vega_map_view/view.test.ts @@ -17,8 +17,7 @@ import { SearchAPI } from '../../data_model/search_api'; import vegaMap from '../../test_utils/vega_map_test.json'; import { coreMock } from '../../../../../core/public/mocks'; import { dataPluginMock } from '../../../../data/public/mocks'; -import { IServiceSettings } from '../../../../maps_legacy/public'; -import type { MapsLegacyConfig } from '../../../../maps_legacy/config'; +import type { IServiceSettings, MapsEmsConfig } from '../../../../maps_ems/public'; import { MapServiceSettings } from './map_service_settings'; import { userConfiguredLayerId } from './constants'; import { @@ -94,7 +93,7 @@ describe('vega_map_view/view', () => { maxZoom: 20, }, }, - } as MapsLegacyConfig; + } as MapsEmsConfig; function setMapService(defaultTmsLayer: string) { setMapServiceSettings(({ diff --git a/src/plugins/vis_type_vega/tsconfig.json b/src/plugins/vis_type_vega/tsconfig.json index d03ee6eae790e..4091dafcbe357 100644 --- a/src/plugins/vis_type_vega/tsconfig.json +++ b/src/plugins/vis_type_vega/tsconfig.json @@ -19,7 +19,7 @@ { "path": "../../core/tsconfig.json" }, { "path": "../data/tsconfig.json" }, { "path": "../visualizations/tsconfig.json" }, - { "path": "../maps_legacy/tsconfig.json" }, + { "path": "../maps_ems/tsconfig.json" }, { "path": "../expressions/tsconfig.json" }, { "path": "../inspector/tsconfig.json" }, { "path": "../home/tsconfig.json" }, diff --git a/x-pack/plugins/maps/common/ems_settings.test.ts b/x-pack/plugins/maps/common/ems_settings.test.ts index 2e31ae6e6f3d9..c299d535db193 100644 --- a/x-pack/plugins/maps/common/ems_settings.test.ts +++ b/x-pack/plugins/maps/common/ems_settings.test.ts @@ -11,7 +11,7 @@ import { DEFAULT_EMS_FONT_LIBRARY_URL, DEFAULT_EMS_LANDING_PAGE_URL, DEFAULT_EMS_TILE_API_URL, -} from '../../../../src/plugins/maps_legacy/common'; +} from '../../../../src/plugins/maps_ems/common'; const IS_ENTERPRISE_PLUS = () => true; diff --git a/x-pack/plugins/maps/common/ems_settings.ts b/x-pack/plugins/maps/common/ems_settings.ts index 1e8229e227245..166fc6fbdfc4c 100644 --- a/x-pack/plugins/maps/common/ems_settings.ts +++ b/x-pack/plugins/maps/common/ems_settings.ts @@ -10,7 +10,7 @@ import { DEFAULT_EMS_FONT_LIBRARY_URL, DEFAULT_EMS_LANDING_PAGE_URL, DEFAULT_EMS_TILE_API_URL, -} from '../../../../src/plugins/maps_legacy/common'; +} from '../../../../src/plugins/maps_ems/common'; export interface IEMSConfig { emsUrl?: string; diff --git a/x-pack/plugins/maps/kibana.json b/x-pack/plugins/maps/kibana.json index 1d4f76db79751..ffedf855c6d9c 100644 --- a/x-pack/plugins/maps/kibana.json +++ b/x-pack/plugins/maps/kibana.json @@ -17,7 +17,7 @@ "visualizations", "dashboard", "embeddable", - "mapsLegacy", + "mapsEms", "usageCollection", "savedObjects", "share", diff --git a/x-pack/plugins/maps/public/classes/sources/kibana_regionmap_source/kibana_regionmap_source.ts b/x-pack/plugins/maps/public/classes/sources/kibana_regionmap_source/kibana_regionmap_source.ts index 4a2f9618bdc40..0f778f194ce3f 100644 --- a/x-pack/plugins/maps/public/classes/sources/kibana_regionmap_source/kibana_regionmap_source.ts +++ b/x-pack/plugins/maps/public/classes/sources/kibana_regionmap_source/kibana_regionmap_source.ts @@ -12,10 +12,10 @@ import { getDataSourceLabel } from '../../../../common/i18n_getters'; import { FIELD_ORIGIN, FORMAT_TYPE, SOURCE_TYPES } from '../../../../common/constants'; import { KibanaRegionField } from '../../fields/kibana_region_field'; import { registerSource } from '../source_registry'; -import { KibanaRegionmapSourceDescriptor } from '../../../../common/descriptor_types/source_descriptor_types'; +import { KibanaRegionmapSourceDescriptor } from '../../../../common/descriptor_types'; import { Adapters } from '../../../../../../../src/plugins/inspector/common/adapters'; import { IField } from '../../fields/field'; -import { LayerConfig } from '../../../../../../../src/plugins/maps_legacy/config'; +import type { LayerConfig } from '../../../../../../../src/plugins/maps_ems/public'; export const sourceTitle = i18n.translate('xpack.maps.source.kbnRegionMapTitle', { defaultMessage: 'Configured GeoJSON', diff --git a/x-pack/plugins/maps/public/kibana_services.ts b/x-pack/plugins/maps/public/kibana_services.ts index 1fbca669b0d8e..23d19d0ea4961 100644 --- a/x-pack/plugins/maps/public/kibana_services.ts +++ b/x-pack/plugins/maps/public/kibana_services.ts @@ -7,7 +7,7 @@ import _ from 'lodash'; import { CoreStart } from 'kibana/public'; -import { MapsLegacyConfig } from '../../../../src/plugins/maps_legacy/config'; +import type { MapsEmsConfig } from '../../../../src/plugins/maps_ems/public'; import { MapsConfigType } from '../config'; import { MapsPluginStartDependencies } from './plugin'; import { EMSSettings } from '../common/ems_settings'; @@ -62,9 +62,9 @@ export const getEnabled = () => getMapAppConfig().enabled; export const getShowMapsInspectorAdapter = () => getMapAppConfig().showMapsInspectorAdapter; export const getPreserveDrawingBuffer = () => getMapAppConfig().preserveDrawingBuffer; -// map.* kibana.yml settings from maps_legacy plugin that are shared between OSS map visualizations and maps app -let kibanaCommonConfig: MapsLegacyConfig; -export const setKibanaCommonConfig = (config: MapsLegacyConfig) => (kibanaCommonConfig = config); +// map.* kibana.yml settings from maps_ems plugin that are shared between OSS map visualizations and maps app +let kibanaCommonConfig: MapsEmsConfig; +export const setKibanaCommonConfig = (config: MapsEmsConfig) => (kibanaCommonConfig = config); export const getKibanaCommonConfig = () => kibanaCommonConfig; let emsSettings: EMSSettings; diff --git a/x-pack/plugins/maps/public/meta.ts b/x-pack/plugins/maps/public/meta.ts index 050a516ba22b2..11dc033846222 100644 --- a/x-pack/plugins/maps/public/meta.ts +++ b/x-pack/plugins/maps/public/meta.ts @@ -25,7 +25,7 @@ import { getEMSSettings, } from './kibana_services'; import { getLicenseId } from './licensed_features'; -import { LayerConfig } from '../../../../src/plugins/maps_legacy/config'; +import { LayerConfig } from '../../../../src/plugins/maps_ems/public'; export function getKibanaRegionList(): LayerConfig[] { return getRegionmapLayers(); diff --git a/x-pack/plugins/maps/public/plugin.ts b/x-pack/plugins/maps/public/plugin.ts index d423acf67bcd4..be2e097c71dc5 100644 --- a/x-pack/plugins/maps/public/plugin.ts +++ b/x-pack/plugins/maps/public/plugin.ts @@ -51,7 +51,7 @@ import { MapsStartApi } from './api'; import { createLayerDescriptors, registerLayerWizard, registerSource } from './api'; import { SharePluginSetup, SharePluginStart } from '../../../../src/plugins/share/public'; import { EmbeddableStart } from '../../../../src/plugins/embeddable/public'; -import { MapsLegacyConfig } from '../../../../src/plugins/maps_legacy/config'; +import type { MapsEmsPluginSetup } from '../../../../src/plugins/maps_ems/public'; import { DataPublicPluginStart } from '../../../../src/plugins/data/public'; import { LicensingPluginSetup, LicensingPluginStart } from '../../licensing/public'; import { FileUploadPluginStart } from '../../file_upload/public'; @@ -71,7 +71,7 @@ export interface MapsPluginSetupDependencies { home?: HomePublicPluginSetup; visualizations: VisualizationsSetup; embeddable: EmbeddableSetup; - mapsLegacy: { config: MapsLegacyConfig }; + mapsEms: MapsEmsPluginSetup; share: SharePluginSetup; licensing: LicensingPluginSetup; } @@ -120,11 +120,11 @@ export class MapsPlugin registerLicensedFeatures(plugins.licensing); const config = this._initializerContext.config.get(); - setKibanaCommonConfig(plugins.mapsLegacy.config); + setKibanaCommonConfig(plugins.mapsEms.config); setMapAppConfig(config); setKibanaVersion(this._initializerContext.env.packageInfo.version); - const emsSettings = new EMSSettings(plugins.mapsLegacy.config, getIsEnterprisePlus); + const emsSettings = new EMSSettings(plugins.mapsEms.config, getIsEnterprisePlus); setEMSSettings(emsSettings); // register url generators diff --git a/x-pack/plugins/maps/server/plugin.ts b/x-pack/plugins/maps/server/plugin.ts index 4118074841aef..690a1d0d4772d 100644 --- a/x-pack/plugins/maps/server/plugin.ts +++ b/x-pack/plugins/maps/server/plugin.ts @@ -6,8 +6,14 @@ */ import { i18n } from '@kbn/i18n'; -import { CoreSetup, CoreStart, Logger, Plugin, PluginInitializerContext } from 'src/core/server'; -import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/server'; +import { + CoreSetup, + CoreStart, + Logger, + Plugin, + PluginInitializerContext, + DEFAULT_APP_CATEGORIES, +} from '../../../../src/core/server'; import { PluginSetupContract as FeaturesPluginSetupContract } from '../../features/server'; // @ts-ignore import { getEcommerceSavedObjects } from './sample_data/ecommerce_saved_objects'; @@ -28,7 +34,7 @@ import { initRoutes } from './routes'; import { ILicense } from '../../licensing/common/types'; import { LicensingPluginSetup } from '../../licensing/server'; import { HomeServerPluginSetup } from '../../../../src/plugins/home/server'; -import { MapsLegacyPluginSetup } from '../../../../src/plugins/maps_legacy/server'; +import { MapsEmsPluginSetup } from '../../../../src/plugins/maps_ems/server'; import { EMSSettings } from '../common/ems_settings'; import { PluginStart as DataPluginStart } from '../../../../src/plugins/data/server'; @@ -37,7 +43,7 @@ interface SetupDeps { usageCollection: UsageCollectionSetup; home: HomeServerPluginSetup; licensing: LicensingPluginSetup; - mapsLegacy: MapsLegacyPluginSetup; + mapsEms: MapsEmsPluginSetup; } export interface StartDeps { @@ -139,8 +145,8 @@ export class MapsPlugin implements Plugin { // @ts-ignore setup(core: CoreSetup, plugins: SetupDeps) { - const { usageCollection, home, licensing, features, mapsLegacy } = plugins; - const mapsLegacyConfig = mapsLegacy.config; + const { usageCollection, home, licensing, features, mapsEms } = plugins; + const mapsEmsConfig = mapsEms.config; const config$ = this._initializerContext.config.create(); const currentConfig = this._initializerContext.config.get(); @@ -154,7 +160,7 @@ export class MapsPlugin implements Plugin { let isEnterprisePlus = false; let lastLicenseId: string | undefined; - const emsSettings = new EMSSettings(mapsLegacyConfig, () => isEnterprisePlus); + const emsSettings = new EMSSettings(mapsEmsConfig, () => isEnterprisePlus); licensing.license$.subscribe((license: ILicense) => { const enterprise = license.check(APP_ID, 'enterprise'); isEnterprisePlus = enterprise.state === 'valid'; diff --git a/x-pack/plugins/maps/tsconfig.json b/x-pack/plugins/maps/tsconfig.json index 4a8bfe2ebae66..1b74b7ee7566a 100644 --- a/x-pack/plugins/maps/tsconfig.json +++ b/x-pack/plugins/maps/tsconfig.json @@ -16,7 +16,7 @@ ], "references": [ { "path": "../../../src/core/tsconfig.json" }, - { "path": "../../../src/plugins/maps_legacy/tsconfig.json" }, + { "path": "../../../src/plugins/maps_ems/tsconfig.json" }, { "path": "../features/tsconfig.json" }, { "path": "../licensing/tsconfig.json" }, { "path": "../file_upload/tsconfig.json" }, diff --git a/x-pack/plugins/maps_legacy_licensing/kibana.json b/x-pack/plugins/maps_legacy_licensing/kibana.json index e98c33d21ec40..7a49e0aaa7be1 100644 --- a/x-pack/plugins/maps_legacy_licensing/kibana.json +++ b/x-pack/plugins/maps_legacy_licensing/kibana.json @@ -4,5 +4,5 @@ "kibanaVersion": "kibana", "server": false, "ui": true, - "requiredPlugins": ["licensing", "mapsLegacy"] + "requiredPlugins": ["licensing", "mapsEms"] } diff --git a/x-pack/plugins/maps_legacy_licensing/public/plugin.ts b/x-pack/plugins/maps_legacy_licensing/public/plugin.ts index 493d7bb8fa1e5..f8118575cd6a2 100644 --- a/x-pack/plugins/maps_legacy_licensing/public/plugin.ts +++ b/x-pack/plugins/maps_legacy_licensing/public/plugin.ts @@ -7,6 +7,7 @@ import { CoreSetup, CoreStart, Plugin } from 'kibana/public'; import { LicensingPluginSetup, ILicense } from '../../licensing/public'; +import { IServiceSettings, MapsEmsPluginSetup } from '../../../../src/plugins/maps_ems/public'; /** * These are the interfaces with your public contracts. You should export these @@ -16,7 +17,7 @@ import { LicensingPluginSetup, ILicense } from '../../licensing/public'; export interface MapsLegacyLicensingSetupDependencies { licensing: LicensingPluginSetup; - mapsLegacy: any; + mapsEms: MapsEmsPluginSetup; } // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface MapsLegacyLicensingStartDependencies {} @@ -27,16 +28,16 @@ export type MapsLegacyLicensingStart = ReturnType; export class MapsLegacyLicensing implements Plugin { public setup(core: CoreSetup, plugins: MapsLegacyLicensingSetupDependencies) { - const { licensing, mapsLegacy } = plugins; + const { licensing, mapsEms } = plugins; if (licensing) { licensing.license$.subscribe(async (license: ILicense) => { - const serviceSettings = await mapsLegacy.getServiceSettings(); + const serviceSettings: IServiceSettings = await mapsEms.getServiceSettings(); const { uid, isActive } = license; if (isActive && license.hasAtLeast('basic')) { - serviceSettings.setQueryParams({ license: uid }); + serviceSettings.setQueryParams({ license: uid || '' }); serviceSettings.disableZoomMessage(); } else { - serviceSettings.setQueryParams({ license: undefined }); + serviceSettings.setQueryParams({ license: '' }); serviceSettings.enableZoomMessage(); } }); diff --git a/x-pack/plugins/maps_legacy_licensing/tsconfig.json b/x-pack/plugins/maps_legacy_licensing/tsconfig.json index 90e8265515a16..30a547b18a831 100644 --- a/x-pack/plugins/maps_legacy_licensing/tsconfig.json +++ b/x-pack/plugins/maps_legacy_licensing/tsconfig.json @@ -10,5 +10,6 @@ "include": ["public/**/*"], "references": [ { "path": "../licensing/tsconfig.json" }, + { "path": "../../../src/plugins/maps_ems/tsconfig.json" } ] }