From da8d6b939a9a4780292cdc6cd243752e597b0846 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Wed, 27 Jan 2021 08:18:54 -0700 Subject: [PATCH] Migrate maps_legacy, maps_oss, region_map, and tile_map plugions to TS projects (#89351) --- src/plugins/maps_legacy/public/index.ts | 3 --- .../maps_legacy/public/map/color_util.d.ts | 11 ++++++++ .../public/map/kibana_map_layer.d.ts | 25 +++++++++++++++++++ .../maps_legacy/public/tooltip_provider.d.ts | 9 +++++++ src/plugins/maps_legacy/tsconfig.json | 14 +++++++++++ src/plugins/maps_oss/tsconfig.json | 14 +++++++++++ src/plugins/region_map/tsconfig.json | 15 +++++++++++ src/plugins/tile_map/tsconfig.json | 15 +++++++++++ tsconfig.json | 8 ++++++ tsconfig.refs.json | 4 +++ 10 files changed, 115 insertions(+), 3 deletions(-) create mode 100644 src/plugins/maps_legacy/public/map/color_util.d.ts create mode 100644 src/plugins/maps_legacy/public/map/kibana_map_layer.d.ts create mode 100644 src/plugins/maps_legacy/public/tooltip_provider.d.ts create mode 100644 src/plugins/maps_legacy/tsconfig.json create mode 100644 src/plugins/maps_oss/tsconfig.json create mode 100644 src/plugins/region_map/tsconfig.json create mode 100644 src/plugins/tile_map/tsconfig.json diff --git a/src/plugins/maps_legacy/public/index.ts b/src/plugins/maps_legacy/public/index.ts index 95550fab1ba1..9268f14995f4 100644 --- a/src/plugins/maps_legacy/public/index.ts +++ b/src/plugins/maps_legacy/public/index.ts @@ -8,9 +8,7 @@ import { PluginInitializerContext } from 'kibana/public'; import { MapsLegacyPlugin } from './plugin'; -// @ts-ignore import * as colorUtil from './map/color_util'; -// @ts-ignore import { KibanaMapLayer } from './map/kibana_map_layer'; import { VectorLayer, @@ -19,7 +17,6 @@ import { TmsLayer, IServiceSettings, } from './map/service_settings_types'; -// @ts-ignore import { mapTooltipProvider } from './tooltip_provider'; import './map/index.scss'; diff --git a/src/plugins/maps_legacy/public/map/color_util.d.ts b/src/plugins/maps_legacy/public/map/color_util.d.ts new file mode 100644 index 000000000000..9ec6b3c1fb00 --- /dev/null +++ b/src/plugins/maps_legacy/public/map/color_util.d.ts @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * and the Server Side Public License, v 1; you may not use this file except in + * compliance with, at your election, the Elastic License or the Server Side + * Public License, v 1. + */ + +export function getLegendColors(colorRamp: unknown, numLegendColors?: number): string[]; + +export function getColor(colorRamp: unknown, i: number): string; diff --git a/src/plugins/maps_legacy/public/map/kibana_map_layer.d.ts b/src/plugins/maps_legacy/public/map/kibana_map_layer.d.ts new file mode 100644 index 000000000000..222cb6b215f9 --- /dev/null +++ b/src/plugins/maps_legacy/public/map/kibana_map_layer.d.ts @@ -0,0 +1,25 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * and the Server Side Public License, v 1; you may not use this file except in + * compliance with, at your election, the Elastic License or the Server Side + * Public License, v 1. + */ + +export class KibanaMapLayer { + constructor(); + + getBounds(): Promise; + + addToLeafletMap(leafletMap: unknown): void; + + removeFromLeafletMap(leafletMap: unknown): void; + + appendLegendContents(): void; + + updateExtent(): void; + + movePointer(): void; + + getAttributions(): unknown; +} diff --git a/src/plugins/maps_legacy/public/tooltip_provider.d.ts b/src/plugins/maps_legacy/public/tooltip_provider.d.ts new file mode 100644 index 000000000000..4082a6ef83c4 --- /dev/null +++ b/src/plugins/maps_legacy/public/tooltip_provider.d.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 + * and the Server Side Public License, v 1; you may not use this file except in + * compliance with, at your election, the Elastic License or the Server Side + * Public License, v 1. + */ + +export function mapTooltipProvider(element: unknown, formatter: unknown): () => unknown; diff --git a/src/plugins/maps_legacy/tsconfig.json b/src/plugins/maps_legacy/tsconfig.json new file mode 100644 index 000000000000..e7ea06706b64 --- /dev/null +++ b/src/plugins/maps_legacy/tsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": ["common/**/*", "public/**/*", "server/**/*", "config.ts"], + "references": [ + { "path": "../vis_default_editor/tsconfig.json" }, + ] +} diff --git a/src/plugins/maps_oss/tsconfig.json b/src/plugins/maps_oss/tsconfig.json new file mode 100644 index 000000000000..03c30c3c49fd --- /dev/null +++ b/src/plugins/maps_oss/tsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": ["common/**/*", "public/**/*", "server/**/*", "config.ts"], + "references": [ + { "path": "../visualizations/tsconfig.json" }, + ] +} diff --git a/src/plugins/region_map/tsconfig.json b/src/plugins/region_map/tsconfig.json new file mode 100644 index 000000000000..40f76ece2a6f --- /dev/null +++ b/src/plugins/region_map/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": ["public/**/*", "server/**/*"], + "references": [ + { "path": "../maps_legacy/tsconfig.json" }, + { "path": "../vis_default_editor/tsconfig.json" }, + ] +} diff --git a/src/plugins/tile_map/tsconfig.json b/src/plugins/tile_map/tsconfig.json new file mode 100644 index 000000000000..40f76ece2a6f --- /dev/null +++ b/src/plugins/tile_map/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": ["public/**/*", "server/**/*"], + "references": [ + { "path": "../maps_legacy/tsconfig.json" }, + { "path": "../vis_default_editor/tsconfig.json" }, + ] +} diff --git a/tsconfig.json b/tsconfig.json index e7856aa0c874..334a3febfddd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -27,8 +27,11 @@ "src/plugins/kibana_usage_collection/**/*", "src/plugins/kibana_utils/**/*", "src/plugins/management/**/*", + "src/plugins/maps_legacy/**/*", + "src/plugins/maps_oss/**/*", "src/plugins/navigation/**/*", "src/plugins/newsfeed/**/*", + "src/plugins/region_map/**/*", "src/plugins/saved_objects/**/*", "src/plugins/saved_objects_management/**/*", "src/plugins/saved_objects_tagging_oss/**/*", @@ -37,6 +40,7 @@ "src/plugins/spaces_oss/**/*", "src/plugins/telemetry/**/*", "src/plugins/telemetry_collection_manager/**/*", + "src/plugins/tile_map/**/*", "src/plugins/timelion/**/*", "src/plugins/ui_actions/**/*", "src/plugins/url_forwarding/**/*", @@ -81,8 +85,11 @@ { "path": "./src/plugins/kibana_usage_collection/tsconfig.json" }, { "path": "./src/plugins/kibana_utils/tsconfig.json" }, { "path": "./src/plugins/management/tsconfig.json" }, + { "path": "./src/plugins/maps_legacy/tsconfig.json" }, + { "path": "./src/plugins/maps_oss/tsconfig.json" }, { "path": "./src/plugins/navigation/tsconfig.json" }, { "path": "./src/plugins/newsfeed/tsconfig.json" }, + { "path": "./src/plugins/region_map/tsconfig.json" }, { "path": "./src/plugins/saved_objects/tsconfig.json" }, { "path": "./src/plugins/saved_objects_management/tsconfig.json" }, { "path": "./src/plugins/saved_objects_tagging_oss/tsconfig.json" }, @@ -91,6 +98,7 @@ { "path": "./src/plugins/spaces_oss/tsconfig.json" }, { "path": "./src/plugins/telemetry/tsconfig.json" }, { "path": "./src/plugins/telemetry_collection_manager/tsconfig.json" }, + { "path": "./src/plugins/tile_map/tsconfig.json" }, { "path": "./src/plugins/timelion/tsconfig.json" }, { "path": "./src/plugins/ui_actions/tsconfig.json" }, { "path": "./src/plugins/url_forwarding/tsconfig.json" }, diff --git a/tsconfig.refs.json b/tsconfig.refs.json index 5edfd4231a6d..a8eecd278160 100644 --- a/tsconfig.refs.json +++ b/tsconfig.refs.json @@ -23,8 +23,11 @@ { "path": "./src/plugins/kibana_usage_collection/tsconfig.json" }, { "path": "./src/plugins/kibana_utils/tsconfig.json" }, { "path": "./src/plugins/management/tsconfig.json" }, + { "path": "./src/plugins/maps_legacy/tsconfig.json" }, + { "path": "./src/plugins/maps_oss/tsconfig.json" }, { "path": "./src/plugins/navigation/tsconfig.json" }, { "path": "./src/plugins/newsfeed/tsconfig.json" }, + { "path": "./src/plugins/region_map/tsconfig.json" }, { "path": "./src/plugins/saved_objects/tsconfig.json" }, { "path": "./src/plugins/saved_objects_management/tsconfig.json" }, { "path": "./src/plugins/saved_objects_tagging_oss/tsconfig.json" }, @@ -34,6 +37,7 @@ { "path": "./src/plugins/spaces_oss/tsconfig.json" }, { "path": "./src/plugins/telemetry/tsconfig.json" }, { "path": "./src/plugins/telemetry_collection_manager/tsconfig.json" }, + { "path": "./src/plugins/tile_map/tsconfig.json" }, { "path": "./src/plugins/timelion/tsconfig.json" }, { "path": "./src/plugins/ui_actions/tsconfig.json" }, { "path": "./src/plugins/url_forwarding/tsconfig.json" },