[Maps] hide map visualization types with default kibana.yml settings (#49103) (#49585)

* [Maps] hide map visualization types with default kibana.yml settings

* add docs explaining xpack.maps.showMapVisualizationTypes

* clean up docs

* fix docs build

* fix typescript failures

* move docs to troubleshooting section

* add message about xpack.maps.showMapVisualizationTypes in coordinate map and region map docs

* doc updates based on gchaps feedback

* Update docs/visualize/regionmap.asciidoc

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/visualize/tilemap.asciidoc

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>
This commit is contained in:
Nathan Reese 2019-10-28 20:44:19 -06:00 committed by GitHub
parent 7a755d0e92
commit eb23b467ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 55 additions and 13 deletions

View file

@ -30,4 +30,9 @@ image::maps/images/inspector.png[]
* Ensure your tile server has configured https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS[Cross-Origin Resource Sharing (CORS)] so tile requests from your Kibana domain have permission to access your tile server domain.
* Ensure tiles have the required coordinate system. Vector data must use EPSG:4326 and tiles must use EPSG:3857.
[float]
==== Coordinate and region map visualizations not available in New Visualization menu
Kibanas out-of-the-box settings no longer offers coordinate and region maps as a choice in the New Visualization menu because you can create these maps in *Elastic Maps*.
If you want to create new coordinate and region map visualizations, set `xpack.maps.showMapVisualizationTypes` to `true`.

View file

@ -1,9 +1,12 @@
[[regionmap]]
== Region Maps
Region maps are thematic maps in which boundary vector shapes are colored using a gradient:
higher intensity colors indicate larger values, and lower intensity colors indicate smaller values.
These are also known as choropleth maps.
Region maps are thematic maps in which boundary vector shapes are colored using a gradient:
higher intensity colors indicate larger values, and lower intensity colors indicate smaller values.
These are also known as choropleth maps.
Kibanas out-of-the-box settings do not show a region map in the New Visualization menu. Use <<maps>> instead, which offers more functionality and is easier to use.
If you want to create new region map visualizations, set `xpack.maps.showMapVisualizationTypes` to `true`.
image::images/regionmap.png[]
@ -11,7 +14,7 @@ image::images/regionmap.png[]
[[regionmap-configuration]]
=== Configuration
To create a region map, you configure an inner join that joins the result of an Elasticsearch terms aggregation
To create a region map, you configure an inner join that joins the result of an Elasticsearch terms aggregation
and a reference vector file based on a shared key.
[float]
@ -23,7 +26,7 @@ and a reference vector file based on a shared key.
Select any of the supported _Metric_ or _Sibling Pipeline Aggregations_.
[float]
===== Buckets
===== Buckets
Configure a _Terms_ aggregation. The term is the _key_ that is used to join the results to the vector data on the map.
@ -35,7 +38,7 @@ Configure a _Terms_ aggregation. The term is the _key_ that is used to join the
- *Vector map*: select from a list of vector maps. This list includes the maps that are hosted by the © https://www.elastic.co/elastic-maps-service[Elastic Maps Service],
as well as your self-hosted layers that are configured in the *config/kibana.yml* file. To learn more about how to configure Kibana
to make self-hosted layers available, see the <<regionmap-settings,regionmap settings>> documentation. You can also explore and preview vector layers available in Elastic Maps Service at https://maps.elastic.co[https://maps.elastic.co].
- *Join field*: this is the property from the selected vector map that will be used to join on the terms in your terms-aggregation.
- *Join field*: this is the property from the selected vector map that will be used to join on the terms in your terms-aggregation.
When terms cannot be joined to any of the shapes in the vector layer because there is no exact match in the vector layer, Kibana will display a warning.
To turn of these warnings, go to *Management/Kibana/Advanced Settings* and set `visualization:regionmap:showWarnings` to `false`.
@ -46,4 +49,4 @@ To turn of these warnings, go to *Management/Kibana/Advanced Settings* and set `
[float]
===== Basic Settings
- *Legend Position*: the location on the screen where the legend should be rendered.
- *Show Tooltip*: indicates whether a tooltip should be displayed when hovering over a shape..
- *Show Tooltip*: indicates whether a tooltip should be displayed when hovering over a shape..

View file

@ -3,7 +3,10 @@
A coordinate map displays a geographic area overlaid with circles keyed to the data determined by the buckets you specify.
NOTE: By default, Kibana uses the https://www.elastic.co/elastic-maps-service[Elastic Maps Service]
Kibanas out-of-the-box settings do not show a coordinate map in the New Visualization menu. Use <<maps>> instead, which offers more functionality and is easier to use.
If you want to create new coordinate map visualizations, set `xpack.maps.showMapVisualizationTypes` to `true`.
Kibana uses the https://www.elastic.co/elastic-maps-service[Elastic Maps Service]
to display map tiles. To use other tile service providers, configure the <<tilemap-settings,tilemap settings>>
in `kibana.yml`.

View file

@ -42,6 +42,7 @@ const createSetupContract = (): VisualizationsSetup => ({
types: {
registerVisualization: jest.fn(),
registerAlias: jest.fn(),
hideTypes: jest.fn(),
},
});

View file

@ -48,16 +48,30 @@ export interface VisType {
*/
export class TypesService {
private types: Record<string, VisType> = {};
private unregisteredHiddenTypes: string[] = [];
public setup() {
return {
registerVisualization: (registerFn: () => VisType) => {
const visDefinition = registerFn();
if (this.unregisteredHiddenTypes.includes(visDefinition.name)) {
visDefinition.hidden = true;
}
if (this.types[visDefinition.name]) {
throw new Error('type already exists!');
}
this.types[visDefinition.name] = visDefinition;
},
registerAlias: visTypeAliasRegistry.add,
hideTypes: (typeNames: string[]) => {
typeNames.forEach((name: string) => {
if (this.types[name]) {
this.types[name].hidden = true;
} else {
this.unregisteredHiddenTypes.push(name);
}
});
},
};
}

View file

@ -43,6 +43,7 @@ export function maps(kibana) {
const mapConfig = serverConfig.get('map');
return {
showMapVisualizationTypes: serverConfig.get('xpack.maps.showMapVisualizationTypes'),
showMapsInspectorAdapter: serverConfig.get('xpack.maps.showMapsInspectorAdapter'),
preserveDrawingBuffer: serverConfig.get('xpack.maps.preserveDrawingBuffer'),
isEmsEnabled: mapConfig.includeElasticMapsService,
@ -92,6 +93,7 @@ export function maps(kibana) {
config(Joi) {
return Joi.object({
enabled: Joi.boolean().default(true),
showMapVisualizationTypes: Joi.boolean().default(false),
showMapsInspectorAdapter: Joi.boolean().default(false), // flag used in functional testing
preserveDrawingBuffer: Joi.boolean().default(false), // flag used in functional testing
}).default();

View file

@ -4,21 +4,35 @@
* you may not use this file except in compliance with the Elastic License.
*/
import chrome from 'ui/chrome';
import { setup as visualizationsSetup } from '../../../../../src/legacy/core_plugins/visualizations/public/np_ready/public/legacy';
import { i18n } from '@kbn/i18n';
import { APP_ID, APP_ICON, MAP_BASE_URL } from '../common/constants';
const showMapVisualizationTypes = chrome.getInjected('showMapVisualizationTypes', false);
const description = i18n.translate('xpack.maps.visTypeAlias.description', {
defaultMessage: 'Create and style maps with multiple layers and indices.',
});
const legacyMapVisualizationWarning = i18n.translate('xpack.maps.visTypeAlias.legacyMapVizWarning', {
defaultMessage: `Use the Maps app instead of Coordinate Map and Region Map.
The Maps app offers more functionality and is easier to use.`,
});
visualizationsSetup.types.registerAlias({
aliasUrl: MAP_BASE_URL,
name: APP_ID,
title: i18n.translate('xpack.maps.visTypeAlias.title', {
defaultMessage: 'Maps',
}),
description: i18n.translate('xpack.maps.visTypeAlias.description', {
defaultMessage: `Create and style maps with multiple layers and indices.
Use the Maps app instead of Coordinate Map and Region Map.
The Maps app offers more functionality and is easier to use.`,
}),
description: showMapVisualizationTypes
? `${description} ${legacyMapVisualizationWarning}`
: description,
icon: APP_ICON,
stage: 'production',
});
if (!showMapVisualizationTypes) {
visualizationsSetup.types.hideTypes(['region_map', 'tile_map']);
}