mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Backport PR #7724
--------- **Commit 1:** [viz] Allow for configurable map urls * Original sha:58844a0296
* Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-07-12T21:29:00Z **Commit 2:** Adds every config option from Leaflet * Original sha:0b9388ce83
* Authored by Chris Earle <chris.earle@elastic.co> on 2016-07-13T00:31:04Z * Committed by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-07-13T01:55:01Z **Commit 3:** Removed confusing config options * Original sha:b1f8ac8afe
* Authored by Chris Earle <chris.earle@elastic.co> on 2016-07-13T01:07:01Z * Committed by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-07-13T01:55:01Z **Commit 4:** [vis] Don't rewrite markdown * Original sha:c670a1c415
* Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-07-13T02:52:39Z **Commit 5:** [config] Update default tile link * Original sha:7c8ec7560c
* Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-07-13T02:55:16Z **Commit 6:** Change bounds from object to GeoJSON (long, lat) array style * Original sha:6d8f803f2b
* Authored by Chris Earle <chris.earle@elastic.co> on 2016-07-13T02:58:07Z **Commit 7:** [config] Set max zoom to 7 * Original sha:b7629490ad
* Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-07-13T03:07:47Z **Commit 8:** [tests] Cleanup schema data * Original sha:c3d203f07b
* Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-07-13T04:04:04Z **Commit 9:** [vis] Bound tilemap zoom * Original sha:3c1339e17c
* Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-07-13T15:25:16Z **Commit 10:** Round out support for the initial Elastic Tile Service Correct links, legacy config handling, and wms server conditionals. * Original sha:41fbb060c4
* Authored by Court Ewing <court@epixa.com> on 2016-07-15T20:50:47Z **Commit 11:** Made minZoom in test fixture consistent with reality * Original sha:6494caa789
* Authored by Court Ewing <court@epixa.com> on 2016-07-15T21:11:36Z **Commit 12:** 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. * Original sha:c74041cadb
* Authored by Court Ewing <court@epixa.com> on 2016-07-15T21:15:10Z **Commit 13:** Remove duplicate wms conditional in tilemap createmap This separation made sense in the original implementation, but it is not necessary in this version. * Original sha:ca5a96838b
* Authored by Court Ewing <court@epixa.com> on 2016-07-15T21:35:21Z **Commit 14:** Remove optional joi references in tilemap config In joi, configurations are optional by default, so there's no need to be explicit here. * Original sha:2feac112f3
* Authored by Court Ewing <court@epixa.com> on 2016-07-19T17:34:38Z **Commit 15:** Re-disable scroll wheel zoom on maps Enabling scroll wheel search does not seem necessary in the context of this overall bug fix. * Original sha:2862f94cda
* Authored by Court Ewing <court@epixa.com> on 2016-07-19T17:39:40Z
This commit is contained in:
parent
790202b1fe
commit
38b0117057
6 changed files with 60 additions and 13 deletions
|
@ -32,6 +32,11 @@ let legacySettingMap = {
|
|||
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',
|
||||
};
|
||||
|
||||
|
|
|
@ -38,7 +38,8 @@ module.exports = function (kibana) {
|
|||
let config = server.config();
|
||||
|
||||
return {
|
||||
kbnDefaultAppId: config.get('kibana.defaultAppId')
|
||||
kbnDefaultAppId: config.get('kibana.defaultAppId'),
|
||||
tilemap: config.get('tilemap')
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,15 @@ 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?my_app_name=kibana&my_app_version=1.2.3&elastic_tile_service_tos=agree',
|
||||
options: {
|
||||
minZoom: 1,
|
||||
maxZoom: 7,
|
||||
attribution: '© [Elastic Tile Service](https://www.elastic.co/elastic_tile_service)'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@ let utils = require('requirefrom')('src/utils');
|
|||
let fromRoot = utils('fromRoot');
|
||||
const randomBytes = require('crypto').randomBytes;
|
||||
|
||||
import pkg from '../../../src/utils/packageJson';
|
||||
|
||||
module.exports = () => Joi.object({
|
||||
pkg: Joi.object({
|
||||
version: Joi.string().default(Joi.ref('$version')),
|
||||
|
@ -110,6 +112,21 @@ module.exports = () => Joi.object({
|
|||
)
|
||||
.default(Joi.ref('$dev')),
|
||||
profile: Joi.boolean().default(false)
|
||||
}).default(),
|
||||
|
||||
tilemap: Joi.object({
|
||||
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().min(1, 'Must not be less than 1').default(1),
|
||||
maxZoom: Joi.number().default(7),
|
||||
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()
|
||||
|
||||
}).default();
|
||||
|
|
|
@ -158,6 +158,10 @@
|
|||
.leaflet-control-attribution {
|
||||
background-color: @tilemap-leaflet-footer-bg !important;
|
||||
color: @tilemap-leaflet-footer-color !important;
|
||||
|
||||
p {
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
|
||||
.leaflet-left {
|
||||
|
|
|
@ -1,21 +1,24 @@
|
|||
define(function (require) {
|
||||
return function MapFactory(Private) {
|
||||
return function MapFactory(Private, tilemap) {
|
||||
var _ = require('lodash');
|
||||
var $ = require('jquery');
|
||||
var L = require('leaflet');
|
||||
var marked = require('marked');
|
||||
marked.setOptions({
|
||||
gfm: true, // Github-flavored markdown
|
||||
sanitize: true // Sanitize HTML tags
|
||||
});
|
||||
|
||||
var defaultMapZoom = 2;
|
||||
var defaultMapCenter = [15, 5];
|
||||
var defaultMarkerType = 'Scaled Circle Markers';
|
||||
|
||||
var tilemapOptions = tilemap.options;
|
||||
var attribution = marked(tilemapOptions.attribution);
|
||||
|
||||
var mapTiles = {
|
||||
url: 'https://otile{s}-s.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpeg',
|
||||
options: {
|
||||
attribution: 'Tiles by <a href="http://www.mapquest.com/">MapQuest</a> — ' +
|
||||
'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
|
||||
'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>',
|
||||
subdomains: '1234'
|
||||
}
|
||||
url: tilemap.url,
|
||||
options: _.assign({}, tilemapOptions, { attribution })
|
||||
};
|
||||
|
||||
var markerTypes = {
|
||||
|
@ -47,8 +50,8 @@ define(function (require) {
|
|||
this._attr = params.attr || {};
|
||||
|
||||
var mapOptions = {
|
||||
minZoom: 1,
|
||||
maxZoom: 18,
|
||||
minZoom: tilemapOptions.minZoom,
|
||||
maxZoom: tilemapOptions.maxZoom,
|
||||
noWrap: true,
|
||||
maxBounds: L.latLngBounds([-90, -220], [90, 220]),
|
||||
scrollWheelZoom: false,
|
||||
|
@ -261,9 +264,18 @@ define(function (require) {
|
|||
TileMapMap.prototype._createMap = function (mapOptions) {
|
||||
if (this.map) this.destroy();
|
||||
|
||||
if (this._attr.wms && this._attr.wms.enabled) {
|
||||
_.assign(mapOptions, {
|
||||
minZoom: 1,
|
||||
maxZoom: 18
|
||||
});
|
||||
}
|
||||
|
||||
const savedZoom = _.get(this._geoJson, 'properties.zoom');
|
||||
|
||||
// get center and zoom from mapdata, or use defaults
|
||||
this._mapCenter = _.get(this._geoJson, 'properties.center') || defaultMapCenter;
|
||||
this._mapZoom = _.get(this._geoJson, 'properties.zoom') || defaultMapZoom;
|
||||
this._mapZoom = Math.max(Math.min(savedZoom || defaultMapZoom, mapOptions.maxZoom), mapOptions.minZoom);
|
||||
|
||||
// add map tiles layer, using the mapTiles object settings
|
||||
if (this._attr.wms && this._attr.wms.enabled) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue