diff --git a/src/core_plugins/kibana/index.js b/src/core_plugins/kibana/index.js index 686c55ebd099b..6b22f5271fb0a 100644 --- a/src/core_plugins/kibana/index.js +++ b/src/core_plugins/kibana/index.js @@ -31,9 +31,9 @@ module.exports = function (kibana) { injectVars: function (server, options) { let config = server.config(); - return { - kbnDefaultAppId: config.get('kibana.defaultAppId') + kbnDefaultAppId: config.get('kibana.defaultAppId'), + tilemap: config.get('tilemap') }; }, }, diff --git a/src/core_plugins/tests_bundle/tests_entry_template.js b/src/core_plugins/tests_bundle/tests_entry_template.js index 79645defda328..ae2e37c3bcf14 100644 --- a/src/core_plugins/tests_bundle/tests_entry_template.js +++ b/src/core_plugins/tests_bundle/tests_entry_template.js @@ -27,7 +27,14 @@ window.__KBN__ = { kbnIndex: '.kibana', esShardTimeout: 1500, esApiVersion: '2.0', - esRequestTimeout: '300000' + esRequestTimeout: '300000', + tilemap: { + url: 'https://tiles.elastic.co/v1/default/{z}/{x}/{y}.png?elastic_tile_service_tos=agree&my_app_name=kibana', + subdomains: [], + minZoom: 1, + maxZoom: 8, + attribution: '© [Elastic Tile Service](https://www.elastic.co/elastic_tile_service_tos)' + } }, uiSettings: { defaults: ${JSON.stringify(env.defaultUiSettings, null, 2).split('\n').join('\n ')}, diff --git a/src/server/config/schema.js b/src/server/config/schema.js index bb78856f1c72b..10e8bb535e795 100644 --- a/src/server/config/schema.js +++ b/src/server/config/schema.js @@ -130,6 +130,14 @@ module.exports = () => Joi.object({ status: Joi.object({ allowAnonymous: Joi.boolean().default(false) - }).default() + }).default(), + + tilemap: Joi.object({ + url: Joi.string().default('https://tiles.elastic.co/v1/default/{z}/{x}/{y}.png?elastic_tile_service_tos=agree&my_app_name=kibana'), + subdomains: Joi.array().items(Joi.string()).default([]), + minZoom: Joi.number().default(1), + maxZoom: Joi.number().default(8), + attribution: Joi.string().default('© [Elastic Tile Service](https://www.elastic.co/elastic_tile_service_tos)') + }).default(), }).default(); diff --git a/src/ui/public/vislib/styles/_tilemap.less b/src/ui/public/vislib/styles/_tilemap.less index 71887e14685aa..d3d743075d87d 100644 --- a/src/ui/public/vislib/styles/_tilemap.less +++ b/src/ui/public/vislib/styles/_tilemap.less @@ -142,6 +142,10 @@ .leaflet-control-attribution { background-color: @tilemap-leaflet-footer-bg !important; color: @tilemap-leaflet-footer-color !important; + + p { + display: inline; + } } .leaflet-left { diff --git a/src/ui/public/vislib/visualizations/_map.js b/src/ui/public/vislib/visualizations/_map.js index ce38af970b2c8..72883ce839a39 100644 --- a/src/ui/public/vislib/visualizations/_map.js +++ b/src/ui/public/vislib/visualizations/_map.js @@ -1,23 +1,27 @@ import _ from 'lodash'; import $ from 'jquery'; import L from 'leaflet'; +import marked from 'marked'; +marked.setOptions({ + gfm: true, // Github-flavored markdown + sanitize: true // Sanitize HTML tags +}); + import VislibVisualizationsMarkerTypesScaledCirclesProvider from 'ui/vislib/visualizations/marker_types/scaled_circles'; import VislibVisualizationsMarkerTypesShadedCirclesProvider from 'ui/vislib/visualizations/marker_types/shaded_circles'; import VislibVisualizationsMarkerTypesGeohashGridProvider from 'ui/vislib/visualizations/marker_types/geohash_grid'; import VislibVisualizationsMarkerTypesHeatmapProvider from 'ui/vislib/visualizations/marker_types/heatmap'; -export default function MapFactory(Private) { +export default function MapFactory(Private, tilemap) { let defaultMapZoom = 2; let defaultMapCenter = [15, 5]; let defaultMarkerType = 'Scaled Circle Markers'; let mapTiles = { - url: 'https://otile{s}-s.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpeg', + url: tilemap.url, options: { - attribution: 'Tiles by MapQuest — ' + - 'Map data © OpenStreetMap contributors, ' + - 'CC-BY-SA', - subdomains: '1234' + attribution: marked(tilemap.attribution), + subdomains: tilemap.subdomains } }; @@ -52,8 +56,8 @@ export default function MapFactory(Private) { this._attr = params.attr || {}; let mapOptions = { - minZoom: 1, - maxZoom: 18, + minZoom: tilemap.minZoom, + maxZoom: tilemap.maxZoom, noWrap: true, maxBounds: L.latLngBounds([-90, -220], [90, 220]), scrollWheelZoom: false,