From 58844a0296e8f802e99f973e963e26e2fdf3799c Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 12 Jul 2016 17:29:00 -0400 Subject: [PATCH 01/15] [viz] Allow for configurable map urls --- src/core_plugins/kibana/index.js | 4 ++-- .../tests_bundle/tests_entry_template.js | 9 ++++++++- src/server/config/schema.js | 10 +++++++++- src/ui/public/vislib/styles/_tilemap.less | 4 ++++ src/ui/public/vislib/visualizations/_map.js | 20 +++++++++++-------- 5 files changed, 35 insertions(+), 12 deletions(-) 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, From 0b9388ce830af359ff73894189b4dda40b0dfbcd Mon Sep 17 00:00:00 2001 From: Chris Earle Date: Tue, 12 Jul 2016 20:31:04 -0400 Subject: [PATCH 02/15] Adds every config option from Leaflet --- .../tests_bundle/tests_entry_template.js | 9 ++--- src/server/config/schema.js | 33 ++++++++++++++++--- src/ui/public/vislib/visualizations/_map.js | 14 ++++---- 3 files changed, 41 insertions(+), 15 deletions(-) diff --git a/src/core_plugins/tests_bundle/tests_entry_template.js b/src/core_plugins/tests_bundle/tests_entry_template.js index ae2e37c3bcf14..bf1ef79fe0fa2 100644 --- a/src/core_plugins/tests_bundle/tests_entry_template.js +++ b/src/core_plugins/tests_bundle/tests_entry_template.js @@ -30,10 +30,11 @@ window.__KBN__ = { 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)' + options: { + minZoom: 0, + maxZoom: 8, + attribution: '© [Elastic Tile Service](https://www.elastic.co/elastic_tile_service_tos)' + } } }, uiSettings: { diff --git a/src/server/config/schema.js b/src/server/config/schema.js index 10e8bb535e795..605093c97fbb8 100644 --- a/src/server/config/schema.js +++ b/src/server/config/schema.js @@ -134,10 +134,35 @@ module.exports = () => Joi.object({ 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)') + options: Joi.object({ + attribution: Joi.string().default('© [Elastic Tile Service](https://www.elastic.co/elastic_tile_service_tos)'), + minZoom: Joi.number().default(0), + maxZoom: Joi.number().default(8), + maxNativeZoom: Joi.number().optional(), + tileSize: Joi.number().optional(), + subdomains: Joi.array().items(Joi.string()).single().optional(), + errorTileUrl: Joi.string().uri().optional(), + tms: Joi.boolean().optional(), + continuousWorld: Joi.boolean().optional(), + noWrap: Joi.boolean().optional(), + zoomOffset: Joi.number().optional(), + zoomReverse: Joi.boolean().optional(), + opacity: Joi.number().optional(), + zIndex: Joi.number().optional(), + unloadInvisibleTiles: Joi.boolean().optional(), + detectRetina: Joi.boolean().optional(), + reuseTiles: Joi.boolean().optional(), + bounds: Joi.object({ + southWest: Joi.object({ + lat: Joi.number().required(), + lng: Joi.number().required() + }).required(), + northEast: Joi.object({ + lat: Joi.number().required(), + lng: Joi.number().required() + }).required() + }).optional() + }).default() }).default(), }).default(); diff --git a/src/ui/public/vislib/visualizations/_map.js b/src/ui/public/vislib/visualizations/_map.js index 72883ce839a39..c4f79f8b26718 100644 --- a/src/ui/public/vislib/visualizations/_map.js +++ b/src/ui/public/vislib/visualizations/_map.js @@ -17,12 +17,13 @@ export default function MapFactory(Private, tilemap) { let defaultMapCenter = [15, 5]; let defaultMarkerType = 'Scaled Circle Markers'; + let tilemapOptions = tilemap.options; + + tilemapOptions.attribution = marked(tilemapOptions.attribution); + let mapTiles = { url: tilemap.url, - options: { - attribution: marked(tilemap.attribution), - subdomains: tilemap.subdomains - } + options: tilemapOptions }; let markerTypes = { @@ -56,11 +57,10 @@ export default function MapFactory(Private, tilemap) { this._attr = params.attr || {}; let mapOptions = { - minZoom: tilemap.minZoom, - maxZoom: tilemap.maxZoom, + minZoom: tilemapOptions.minZoom, + maxZoom: tilemapOptions.maxZoom, noWrap: true, maxBounds: L.latLngBounds([-90, -220], [90, 220]), - scrollWheelZoom: false, fadeAnimation: false, }; From b1f8ac8afe2ec8947cc40db14f80ea8d17272b13 Mon Sep 17 00:00:00 2001 From: Chris Earle Date: Tue, 12 Jul 2016 21:07:01 -0400 Subject: [PATCH 03/15] Removed confusing config options --- src/server/config/schema.js | 9 --------- src/ui/public/vislib/visualizations/_map.js | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/server/config/schema.js b/src/server/config/schema.js index 605093c97fbb8..c7fa9ace9fdb8 100644 --- a/src/server/config/schema.js +++ b/src/server/config/schema.js @@ -138,19 +138,10 @@ module.exports = () => Joi.object({ attribution: Joi.string().default('© [Elastic Tile Service](https://www.elastic.co/elastic_tile_service_tos)'), minZoom: Joi.number().default(0), maxZoom: Joi.number().default(8), - maxNativeZoom: Joi.number().optional(), tileSize: Joi.number().optional(), subdomains: Joi.array().items(Joi.string()).single().optional(), errorTileUrl: Joi.string().uri().optional(), tms: Joi.boolean().optional(), - continuousWorld: Joi.boolean().optional(), - noWrap: Joi.boolean().optional(), - zoomOffset: Joi.number().optional(), - zoomReverse: Joi.boolean().optional(), - opacity: Joi.number().optional(), - zIndex: Joi.number().optional(), - unloadInvisibleTiles: Joi.boolean().optional(), - detectRetina: Joi.boolean().optional(), reuseTiles: Joi.boolean().optional(), bounds: Joi.object({ southWest: Joi.object({ diff --git a/src/ui/public/vislib/visualizations/_map.js b/src/ui/public/vislib/visualizations/_map.js index c4f79f8b26718..8a6910c94ba93 100644 --- a/src/ui/public/vislib/visualizations/_map.js +++ b/src/ui/public/vislib/visualizations/_map.js @@ -23,7 +23,7 @@ export default function MapFactory(Private, tilemap) { let mapTiles = { url: tilemap.url, - options: tilemapOptions + options: tilemapOptions }; let markerTypes = { From c670a1c415002e8ef5e6910e3c53cfa8c14fcf97 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 12 Jul 2016 22:52:39 -0400 Subject: [PATCH 04/15] [vis] Don't rewrite markdown --- src/ui/public/vislib/visualizations/_map.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ui/public/vislib/visualizations/_map.js b/src/ui/public/vislib/visualizations/_map.js index 8a6910c94ba93..5b5f20eee7a86 100644 --- a/src/ui/public/vislib/visualizations/_map.js +++ b/src/ui/public/vislib/visualizations/_map.js @@ -18,12 +18,11 @@ export default function MapFactory(Private, tilemap) { let defaultMarkerType = 'Scaled Circle Markers'; let tilemapOptions = tilemap.options; - - tilemapOptions.attribution = marked(tilemapOptions.attribution); + let attribution = marked(tilemapOptions.attribution); let mapTiles = { url: tilemap.url, - options: tilemapOptions + options: _.assign({}, tilemapOptions, { attribution }) }; let markerTypes = { From 7c8ec7560c991e730aa34ad9ee647195fc78bf66 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 12 Jul 2016 22:55:16 -0400 Subject: [PATCH 05/15] [config] Update default tile link --- src/server/config/schema.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/config/schema.js b/src/server/config/schema.js index c7fa9ace9fdb8..c91da09e95f85 100644 --- a/src/server/config/schema.js +++ b/src/server/config/schema.js @@ -135,7 +135,7 @@ module.exports = () => Joi.object({ 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'), options: Joi.object({ - attribution: Joi.string().default('© [Elastic Tile Service](https://www.elastic.co/elastic_tile_service_tos)'), + attribution: Joi.string().default('© [Elastic Tile Service](https://www.elastic.co/elastic_tile_service)'), minZoom: Joi.number().default(0), maxZoom: Joi.number().default(8), tileSize: Joi.number().optional(), From 6d8f803f2b33b74fb157236bffa7948e34663625 Mon Sep 17 00:00:00 2001 From: Chris Earle Date: Tue, 12 Jul 2016 22:58:07 -0400 Subject: [PATCH 06/15] Change bounds from object to GeoJSON (long, lat) array style --- src/server/config/schema.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/server/config/schema.js b/src/server/config/schema.js index c91da09e95f85..2386a4fe7a8a7 100644 --- a/src/server/config/schema.js +++ b/src/server/config/schema.js @@ -143,16 +143,7 @@ module.exports = () => Joi.object({ errorTileUrl: Joi.string().uri().optional(), tms: Joi.boolean().optional(), reuseTiles: Joi.boolean().optional(), - bounds: Joi.object({ - southWest: Joi.object({ - lat: Joi.number().required(), - lng: Joi.number().required() - }).required(), - northEast: Joi.object({ - lat: Joi.number().required(), - lng: Joi.number().required() - }).required() - }).optional() + bounds: Joi.array().items(Joi.array().items(Joi.number()).min(2).required()).min(2).optional() }).default() }).default(), From b7629490ad8c1667c0c84d2fec4622404dcba2e7 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 12 Jul 2016 23:07:47 -0400 Subject: [PATCH 07/15] [config] Set max zoom to 7 --- src/server/config/schema.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/config/schema.js b/src/server/config/schema.js index 2386a4fe7a8a7..b14290c96b28e 100644 --- a/src/server/config/schema.js +++ b/src/server/config/schema.js @@ -137,7 +137,7 @@ module.exports = () => Joi.object({ options: Joi.object({ attribution: Joi.string().default('© [Elastic Tile Service](https://www.elastic.co/elastic_tile_service)'), minZoom: Joi.number().default(0), - maxZoom: Joi.number().default(8), + maxZoom: Joi.number().default(7), tileSize: Joi.number().optional(), subdomains: Joi.array().items(Joi.string()).single().optional(), errorTileUrl: Joi.string().uri().optional(), From c3d203f07b187e84ab6c884a8e789de524972720 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Wed, 13 Jul 2016 00:04:04 -0400 Subject: [PATCH 08/15] [tests] Cleanup schema data --- src/core_plugins/tests_bundle/tests_entry_template.js | 4 ++-- src/server/config/schema.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core_plugins/tests_bundle/tests_entry_template.js b/src/core_plugins/tests_bundle/tests_entry_template.js index bf1ef79fe0fa2..eda06891bb2a8 100644 --- a/src/core_plugins/tests_bundle/tests_entry_template.js +++ b/src/core_plugins/tests_bundle/tests_entry_template.js @@ -32,8 +32,8 @@ window.__KBN__ = { url: 'https://tiles.elastic.co/v1/default/{z}/{x}/{y}.png?elastic_tile_service_tos=agree&my_app_name=kibana', options: { minZoom: 0, - maxZoom: 8, - attribution: '© [Elastic Tile Service](https://www.elastic.co/elastic_tile_service_tos)' + maxZoom: 7, + attribution: '© [Elastic Tile Service](https://www.elastic.co/elastic_tile_service)' } } }, diff --git a/src/server/config/schema.js b/src/server/config/schema.js index b14290c96b28e..988d0dde5b8da 100644 --- a/src/server/config/schema.js +++ b/src/server/config/schema.js @@ -145,6 +145,6 @@ module.exports = () => Joi.object({ reuseTiles: Joi.boolean().optional(), bounds: Joi.array().items(Joi.array().items(Joi.number()).min(2).required()).min(2).optional() }).default() - }).default(), + }).default() }).default(); From 3c1339e17c31ad9d10d94be3452ff9ea43dd6cb4 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Wed, 13 Jul 2016 11:25:16 -0400 Subject: [PATCH 09/15] [vis] Bound tilemap zoom --- src/ui/public/vislib/visualizations/_map.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/public/vislib/visualizations/_map.js b/src/ui/public/vislib/visualizations/_map.js index 5b5f20eee7a86..15cb9091712c2 100644 --- a/src/ui/public/vislib/visualizations/_map.js +++ b/src/ui/public/vislib/visualizations/_map.js @@ -51,7 +51,7 @@ export default function MapFactory(Private, tilemap) { this._valueFormatter = params.valueFormatter || _.identity; this._tooltipFormatter = params.tooltipFormatter || _.identity; this._geoJson = _.get(this._chartData, 'geoJson'); - this._mapZoom = params.zoom || defaultMapZoom; + this._mapZoom = Math.max(Math.min(params.zoom || defaultMapZoom, tilemapOptions.maxZoom), tilemapOptions.minZoom); this._mapCenter = params.center || defaultMapCenter; this._attr = params.attr || {}; From 41fbb060c426c79c4198d00c8cee60aa0795c4be Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Fri, 15 Jul 2016 16:50:47 -0400 Subject: [PATCH 10/15] Round out support for the initial Elastic Tile Service Correct links, legacy config handling, and wms server conditionals. --- src/cli/serve/legacy_config.js | 5 +++++ src/core_plugins/tests_bundle/tests_entry_template.js | 2 +- src/server/config/schema.js | 8 +++++--- src/ui/public/vislib/visualizations/_map.js | 7 +++++++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/cli/serve/legacy_config.js b/src/cli/serve/legacy_config.js index 75fbb4e407eac..591a4fd1a6f8c 100644 --- a/src/cli/serve/legacy_config.js +++ b/src/cli/serve/legacy_config.js @@ -30,6 +30,11 @@ export const legacySettings = { request_timeout: 'elasticsearch.requestTimeout', shard_timeout: 'elasticsearch.shardTimeout', startup_timeout: 'elasticsearch.startupTimeout', + tilemap_url: 'tilemap.url', + tilemap_min_zoom: 'tilemap.options.minZoom', + tilemap_max_zoom: 'tilemap.options.maxZoom', + tilemap_attribution: 'tilemap.options.attribution', + tilemap_subdomains: 'tilemap.options.subdomains', verify_ssl: 'elasticsearch.ssl.verify', }; diff --git a/src/core_plugins/tests_bundle/tests_entry_template.js b/src/core_plugins/tests_bundle/tests_entry_template.js index eda06891bb2a8..544890c6d350d 100644 --- a/src/core_plugins/tests_bundle/tests_entry_template.js +++ b/src/core_plugins/tests_bundle/tests_entry_template.js @@ -29,7 +29,7 @@ window.__KBN__ = { esApiVersion: '2.0', esRequestTimeout: '300000', tilemap: { - url: 'https://tiles.elastic.co/v1/default/{z}/{x}/{y}.png?elastic_tile_service_tos=agree&my_app_name=kibana', + url: 'https://tiles.elastic.co/v1/default/{z}/{x}/{y}.png?my_app_name=kibana&my_app_version=1.2.3&elastic_tile_service_tos=agree', options: { minZoom: 0, maxZoom: 7, diff --git a/src/server/config/schema.js b/src/server/config/schema.js index 988d0dde5b8da..be05940c08391 100644 --- a/src/server/config/schema.js +++ b/src/server/config/schema.js @@ -8,6 +8,8 @@ import os from 'os'; import { fromRoot } from '../../utils'; import { getData } from '../path'; +import pkg from '../../../src/utils/package_json'; + module.exports = () => Joi.object({ pkg: Joi.object({ version: Joi.string().default(Joi.ref('$version')), @@ -133,10 +135,10 @@ module.exports = () => Joi.object({ }).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'), + url: Joi.string().default(`https://tiles.elastic.co/v1/default/{z}/{x}/{y}.png?my_app_name=kibana&my_app_version=${pkg.version}&elastic_tile_service_tos=agree`), options: Joi.object({ - attribution: Joi.string().default('© [Elastic Tile Service](https://www.elastic.co/elastic_tile_service)'), - minZoom: Joi.number().default(0), + attribution: Joi.string().default('© [Elastic Tile Service](https://www.elastic.co/elastic-tile-service)'), + minZoom: Joi.number().min(1, 'Must not be less than 1').default(1), maxZoom: Joi.number().default(7), tileSize: Joi.number().optional(), subdomains: Joi.array().items(Joi.string()).single().optional(), diff --git a/src/ui/public/vislib/visualizations/_map.js b/src/ui/public/vislib/visualizations/_map.js index 15cb9091712c2..d9c4218ff46b1 100644 --- a/src/ui/public/vislib/visualizations/_map.js +++ b/src/ui/public/vislib/visualizations/_map.js @@ -278,6 +278,13 @@ export default function MapFactory(Private, tilemap) { TileMapMap.prototype._createMap = function (mapOptions) { if (this.map) this.destroy(); + if (this._attr.wms.enabled) { + _.assign(mapOptions, { + minZoom: 1, + maxZoom: 18 + }); + } + // add map tiles layer, using the mapTiles object settings if (this._attr.wms && this._attr.wms.enabled) { this._tileLayer = L.tileLayer.wms(this._attr.wms.url, this._attr.wms.options); From 6494caa789d8b7069a82b376f586d7560ef03993 Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Fri, 15 Jul 2016 17:11:36 -0400 Subject: [PATCH 11/15] Made minZoom in test fixture consistent with reality --- src/core_plugins/tests_bundle/tests_entry_template.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core_plugins/tests_bundle/tests_entry_template.js b/src/core_plugins/tests_bundle/tests_entry_template.js index 544890c6d350d..257ca69113c50 100644 --- a/src/core_plugins/tests_bundle/tests_entry_template.js +++ b/src/core_plugins/tests_bundle/tests_entry_template.js @@ -31,7 +31,7 @@ window.__KBN__ = { tilemap: { url: 'https://tiles.elastic.co/v1/default/{z}/{x}/{y}.png?my_app_name=kibana&my_app_version=1.2.3&elastic_tile_service_tos=agree', options: { - minZoom: 0, + minZoom: 1, maxZoom: 7, attribution: '© [Elastic Tile Service](https://www.elastic.co/elastic_tile_service)' } From c74041cadbc56c706dfc8021f0316d4807cc614f Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Fri, 15 Jul 2016 17:15:10 -0400 Subject: [PATCH 12/15] Correctly check for enabled wms to determine zoom Without this defensive check, a JS console error is thrown whenever wms is not configured for a map visualization. --- src/ui/public/vislib/visualizations/_map.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/public/vislib/visualizations/_map.js b/src/ui/public/vislib/visualizations/_map.js index d9c4218ff46b1..a7a1e1eda0726 100644 --- a/src/ui/public/vislib/visualizations/_map.js +++ b/src/ui/public/vislib/visualizations/_map.js @@ -278,7 +278,7 @@ export default function MapFactory(Private, tilemap) { TileMapMap.prototype._createMap = function (mapOptions) { if (this.map) this.destroy(); - if (this._attr.wms.enabled) { + if (this._attr.wms && this._attr.wms.enabled) { _.assign(mapOptions, { minZoom: 1, maxZoom: 18 From ca5a96838b0679df4697847cc085f5bc858092d1 Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Fri, 15 Jul 2016 17:35:21 -0400 Subject: [PATCH 13/15] Remove duplicate wms conditional in tilemap createmap This separation made sense in the original implementation, but it is not necessary in this version. --- src/ui/public/vislib/visualizations/_map.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/ui/public/vislib/visualizations/_map.js b/src/ui/public/vislib/visualizations/_map.js index a7a1e1eda0726..405d1a1be32e1 100644 --- a/src/ui/public/vislib/visualizations/_map.js +++ b/src/ui/public/vislib/visualizations/_map.js @@ -278,15 +278,12 @@ export default function MapFactory(Private, tilemap) { TileMapMap.prototype._createMap = function (mapOptions) { if (this.map) this.destroy(); + // add map tiles layer, using the mapTiles object settings if (this._attr.wms && this._attr.wms.enabled) { _.assign(mapOptions, { minZoom: 1, maxZoom: 18 }); - } - - // add map tiles layer, using the mapTiles object settings - if (this._attr.wms && this._attr.wms.enabled) { this._tileLayer = L.tileLayer.wms(this._attr.wms.url, this._attr.wms.options); } else { this._tileLayer = L.tileLayer(mapTiles.url, mapTiles.options); From 2feac112f389974afb6830d10a02df228e8b0429 Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Tue, 19 Jul 2016 13:34:38 -0400 Subject: [PATCH 14/15] Remove optional joi references in tilemap config In joi, configurations are optional by default, so there's no need to be explicit here. --- src/server/config/schema.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/server/config/schema.js b/src/server/config/schema.js index be05940c08391..a12098be16c81 100644 --- a/src/server/config/schema.js +++ b/src/server/config/schema.js @@ -140,12 +140,12 @@ module.exports = () => Joi.object({ attribution: Joi.string().default('© [Elastic Tile Service](https://www.elastic.co/elastic-tile-service)'), minZoom: Joi.number().min(1, 'Must not be less than 1').default(1), maxZoom: Joi.number().default(7), - tileSize: Joi.number().optional(), - subdomains: Joi.array().items(Joi.string()).single().optional(), - errorTileUrl: Joi.string().uri().optional(), - tms: Joi.boolean().optional(), - reuseTiles: Joi.boolean().optional(), - bounds: Joi.array().items(Joi.array().items(Joi.number()).min(2).required()).min(2).optional() + tileSize: Joi.number(), + subdomains: Joi.array().items(Joi.string()).single(), + errorTileUrl: Joi.string().uri(), + tms: Joi.boolean(), + reuseTiles: Joi.boolean(), + bounds: Joi.array().items(Joi.array().items(Joi.number()).min(2).required()).min(2) }).default() }).default() From 2862f94cda962bb78b6c31f11a745b664d758fd7 Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Tue, 19 Jul 2016 13:39:40 -0400 Subject: [PATCH 15/15] Re-disable scroll wheel zoom on maps Enabling scroll wheel search does not seem necessary in the context of this overall bug fix. --- src/ui/public/vislib/visualizations/_map.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ui/public/vislib/visualizations/_map.js b/src/ui/public/vislib/visualizations/_map.js index 405d1a1be32e1..44aadba055b4b 100644 --- a/src/ui/public/vislib/visualizations/_map.js +++ b/src/ui/public/vislib/visualizations/_map.js @@ -60,6 +60,7 @@ export default function MapFactory(Private, tilemap) { maxZoom: tilemapOptions.maxZoom, noWrap: true, maxBounds: L.latLngBounds([-90, -220], [90, 220]), + scrollWheelZoom: false, fadeAnimation: false, };