-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
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
- Loading branch information
1 parent
d1ded01
commit 366ad49
Showing
80 changed files
with
550 additions
and
350 deletions.
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.