-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Maps] Isolate maps-setting froms maps_legacy #92918
Merged
thomasneirynck
merged 33 commits into
elastic:master
from
thomasneirynck:maps/add_maps_ems
Mar 15, 2021
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
22de368
init boiler
thomasneirynck bc68048
Merge branch 'master' of github.com:elastic/kibana into maps/add_maps…
thomasneirynck fcd19cf
type fixes (1)
thomasneirynck d1a5870
Merge branch 'master' of github.com:elastic/kibana into maps/add_maps…
thomasneirynck 3fb1cee
ts fixes
thomasneirynck 322f737
remove comma
thomasneirynck b52d925
convert to ts
thomasneirynck c00731a
fix deps
thomasneirynck 6fe19b9
more typing
thomasneirynck 2259d9e
Merge branch 'master' of github.com:elastic/kibana into maps/add_maps…
thomasneirynck 37060ff
Merge branch 'master' of github.com:elastic/kibana into maps/add_maps…
thomasneirynck 63013cf
fix ts types
thomasneirynck dbee0c6
align ts with ems-client
thomasneirynck 1515d43
build plugin list
thomasneirynck c1662e3
Merge branch 'master' of github.com:elastic/kibana into maps/add_maps…
thomasneirynck fb30c5d
make typing more strict
thomasneirynck afbd3b2
Merge branch 'master' of github.com:elastic/kibana into maps/add_maps…
thomasneirynck e835b39
move to common
thomasneirynck a7ac778
remove duplicate tilemap/regionmap configs
thomasneirynck 3a773f8
remove dupe types
thomasneirynck e85fded
only import type
thomasneirynck 32ce7de
type import
thomasneirynck 357c9b3
remove export
thomasneirynck ac9ac35
remove export
thomasneirynck 424a4a1
add typing
thomasneirynck 788be87
generate bundles
thomasneirynck 3fbd3d8
Merge branch 'master' of github.com:elastic/kibana into maps/add_maps…
thomasneirynck 40d3f90
remove autogen
thomasneirynck 5b4b6c7
feedback
thomasneirynck 37aa88b
re move unused
thomasneirynck 2c152e0
ts fixes
thomasneirynck f515a7c
update limit
thomasneirynck 929ca7b
Merge branch 'master' into maps/add_maps_ems
kibanamachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Maps EMS | ||
|
||
Configuration of kibana-wide EMS settings and some higher level utilities. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<typeof layerConfigSchema>; | ||
|
||
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<typeof emsConfigSchema>; | ||
export type TileMapConfig = TypeOf<typeof tilemapConfigSchema>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: ['<rootDir>/src/plugins/maps_ems'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"id": "mapsEms", | ||
"version": "8.0.0", | ||
"kibanaVersion": "kibana", | ||
"configPath": ["map"], | ||
"ui": true, | ||
"server": true, | ||
"extraPublicDirs": ["common"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<IServiceSettings>; | ||
} | ||
export type MapsEmsPluginStart = ReturnType<MapsEmsPlugin['start']>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<MapsEmsPluginSetup, MapsEmsPluginStart> { | ||
readonly _initializerContext: PluginInitializerContext<MapsEmsConfig>; | ||
|
||
constructor(initializerContext: PluginInitializerContext<MapsEmsConfig>) { | ||
this._initializerContext = initializerContext; | ||
} | ||
|
||
public setup(core: CoreSetup, plugins: MapsEmsSetupDependencies) { | ||
const config = this._initializerContext.config.get<MapsEmsConfig>(); | ||
const kibanaVersion = this._initializerContext.env.packageInfo.version; | ||
|
||
setKibanaVersion(kibanaVersion); | ||
setMapsEmsConfig(config); | ||
|
||
return { | ||
getServiceSettings, | ||
config, | ||
}; | ||
} | ||
|
||
public start(core: CoreStart, plugins: MapsEmsStartDependencies) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,4 @@ | |
* Side Public License, v 1. | ||
*/ | ||
|
||
export * from './ems_defaults'; | ||
export * from './service_settings_types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could
mapsLegacy
be reduced since this was broken out?Running
node scripts/build_kibana_platform_plugins.js --update-limits
it looks likemapsLegacy
could be set to87859
which is 5k above the current size.