From 6c38371033e995da45b90c769c2908065d04fd6c Mon Sep 17 00:00:00 2001 From: Kawika Avilla Date: Tue, 9 Mar 2021 22:32:18 +0000 Subject: [PATCH] [Rename] maps-legacy plugin Signed-off-by: Kawika Avilla --- src/plugins/maps_legacy/config.ts | 6 +- src/plugins/maps_legacy/kibana.json | 9 -- .../maps_legacy/opensearch_dashboards.json | 9 ++ .../__tests__/map/ems_mocks/sample_files.json | 108 +++++++++--------- .../map/ems_mocks/sample_manifest.json | 4 +- .../__tests__/map/ems_mocks/sample_tiles.json | 10 +- .../public/common/constants/origin.ts | 3 +- .../legacy_map_deprecation_message.tsx | 7 +- .../components/wms_internal_options.tsx | 2 +- .../public/components/wms_options.tsx | 4 +- .../public/get_service_settings.ts | 2 +- src/plugins/maps_legacy/public/index.ts | 6 +- .../public/lazy_load_bundle/index.ts | 6 +- .../public/lazy_load_bundle/lazy/index.ts | 2 +- .../public/map/_leaflet_overrides.scss | 2 +- .../public/map/base_maps_visualization.js | 76 ++++++------ .../maps_legacy/public/map/map_messages.js | 10 +- ...na_map.js => opensearch_dashboards_map.js} | 66 +++++------ ....js => opensearch_dashboards_map_layer.js} | 2 +- .../maps_legacy/public/map/precision.ts | 2 +- .../public/map/service_settings.js | 28 ++--- .../public/map/service_settings.test.js | 38 +++--- ...s.js => opensearch_dashboards_services.js} | 6 +- src/plugins/maps_legacy/public/plugin.ts | 12 +- src/plugins/maps_legacy/server/index.ts | 6 +- src/plugins/maps_legacy/server/ui_settings.ts | 6 +- 26 files changed, 217 insertions(+), 215 deletions(-) delete mode 100644 src/plugins/maps_legacy/kibana.json create mode 100644 src/plugins/maps_legacy/opensearch_dashboards.json rename src/plugins/maps_legacy/public/map/{kibana_map.js => opensearch_dashboards_map.js} (90%) rename src/plugins/maps_legacy/public/map/{kibana_map_layer.js => opensearch_dashboards_map_layer.js} (95%) rename src/plugins/maps_legacy/public/{kibana_services.js => opensearch_dashboards_services.js} (87%) diff --git a/src/plugins/maps_legacy/config.ts b/src/plugins/maps_legacy/config.ts index f49d56dedd45..c98318bf1e4b 100644 --- a/src/plugins/maps_legacy/config.ts +++ b/src/plugins/maps_legacy/config.ts @@ -17,13 +17,13 @@ * under the License. */ -import { schema, TypeOf } from '@kbn/config-schema'; +import { schema, TypeOf } from '@osd/config-schema'; import { configSchema as tilemapSchema } from '../tile_map/config'; import { configSchema as regionmapSchema } from '../region_map/config'; export const configSchema = schema.object({ - includeElasticMapsService: schema.boolean({ defaultValue: true }), - proxyElasticMapsServiceInMaps: schema.boolean({ defaultValue: false }), + includeOpenSearchDashboardsMapsService: schema.boolean({ defaultValue: true }), + proxyOpenSearchDashboardsMapsServiceInMaps: schema.boolean({ defaultValue: false }), tilemap: tilemapSchema, regionmap: regionmapSchema, manifestServiceUrl: schema.string({ defaultValue: '' }), diff --git a/src/plugins/maps_legacy/kibana.json b/src/plugins/maps_legacy/kibana.json deleted file mode 100644 index d9bf33e66136..000000000000 --- a/src/plugins/maps_legacy/kibana.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "id": "mapsLegacy", - "version": "8.0.0", - "kibanaVersion": "kibana", - "configPath": ["map"], - "ui": true, - "server": true, - "requiredBundles": ["kibanaReact", "charts"] -} diff --git a/src/plugins/maps_legacy/opensearch_dashboards.json b/src/plugins/maps_legacy/opensearch_dashboards.json new file mode 100644 index 000000000000..246221ff8691 --- /dev/null +++ b/src/plugins/maps_legacy/opensearch_dashboards.json @@ -0,0 +1,9 @@ +{ + "id": "mapsLegacy", + "version": "8.0.0", + "opensearchDashboards": "opensearchDashboards", + "configPath": ["map"], + "ui": true, + "server": true, + "requiredBundles": ["opensearchDashboardsReact", "charts"] +} diff --git a/src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_files.json b/src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_files.json index 470544cf35b3..4a505db3bfbf 100644 --- a/src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_files.json +++ b/src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_files.json @@ -14,10 +14,10 @@ }, { "label": { - "en": "Elastic Maps Service" + "en": "OpenSearch Maps Service" }, "url": { - "en": "https://www.elastic.co/elastic-maps-service" + "en": "https://www.opensearch.co/opensearch-maps-service" } } ], @@ -420,7 +420,7 @@ }, { "label": { - "en": "Elastic Maps Service" + "en": "OpenSearch Maps Service" }, "url": { "en": "javascript:alert('foobar')" @@ -462,17 +462,17 @@ }, { "label": { - "en": "Elastic Maps Service" + "en": "OpenSearch Maps Service" }, "url": { - "en": "https://www.elastic.co/elastic-maps-service" + "en": "https://www.opensearch.co/opensearch-maps-service" } } ], "formats": [ { "type": "geojson", - "url": "/files/australia_states_v1.geo.json?elastic_tile_service_tos=agree", + "url": "/files/australia_states_v1.geo.json?opensearch_tile_service_tos=agree", "legacy_default": true } ], @@ -661,17 +661,17 @@ }, { "label": { - "en": "Elastic Maps Service" + "en": "OpenSearch Maps Service" }, "url": { - "en": "https://www.elastic.co/elastic-maps-service" + "en": "https://www.opensearch.co/opensearch-maps-service" } } ], "formats": [ { "type": "geojson", - "url": "/files/canada_provinces_v1.geo.json?elastic_tile_service_tos=agree", + "url": "/files/canada_provinces_v1.geo.json?opensearch_tile_service_tos=agree", "legacy_default": true } ], @@ -940,17 +940,17 @@ }, { "label": { - "en": "Elastic Maps Service" + "en": "OpenSearch Maps Service" }, "url": { - "en": "https://www.elastic.co/elastic-maps-service" + "en": "https://www.opensearch.co/opensearch-maps-service" } } ], "formats": [ { "type": "geojson", - "url": "/files/china_provinces_v1.geo.json?elastic_tile_service_tos=agree", + "url": "/files/china_provinces_v1.geo.json?opensearch_tile_service_tos=agree", "legacy_default": true } ], @@ -1298,17 +1298,17 @@ }, { "label": { - "en": "Elastic Maps Service" + "en": "OpenSearch Maps Service" }, "url": { - "en": "https://www.elastic.co/elastic-maps-service" + "en": "https://www.opensearch.co/opensearch-maps-service" } } ], "formats": [ { "type": "geojson", - "url": "/files/finland_regions_v1.geo.json?elastic_tile_service_tos=agree", + "url": "/files/finland_regions_v1.geo.json?opensearch_tile_service_tos=agree", "legacy_default": true } ], @@ -1666,17 +1666,17 @@ }, { "label": { - "en": "Elastic Maps Service" + "en": "OpenSearch Maps Service" }, "url": { - "en": "https://www.elastic.co/elastic-maps-service" + "en": "https://www.opensearch.co/opensearch-maps-service" } } ], "formats": [ { "type": "geojson", - "url": "/files/france_departments_v1.geo.json?elastic_tile_service_tos=agree", + "url": "/files/france_departments_v1.geo.json?opensearch_tile_service_tos=agree", "legacy_default": true } ], @@ -2016,17 +2016,17 @@ }, { "label": { - "en": "Elastic Maps Service" + "en": "OpenSearch Maps Service" }, "url": { - "en": "https://www.elastic.co/elastic-maps-service" + "en": "https://www.opensearch.co/opensearch-maps-service" } } ], "formats": [ { "type": "geojson", - "url": "/files/germany_states_v1.geo.json?elastic_tile_service_tos=agree", + "url": "/files/germany_states_v1.geo.json?opensearch_tile_service_tos=agree", "legacy_default": true } ], @@ -2360,17 +2360,17 @@ }, { "label": { - "en": "Elastic Maps Service" + "en": "OpenSearch Maps Service" }, "url": { - "en": "https://www.elastic.co/elastic-maps-service" + "en": "https://www.opensearch.co/opensearch-maps-service" } } ], "formats": [ { "type": "geojson", - "url": "/files/ireland_counties_v1.geo.json?elastic_tile_service_tos=agree", + "url": "/files/ireland_counties_v1.geo.json?opensearch_tile_service_tos=agree", "legacy_default": true } ], @@ -2669,17 +2669,17 @@ }, { "label": { - "en": "Elastic Maps Service" + "en": "OpenSearch Maps Service" }, "url": { - "en": "https://www.elastic.co/elastic-maps-service" + "en": "https://www.opensearch.co/opensearch-maps-service" } } ], "formats": [ { "type": "geojson", - "url": "/files/japan_prefectures_v1.geo.json?elastic_tile_service_tos=agree", + "url": "/files/japan_prefectures_v1.geo.json?opensearch_tile_service_tos=agree", "legacy_default": true } ], @@ -3035,17 +3035,17 @@ }, { "label": { - "en": "Elastic Maps Service" + "en": "OpenSearch Maps Service" }, "url": { - "en": "https://www.elastic.co/elastic-maps-service" + "en": "https://www.opensearch.co/opensearch-maps-service" } } ], "formats": [ { "type": "geojson", - "url": "/files/netherlands_provinces_v1.geo.json?elastic_tile_service_tos=agree", + "url": "/files/netherlands_provinces_v1.geo.json?opensearch_tile_service_tos=agree", "legacy_default": true } ], @@ -3341,17 +3341,17 @@ }, { "label": { - "en": "Elastic Maps Service" + "en": "OpenSearch Maps Service" }, "url": { - "en": "https://www.elastic.co/elastic-maps-service" + "en": "https://www.opensearch.co/opensearch-maps-service" } } ], "formats": [ { "type": "geojson", - "url": "/files/norway_counties_v1.geo.json?elastic_tile_service_tos=agree", + "url": "/files/norway_counties_v1.geo.json?opensearch_tile_service_tos=agree", "legacy_default": true } ], @@ -3703,17 +3703,17 @@ }, { "label": { - "en": "Elastic Maps Service" + "en": "OpenSearch Maps Service" }, "url": { - "en": "https://www.elastic.co/elastic-maps-service" + "en": "https://www.opensearch.co/opensearch-maps-service" } } ], "formats": [ { "type": "geojson", - "url": "/files/spain_provinces_v1.geo.json?elastic_tile_service_tos=agree", + "url": "/files/spain_provinces_v1.geo.json?opensearch_tile_service_tos=agree", "legacy_default": true } ], @@ -4034,17 +4034,17 @@ }, { "label": { - "en": "Elastic Maps Service" + "en": "OpenSearch Maps Service" }, "url": { - "en": "https://www.elastic.co/elastic-maps-service" + "en": "https://www.opensearch.co/opensearch-maps-service" } } ], "formats": [ { "type": "geojson", - "url": "/files/sweden_counties_v1.geo.json?elastic_tile_service_tos=agree", + "url": "/files/sweden_counties_v1.geo.json?opensearch_tile_service_tos=agree", "legacy_default": true } ], @@ -4343,17 +4343,17 @@ }, { "label": { - "en": "Elastic Maps Service" + "en": "OpenSearch Maps Service" }, "url": { - "en": "https://www.elastic.co/elastic-maps-service" + "en": "https://www.opensearch.co/opensearch-maps-service" } } ], "formats": [ { "type": "geojson", - "url": "/files/switzerland_cantons_v1.geo.json?elastic_tile_service_tos=agree", + "url": "/files/switzerland_cantons_v1.geo.json?opensearch_tile_service_tos=agree", "legacy_default": true } ], @@ -4859,17 +4859,17 @@ }, { "label": { - "en": "Elastic Maps Service" + "en": "OpenSearch Maps Service" }, "url": { - "en": "https://www.elastic.co/elastic-maps-service" + "en": "https://www.opensearch.co/opensearch-maps-service" } } ], "formats": [ { "type": "geojson", - "url": "/files/uk_subdivisions_v1.geo.json?elastic_tile_service_tos=agree", + "url": "/files/uk_subdivisions_v1.geo.json?opensearch_tile_service_tos=agree", "legacy_default": true } ], @@ -5106,17 +5106,17 @@ }, { "label": { - "en": "Elastic Maps Service" + "en": "OpenSearch Maps Service" }, "url": { - "en": "https://www.elastic.co/elastic-maps-service" + "en": "https://www.opensearch.co/opensearch-maps-service" } } ], "formats": [ { "type": "topojson", - "url": "/files/usa_counties_v2.topo.json?elastic_tile_service_tos=agree", + "url": "/files/usa_counties_v2.topo.json?opensearch_tile_service_tos=agree", "legacy_default": true } ], @@ -5473,17 +5473,17 @@ }, { "label": { - "en": "Elastic Maps Service" + "en": "OpenSearch Maps Service" }, "url": { - "en": "https://www.elastic.co/elastic-maps-service" + "en": "https://www.opensearch.co/opensearch-maps-service" } } ], "formats": [ { "type": "geojson", - "url": "/files/usa_states_v1.geo.json?elastic_tile_service_tos=agree", + "url": "/files/usa_states_v1.geo.json?opensearch_tile_service_tos=agree", "legacy_default": true } ], @@ -5763,17 +5763,17 @@ }, { "label": { - "en": "Elastic Maps Service" + "en": "OpenSearch Maps Service" }, "url": { - "en": "https://www.elastic.co/elastic-maps-service" + "en": "https://www.opensearch.co/opensearch-maps-service" } } ], "formats": [ { "type": "topojson", - "url": "/files/usa_zip_codes_v2.topo.json?elastic_tile_service_tos=agree", + "url": "/files/usa_zip_codes_v2.topo.json?opensearch_tile_service_tos=agree", "legacy_default": true } ], diff --git a/src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_manifest.json b/src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_manifest.json index 6030c8068884..cb7233a94e97 100644 --- a/src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_manifest.json +++ b/src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_manifest.json @@ -2,13 +2,13 @@ "services": [ { "id": "tiles_v2", - "name": "Elastic Maps Tile Service", + "name": "OpenSearch Maps Tile Service", "manifest": "https://tiles.foobar/v7.6/manifest", "type": "tms" }, { "id": "geo_layers", - "name": "Elastic Maps Vector Service", + "name": "OpenSearch Maps Vector Service", "manifest": "https://files.foobar/v7.6/manifest", "type": "file" } diff --git a/src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_tiles.json b/src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_tiles.json index 1bbd94879b70..14be211c1893 100644 --- a/src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_tiles.json +++ b/src/plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_tiles.json @@ -12,7 +12,7 @@ { "label": { "en": "MapTiler" }, "url": { "en": "https://www.maptiler.com" } }, { "label": { "en": "" }, - "url": { "en": "https://www.elastic.co/elastic-maps-service" } + "url": { "en": "https://www.opensearch.co/opensearch-maps-service" } } ], "formats": [ @@ -39,8 +39,8 @@ { "label": { "en": "OpenMapTiles" }, "url": { "en": "https://openmaptiles.org" } }, { "label": { "en": "MapTiler" }, "url": { "en": "https://www.maptiler.com" } }, { - "label": { "en": "Elastic Maps Service" }, - "url": { "en": "https://www.elastic.co/elastic-maps-service" } + "label": { "en": "OpenSearch Maps Service" }, + "url": { "en": "https://www.opensearch.co/opensearch-maps-service" } } ], "formats": [ @@ -67,8 +67,8 @@ { "label": { "en": "OpenMapTiles" }, "url": { "en": "https://openmaptiles.org" } }, { "label": { "en": "MapTiler" }, "url": { "en": "https://www.maptiler.com" } }, { - "label": { "en": "Elastic Maps Service" }, - "url": { "en": "https://www.elastic.co/elastic-maps-service" } + "label": { "en": "OpenSearch Maps Service" }, + "url": { "en": "https://www.opensearch.co/opensearch-maps-service" } } ], "formats": [ diff --git a/src/plugins/maps_legacy/public/common/constants/origin.ts b/src/plugins/maps_legacy/public/common/constants/origin.ts index fdf74cae4ba6..8edb862976cc 100644 --- a/src/plugins/maps_legacy/public/common/constants/origin.ts +++ b/src/plugins/maps_legacy/public/common/constants/origin.ts @@ -18,6 +18,7 @@ */ export const ORIGIN = { + // TODO: Rename EMS EMS: 'elastic_maps_service', - KIBANA_YML: 'self_hosted', + OPENSEARCH_DASHBOARDS_YML: 'self_hosted', }; diff --git a/src/plugins/maps_legacy/public/components/legacy_map_deprecation_message.tsx b/src/plugins/maps_legacy/public/components/legacy_map_deprecation_message.tsx index 3fae842663fd..34f6c2d684f6 100644 --- a/src/plugins/maps_legacy/public/components/legacy_map_deprecation_message.tsx +++ b/src/plugins/maps_legacy/public/components/legacy_map_deprecation_message.tsx @@ -19,8 +19,8 @@ import React from 'react'; import { EuiButton, EuiCallOut, EuiLink } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; -import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@osd/i18n/react'; +import { i18n } from '@osd/i18n'; interface Props { isMapsAvailable: boolean; @@ -32,12 +32,13 @@ export function LegacyMapDeprecationMessage(props: Props) { const getMapsMessage = !props.isMapsAvailable ? ( diff --git a/src/plugins/maps_legacy/public/components/wms_internal_options.tsx b/src/plugins/maps_legacy/public/components/wms_internal_options.tsx index d1def8153d1a..6c6f64501d91 100644 --- a/src/plugins/maps_legacy/public/components/wms_internal_options.tsx +++ b/src/plugins/maps_legacy/public/components/wms_internal_options.tsx @@ -19,7 +19,7 @@ import React from 'react'; import { EuiLink, EuiSpacer, EuiText, EuiScreenReaderOnly } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; +import { FormattedMessage } from '@osd/i18n/react'; import { TextInputOption } from '../../../charts/public'; import { WMSOptions } from '../common/types/external_basemap_types'; diff --git a/src/plugins/maps_legacy/public/components/wms_options.tsx b/src/plugins/maps_legacy/public/components/wms_options.tsx index 4892463bb9f8..f0f972680d42 100644 --- a/src/plugins/maps_legacy/public/components/wms_options.tsx +++ b/src/plugins/maps_legacy/public/components/wms_options.tsx @@ -19,8 +19,8 @@ import React, { useMemo } from 'react'; import { EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; -import { FormattedMessage } from '@kbn/i18n/react'; +import { i18n } from '@osd/i18n'; +import { FormattedMessage } from '@osd/i18n/react'; import { TmsLayer } from '../index'; import { Vis } from '../../../visualizations/public'; import { RegionMapVisParams } from '../common/types/region_map_types'; diff --git a/src/plugins/maps_legacy/public/get_service_settings.ts b/src/plugins/maps_legacy/public/get_service_settings.ts index 8d0656237976..6f89b6c6821f 100644 --- a/src/plugins/maps_legacy/public/get_service_settings.ts +++ b/src/plugins/maps_legacy/public/get_service_settings.ts @@ -19,7 +19,7 @@ import { lazyLoadMapsLegacyModules } from './lazy_load_bundle'; // @ts-expect-error -import { getMapsLegacyConfig } from './kibana_services'; +import { getMapsLegacyConfig } from './opensearch_dashboards_services'; import { IServiceSettings } from './map/service_settings_types'; let loadPromise: Promise; diff --git a/src/plugins/maps_legacy/public/index.ts b/src/plugins/maps_legacy/public/index.ts index fe5338b890ec..3c39927049e9 100644 --- a/src/plugins/maps_legacy/public/index.ts +++ b/src/plugins/maps_legacy/public/index.ts @@ -18,12 +18,12 @@ */ // @ts-ignore -import { PluginInitializerContext } from 'kibana/public'; +import { PluginInitializerContext } from 'opensearch-dashboards/public'; import { MapsLegacyPlugin } from './plugin'; // @ts-ignore import * as colorUtil from './map/color_util'; // @ts-ignore -import { KibanaMapLayer } from './map/kibana_map_layer'; +import { OpensearchDashboardsMapLayer } from './map/opensearch_dashboards_map_layer'; // @ts-ignore import { convertToGeoJson } from './map/convert_to_geojson'; // @ts-ignore @@ -51,7 +51,7 @@ export { colorUtil, convertToGeoJson, IServiceSettings, - KibanaMapLayer, + OpensearchDashboardsMapLayer, VectorLayer, FileLayerField, FileLayer, 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 292949503a61..f8febccedcda 100644 --- a/src/plugins/maps_legacy/public/lazy_load_bundle/index.ts +++ b/src/plugins/maps_legacy/public/lazy_load_bundle/index.ts @@ -20,7 +20,7 @@ let loadModulesPromise: Promise; interface LazyLoadedMapsLegacyModules { - KibanaMap: unknown; + OpenSearchDashboardsMap: unknown; L: unknown; ServiceSettings: unknown; } @@ -31,10 +31,10 @@ export async function lazyLoadMapsLegacyModules(): Promise { - const { KibanaMap, L, ServiceSettings } = await import('./lazy'); + const { OpenSearchDashboardsMap, L, ServiceSettings } = await import('./lazy'); resolve({ - KibanaMap, + OpenSearchDashboardsMap, L, ServiceSettings, }); 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 5031b29e74b9..df938046261f 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 @@ -18,7 +18,7 @@ */ // @ts-expect-error -export { KibanaMap } from '../../map/kibana_map'; +export { OpenSearchDashboardsMap } from '../../map/opensearch_dashboards_map'; // @ts-expect-error export { ServiceSettings } from '../../map/service_settings'; // @ts-expect-error diff --git a/src/plugins/maps_legacy/public/map/_leaflet_overrides.scss b/src/plugins/maps_legacy/public/map/_leaflet_overrides.scss index 3235bb63ca22..2018878e2708 100644 --- a/src/plugins/maps_legacy/public/map/_leaflet_overrides.scss +++ b/src/plugins/maps_legacy/public/map/_leaflet_overrides.scss @@ -74,7 +74,7 @@ $visMapLeafletSprite: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/s } } -/* over-rides leaflet popup styles to look like kibana tooltip */ +/* over-rides leaflet popup styles to look like OpenSearch Dashboards tooltip */ .leaflet-popup-content-wrapper { margin: 0; padding: 0; 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 406dae43c9b5..2be19da2fd66 100644 --- a/src/plugins/maps_legacy/public/map/base_maps_visualization.js +++ b/src/plugins/maps_legacy/public/map/base_maps_visualization.js @@ -17,10 +17,10 @@ * under the License. */ -import { i18n } from '@kbn/i18n'; +import { i18n } from '@osd/i18n'; import * as Rx from 'rxjs'; import { filter, first } from 'rxjs/operators'; -import { getEmsTileLayerId, getUiSettings, getToasts } from '../kibana_services'; +import { getEmsTileLayerId, getUiSettings, getToasts } from '../opensearch_dashboards_services'; import { lazyLoadMapsLegacyModules } from '../lazy_load_bundle'; import { getServiceSettings } from '../get_service_settings'; @@ -37,10 +37,10 @@ export function BaseMapsVisualizationProvider() { constructor(element, vis) { this.vis = vis; this._container = element; - this._kibanaMap = null; + this._opensearchDashboardsMap = null; this._chartData = null; //reference to data currently on the map. this._baseLayerDirty = true; - this._mapIsLoaded = this._makeKibanaMap(); + this._mapIsLoaded = this._makeOpenSearchDashboardsMap(); } isLoaded() { @@ -48,44 +48,44 @@ export function BaseMapsVisualizationProvider() { } destroy() { - if (this._kibanaMap) { - this._kibanaMap.destroy(); - this._kibanaMap = null; + if (this._opensearchDashboardsMap) { + this._opensearchDashboardsMap.destroy(); + this._opensearchDashboardsMap = null; } } /** * Implementation of Visualization#render. * Child-classes can extend this method if the render-complete function requires more time until rendering has completed. - * @param esResponse + * @param opensearchResponse * @param status * @return {Promise} */ - async render(esResponse, visParams) { - if (!this._kibanaMap) { + async render(opensearchResponse, visParams) { + if (!this._opensearchDashboardsMap) { //the visualization has been destroyed; return; } await this._mapIsLoaded; - this._kibanaMap.resize(); + this._opensearchDashboardsMap.resize(); this._params = visParams; await this._updateParams(); - if (this._hasESResponseChanged(esResponse)) { - await this._updateData(esResponse); + if (this._hasOpenSearchResponseChanged(opensearchResponse)) { + await this._updateData(opensearchResponse); } - this._kibanaMap.useUiStateFromVisualization(this.vis); + this._opensearchDashboardsMap.useUiStateFromVisualization(this.vis); await this._whenBaseLayerIsLoaded(); } /** - * Creates an instance of a kibana-map with a single baselayer and assigns it to the this._kibanaMap property. + * Creates an instance of a opensearch-dashboards-map with a single baselayer and assigns it to the this._opensearchDashboardsMap property. * Clients can override this method to customize the initialization. * @private */ - async _makeKibanaMap() { + async _makeOpenSearchDashboardsMap() { const options = {}; const uiState = this.vis.getUiState(); const zoomFromUiState = parseInt(uiState.get('mapZoom')); @@ -94,18 +94,18 @@ export function BaseMapsVisualizationProvider() { options.center = centerFromUIState ? centerFromUIState : this.vis.params.mapCenter; const modules = await lazyLoadMapsLegacyModules(); - this._kibanaMap = new modules.KibanaMap(this._container, options); - this._kibanaMap.setMinZoom(WMS_MINZOOM); //use a default - this._kibanaMap.setMaxZoom(WMS_MAXZOOM); //use a default + this._opensearchDashboardsMap = new modules.OpenSearchDashboardMap(this._container, options); + this._opensearchDashboardsMap.setMinZoom(WMS_MINZOOM); //use a default + this._opensearchDashboardsMap.setMaxZoom(WMS_MAXZOOM); //use a default - this._kibanaMap.addLegendControl(); - this._kibanaMap.addFitControl(); - this._kibanaMap.persistUiStateForVisualization(this.vis); + this._opensearchDashboardsMap.addLegendControl(); + this._opensearchDashboardsMap.addFitControl(); + this._opensearchDashboardsMap.persistUiStateForVisualization(this.vis); - this._kibanaMap.on('baseLayer:loaded', () => { + this._opensearchDashboardsMap.on('baseLayer:loaded', () => { this._baseLayerDirty = false; }); - this._kibanaMap.on('baseLayer:loading', () => { + this._opensearchDashboardsMap.on('baseLayer:loading', () => { this._baseLayerDirty = true; }); await this._updateBaseLayer(); @@ -128,7 +128,7 @@ export function BaseMapsVisualizationProvider() { async _updateBaseLayer() { const emsTileLayerId = getEmsTileLayerId(); - if (!this._kibanaMap) { + if (!this._opensearchDashboardsMap) { return; } @@ -153,12 +153,12 @@ export function BaseMapsVisualizationProvider() { try { if (this._wmsConfigured()) { - if (WMS_MINZOOM > this._kibanaMap.getMaxZoomLevel()) { - this._kibanaMap.setMinZoom(WMS_MINZOOM); - this._kibanaMap.setMaxZoom(WMS_MAXZOOM); + if (WMS_MINZOOM > this._opensearchDashboardsMap.getMaxZoomLevel()) { + this._opensearchDashboardsMap.setMinZoom(WMS_MINZOOM); + this._opensearchDashboardsMap.setMaxZoom(WMS_MAXZOOM); } - this._kibanaMap.setBaseLayer({ + this._opensearchDashboardsMap.setBaseLayer({ baseLayerType: 'wms', options: { minZoom: WMS_MINZOOM, @@ -177,10 +177,10 @@ export function BaseMapsVisualizationProvider() { } async _setTmsLayer(tmsLayer) { - this._kibanaMap.setMinZoom(tmsLayer.minZoom); - this._kibanaMap.setMaxZoom(tmsLayer.maxZoom); - if (this._kibanaMap.getZoomLevel() > tmsLayer.maxZoom) { - this._kibanaMap.setZoomLevel(tmsLayer.maxZoom); + this._opensearchDashboardsMap.setMinZoom(tmsLayer.minZoom); + this._opensearchDashboardsMap.setMaxZoom(tmsLayer.maxZoom); + if (this._opensearchDashboardsMap.getZoomLevel() > tmsLayer.maxZoom) { + this._opensearchDashboardsMap.setZoomLevel(tmsLayer.maxZoom); } let isDesaturated = this._getMapsParams().isDesaturated; if (typeof isDesaturated !== 'boolean') { @@ -197,7 +197,7 @@ export function BaseMapsVisualizationProvider() { const options = { ...tmsLayer }; delete options.id; delete options.subdomains; - this._kibanaMap.setBaseLayer({ + this._opensearchDashboardsMap.setBaseLayer({ baseLayerType: 'tms', options: { ...options, showZoomMessage, ...meta }, }); @@ -211,7 +211,7 @@ export function BaseMapsVisualizationProvider() { ); } - _hasESResponseChanged(data) { + _hasOpenSearchResponseChanged(data) { return this._chartData !== data; } @@ -221,9 +221,9 @@ export function BaseMapsVisualizationProvider() { async _updateParams() { const mapParams = this._getMapsParams(); await this._updateBaseLayer(); - this._kibanaMap.setLegendPosition(mapParams.legendPosition); - this._kibanaMap.setShowTooltip(mapParams.addTooltip); - this._kibanaMap.useUiStateFromVisualization(this.vis); + this._opensearchDashboardsMap.setLegendPosition(mapParams.legendPosition); + this._opensearchDashboardsMap.setShowTooltip(mapParams.addTooltip); + this._opensearchDashboardsMap.useUiStateFromVisualization(this.vis); } _getMapsParams() { diff --git a/src/plugins/maps_legacy/public/map/map_messages.js b/src/plugins/maps_legacy/public/map/map_messages.js index 3c7dca0ba9b4..fce56a786e0a 100644 --- a/src/plugins/maps_legacy/public/map/map_messages.js +++ b/src/plugins/maps_legacy/public/map/map_messages.js @@ -18,9 +18,9 @@ */ import React from 'react'; -import { FormattedMessage } from '@kbn/i18n/react'; +import { FormattedMessage } from '@osd/i18n/react'; import { EuiSpacer, EuiButtonEmpty } from '@elastic/eui'; -import { toMountPoint } from '../../../kibana_react/public'; +import { toMountPoint } from '../../../opensearch_dashboards_react/public'; export const createZoomWarningMsg = (function () { let disableZoomMsg = false; @@ -39,10 +39,10 @@ export const createZoomWarningMsg = (function () {

- {`Elastic Maps Service`} + {`OpenSearch Maps Service`} ), wms: ( diff --git a/src/plugins/maps_legacy/public/map/kibana_map.js b/src/plugins/maps_legacy/public/map/opensearch_dashboards_map.js similarity index 90% rename from src/plugins/maps_legacy/public/map/kibana_map.js rename to src/plugins/maps_legacy/public/map/opensearch_dashboards_map.js index 3948692e5567..625367756fe3 100644 --- a/src/plugins/maps_legacy/public/map/kibana_map.js +++ b/src/plugins/maps_legacy/public/map/opensearch_dashboards_map.js @@ -22,26 +22,26 @@ import { createZoomWarningMsg } from './map_messages'; import $ from 'jquery'; import { get, isEqual, escape } from 'lodash'; import { zoomToPrecision } from './zoom_to_precision'; -import { i18n } from '@kbn/i18n'; +import { i18n } from '@osd/i18n'; import { ORIGIN } from '../common/constants/origin'; -import { getToasts } from '../kibana_services'; +import { getToasts } from '../opensearch_dashboards_services'; import { L } from '../leaflet'; -function makeFitControl(fitContainer, kibanaMap) { +function makeFitControl(fitContainer, opensearchDashboardsMap) { // eslint-disable-next-line no-undef const FitControl = L.Control.extend({ options: { position: 'topleft', }, - initialize: function (fitContainer, kibanaMap) { + initialize: function (fitContainer, opensearchDashboardsMap) { this._fitContainer = fitContainer; - this._kibanaMap = kibanaMap; + this._opensearchDashboardsMap = opensearchDashboardsMap; this._leafletMap = null; }, onAdd: function (leafletMap) { this._leafletMap = leafletMap; const fitDatBoundsLabel = i18n.translate( - 'maps_legacy.kibanaMap.leaflet.fitDataBoundsAriaLabel', + 'maps_legacy.opensearchDashboardsMap.leaflet.fitDataBoundsAriaLabel', { defaultMessage: 'Fit Data Bounds' } ); $(this._fitContainer) @@ -50,7 +50,7 @@ function makeFitControl(fitContainer, kibanaMap) { ) .on('click', (e) => { e.preventDefault(); - this._kibanaMap.fitToData(); + this._opensearchDashboardsMap.fitToData(); }); return this._fitContainer; @@ -60,19 +60,19 @@ function makeFitControl(fitContainer, kibanaMap) { }, }); - return new FitControl(fitContainer, kibanaMap); + return new FitControl(fitContainer, opensearchDashboardsMap); } -function makeLegendControl(container, kibanaMap, position) { +function makeLegendControl(container, opensearchDashboardsMap, position) { // eslint-disable-next-line no-undef const LegendControl = L.Control.extend({ options: { position: 'topright', }, - initialize: function (container, kibanaMap, position) { + initialize: function (container, opensearchDashboardsMap, position) { this._legendContainer = container; - this._kibanaMap = kibanaMap; + this._opensearchDashboardsMap = opensearchDashboardsMap; this.options.position = position; }, @@ -80,30 +80,30 @@ function makeLegendControl(container, kibanaMap, position) { this._legendContainer.empty(); const $div = $('

').addClass('visMapLegend'); this._legendContainer.append($div); - const layers = this._kibanaMap.getLayers(); + const layers = this._opensearchDashboardsMap.getLayers(); layers.forEach((layer) => layer.appendLegendContents($div)); }, onAdd: function () { this._layerUpdateHandle = () => this.updateContents(); - this._kibanaMap.on('layers:update', this._layerUpdateHandle); + this._opensearchDashboardsMap.on('layers:update', this._layerUpdateHandle); this.updateContents(); return this._legendContainer.get(0); }, onRemove: function () { - this._kibanaMap.removeListener('layers:update', this._layerUpdateHandle); + this._opensearchDashboardsMap.removeListener('layers:update', this._layerUpdateHandle); this._legendContainer.empty(); }, }); - return new LegendControl(container, kibanaMap, position); + return new LegendControl(container, opensearchDashboardsMap, position); } /** - * Collects map functionality required for Kibana. + * Collects map functionality required for OpenSearch Dashboards. * Serves as simple abstraction for leaflet as well. */ -export class KibanaMap extends EventEmitter { +export class OpenSearchDashboardsMap extends EventEmitter { constructor(containerNode, options) { super(); this._containerNode = containerNode; @@ -225,7 +225,7 @@ export class KibanaMap extends EventEmitter { return this._layers.slice(); } - addLayer(kibanaLayer) { + addLayer(opensearchDashboardsLayer) { const onshowTooltip = (event) => { if (!this._showTooltip) { return; @@ -247,44 +247,44 @@ export class KibanaMap extends EventEmitter { } }; - kibanaLayer.on('showTooltip', onshowTooltip); - this._listeners.push({ name: 'showTooltip', handle: onshowTooltip, layer: kibanaLayer }); + opensearchDashboardsLayer.on('showTooltip', onshowTooltip); + this._listeners.push({ name: 'showTooltip', handle: onshowTooltip, layer: opensearchDashboardsLayer }); const onHideTooltip = () => { this._leafletMap.closePopup(); this._popup = null; }; - kibanaLayer.on('hideTooltip', onHideTooltip); - this._listeners.push({ name: 'hideTooltip', handle: onHideTooltip, layer: kibanaLayer }); + opensearchDashboardsLayer.on('hideTooltip', onHideTooltip); + this._listeners.push({ name: 'hideTooltip', handle: onHideTooltip, layer: opensearchDashboardsLayer }); const onStyleChanged = () => { if (this._leafletLegendControl) { this._leafletLegendControl.updateContents(); } }; - kibanaLayer.on('styleChanged', onStyleChanged); - this._listeners.push({ name: 'styleChanged', handle: onStyleChanged, layer: kibanaLayer }); + opensearchDashboardsLayer.on('styleChanged', onStyleChanged); + this._listeners.push({ name: 'styleChanged', handle: onStyleChanged, layer: opensearchDashboardsLayer }); - this._layers.push(kibanaLayer); - kibanaLayer.addToLeafletMap(this._leafletMap); + this._layers.push(opensearchDashboardsLayer); + opensearchDashboardsLayer.addToLeafletMap(this._leafletMap); this.emit('layers:update'); - this._addAttributions(kibanaLayer.getAttributions()); + this._addAttributions(opensearchDashboardsLayer.getAttributions()); } - removeLayer(kibanaLayer) { - if (!kibanaLayer) { + removeLayer(opensearchDashboardsLayer) { + if (!opensearchDashboardsLayer) { return; } - this._removeAttributions(kibanaLayer.getAttributions()); - const index = this._layers.indexOf(kibanaLayer); + this._removeAttributions(opensearchDashboardsLayer.getAttributions()); + const index = this._layers.indexOf(opensearchDashboardsLayer); if (index >= 0) { this._layers.splice(index, 1); - kibanaLayer.removeFromLeafletMap(this._leafletMap); + opensearchDashboardsLayer.removeFromLeafletMap(this._leafletMap); } this._listeners.forEach((listener) => { - if (listener.layer === kibanaLayer) { + if (listener.layer === opensearchDashboardsLayer) { listener.layer.removeListener(listener.name, listener.handle); } }); diff --git a/src/plugins/maps_legacy/public/map/kibana_map_layer.js b/src/plugins/maps_legacy/public/map/opensearch_dashboards_map_layer.js similarity index 95% rename from src/plugins/maps_legacy/public/map/kibana_map_layer.js rename to src/plugins/maps_legacy/public/map/opensearch_dashboards_map_layer.js index e276799ed0e1..ae69d0413bf7 100644 --- a/src/plugins/maps_legacy/public/map/kibana_map_layer.js +++ b/src/plugins/maps_legacy/public/map/opensearch_dashboards_map_layer.js @@ -19,7 +19,7 @@ import { EventEmitter } from 'events'; -export class KibanaMapLayer extends EventEmitter { +export class OpenSearchDashboardsMapLayer extends EventEmitter { constructor() { super(); this._leafletLayer = null; diff --git a/src/plugins/maps_legacy/public/map/precision.ts b/src/plugins/maps_legacy/public/map/precision.ts index a1b3b72f201a..4acef322a044 100644 --- a/src/plugins/maps_legacy/public/map/precision.ts +++ b/src/plugins/maps_legacy/public/map/precision.ts @@ -18,7 +18,7 @@ */ // @ts-ignore -import { getUiSettings } from '../kibana_services'; +import { getUiSettings } from '../opensearch_dashboards_services'; import { geohashColumns } from './decode_geo_hash'; /** diff --git a/src/plugins/maps_legacy/public/map/service_settings.js b/src/plugins/maps_legacy/public/map/service_settings.js index 833304378402..360739ee2307 100644 --- a/src/plugins/maps_legacy/public/map/service_settings.js +++ b/src/plugins/maps_legacy/public/map/service_settings.js @@ -20,11 +20,11 @@ import _ from 'lodash'; import MarkdownIt from 'markdown-it'; import { EMSClient } from '@elastic/ems-client'; -import { i18n } from '@kbn/i18n'; -import { getKibanaVersion } from '../kibana_services'; +import { i18n } from '@osd/i18n'; +import { getOpenSearchDashboardsVersion } from '../opensearch_dashboards_services'; import { ORIGIN } from '../common/constants/origin'; -const TMS_IN_YML_ID = 'TMS in config/kibana.yml'; +const TMS_IN_YML_ID = 'TMS in config/opensearch_dashboards.yml'; export class ServiceSettings { constructor(mapConfig, tilemapsConfig) { @@ -35,8 +35,8 @@ export class ServiceSettings { this._showZoomMessage = true; this._emsClient = new EMSClient({ language: i18n.getLocale(), - appVersion: getKibanaVersion(), - appName: 'kibana', + appVersion: getOpenSearchDashboardsVersion(), + appName: 'opensearch-dashboards', fileApiUrl: this._mapConfig.emsFileApiUrl, tileApiUrl: this._mapConfig.emsTileApiUrl, landingPageUrl: this._mapConfig.emsLandingPageUrl, @@ -88,7 +88,7 @@ export class ServiceSettings { } _backfillSettings = (fileLayer) => { - // Older version of Kibana stored EMS state in the URL-params + // Older version of OpenSearch Dashboards stored EMS state in the URL-params // Creates object literal with required parameters as key-value pairs const format = fileLayer.getDefaultFormatType(); const meta = fileLayer.getDefaultFormatMeta(); @@ -106,7 +106,7 @@ export class ServiceSettings { }; async getFileLayers() { - if (!this._mapConfig.includeElasticMapsService) { + if (!this._mapConfig.includeOpenSearchDashboardsMapsService) { return []; } @@ -124,11 +124,11 @@ export class ServiceSettings { //use tilemap.* settings from yml const tmsService = _.cloneDeep(this.tmsOptionsFromConfig); tmsService.id = TMS_IN_YML_ID; - tmsService.origin = ORIGIN.KIBANA_YML; + tmsService.origin = ORIGIN.OPENSEARCH_DASHBOARDS_YML; allServices.push(tmsService); } - if (this._mapConfig.includeElasticMapsService) { + if (this._mapConfig.includeOpenSearchDashboardsMapsService) { const servicesFromManifest = await this._emsClient.getTMSServices(); const strippedServiceFromManifest = await Promise.all( servicesFromManifest @@ -207,14 +207,14 @@ export class ServiceSettings { async getAttributesForTMSLayer(tmsServiceConfig, isDesaturated, isDarkMode) { if (tmsServiceConfig.origin === ORIGIN.EMS) { return this._getAttributesForEMSTMSLayer(isDesaturated, isDarkMode); - } else if (tmsServiceConfig.origin === ORIGIN.KIBANA_YML) { + } else if (tmsServiceConfig.origin === ORIGIN.OPENSEARCH_DASHBOARDS_YML) { const attrs = _.pick(this._tilemapsConfig, ['url', 'minzoom', 'maxzoom', 'attribution']); - return { ...attrs, ...{ origin: ORIGIN.KIBANA_YML } }; + return { ...attrs, ...{ origin: ORIGIN.OPENSEARCH_DASHBOARDS_YML } }; } else { //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 } }; + return { ...attrs, ...{ origin: ORIGIN.OPENSEARCH_DASHBOARDS_YML } }; } else { //assume ems return this._getAttributesForEMSTMSLayer(isDesaturated, isDarkMode); @@ -246,7 +246,7 @@ export class ServiceSettings { url = this._getFileUrlFromEMS(fileLayerConfig); } else if ( fileLayerConfig.layerId && - fileLayerConfig.layerId.startsWith(`${ORIGIN.KIBANA_YML}.`) + fileLayerConfig.layerId.startsWith(`${ORIGIN.OPENSEARCH_DASHBOARDS_YML}.`) ) { //fallback for older saved objects url = fileLayerConfig.url; @@ -275,5 +275,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 OpenSearch Dashboards } diff --git a/src/plugins/maps_legacy/public/map/service_settings.test.js b/src/plugins/maps_legacy/public/map/service_settings.test.js index b924c3bb5305..5636812c4bec 100644 --- a/src/plugins/maps_legacy/public/map/service_settings.test.js +++ b/src/plugins/maps_legacy/public/map/service_settings.test.js @@ -17,8 +17,8 @@ * under the License. */ -jest.mock('../kibana_services', () => ({ - getKibanaVersion() { +jest.mock('../opensearch_dashboards_services', () => ({ + getOpenSearchDashboardsVersion() { return '1.2.3'; }, })); @@ -40,7 +40,7 @@ describe('service_settings (FKA tile_map test)', function () { const defaultMapConfig = { emsFileApiUrl, emsTileApiUrl, - includeElasticMapsService: true, + includeOpenSearchDashboardsMapsService: true, emsTileLayerId: { bright: 'road_map', desaturated: 'road_map_desaturated', @@ -100,8 +100,8 @@ describe('service_settings (FKA tile_map test)', function () { const urlObject = url.parse(attrs.url, true); expect(urlObject.hostname).toEqual('tiles.foobar'); - expect(urlObject.query.my_app_name).toEqual('kibana'); - expect(urlObject.query.elastic_tile_service_tos).toEqual('agree'); + expect(urlObject.query.my_app_name).toEqual('opensearchDashboards'); + expect(urlObject.query.opensearch_tile_service_tos).toEqual('agree'); expect(typeof urlObject.query.my_app_version).toEqual('string'); }); @@ -166,13 +166,13 @@ describe('service_settings (FKA tile_map test)', function () { { attribution: '', url: 'https://a.tile.openstreetmap.org/{z}/{x}/{y}.png', - id: 'TMS in config/kibana.yml', + id: 'TMS in config/opensearch_dashboards.yml', }, { id: 'road_map', name: 'Road Map - Bright', url: - 'https://tiles.foobar/raster/styles/osm-bright/{z}/{x}/{y}.png?elastic_tile_service_tos=agree&my_app_name=kibana&my_app_version=1.2.3', + 'https://tiles.foobar/raster/styles/osm-bright/{z}/{x}/{y}.png?opensearch_tile_service_tos=agree&my_app_name=opensearch-dashboards&my_app_version=1.2.3', minZoom: 0, maxZoom: 10, attribution: @@ -219,19 +219,19 @@ describe('service_settings (FKA tile_map test)', function () { ); expect(desaturationFalse.url).toEqual( - 'https://tiles.foobar/raster/styles/osm-bright/{z}/{x}/{y}.png?elastic_tile_service_tos=agree&my_app_name=kibana&my_app_version=1.2.3' + 'https://tiles.foobar/raster/styles/osm-bright/{z}/{x}/{y}.png?opensearch_tile_service_tos=agree&my_app_name=opensearch-dashboards&my_app_version=1.2.3' ); expect(desaturationFalse.maxZoom).toEqual(10); expect(desaturationTrue.url).toEqual( - 'https://tiles.foobar/raster/styles/osm-bright-desaturated/{z}/{x}/{y}.png?elastic_tile_service_tos=agree&my_app_name=kibana&my_app_version=1.2.3' + 'https://tiles.foobar/raster/styles/osm-bright-desaturated/{z}/{x}/{y}.png?opensearch_tile_service_tos=agree&my_app_name=opensearch-dashboards&my_app_version=1.2.3' ); expect(desaturationTrue.maxZoom).toEqual(18); expect(darkThemeDesaturationFalse.url).toEqual( - 'https://tiles.foobar/raster/styles/dark-matter/{z}/{x}/{y}.png?elastic_tile_service_tos=agree&my_app_name=kibana&my_app_version=1.2.3' + 'https://tiles.foobar/raster/styles/dark-matter/{z}/{x}/{y}.png?opensearch_tile_service_tos=agree&my_app_name=opensearch-dashboards&my_app_version=1.2.3' ); expect(darkThemeDesaturationFalse.maxZoom).toEqual(22); expect(darkThemeDesaturationTrue.url).toEqual( - 'https://tiles.foobar/raster/styles/dark-matter/{z}/{x}/{y}.png?elastic_tile_service_tos=agree&my_app_name=kibana&my_app_version=1.2.3' + 'https://tiles.foobar/raster/styles/dark-matter/{z}/{x}/{y}.png?opensearch_tile_service_tos=agree&my_app_name=opensearch-dashboards&my_app_version=1.2.3' ); expect(darkThemeDesaturationTrue.maxZoom).toEqual(22); }); @@ -239,7 +239,7 @@ describe('service_settings (FKA tile_map test)', function () { it('should exclude EMS', async () => { serviceSettings = makeServiceSettings( { - includeElasticMapsService: false, + includeOpenSearchDashboardsMapsService: false, }, { url: 'https://a.tile.openstreetmap.org/{z}/{x}/{y}.png', @@ -251,7 +251,7 @@ describe('service_settings (FKA tile_map test)', function () { { attribution: '', url: 'https://a.tile.openstreetmap.org/{z}/{x}/{y}.png', - id: 'TMS in config/kibana.yml', + id: 'TMS in config/opensearch_dashboards.yml', }, ]; expect(tilemapServices.length).toEqual(1); @@ -263,7 +263,7 @@ describe('service_settings (FKA tile_map test)', function () { it('should exclude all when not configured', async () => { serviceSettings = makeServiceSettings({ - includeElasticMapsService: false, + includeOpenSearchDashboardsMapsService: false, }); const tilemapServices = await serviceSettings.getTMSServices(); const expected = []; @@ -282,7 +282,7 @@ describe('service_settings (FKA tile_map test)', function () { expect(fileLayer.origin).toEqual(ORIGIN.EMS); const fileUrl = await serviceSettings.getUrlForRegionLayer(fileLayer); const urlObject = url.parse(fileUrl, true); - Object.keys({ foo: 'bar', elastic_tile_service_tos: 'agree' }).forEach((key) => { + Object.keys({ foo: 'bar', opensearch_tile_service_tos: 'agree' }).forEach((key) => { expect(typeof urlObject.query[key]).toEqual('string'); }); }); @@ -293,7 +293,7 @@ describe('service_settings (FKA tile_map test)', function () { it('should load manifest (individual props)', async () => { const expected = { attribution: - 'Made with NaturalEarth | Elastic Maps Service', + 'Made with NaturalEarth | OpenSearch Maps Service', format: 'geojson', fields: [ { type: 'id', name: 'iso2', description: 'ISO 3166-1 alpha-2 code' }, @@ -318,7 +318,7 @@ describe('service_settings (FKA tile_map test)', function () { it('should exclude all when not configured', async () => { const serviceSettings = makeServiceSettings({ - includeElasticMapsService: false, + includeOpenSearchDashboardsMapsService: false, }); const fileLayers = await serviceSettings.getFileLayers(); const expected = []; @@ -329,7 +329,7 @@ describe('service_settings (FKA tile_map test)', function () { const serviceSettings = makeServiceSettings(); const fileLayers = await serviceSettings.getFileLayers(); const hotlink = await serviceSettings.getEMSHotLink(fileLayers[0]); - expect(hotlink).toEqual('?locale=en#file/world_countries'); //url host undefined becuase emsLandingPageUrl is set at kibana-load + expect(hotlink).toEqual('?locale=en#file/world_countries'); //url host undefined becuase emsLandingPageUrl is set at opensearch-dashboards-load }); it('should sanitize EMS attribution', async () => { @@ -339,7 +339,7 @@ describe('service_settings (FKA tile_map test)', function () { return layer.id === 'world_countries_with_compromised_attribution'; }); expect(fileLayer.attribution).toEqual( - '<div onclick=\'alert(1\')>Made with NaturalEarth</div> | Elastic Maps Service' + '<div onclick=\'alert(1\')>Made with NaturalEarth</div> | OpenSearch Maps Service' ); }); }); diff --git a/src/plugins/maps_legacy/public/kibana_services.js b/src/plugins/maps_legacy/public/opensearch_dashboards_services.js similarity index 87% rename from src/plugins/maps_legacy/public/kibana_services.js rename to src/plugins/maps_legacy/public/opensearch_dashboards_services.js index 256b5f386d5f..ab2114685e9a 100644 --- a/src/plugins/maps_legacy/public/kibana_services.js +++ b/src/plugins/maps_legacy/public/opensearch_dashboards_services.js @@ -25,9 +25,9 @@ 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 opensearchDashboards; +export const setOpenSearchDashboardsVersion = (version) => (opensearchDashboards = version); +export const getOpenSearchDashboardsVersion = () => opensearchDashboards; let mapsLegacyConfig; export const setMapsLegacyConfig = (config) => (mapsLegacyConfig = config); diff --git a/src/plugins/maps_legacy/public/plugin.ts b/src/plugins/maps_legacy/public/plugin.ts index 17cee226cb70..a4d3133accde 100644 --- a/src/plugins/maps_legacy/public/plugin.ts +++ b/src/plugins/maps_legacy/public/plugin.ts @@ -18,9 +18,9 @@ */ // @ts-ignore -import { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from 'kibana/public'; +import { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from 'opensearch-dashboards/public'; // @ts-ignore -import { setToasts, setUiSettings, setKibanaVersion, setMapsLegacyConfig } from './kibana_services'; +import { setToasts, setUiSettings, setOpenSearchDashboardsVersion, setMapsLegacyConfig } from './opensearch_dashboards_services'; // @ts-ignore import { getPrecision, getZoomPrecision } from './map/precision'; import { MapsLegacyPluginSetup, MapsLegacyPluginStart } from './index'; @@ -38,11 +38,11 @@ import { getServiceSettings } from './get_service_settings'; export const bindSetupCoreAndPlugins = ( core: CoreSetup, config: MapsLegacyConfig, - kibanaVersion: string + opensearchDashboards: string ) => { setToasts(core.notifications.toasts); setUiSettings(core.uiSettings); - setKibanaVersion(kibanaVersion); + setOpenSearchDashboardsVersion(opensearchDashboards); setMapsLegacyConfig(config); }; @@ -60,9 +60,9 @@ export class MapsLegacyPlugin implements Plugin(); - const kibanaVersion = this._initializerContext.env.packageInfo.version; + const opensearchDashboards = this._initializerContext.env.packageInfo.version; - bindSetupCoreAndPlugins(core, config, kibanaVersion); + bindSetupCoreAndPlugins(core, config, opensearchDashboards); const getBaseMapsVis = () => new BaseMapsVisualizationProvider(); diff --git a/src/plugins/maps_legacy/server/index.ts b/src/plugins/maps_legacy/server/index.ts index 665b3b8986ef..9eda3a0ff140 100644 --- a/src/plugins/maps_legacy/server/index.ts +++ b/src/plugins/maps_legacy/server/index.ts @@ -17,7 +17,7 @@ * under the License. */ -import { Plugin, PluginConfigDescriptor } from 'kibana/server'; +import { Plugin, PluginConfigDescriptor } from 'opensearch-dashboards/server'; import { CoreSetup, PluginInitializerContext } from 'src/core/server'; import { Observable } from 'rxjs'; import { configSchema, MapsLegacyConfig } from '../config'; @@ -25,8 +25,8 @@ import { getUiSettings } from './ui_settings'; export const config: PluginConfigDescriptor = { exposeToBrowser: { - includeElasticMapsService: true, - proxyElasticMapsServiceInMaps: true, + includeOpenSearchDashboardsMapsService: true, + proxyOpenSearchDashboardsMapsServiceInMaps: true, tilemap: true, regionmap: true, manifestServiceUrl: true, diff --git a/src/plugins/maps_legacy/server/ui_settings.ts b/src/plugins/maps_legacy/server/ui_settings.ts index f92ccf848f40..95261fd19264 100644 --- a/src/plugins/maps_legacy/server/ui_settings.ts +++ b/src/plugins/maps_legacy/server/ui_settings.ts @@ -17,9 +17,9 @@ * under the License. */ -import { i18n } from '@kbn/i18n'; -import { UiSettingsParams } from 'kibana/server'; -import { schema } from '@kbn/config-schema'; +import { i18n } from '@osd/i18n'; +import { UiSettingsParams } from 'opensearch-dashboards/server'; +import { schema } from '@osd/config-schema'; export function getUiSettings(): Record> { return {