From 557123da0e47a9e87b1b2e3bd9cc0777d689296a Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 12 Feb 2019 14:51:29 -0500 Subject: [PATCH 01/84] initial commit --- x-pack/plugins/maps/index.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/maps/index.js b/x-pack/plugins/maps/index.js index 1c6ecf951bf28..3c3924df6c1ed 100644 --- a/x-pack/plugins/maps/index.js +++ b/x-pack/plugins/maps/index.js @@ -14,6 +14,7 @@ import { checkLicense } from './check_license'; import { watchStatusAndLicenseToInitialize } from '../../server/lib/watch_status_and_license_to_initialize'; import { initTelemetryCollection } from './server/maps_telemetry'; +import { i18n } from '@kbn/i18n'; export function maps(kibana) { @@ -24,8 +25,12 @@ export function maps(kibana) { publicDir: resolve(__dirname, 'public'), uiExports: { app: { - title: 'Maps', - description: 'Map application', + title: i18n.translate('xpack.maps.appTitle', { + defaultMessage: 'Maps' + }), + description: i18n.translate('xpack.maps.appDescription', { + defaultMessage: 'Map application' + }), main: 'plugins/maps/index', icon: 'plugins/maps/icon.svg', euiIconType: 'gisApp', @@ -57,11 +62,14 @@ export function maps(kibana) { }).default(); }, - init(server) { + init: function (server) { const mapsEnabled = server.config().get('xpack.maps.enabled'); if (!mapsEnabled) { - server.log(['info', 'maps'], 'Maps app disabled by configuration'); + server.log(['info', 'maps'], + i18n.translate('xpack.maps.appDisabled', { + defaultMessage: 'Maps' + })); return; } initTelemetryCollection(server); From 6ee5a8e950590bbc41bf2c705fe919b3516d79eb Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 12 Feb 2019 15:04:54 -0500 Subject: [PATCH 02/84] add telemetry file --- .../server/maps_telemetry/telemetry_task.js | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/maps/server/maps_telemetry/telemetry_task.js b/x-pack/plugins/maps/server/maps_telemetry/telemetry_task.js index 7fbbe8ef77ff5..a484a69cb2c26 100644 --- a/x-pack/plugins/maps/server/maps_telemetry/telemetry_task.js +++ b/x-pack/plugins/maps/server/maps_telemetry/telemetry_task.js @@ -5,6 +5,7 @@ */ import { getMapsTelemetry } from './maps_telemetry'; +import { i18n } from '@kbn/i18n'; const TELEMETRY_TASK_TYPE = 'maps_telemetry'; @@ -21,7 +22,14 @@ export function scheduleTask(server, taskManager) { state: { stats: {}, runs: 0 }, }); }catch(e) { - server.log(['warning', 'maps'], `Error scheduling telemetry task, received ${e.message}`); + server.log(['warning', 'maps'], + i18n.translate('xpack.maps.telemetry.scheduleError', { + defaultMessage: `Error scheduling telemetry task, received {message}`, + values: { + message: e.message + }, + }) + ); } }); } @@ -29,7 +37,9 @@ export function scheduleTask(server, taskManager) { export function registerMapsTelemetryTask(taskManager) { taskManager.registerTaskDefinitions({ [TELEMETRY_TASK_TYPE]: { - title: 'Maps telemetry fetch task', + title: i18n.translate('xpack.maps.telemetry.taskTitle', { + defaultMessage: 'Maps telemetry fetch task', + }), type: TELEMETRY_TASK_TYPE, timeout: '1m', numWorkers: 2, @@ -54,7 +64,14 @@ export function telemetryTaskRunner() { try { mapsTelemetry = await getMapsTelemetry(server, callCluster); } catch (err) { - server.log(['warning'], `Error loading maps telemetry: ${err}`); + server.log(['warning'], + i18n.translate('xpack.maps.telemetry.loadError', { + defaultMessage: `Error loading maps telemetry: {error}`, + values: { + error: err + } + }) + ); } finally { return { state: { From a83d80efa8bb16b0458488ad1f28057f1b12d210 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 14 Feb 2019 11:24:58 -0500 Subject: [PATCH 03/84] translate routes file --- x-pack/plugins/maps/server/routes.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/maps/server/routes.js b/x-pack/plugins/maps/server/routes.js index 4139749907042..20efa60e7d4e3 100644 --- a/x-pack/plugins/maps/server/routes.js +++ b/x-pack/plugins/maps/server/routes.js @@ -30,7 +30,10 @@ export function initRoutes(server, licenseUid) { handler: async (request) => { if (!request.query.id) { - server.log('warning', 'Must supply id parameters to retrieve EMS file'); + server.log('warning', + i18n.translate('xpack.maps.server.missingEMSId', { + defaultMessage: 'Must supply id parameters to retrieve EMS file' + })); return null; } From 4f88465787fdc98312287cb5ec53d363e179ad74 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 14 Feb 2019 11:52:17 -0500 Subject: [PATCH 04/84] localize feature registration --- x-pack/plugins/maps/common/constants.js | 6 ++++++ x-pack/plugins/maps/common/i18n_getters.js | 15 +++++++++++++++ x-pack/plugins/maps/index.js | 10 +++++----- x-pack/plugins/maps/public/register_feature.js | 14 +++++++++----- 4 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 x-pack/plugins/maps/common/i18n_getters.js diff --git a/x-pack/plugins/maps/common/constants.js b/x-pack/plugins/maps/common/constants.js index 01f5dab5268bd..996e97af6514d 100644 --- a/x-pack/plugins/maps/common/constants.js +++ b/x-pack/plugins/maps/common/constants.js @@ -13,3 +13,9 @@ export const DECIMAL_DEGREES_PRECISION = 5; // meters precision export const ZOOM_PRECISION = 2; export const DEFAULT_EMS_TILE_LAYER = 'road_map'; + +export const APP_TITLE_EN = 'Maps'; + +export const APP_ID = 'maps'; + +export const APP_ICON = 'gisApp'; diff --git a/x-pack/plugins/maps/common/i18n_getters.js b/x-pack/plugins/maps/common/i18n_getters.js new file mode 100644 index 0000000000000..c27912c92ae24 --- /dev/null +++ b/x-pack/plugins/maps/common/i18n_getters.js @@ -0,0 +1,15 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { i18n } from '@kbn/i18n'; +import { APP_TITLE_EN } from './constants'; + + +export function getAppTitle() { + return i18n.translate('xpack.maps.appTitle', { + defaultMessage: APP_TITLE_EN + }); +} diff --git a/x-pack/plugins/maps/index.js b/x-pack/plugins/maps/index.js index 3c3924df6c1ed..770c01c798b64 100644 --- a/x-pack/plugins/maps/index.js +++ b/x-pack/plugins/maps/index.js @@ -15,25 +15,25 @@ import { watchStatusAndLicenseToInitialize } from '../../server/lib/watch_status_and_license_to_initialize'; import { initTelemetryCollection } from './server/maps_telemetry'; import { i18n } from '@kbn/i18n'; +import { APP_ID, APP_ICON } from './common/constants'; +import { getAppTitle } from './common/i18n_getters'; export function maps(kibana) { return new kibana.Plugin({ require: ['kibana', 'elasticsearch', 'xpack_main', 'tile_map', 'task_manager'], - id: 'maps', + id: APP_ID, configPrefix: 'xpack.maps', publicDir: resolve(__dirname, 'public'), uiExports: { app: { - title: i18n.translate('xpack.maps.appTitle', { - defaultMessage: 'Maps' - }), + title: getAppTitle(), description: i18n.translate('xpack.maps.appDescription', { defaultMessage: 'Map application' }), main: 'plugins/maps/index', icon: 'plugins/maps/icon.svg', - euiIconType: 'gisApp', + euiIconType: APP_ICON, }, injectDefaultVars(server) { const serverConfig = server.config(); diff --git a/x-pack/plugins/maps/public/register_feature.js b/x-pack/plugins/maps/public/register_feature.js index 067348d41afa5..e112ca23483ed 100644 --- a/x-pack/plugins/maps/public/register_feature.js +++ b/x-pack/plugins/maps/public/register_feature.js @@ -8,14 +8,18 @@ import { FeatureCatalogueRegistryProvider, FeatureCatalogueCategory } from 'ui/registry/feature_catalogue'; - +import { i18n } from '@kbn/i18n'; +import { APP_ID, APP_ICON } from '../common/constants'; +import { getAppTitle } from '../common/i18n_getters'; FeatureCatalogueRegistryProvider.register(() => { return { - id: 'maps', - title: 'Maps', - description: 'Explore geospatial data from Elasticsearch and the Elastic Maps Service', - icon: 'gisApp', + id: APP_ID, + title: getAppTitle(), + description: i18n.translate('xpack.maps.feature.appDescription', { + defaultMessage: 'Explore geospatial data from Elasticsearch and the Elastic Maps Service' + }), + icon: APP_ICON, path: '/app/maps', showOnHomePage: true, category: FeatureCatalogueCategory.DATA From 3ab2b0f83e70fa65ead87a184ab3f5f7b05be8f6 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 14 Feb 2019 11:57:17 -0500 Subject: [PATCH 05/84] remove dead code path --- x-pack/plugins/maps/public/meta.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/maps/public/meta.js b/x-pack/plugins/maps/public/meta.js index 91a296f08cf76..cace04a9ae7bf 100644 --- a/x-pack/plugins/maps/public/meta.js +++ b/x-pack/plugins/maps/public/meta.js @@ -36,10 +36,10 @@ export async function getDataSources() { return loadingMetaPromise; } +/** + * Should only call this after verifying `isMetadataLoaded` equals true + */ export function getDataSourcesSync() { - if (!isLoaded) { - throw new Error('Metadata is not loaded yet. Use isMetadataLoaded first before calling this function.'); - } return meta; } From b9f6af20ded938a30ba36dbb96e0c02a81686c95 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 14 Feb 2019 12:01:57 -0500 Subject: [PATCH 06/84] fix edit --- x-pack/plugins/maps/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/maps/index.js b/x-pack/plugins/maps/index.js index 770c01c798b64..47e6d525e1868 100644 --- a/x-pack/plugins/maps/index.js +++ b/x-pack/plugins/maps/index.js @@ -68,7 +68,7 @@ export function maps(kibana) { if (!mapsEnabled) { server.log(['info', 'maps'], i18n.translate('xpack.maps.appDisabled', { - defaultMessage: 'Maps' + defaultMessage: 'Maps app disabled by configuration' })); return; } From 538f533bec5efdcbaa7aa5081a956a6d3a6ff1f0 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 14 Feb 2019 15:59:26 -0500 Subject: [PATCH 07/84] localize es parsing --- .../maps/public/elasticsearch_geo_utils.js | 33 +++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/maps/public/elasticsearch_geo_utils.js b/x-pack/plugins/maps/public/elasticsearch_geo_utils.js index bb054c611e650..1dfd1109855f2 100644 --- a/x-pack/plugins/maps/public/elasticsearch_geo_utils.js +++ b/x-pack/plugins/maps/public/elasticsearch_geo_utils.js @@ -5,6 +5,7 @@ */ import _ from 'lodash'; +import { i18n } from '@kbn/i18n'; /** * Converts Elasticsearch search results into GeoJson FeatureCollection @@ -27,7 +28,11 @@ export function hitsToGeoJson(hits, flattenHit, geoFieldName, geoFieldType) { } else if (geoFieldType === 'geo_shape') { geometries = geoShapeToGeometry(properties[geoFieldName]); } else { - throw new Error(`Unsupported field type, expected: geo_shape or geo_point, you provided: ${geoFieldType}`); + const errorMessage = i18n.translate('xpack.maps.elasticsearch_geo_utils.unsupportedFieldType', { + defaultMessage: 'Unsupported field type, expected: geo_shape or geo_point, you provided: {geoFieldType}', + values: { geoFieldType } + }); + throw new Error(errorMessage); } // don't include geometry field value in properties @@ -63,8 +68,11 @@ export function geoPointToGeometry(value) { if (typeof value === 'string') { const commaSplit = value.split(','); if (commaSplit.length === 1) { - // Geo-point expressed as a geohash. - throw new Error(`Unable to convert to geojson, geohash not supported`); + const errorMessage = i18n.translate('xpack.maps.elasticsearch_geo_utils.geohashIsUnsupported', { + defaultMessage: `Unable to convert to geojson, geohash not supported` + }); + + throw new Error(errorMessage); } // Geo-point expressed as a string with the format: "lat,lon". const lat = parseFloat(commaSplit[0]); @@ -78,7 +86,13 @@ export function geoPointToGeometry(value) { } if (!Array.isArray(value)) { - throw new Error(`Unsupported geo_point value: ${value}`); + const errorMessage = i18n.translate('xpack.maps.elasticsearch_geo_utils.unsupportedGeoPointValue', { + defaultMessage: `Unsupported geo_point value: {geoPointValue}`, + values: { + geoPointValue: value + } + }); + throw new Error(errorMessage); } if (value.length === 2 @@ -116,7 +130,10 @@ export function geoShapeToGeometry(value) { // TODO handle case where value is WKT and convert to geojson if (typeof value === "string") { - throw new Error(`Unable to convert WKT to geojson, not supported`); + const errorMessage = i18n.translate('xpack.maps.elasticsearch_geo_utils.wktIsUnsupported', { + defaultMessage: `Unable to convert WKT to geojson, not supported`, + }); + throw new Error(errorMessage); } const geoJson = _.cloneDeep(value); @@ -180,7 +197,11 @@ export function createExtentFilter(mapExtent, geoFieldName, geoFieldType) { } }; } else { - throw new Error(`Unsupported field type, expected: geo_shape or geo_point, you provided: ${geoFieldType}`); + const errorMessage = i18n.translate('xpack.maps.elasticsearch_geo_utils.unsupportedGeoFieldType', { + defaultMessage: `Unsupported field type, expected: geo_shape or geo_point, you provided: {geoFieldType}`, + values: { geoFieldType } + }); + throw new Error(errorMessage); } } From 27b964b2fbcc0d06c5e61ab401093a316b8ee0fb Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 14 Feb 2019 17:12:04 -0500 Subject: [PATCH 08/84] remove dead code --- .../maps/public/shared/layers/heatmap_layer.js | 5 ++--- .../public/shared/layers/styles/heatmap_style.js | 15 ++++----------- .../maps/public/shared/utils/color_utils.js | 7 ++++--- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/heatmap_layer.js b/x-pack/plugins/maps/public/shared/layers/heatmap_layer.js index bdecba2f91bb3..479e90c2a1181 100644 --- a/x-pack/plugins/maps/public/shared/layers/heatmap_layer.js +++ b/x-pack/plugins/maps/public/shared/layers/heatmap_layer.js @@ -19,15 +19,14 @@ export class HeatmapLayer extends AbstractLayer { static createDescriptor(options) { const heatmapLayerDescriptor = super.createDescriptor(options); heatmapLayerDescriptor.type = HeatmapLayer.type; - const defaultStyle = HeatmapStyle.createDescriptor('coarse'); - heatmapLayerDescriptor.style = defaultStyle; + heatmapLayerDescriptor.style = HeatmapStyle.createDescriptor(); return heatmapLayerDescriptor; } constructor({ layerDescriptor, source, style }) { super({ layerDescriptor, source, style }); if (!style) { - const defaultStyle = HeatmapStyle.createDescriptor('coarse'); + const defaultStyle = HeatmapStyle.createDescriptor(); this._style = new HeatmapStyle(defaultStyle); } } diff --git a/x-pack/plugins/maps/public/shared/layers/styles/heatmap_style.js b/x-pack/plugins/maps/public/shared/layers/styles/heatmap_style.js index fdf6622a75495..9877ac46f94f8 100644 --- a/x-pack/plugins/maps/public/shared/layers/styles/heatmap_style.js +++ b/x-pack/plugins/maps/public/shared/layers/styles/heatmap_style.js @@ -11,25 +11,18 @@ export class HeatmapStyle extends AbstractStyle { static type = 'HEATMAP'; - constructor(styleDescriptor = {}) { + constructor() { super(); - this._descriptor = HeatmapStyle.createDescriptor( - styleDescriptor.refinement, - styleDescriptor.properties - ); + this._descriptor = HeatmapStyle.createDescriptor(); } static canEdit(styleInstance) { return styleInstance.constructor === HeatmapStyle; } - static createDescriptor(refinement, properties = {}) { + static createDescriptor() { return { type: HeatmapStyle.type, - refinement: refinement || 'coarse', - properties: { - ...properties - } }; } @@ -50,7 +43,7 @@ export class HeatmapStyle extends AbstractStyle { } else if (resolution === GRID_RESOLUTION.MOST_FINE) { radius = 32; } else { - throw new Error(`Refinement param not recognized: ${this._descriptor.refinement}`); + throw new Error(`Resolution param not recognized: ${this._descriptor.refinement}`); } mbMap.setPaintProperty(layerId, 'heatmap-radius', radius); mbMap.setPaintProperty(layerId, 'heatmap-weight', { diff --git a/x-pack/plugins/maps/public/shared/utils/color_utils.js b/x-pack/plugins/maps/public/shared/utils/color_utils.js index 1432538f78b85..38c91c44cf0f4 100644 --- a/x-pack/plugins/maps/public/shared/utils/color_utils.js +++ b/x-pack/plugins/maps/public/shared/utils/color_utils.js @@ -11,8 +11,9 @@ import chroma from 'chroma-js'; export function getRGBColorRangeStrings(colorName, numberColors) { const colorKeys = Object.keys(vislibColorMaps); if (!colorKeys.includes(colorName)) { - throw `${colorName} not found. Expected one of following values: \ - ${colorKeys}`; + //This is an internal error and should never occur. It it does, it is a bug. + throw new Error(`${colorName} not found. Expected one of following values: \ + ${colorKeys}`); } return getLegendColors(vislibColorMaps[colorName].value, numberColors); } @@ -20,4 +21,4 @@ export function getRGBColorRangeStrings(colorName, numberColors) { export function getHexColorRangeStrings(colorName, numberColors) { return getRGBColorRangeStrings(colorName, numberColors) .map(rgbColor => chroma(rgbColor).hex()); -} \ No newline at end of file +} From 46e896ad5590a1d4f6ec207c46b5f5227da9dbf0 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 14 Feb 2019 17:16:09 -0500 Subject: [PATCH 09/84] style names --- .../maps/public/shared/layers/styles/heatmap_style.js | 5 ++++- .../plugins/maps/public/shared/layers/styles/tile_style.js | 5 ++++- .../maps/public/shared/layers/styles/vector_style.js | 6 ++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/styles/heatmap_style.js b/x-pack/plugins/maps/public/shared/layers/styles/heatmap_style.js index 9877ac46f94f8..a7a0ff6d3bb7b 100644 --- a/x-pack/plugins/maps/public/shared/layers/styles/heatmap_style.js +++ b/x-pack/plugins/maps/public/shared/layers/styles/heatmap_style.js @@ -6,6 +6,7 @@ import { GRID_RESOLUTION } from '../grid_resolution'; import { AbstractStyle } from './abstract_style'; +import { i18n } from '@kbn/i18n'; export class HeatmapStyle extends AbstractStyle { @@ -27,7 +28,9 @@ export class HeatmapStyle extends AbstractStyle { } static getDisplayName() { - return 'Heatmap style'; + return i18n.translate('xpack.maps.style.heatmap.displayName', { + defaultMessage: 'Heatmap style' + }); } static renderEditor() { diff --git a/x-pack/plugins/maps/public/shared/layers/styles/tile_style.js b/x-pack/plugins/maps/public/shared/layers/styles/tile_style.js index 658d7957dcede..d93d8956bc2bf 100644 --- a/x-pack/plugins/maps/public/shared/layers/styles/tile_style.js +++ b/x-pack/plugins/maps/public/shared/layers/styles/tile_style.js @@ -5,6 +5,7 @@ */ import { AbstractStyle } from './abstract_style'; +import { i18n } from '@kbn/i18n'; export class TileStyle extends AbstractStyle { @@ -29,6 +30,8 @@ export class TileStyle extends AbstractStyle { } static getDisplayName() { - return 'Tile style'; + return i18n.translate('xpack.maps.style.tyle.displayName', { + defaultMessage: 'Tile style' + }); } } diff --git a/x-pack/plugins/maps/public/shared/layers/styles/vector_style.js b/x-pack/plugins/maps/public/shared/layers/styles/vector_style.js index df666c9d33f65..c6002e4e054f2 100644 --- a/x-pack/plugins/maps/public/shared/layers/styles/vector_style.js +++ b/x-pack/plugins/maps/public/shared/layers/styles/vector_style.js @@ -6,7 +6,7 @@ import _ from 'lodash'; import React from 'react'; - +import { i18n } from '@kbn/i18n'; import { FillableCircle, FillableVector } from '../../icons/additional_layer_icons'; import { ColorGradient } from '../../icons/color_gradient'; import { getHexColorRangeStrings } from '../../utils/color_utils'; @@ -44,7 +44,9 @@ export class VectorStyle extends AbstractStyle { } static getDisplayName() { - return 'Vector style'; + return i18n.translate('xpack.maps.style.tyle.displayName', { + defaultMessage: 'Vector style' + }); } static description = ''; From 1650e40ac18ca9e957ef134d4d478cdb2b1413ed Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 14 Feb 2019 17:18:32 -0500 Subject: [PATCH 10/84] typos --- x-pack/plugins/maps/public/shared/layers/styles/tile_style.js | 2 +- x-pack/plugins/maps/public/shared/layers/styles/vector_style.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/styles/tile_style.js b/x-pack/plugins/maps/public/shared/layers/styles/tile_style.js index d93d8956bc2bf..848198a05dcfc 100644 --- a/x-pack/plugins/maps/public/shared/layers/styles/tile_style.js +++ b/x-pack/plugins/maps/public/shared/layers/styles/tile_style.js @@ -30,7 +30,7 @@ export class TileStyle extends AbstractStyle { } static getDisplayName() { - return i18n.translate('xpack.maps.style.tyle.displayName', { + return i18n.translate('xpack.maps.style.tile.displayName', { defaultMessage: 'Tile style' }); } diff --git a/x-pack/plugins/maps/public/shared/layers/styles/vector_style.js b/x-pack/plugins/maps/public/shared/layers/styles/vector_style.js index c6002e4e054f2..29d1d8500d224 100644 --- a/x-pack/plugins/maps/public/shared/layers/styles/vector_style.js +++ b/x-pack/plugins/maps/public/shared/layers/styles/vector_style.js @@ -44,7 +44,7 @@ export class VectorStyle extends AbstractStyle { } static getDisplayName() { - return i18n.translate('xpack.maps.style.tyle.displayName', { + return i18n.translate('xpack.maps.style.vector.displayName', { defaultMessage: 'Vector style' }); } From a88311541a4633c7e63e6ab85ddf921761a4412f Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 14 Feb 2019 17:24:11 -0500 Subject: [PATCH 11/84] register maps plugin --- .i18nrc.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.i18nrc.json b/.i18nrc.json index 7a8b93c6a1a4f..e80465f3fe9b6 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -31,6 +31,7 @@ "xpack.infra": "x-pack/plugins/infra", "xpack.kueryAutocomplete": "x-pack/plugins/kuery_autocomplete", "xpack.licenseMgmt": "x-pack/plugins/license_management", + "xpack.maps": "x-pack/plugins/maps", "xpack.ml": "x-pack/plugins/ml", "xpack.logstash": "x-pack/plugins/logstash", "xpack.main": "x-pack/plugins/xpack_main", From 3834b06374c693a6bed435a22a4e3da7e575edc5 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 14 Feb 2019 17:26:34 -0500 Subject: [PATCH 12/84] replace with string --- x-pack/plugins/maps/common/constants.js | 2 -- x-pack/plugins/maps/common/i18n_getters.js | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/x-pack/plugins/maps/common/constants.js b/x-pack/plugins/maps/common/constants.js index 996e97af6514d..3e92f4bcd2899 100644 --- a/x-pack/plugins/maps/common/constants.js +++ b/x-pack/plugins/maps/common/constants.js @@ -14,8 +14,6 @@ export const ZOOM_PRECISION = 2; export const DEFAULT_EMS_TILE_LAYER = 'road_map'; -export const APP_TITLE_EN = 'Maps'; - export const APP_ID = 'maps'; export const APP_ICON = 'gisApp'; diff --git a/x-pack/plugins/maps/common/i18n_getters.js b/x-pack/plugins/maps/common/i18n_getters.js index c27912c92ae24..4ea3e541300a5 100644 --- a/x-pack/plugins/maps/common/i18n_getters.js +++ b/x-pack/plugins/maps/common/i18n_getters.js @@ -5,11 +5,9 @@ */ import { i18n } from '@kbn/i18n'; -import { APP_TITLE_EN } from './constants'; - export function getAppTitle() { return i18n.translate('xpack.maps.appTitle', { - defaultMessage: APP_TITLE_EN + defaultMessage: 'Maps' }); } From 11a241fee8068569426e2f18237212df4c3830ca Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 14 Feb 2019 17:43:06 -0500 Subject: [PATCH 13/84] localize xyz source --- .../maps/public/shared/layers/sources/xyz_tms_source.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js b/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js index b5bce0d868000..d8ff360eebfdd 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js @@ -13,12 +13,17 @@ import { import { AbstractTMSSource } from './tms_source'; import { TileLayer } from '../tile_layer'; +import { i18n } from '@kbn/i18n'; export class XYZTMSSource extends AbstractTMSSource { static type = 'EMS_XYZ'; - static title = 'Tile Map Service from URL'; - static description = 'Map tiles from a URL that includes the XYZ coordinates'; + static title = i18n.translate('xpack.maps.source.ems_xyz.title', { + defaultMessage: 'Tile Map Service from URL' + }); + static description = i18n.translate('xpack.maps.source.ems_xyz.description', { + defaultMessage: 'Map tiles from a URL that includes the XYZ coordinates' + }); static icon = 'grid'; static createDescriptor(urlTemplate) { From e7011858d953a7ebc479e5b11017227c8b78015c Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 14 Feb 2019 17:47:40 -0500 Subject: [PATCH 14/84] wms --- en.json | 98 +++++++++++++++++++ .../shared/layers/sources/wms_source.js | 10 +- 2 files changed, 105 insertions(+), 3 deletions(-) create mode 100644 en.json diff --git a/en.json b/en.json new file mode 100644 index 0000000000000..584fe7e2f257c --- /dev/null +++ b/en.json @@ -0,0 +1,98 @@ +{ + "formats": { + "number": { + "currency": { + "style": "currency" + }, + "percent": { + "style": "percent" + } + }, + "date": { + "short": { + "month": "numeric", + "day": "numeric", + "year": "2-digit" + }, + "medium": { + "month": "short", + "day": "numeric", + "year": "numeric" + }, + "long": { + "month": "long", + "day": "numeric", + "year": "numeric" + }, + "full": { + "weekday": "long", + "month": "long", + "day": "numeric", + "year": "numeric" + } + }, + "time": { + "short": { + "hour": "numeric", + "minute": "numeric" + }, + "medium": { + "hour": "numeric", + "minute": "numeric", + "second": "numeric" + }, + "long": { + "hour": "numeric", + "minute": "numeric", + "second": "numeric", + "timeZoneName": "short" + }, + "full": { + "hour": "numeric", + "minute": "numeric", + "second": "numeric", + "timeZoneName": "short" + } + }, + "relative": { + "years": { + "units": "year" + }, + "months": { + "units": "month" + }, + "days": { + "units": "day" + }, + "hours": { + "units": "hour" + }, + "minutes": { + "units": "minute" + }, + "seconds": { + "units": "second" + } + } + }, + "messages": { + "xpack.maps.appDescription": "Map application", + "xpack.maps.appDisabled": "Maps app disabled by configuration", + "xpack.maps.appTitle": "Maps", + "xpack.maps.elasticsearch_geo_utils.geohashIsUnsupported": "Unable to convert to geojson, geohash not supported", + "xpack.maps.elasticsearch_geo_utils.unsupportedFieldType": "Unsupported field type, expected: geo_shape or geo_point, you provided: {geoFieldType}", + "xpack.maps.elasticsearch_geo_utils.unsupportedGeoFieldType": "Unsupported field type, expected: geo_shape or geo_point, you provided: {geoFieldType}", + "xpack.maps.elasticsearch_geo_utils.unsupportedGeoPointValue": "Unsupported geo_point value: {geoPointValue}", + "xpack.maps.elasticsearch_geo_utils.wktIsUnsupported": "Unable to convert WKT to geojson, not supported", + "xpack.maps.feature.appDescription": "Explore geospatial data from Elasticsearch and the Elastic Maps Service", + "xpack.maps.server.missingEMSId": "Must supply id parameters to retrieve EMS file", + "xpack.maps.source.ems_xyz.description": "Map tiles from a URL that includes the XYZ coordinates", + "xpack.maps.source.ems_xyz.title": "Tile Map Service from URL", + "xpack.maps.style.heatmap.displayName": "Heatmap style", + "xpack.maps.style.tile.displayName": "Tile style", + "xpack.maps.style.vector.displayName": "Vector style", + "xpack.maps.telemetry.loadError": "Error loading maps telemetry: {error}", + "xpack.maps.telemetry.scheduleError": "Error scheduling telemetry task, received {message}", + "xpack.maps.telemetry.taskTitle": "Maps telemetry fetch task" + } +} \ No newline at end of file diff --git a/x-pack/plugins/maps/public/shared/layers/sources/wms_source.js b/x-pack/plugins/maps/public/shared/layers/sources/wms_source.js index 3428b0c26a346..5197abc7bccc4 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/wms_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/wms_source.js @@ -13,12 +13,17 @@ import { import { AbstractTMSSource } from './tms_source'; import { TileLayer } from '../tile_layer'; +import { i18n } from '@kbn/i18n'; export class WMSSource extends AbstractTMSSource { static type = 'WMS'; - static title = 'Web Map Service'; - static description = 'Maps from OGC Standard WMS'; + static title = i18n.translate('xpack.maps.source.wms.title', { + defaultMessage: 'Web Map Service' + }); + static description = i18n.translate('xpack.maps.source.wms.description', { + defaultMessage: 'Maps from OGC Standard WMS' + }); static icon = 'grid'; static createDescriptor({ serviceUrl, layers, styles }) { @@ -67,7 +72,6 @@ export class WMSSource extends AbstractTMSSource { } getUrlTemplate() { - console.warn('should compose url using url formatter, not string formatting'); const styles = this._descriptor.styles ? this._descriptor.styles : ''; // eslint-disable-next-line max-len return `${this._descriptor.serviceUrl}?bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&srs=EPSG:3857&transparent=true&width=256&height=256&layers=${this._descriptor.layers}&styles=${styles}`; From d0bae4434dc44b05c40e0e699a458d64c4722bcf Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 14 Feb 2019 17:54:09 -0500 Subject: [PATCH 15/84] source details --- en.json | 98 ------------------- x-pack/plugins/maps/common/i18n_getters.js | 13 +++ .../shared/layers/sources/wms_source.js | 13 ++- .../shared/layers/sources/xyz_tms_source.js | 5 +- 4 files changed, 25 insertions(+), 104 deletions(-) delete mode 100644 en.json diff --git a/en.json b/en.json deleted file mode 100644 index 584fe7e2f257c..0000000000000 --- a/en.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "formats": { - "number": { - "currency": { - "style": "currency" - }, - "percent": { - "style": "percent" - } - }, - "date": { - "short": { - "month": "numeric", - "day": "numeric", - "year": "2-digit" - }, - "medium": { - "month": "short", - "day": "numeric", - "year": "numeric" - }, - "long": { - "month": "long", - "day": "numeric", - "year": "numeric" - }, - "full": { - "weekday": "long", - "month": "long", - "day": "numeric", - "year": "numeric" - } - }, - "time": { - "short": { - "hour": "numeric", - "minute": "numeric" - }, - "medium": { - "hour": "numeric", - "minute": "numeric", - "second": "numeric" - }, - "long": { - "hour": "numeric", - "minute": "numeric", - "second": "numeric", - "timeZoneName": "short" - }, - "full": { - "hour": "numeric", - "minute": "numeric", - "second": "numeric", - "timeZoneName": "short" - } - }, - "relative": { - "years": { - "units": "year" - }, - "months": { - "units": "month" - }, - "days": { - "units": "day" - }, - "hours": { - "units": "hour" - }, - "minutes": { - "units": "minute" - }, - "seconds": { - "units": "second" - } - } - }, - "messages": { - "xpack.maps.appDescription": "Map application", - "xpack.maps.appDisabled": "Maps app disabled by configuration", - "xpack.maps.appTitle": "Maps", - "xpack.maps.elasticsearch_geo_utils.geohashIsUnsupported": "Unable to convert to geojson, geohash not supported", - "xpack.maps.elasticsearch_geo_utils.unsupportedFieldType": "Unsupported field type, expected: geo_shape or geo_point, you provided: {geoFieldType}", - "xpack.maps.elasticsearch_geo_utils.unsupportedGeoFieldType": "Unsupported field type, expected: geo_shape or geo_point, you provided: {geoFieldType}", - "xpack.maps.elasticsearch_geo_utils.unsupportedGeoPointValue": "Unsupported geo_point value: {geoPointValue}", - "xpack.maps.elasticsearch_geo_utils.wktIsUnsupported": "Unable to convert WKT to geojson, not supported", - "xpack.maps.feature.appDescription": "Explore geospatial data from Elasticsearch and the Elastic Maps Service", - "xpack.maps.server.missingEMSId": "Must supply id parameters to retrieve EMS file", - "xpack.maps.source.ems_xyz.description": "Map tiles from a URL that includes the XYZ coordinates", - "xpack.maps.source.ems_xyz.title": "Tile Map Service from URL", - "xpack.maps.style.heatmap.displayName": "Heatmap style", - "xpack.maps.style.tile.displayName": "Tile style", - "xpack.maps.style.vector.displayName": "Vector style", - "xpack.maps.telemetry.loadError": "Error loading maps telemetry: {error}", - "xpack.maps.telemetry.scheduleError": "Error scheduling telemetry task, received {message}", - "xpack.maps.telemetry.taskTitle": "Maps telemetry fetch task" - } -} \ No newline at end of file diff --git a/x-pack/plugins/maps/common/i18n_getters.js b/x-pack/plugins/maps/common/i18n_getters.js index 4ea3e541300a5..aab344c421058 100644 --- a/x-pack/plugins/maps/common/i18n_getters.js +++ b/x-pack/plugins/maps/common/i18n_getters.js @@ -11,3 +11,16 @@ export function getAppTitle() { defaultMessage: 'Maps' }); } + + +export function getDataSourceLabel() { + return i18n.translate('xpack.maps.source.common.dataSourceLabel', { + defaultMessage: 'Data source' + }); +} + +export function getUrlLabel() { + return i18n.translate('xpack.maps.source.common.urlLabel', { + defaultMessage: 'Url' + }); +} diff --git a/x-pack/plugins/maps/public/shared/layers/sources/wms_source.js b/x-pack/plugins/maps/public/shared/layers/sources/wms_source.js index 5197abc7bccc4..f06f83b62e0dd 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/wms_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/wms_source.js @@ -14,6 +14,7 @@ import { import { AbstractTMSSource } from './tms_source'; import { TileLayer } from '../tile_layer'; import { i18n } from '@kbn/i18n'; +import { getDataSourceLabel, getUrlLabel } from '../../../../common/i18n_getters'; export class WMSSource extends AbstractTMSSource { @@ -46,10 +47,14 @@ export class WMSSource extends AbstractTMSSource { async getImmutableProperties() { return [ - { label: 'Data source', value: WMSSource.title }, - { label: 'Url', value: this._descriptor.serviceUrl }, - { label: 'Layers', value: this._descriptor.layers }, - { label: 'Styles', value: this._descriptor.styles }, + { label: getDataSourceLabel(), value: WMSSource.title }, + { label: getUrlLabel(), value: this._descriptor.serviceUrl }, + { label: i18n.translate('xpack.maps.source.wms.layersLabel', { + defaultMessage: 'Layers' + }), value: this._descriptor.layers }, + { label: i18n.translate('xpack.maps.source.wms.stylesLabel', { + defaultMessage: 'Styles' + }), value: this._descriptor.styles }, ]; } diff --git a/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js b/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js index d8ff360eebfdd..9a3c946ab5c32 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js @@ -14,6 +14,7 @@ import { import { AbstractTMSSource } from './tms_source'; import { TileLayer } from '../tile_layer'; import { i18n } from '@kbn/i18n'; +import { getDataSourceLabel, getUrlLabel } from '../../../../common/i18n_getters'; export class XYZTMSSource extends AbstractTMSSource { @@ -44,8 +45,8 @@ export class XYZTMSSource extends AbstractTMSSource { async getImmutableProperties() { return [ - { label: 'Data source', value: XYZTMSSource.title }, - { label: 'Url', value: this._descriptor.urlTemplate }, + { label: getDataSourceLabel(), value: XYZTMSSource.title }, + { label: getUrlLabel(), value: this._descriptor.urlTemplate }, ]; } From 1b1e043d1eeac61d7b0b665bc4b710bd5ec89ca5 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 21 Feb 2019 10:43:55 -0500 Subject: [PATCH 16/84] localize add layer panel --- .../maps/public/angular/map_controller.js | 6 +++--- .../public/components/layer_addpanel/view.js | 19 ++++++++++++++++--- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/maps/public/angular/map_controller.js b/x-pack/plugins/maps/public/angular/map_controller.js index 5c941cc987099..3de30f134239f 100644 --- a/x-pack/plugins/maps/public/angular/map_controller.js +++ b/x-pack/plugins/maps/public/angular/map_controller.js @@ -6,7 +6,7 @@ import chrome from 'ui/chrome'; import React from 'react'; -import { I18nContext } from 'ui/i18n'; +import { I18nProvider } from '@kbn/i18n/react'; import { render, unmountComponentAtNode } from 'react-dom'; import { uiModules } from 'ui/modules'; import { timefilter } from 'ui/timefilter'; @@ -143,9 +143,9 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage const root = document.getElementById(REACT_ANCHOR_DOM_ELEMENT_ID); render( - + - + , root ); diff --git a/x-pack/plugins/maps/public/components/layer_addpanel/view.js b/x-pack/plugins/maps/public/components/layer_addpanel/view.js index 57bc8209444a1..e9b02d37b8dd0 100644 --- a/x-pack/plugins/maps/public/components/layer_addpanel/view.js +++ b/x-pack/plugins/maps/public/components/layer_addpanel/view.js @@ -20,6 +20,8 @@ import { EuiFlyoutBody, EuiFlyoutFooter, } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; + export class AddLayerPanel extends Component { @@ -67,7 +69,10 @@ export class AddLayerPanel extends Component { }} fill > - Add layer + ); } @@ -125,7 +130,10 @@ export class AddLayerPanel extends Component { onClick={this._clearSource} iconType="arrowLeft" > - Change data source + @@ -151,7 +159,12 @@ export class AddLayerPanel extends Component { > -

Add layer

+

+ +

From 14f6c10b330bcd91287698e45162de483e771bd5 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Mon, 25 Feb 2019 11:36:49 -0500 Subject: [PATCH 17/84] Remove dead code --- .../maps/public/components/layer_panel/view.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/x-pack/plugins/maps/public/components/layer_panel/view.js b/x-pack/plugins/maps/public/components/layer_panel/view.js index 2144731f28cf6..225381ad1b0af 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/view.js +++ b/x-pack/plugins/maps/public/components/layer_panel/view.js @@ -10,9 +10,8 @@ import { StyleTabs } from './style_tabs'; import { JoinEditor } from './join_editor'; import { FlyoutFooter } from './flyout_footer'; import { SettingsPanel } from './settings_panel'; - import { - EuiButtonIcon, + EuiIcon, EuiFlexItem, EuiTitle, EuiPanel, @@ -132,13 +131,7 @@ export class LayerPanel extends React.Component { - - Fit - + From 9a91f8d82199ba2e4fab00b2c17443834f6e80d9 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Mon, 25 Feb 2019 11:53:15 -0500 Subject: [PATCH 18/84] localize --- .../layer_panel/flyout_footer/view.js | 9 +++++- .../layer_panel/join_editor/view.js | 28 ++++++++++++++++--- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/maps/public/components/layer_panel/flyout_footer/view.js b/x-pack/plugins/maps/public/components/layer_panel/flyout_footer/view.js index 6ce6214854fd9..0e0ffecb861d2 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/flyout_footer/view.js +++ b/x-pack/plugins/maps/public/components/layer_panel/flyout_footer/view.js @@ -13,6 +13,10 @@ import { EuiSpacer, EuiButtonEmpty, } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; + + + export const FlyoutFooter = ({ cancelLayerPanel, saveLayerEdits, removeLayer, hasStateChanged }) => { const removeBtn = ( @@ -23,7 +27,10 @@ export const FlyoutFooter = ({ cancelLayerPanel, saveLayerEdits, removeLayer, flush="right" data-test-subj="mapRemoveLayerButton" > - Remove layer + ); diff --git a/x-pack/plugins/maps/public/components/layer_panel/join_editor/view.js b/x-pack/plugins/maps/public/components/layer_panel/join_editor/view.js index d6334d93fa617..23c4aede3359e 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/join_editor/view.js +++ b/x-pack/plugins/maps/public/components/layer_panel/join_editor/view.js @@ -16,8 +16,10 @@ import { } from '@elastic/eui'; import { Join } from './resources/join'; +import { injectI18n, FormattedMessage } from '@kbn/i18n/react'; -export function JoinEditor({ joins, layer, onChange }) { +// export const JoinEditor = injectI18n(({intl}) => { +export const JoinEditor = injectI18n(({ joins, layer, onChange, intl }) => { const renderJoins = () => { return joins.map((joinDescriptor, index) => { @@ -69,14 +71,32 @@ export function JoinEditor({ joins, layer, onChange }) {
-
Term joins
+ +
+ +
+
- + +
{renderJoins()}
); -} +}); From a47e36ec7b391545929cd73b7f3a348992398e2b Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Mon, 25 Feb 2019 14:33:20 -0500 Subject: [PATCH 19/84] localize joins (pt1) --- .../layer_panel/join_editor/resources/join.js | 14 +++-- .../join_editor/resources/join_expression.js | 51 +++++++++++++++---- 2 files changed, 51 insertions(+), 14 deletions(-) diff --git a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join.js b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join.js index 794897c7edd8a..bf7527227aacd 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join.js +++ b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join.js @@ -6,13 +6,12 @@ import _ from 'lodash'; import React, { Component } from 'react'; - import { EuiFlexItem, EuiFlexGroup, EuiButtonIcon, } from '@elastic/eui'; - +import { i18n } from '@kbn/i18n'; import { JoinExpression } from './join_expression'; import { MetricsExpression } from './metrics_expression'; @@ -204,8 +203,8 @@ export class Join extends Component { className="mapJoinItem__delete" iconType="trash" color="danger" - aria-label="Delete join" - title="Delete join" + aria-label={getDeleteJoin()} + title={getDeleteJoin()} onClick={onRemove} />
@@ -213,3 +212,10 @@ export class Join extends Component { ); } } + + +function getDeleteJoin() { + return i18n.translate('xpack.maps.layerPanel.join.deleteJoin', { + defaultMessage: 'Delete join' + }); +} diff --git a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join_expression.js b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join_expression.js index 836efa89fb532..0c6ba21cc900f 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join_expression.js +++ b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join_expression.js @@ -7,7 +7,6 @@ import _ from 'lodash'; import React, { Component } from 'react'; import PropTypes from 'prop-types'; - import { EuiPopover, EuiPopoverTitle, @@ -15,9 +14,10 @@ import { EuiFormRow, EuiComboBox, } from '@elastic/eui'; - +import { i18n } from '@kbn/i18n'; import { IndexPatternSelect } from 'ui/index_patterns/components/index_pattern_select'; import { SingleFieldSelect } from '../../../../shared/components/single_field_select'; +import { FormattedMessage } from '@kbn/i18n/react'; import { indexPatternService, @@ -87,10 +87,14 @@ export class JoinExpression extends Component { return (
- Join + + + @@ -222,3 +246,10 @@ JoinExpression.propTypes = { rightFields: PropTypes.object, // indexPattern.fields IndexedArray object onRightFieldChange: PropTypes.func.isRequired, }; + + +function getSelectField() { + i18n.translate('xpack.maps.layerPanel.joinExpression.selectField', { + defaultMessage: 'selectField' + }); +} From a0419e0a2e3610616706d2dbdcc0a1e9c82431db Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Mon, 25 Feb 2019 14:42:55 -0500 Subject: [PATCH 20/84] localize joins (pt2) --- .../join_editor/resources/metrics_expression.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/metrics_expression.js b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/metrics_expression.js index 2ff00b6974a0e..70d59d1d93134 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/metrics_expression.js +++ b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/metrics_expression.js @@ -6,14 +6,13 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; - +import { i18n } from '@kbn/i18n'; import { EuiPopover, EuiPopoverTitle, EuiExpression, EuiFormErrorText, } from '@elastic/eui'; - import { MetricsEditor } from '../../../../shared/components/metrics_editor'; export class MetricsExpression extends Component { @@ -82,7 +81,11 @@ export class MetricsExpression extends Component { button={ 1 ? 'and use metrics' : 'and use metric'} + description={metricExpressions.length > 1 ? i18n.translate('xpack.maps.layerPanel.metricsExpression.useMetrics', { + defaultMessage: 'and use metrics' + }) : i18n.translate('xpack.maps.layerPanel.metricsExpression.useMetric', { + defaultMessage: 'and use metric' + })} uppercase={false} value={metricExpressions.length > 0 ? metricExpressions.join(', ') : 'count'} /> From 5e4aa68450fb9e426005134c25eccced336785e1 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Mon, 25 Feb 2019 14:46:03 -0500 Subject: [PATCH 21/84] localize joins (pt3) --- .../join_editor/resources/metrics_expression.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/metrics_expression.js b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/metrics_expression.js index 70d59d1d93134..a7a1715083d89 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/metrics_expression.js +++ b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/metrics_expression.js @@ -14,7 +14,7 @@ import { EuiFormErrorText, } from '@elastic/eui'; import { MetricsEditor } from '../../../../shared/components/metrics_editor'; - +import { FormattedMessage } from '@kbn/i18n/react'; export class MetricsExpression extends Component { state = { @@ -36,7 +36,12 @@ export class MetricsExpression extends Component { _renderMetricsEditor = () => { if (!this.props.rightFields) { return ( - JOIN must be set + + + ); } @@ -92,7 +97,12 @@ export class MetricsExpression extends Component { } >
- Metrics + + + {this._renderMetricsEditor()}
From 99bbea9bc8449c548845e866de2cc9151795f075 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 27 Feb 2019 17:13:54 -0500 Subject: [PATCH 22/84] localize settings --- .../settings_panel/settings_panel.js | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/maps/public/components/layer_panel/settings_panel/settings_panel.js b/x-pack/plugins/maps/public/components/layer_panel/settings_panel/settings_panel.js index 9aa4d99e9e6be..b77b23540ff2e 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/settings_panel/settings_panel.js +++ b/x-pack/plugins/maps/public/components/layer_panel/settings_panel/settings_panel.js @@ -18,6 +18,7 @@ import { EuiCallOut, } from '@elastic/eui'; import { ValidatedRange } from '../../../shared/components/validated_range'; +import { i18n } from '@kbn/i18n'; export function SettingsPanel(props) { @@ -53,7 +54,11 @@ export function SettingsPanel(props) {

{props.layer.getErrors()} @@ -67,7 +72,11 @@ export function SettingsPanel(props) { const renderZoomSliders = () => { return ( @@ -106,7 +115,11 @@ export function SettingsPanel(props) { const renderLabel = () => { return ( { return (

Date: Wed, 27 Feb 2019 17:19:47 -0500 Subject: [PATCH 23/84] localize toc entry --- .../components/widget_overlay/layer_control/view.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/maps/public/components/widget_overlay/layer_control/view.js b/x-pack/plugins/maps/public/components/widget_overlay/layer_control/view.js index d6cef372a5494..db19ddedd6e16 100644 --- a/x-pack/plugins/maps/public/components/widget_overlay/layer_control/view.js +++ b/x-pack/plugins/maps/public/components/widget_overlay/layer_control/view.js @@ -13,6 +13,7 @@ import { EuiTitle, } from '@elastic/eui'; import { LayerTOC } from './layer_toc'; +import { FormattedMessage } from '@kbn/i18n/react'; export function LayerControl({ isReadOnly, showAddLayerWizard }) { let addLayer; @@ -25,7 +26,10 @@ export function LayerControl({ isReadOnly, showAddLayerWizard }) { onClick={showAddLayerWizard} data-test-subj="addLayerButton" > - Add layer + ); @@ -42,7 +46,12 @@ export function LayerControl({ isReadOnly, showAddLayerWizard }) { > -

Layers

+

+ +

{addLayer} From 65f67d687fd107cbb7ddee21ef27a5831749c2fb Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 27 Feb 2019 17:24:14 -0500 Subject: [PATCH 24/84] view control --- .../layer_panel/join_editor/view.js | 1 - .../view_control/view_control.js | 20 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/maps/public/components/layer_panel/join_editor/view.js b/x-pack/plugins/maps/public/components/layer_panel/join_editor/view.js index 23c4aede3359e..fb4a18ed1f3be 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/join_editor/view.js +++ b/x-pack/plugins/maps/public/components/layer_panel/join_editor/view.js @@ -18,7 +18,6 @@ import { import { Join } from './resources/join'; import { injectI18n, FormattedMessage } from '@kbn/i18n/react'; -// export const JoinEditor = injectI18n(({intl}) => { export const JoinEditor = injectI18n(({ joins, layer, onChange, intl }) => { const renderJoins = () => { diff --git a/x-pack/plugins/maps/public/components/widget_overlay/view_control/view_control.js b/x-pack/plugins/maps/public/components/widget_overlay/view_control/view_control.js index 9027255b6072d..1cc23defa403b 100644 --- a/x-pack/plugins/maps/public/components/widget_overlay/view_control/view_control.js +++ b/x-pack/plugins/maps/public/components/widget_overlay/view_control/view_control.js @@ -16,6 +16,7 @@ import { } from '@elastic/eui'; import { SetView } from './set_view'; import { DECIMAL_DEGREES_PRECISION } from '../../../../common/constants'; +import { FormattedMessage } from '@kbn/i18n/react'; export function ViewControl({ isSetViewOpen, closeSetView, openSetView, mouseCoordinates }) { const toggleSetViewVisibility = () => { @@ -37,7 +38,10 @@ export function ViewControl({ isSetViewOpen, closeSetView, openSetView, mouseCoo onClick={toggleSetViewVisibility} data-test-subj="toggleSetViewVisibilityButton" > - Go to + )} isOpen={isSetViewOpen} closePopover={closeSetView} @@ -57,8 +61,18 @@ export function ViewControl({ isSetViewOpen, closeSetView, openSetView, mouseCoo

- lat: {lat},{' '} - lon: {lon} + + + {lat},{' '} + + + {lon}

From d8521517f69201c2c96bf429bc7ab41bc38d012f Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 28 Feb 2019 11:49:02 -0500 Subject: [PATCH 25/84] localize inspector --- .../public/inspector/views/map_details.js | 26 +++++++++++++++---- .../maps/public/inspector/views/map_view.js | 9 +++++-- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/maps/public/inspector/views/map_details.js b/x-pack/plugins/maps/public/inspector/views/map_details.js index 038085043505a..b42af15780066 100644 --- a/x-pack/plugins/maps/public/inspector/views/map_details.js +++ b/x-pack/plugins/maps/public/inspector/views/map_details.js @@ -15,6 +15,9 @@ import { EuiTableRow, EuiTableRowCell, } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; + const DETAILS_TAB_ID = 'details'; const STYLE_TAB_ID = 'mapStyle'; @@ -23,11 +26,15 @@ class MapDetails extends Component { tabs = [{ id: DETAILS_TAB_ID, - name: 'Map details', + name: i18n.translate('xpack.maps.inspector.mapDetails', { + defaultMessage: 'Map details' + }), dataTestSubj: 'mapDetailsTab', }, { id: STYLE_TAB_ID, - name: 'Mapbox style', + name: i18n.translate('xpack.maps.inspector.mapboxStyle', { + defaultMessage: 'Mapbox style' + }), dataTestSubj: 'mapboxStyleTab', }]; @@ -60,21 +67,30 @@ class MapDetails extends Component { - Center lon + {this.props.centerLon} - Center lat + {this.props.centerLat} - Zoom + {this.props.zoom} diff --git a/x-pack/plugins/maps/public/inspector/views/map_view.js b/x-pack/plugins/maps/public/inspector/views/map_view.js index a42c7bbddfff9..71278d3723b1d 100644 --- a/x-pack/plugins/maps/public/inspector/views/map_view.js +++ b/x-pack/plugins/maps/public/inspector/views/map_view.js @@ -9,6 +9,7 @@ import PropTypes from 'prop-types'; import { InspectorView } from 'ui/inspector'; import { MapDetails } from './map_details'; +import { i18n } from '@kbn/i18n'; class MapViewComponent extends Component { @@ -54,9 +55,13 @@ MapViewComponent.propTypes = { }; const MapView = { - title: 'Map details', + title: i18n.translate('xpack.maps.inspector.mapDetailsView', { + defaultMessage: 'Map details' + }), order: 30, - help: `View the map state`, + help: i18n.translate('xpack.maps.inspector.helpView', { + defaultMessage: 'View the map state' + }), shouldShow(adapters) { return Boolean(adapters.map); }, From b10b95257abd262618666bd30ca4e2d7c3ef16a6 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 28 Feb 2019 12:01:27 -0500 Subject: [PATCH 26/84] layer actions --- .../shared/components/layer_toc_actions.js | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/components/layer_toc_actions.js b/x-pack/plugins/maps/public/shared/components/layer_toc_actions.js index ae71f5db63469..19726be1028e8 100644 --- a/x-pack/plugins/maps/public/shared/components/layer_toc_actions.js +++ b/x-pack/plugins/maps/public/shared/components/layer_toc_actions.js @@ -15,6 +15,7 @@ import { EuiToolTip, EuiIconTip } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; function flattenPanelTree(tree, array = []) { array.push(tree); @@ -103,7 +104,7 @@ export class LayerTocActions extends Component { if (layer.hasErrors()) { smallLegendIcon = ( {icon} @@ -135,10 +140,14 @@ export class LayerTocActions extends Component { const visibilityToggle = this._getVisbilityIcon(); const panelTree = { id: 0, - title: 'Layer actions', + title: i18n.translate('xpack.maps.layerTocActions.layerActions', { + defaultMessage: 'Layer actions', + }), items: [ { - name: 'Fit to data', + name: i18n.translate('xpack.maps.layerTocActions.fitToData', { + defaultMessage: 'Fit to data', + }), icon: ( ), 'data-test-subj': 'fitToBoundsButton', - toolTipContent: this.state.supportsFitToBounds ? null : 'Layer does not support fit to data', + toolTipContent: this.state.supportsFitToBounds ? null : i18n.translate('xpack.maps.layerTocActions.noFitSupport', { + defaultMessage: 'Layer does not support fit to data', + }), disabled: !this.state.supportsFitToBounds, onClick: () => { this._closePopover(); @@ -154,7 +165,11 @@ export class LayerTocActions extends Component { }, }, { - name: this.props.layer.isVisible() ? 'Hide layer' : 'Show layer', + name: this.props.layer.isVisible() ? i18n.translate('xpack.maps.layerTocActions.hideLayer', { + defaultMessage: 'Hide layer', + }) : i18n.translate('xpack.maps.layerTocActions.showLayer', { + defaultMessage: 'Show layer', + }), icon: visibilityToggle, 'data-test-subj': 'layerVisibilityToggleButton', onClick: () => { From b0f8ed4e066a3dbc88066f441e9d8c7295bed298 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 28 Feb 2019 12:31:52 -0500 Subject: [PATCH 27/84] localize map listing --- .../public/shared/components/map_listing.js | 96 +++++++++++++++---- 1 file changed, 77 insertions(+), 19 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/components/map_listing.js b/x-pack/plugins/maps/public/shared/components/map_listing.js index 03b85dfd6752a..818a022348736 100644 --- a/x-pack/plugins/maps/public/shared/components/map_listing.js +++ b/x-pack/plugins/maps/public/shared/components/map_listing.js @@ -25,6 +25,8 @@ import { EuiCallOut, EuiBetaBadge, } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; export const EMPTY_FILTER = ''; @@ -86,7 +88,9 @@ export class MapListing extends React.Component { await this.props.delete(this.state.selectedIds); } catch (error) { toastNotifications.addDanger({ - title: `Unable to delete map(s)`, + title: i18n.translate('xpack.maps.mapListing.unableToDelete', { + defaultMessage: `Unable to delete map(s)` + }), text: `${error}`, }); } @@ -168,14 +172,25 @@ export class MapListing extends React.Component { return ( -

{`You can't recover deleted items.`}

+

+ +

); @@ -186,14 +201,32 @@ export class MapListing extends React.Component { return (

- You have {this.state.totalItems} items, - but your listingLimit setting prevents the table below from displaying more than {this.props.listingLimit}. - You can change this setting under Advanced Settings. + + + + + .

@@ -208,10 +241,14 @@ export class MapListing extends React.Component { } if (this.hasNoItems()) { - return `Looks like you don't have any maps. Click the create button to create one.`; + return i18n.translate('xpack.maps.mapListing.noItems', { + defaultMessage: `Looks like you don't have any maps. Click the create button to create one.` + }); } - return 'No items matched your search.'; + return i18n.translate('xpack.maps.mapListing.noMatch', { + defaultMessage: 'No items matched your search.' + }); } renderSearchBar() { @@ -225,7 +262,10 @@ export class MapListing extends React.Component { data-test-subj="deleteSelectedItems" key="delete" > - Delete selected + ); @@ -236,8 +276,12 @@ export class MapListing extends React.Component { {deleteBtn} { @@ -256,7 +300,9 @@ export class MapListing extends React.Component { const tableColumns = [ { field: 'title', - name: 'Title', + name: i18n.translate('xpack.maps.mapListing.titleField', { + defaultMessage: 'Title' + }), sortable: true, render: (field, record) => ( - Create map + ); @@ -335,7 +386,10 @@ export class MapListing extends React.Component {

- Maps +

@@ -343,7 +397,11 @@ export class MapListing extends React.Component { From debf79f2bcb7360f3a94aa2197e9bd33aa1122c5 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 28 Feb 2019 12:37:25 -0500 Subject: [PATCH 28/84] localize metric-select --- .../public/shared/components/metric_select.js | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/components/metric_select.js b/x-pack/plugins/maps/public/shared/components/metric_select.js index dda659106a1f7..73bb0e4426b53 100644 --- a/x-pack/plugins/maps/public/shared/components/metric_select.js +++ b/x-pack/plugins/maps/public/shared/components/metric_select.js @@ -6,15 +6,30 @@ import React from 'react'; import PropTypes from 'prop-types'; - +import { i18n } from '@kbn/i18n'; import { EuiComboBox } from '@elastic/eui'; const AGG_OPTIONS = [ - { label: 'Average', value: 'avg' }, - { label: 'Count', value: 'count' }, - { label: 'Max', value: 'max' }, - { label: 'Min', value: 'min' }, - { label: 'Sum', value: 'sum' }, + { label: i18n.translate('xpack.maps.metricSelect.average', { + defaultMessage: 'Average' + }), + value: 'avg' }, + { label: i18n.translate('xpack.maps.metricSelect.count', { + defaultMessage: 'Count' + }), + value: 'count' }, + { label: i18n.translate('xpack.maps.metricSelect.max', { + defaultMessage: 'Max' + }), + value: 'max' }, + { label: i18n.translate('xpack.maps.metricSelect.min', { + defaultMessage: 'Min' + }), + value: 'min' }, + { label: i18n.translate('xpack.maps.metricSelect.sum', { + defaultMessage: 'Sum' + }), + value: 'sum' }, ]; export const METRIC_AGGREGATION_VALUES = AGG_OPTIONS.map(({ value }) => { return value; }); @@ -34,7 +49,11 @@ export function MetricSelect({ value, onChange, metricsFilter }) { return ( Date: Thu, 28 Feb 2019 12:41:56 -0500 Subject: [PATCH 29/84] localize metrics-editor --- .../shared/components/metrics_editor.js | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/components/metrics_editor.js b/x-pack/plugins/maps/public/shared/components/metrics_editor.js index ed3e166fe3934..1742304588eef 100644 --- a/x-pack/plugins/maps/public/shared/components/metrics_editor.js +++ b/x-pack/plugins/maps/public/shared/components/metrics_editor.js @@ -6,6 +6,8 @@ import React, { Fragment } from 'react'; import PropTypes from 'prop-types'; +import { i18n } from '@kbn/i18n'; + import { EuiFlexGroup, @@ -60,7 +62,9 @@ export function MetricsEditor({ fields, metrics, onChange, allowMultipleMetrics, fieldSelect = ( @@ -120,8 +124,8 @@ export function MetricsEditor({ fields, metrics, onChange, allowMultipleMetrics, return (); } @@ -161,3 +165,16 @@ MetricsEditor.defaultProps = { ], allowMultipleMetrics: true }; + + +function getAddMetric() { + return i18n.translate('xpack.maps.metricsEditor.addMetric', { + defaultMessage: 'Add metric' + }); +} + +function getDeleteMetric() { + return i18n.translate('xpack.maps.metricsEditor.deleteMetric', { + defaultMessage: 'Delete metric' + }); +} From d297e06a3c268e04a8bdc1441ebfa1149ef48616 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 28 Feb 2019 12:55:17 -0500 Subject: [PATCH 30/84] localize no-index-pattern-callout --- .../components/no_index_pattern_callout.js | 35 +++++++++++++++---- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/components/no_index_pattern_callout.js b/x-pack/plugins/maps/public/shared/components/no_index_pattern_callout.js index 6465756387829..df1a3249e1f9d 100644 --- a/x-pack/plugins/maps/public/shared/components/no_index_pattern_callout.js +++ b/x-pack/plugins/maps/public/shared/components/no_index_pattern_callout.js @@ -8,24 +8,45 @@ import chrome from 'ui/chrome'; import React from 'react'; import { EuiCallOut, EuiLink } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; export function NoIndexPatternCallout() { return (

- You’ll need to{' '} + - create an index pattern - {' '} - with geospatial fields. + + +

- Don’t have any geospatial data sets?{' '} + - Get started with some sample data sets. +

From 7d7eedd3678d8cb2543c025b0805c705850baee2 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 28 Feb 2019 12:58:54 -0500 Subject: [PATCH 31/84] localize range --- x-pack/plugins/maps/public/inspector/views/map_view.js | 2 +- .../maps/public/shared/components/validated_range.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/maps/public/inspector/views/map_view.js b/x-pack/plugins/maps/public/inspector/views/map_view.js index 71278d3723b1d..d4e12223b9fac 100644 --- a/x-pack/plugins/maps/public/inspector/views/map_view.js +++ b/x-pack/plugins/maps/public/inspector/views/map_view.js @@ -59,7 +59,7 @@ const MapView = { defaultMessage: 'Map details' }), order: 30, - help: i18n.translate('xpack.maps.inspector.helpView', { + help: i18n.translate('xpack.maps.inspector.viewMapState', { defaultMessage: 'View the map state' }), shouldShow(adapters) { diff --git a/x-pack/plugins/maps/public/shared/components/validated_range.js b/x-pack/plugins/maps/public/shared/components/validated_range.js index 9447dc6a21a2f..04f027e320f43 100644 --- a/x-pack/plugins/maps/public/shared/components/validated_range.js +++ b/x-pack/plugins/maps/public/shared/components/validated_range.js @@ -7,6 +7,7 @@ import React, { Fragment } from 'react'; import { EuiRange, EuiFormErrorText } from '@elastic/eui'; +import { FormattedText } from '@kbn/i18n/react'; function isWithinRange(min, max, value) { if (value >= min && value <= max) { @@ -68,7 +69,11 @@ export class ValidatedRange extends React.Component { if (!this.state.isValid) { errorMessage = ( - {`Must be between ${min} and ${max}`} + ); } From 521ff0939ff7d073c7d645c1429c6c279e5f12cc Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 28 Feb 2019 22:42:53 -0500 Subject: [PATCH 32/84] regenerate snapshots --- .../__snapshots__/view.test.js.snap | 14 ++++---------- .../__snapshots__/view.test.js.snap | 18 +++++++++++++++--- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/x-pack/plugins/maps/public/components/layer_panel/__snapshots__/view.test.js.snap b/x-pack/plugins/maps/public/components/layer_panel/__snapshots__/view.test.js.snap index be667afaf2da5..13d972217a7ed 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/__snapshots__/view.test.js.snap +++ b/x-pack/plugins/maps/public/components/layer_panel/__snapshots__/view.test.js.snap @@ -27,16 +27,10 @@ exports[`LayerPanel is rendered 1`] = ` component="div" grow={false} > - - Fit - +

- Layers +

@@ -47,7 +51,11 @@ exports[`LayerControl is rendered 1`] = ` size="xs" type="button" > - Add layer + @@ -92,7 +100,11 @@ exports[`LayerControl props isReadOnly 1`] = ` textTransform="none" >

- Layers +

From c19c30a79a96acb554b15d0a6c680781360db604 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 5 Mar 2019 09:57:58 -0500 Subject: [PATCH 33/84] review feedback (1) --- x-pack/plugins/maps/common/i18n_getters.js | 4 ++-- .../components/layer_panel/flyout_footer/view.js | 2 -- .../join_editor/resources/join_expression.js | 2 -- .../join_editor/resources/metrics_expression.js | 11 ++++++----- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/x-pack/plugins/maps/common/i18n_getters.js b/x-pack/plugins/maps/common/i18n_getters.js index aab344c421058..0055c899e52c7 100644 --- a/x-pack/plugins/maps/common/i18n_getters.js +++ b/x-pack/plugins/maps/common/i18n_getters.js @@ -14,13 +14,13 @@ export function getAppTitle() { export function getDataSourceLabel() { - return i18n.translate('xpack.maps.source.common.dataSourceLabel', { + return i18n.translate('xpack.maps.source.dataSourceLabel', { defaultMessage: 'Data source' }); } export function getUrlLabel() { - return i18n.translate('xpack.maps.source.common.urlLabel', { + return i18n.translate('xpack.maps.source.urlLabel', { defaultMessage: 'Url' }); } diff --git a/x-pack/plugins/maps/public/components/layer_panel/flyout_footer/view.js b/x-pack/plugins/maps/public/components/layer_panel/flyout_footer/view.js index 0e0ffecb861d2..c1118ed1eded4 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/flyout_footer/view.js +++ b/x-pack/plugins/maps/public/components/layer_panel/flyout_footer/view.js @@ -15,8 +15,6 @@ import { } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; - - export const FlyoutFooter = ({ cancelLayerPanel, saveLayerEdits, removeLayer, hasStateChanged }) => { const removeBtn = ( diff --git a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join_expression.js b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join_expression.js index 0c6ba21cc900f..3c879a4b05dfe 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join_expression.js +++ b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join_expression.js @@ -132,7 +132,6 @@ export class JoinExpression extends Component { ); } - _renderRightFieldSelect() { if (!this.props.rightFields || !this.props.leftValue) { return null; @@ -247,7 +246,6 @@ JoinExpression.propTypes = { onRightFieldChange: PropTypes.func.isRequired, }; - function getSelectField() { i18n.translate('xpack.maps.layerPanel.joinExpression.selectField', { defaultMessage: 'selectField' diff --git a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/metrics_expression.js b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/metrics_expression.js index a7a1715083d89..4049729d69291 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/metrics_expression.js +++ b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/metrics_expression.js @@ -74,6 +74,11 @@ export class MetricsExpression extends Component { return `${type} ${field}`; }); + const useMetricDescription = metricExpressions.length > 1 ? i18n.translate('xpack.maps.layerPanel.metricsExpression.useMetrics', { + defaultMessage: 'and use metrics' + }) : i18n.translate('xpack.maps.layerPanel.metricsExpression.useMetric', { + defaultMessage: 'and use metric' + }); return ( 1 ? i18n.translate('xpack.maps.layerPanel.metricsExpression.useMetrics', { - defaultMessage: 'and use metrics' - }) : i18n.translate('xpack.maps.layerPanel.metricsExpression.useMetric', { - defaultMessage: 'and use metric' - })} + description={useMetricDescription} uppercase={false} value={metricExpressions.length > 0 ? metricExpressions.join(', ') : 'count'} /> From ffa22e972080f5f697079b763722afeff1a00946 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 5 Mar 2019 10:11:29 -0500 Subject: [PATCH 34/84] remove wrapper --- .../public/components/layer_panel/join_editor/view.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/maps/public/components/layer_panel/join_editor/view.js b/x-pack/plugins/maps/public/components/layer_panel/join_editor/view.js index fb4a18ed1f3be..bb217fedd9897 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/join_editor/view.js +++ b/x-pack/plugins/maps/public/components/layer_panel/join_editor/view.js @@ -16,9 +16,10 @@ import { } from '@elastic/eui'; import { Join } from './resources/join'; -import { injectI18n, FormattedMessage } from '@kbn/i18n/react'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { i18n } from '@kbn/i18n'; -export const JoinEditor = injectI18n(({ joins, layer, onChange, intl }) => { +export function JoinEditor({ joins, layer, onChange }) { const renderJoins = () => { return joins.map((joinDescriptor, index) => { @@ -86,8 +87,7 @@ export const JoinEditor = injectI18n(({ joins, layer, onChange, intl }) => { onClick={addJoin} aria-label="Add join" title={ - intl.formatMessage({ - id: 'xpack.maps.layerPanel.joinEditor.addJoin', + i18n.translate('xpack.maps.layerPanel.joinEditor.addJoinButtonLabel', { defaultMessage: 'Add join' }) } @@ -98,4 +98,4 @@ export const JoinEditor = injectI18n(({ joins, layer, onChange, intl }) => { {renderJoins()}
); -}); +} From 296171b16dbcc4d5009e038ac4d59c19463d4ff3 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 5 Mar 2019 10:39:03 -0500 Subject: [PATCH 35/84] rename labels --- .../public/components/layer_addpanel/view.js | 6 ++-- .../layer_panel/flyout_footer/view.js | 2 +- .../layer_panel/join_editor/resources/join.js | 15 ++++----- .../join_editor/resources/join_expression.js | 18 +++++------ .../resources/metrics_expression.js | 16 ++++++---- .../layer_panel/join_editor/view.js | 2 +- .../settings_panel/settings_panel.js | 8 ++--- .../widget_overlay/layer_control/view.js | 4 +-- .../view_control/view_control.js | 6 ++-- .../maps/public/elasticsearch_geo_utils.js | 10 +++--- .../public/inspector/views/map_details.js | 10 +++--- .../maps/public/inspector/views/map_view.js | 4 +-- .../shared/components/layer_toc_actions.js | 14 ++++---- .../public/shared/components/map_listing.js | 32 +++++++++---------- .../public/shared/components/metric_select.js | 12 +++---- .../shared/components/metrics_editor.js | 31 ++++++++---------- .../components/no_index_pattern_callout.js | 12 +++---- .../shared/components/validated_range.js | 2 +- .../shared/layers/styles/heatmap_style.js | 2 +- .../public/shared/layers/styles/tile_style.js | 2 +- .../shared/layers/styles/vector_style.js | 2 +- .../server/maps_telemetry/telemetry_task.js | 4 +-- x-pack/plugins/maps/server/routes.js | 2 +- 23 files changed, 105 insertions(+), 111 deletions(-) diff --git a/x-pack/plugins/maps/public/components/layer_addpanel/view.js b/x-pack/plugins/maps/public/components/layer_addpanel/view.js index 6b2dbfebc945a..4a8b0743177c5 100644 --- a/x-pack/plugins/maps/public/components/layer_addpanel/view.js +++ b/x-pack/plugins/maps/public/components/layer_addpanel/view.js @@ -73,7 +73,7 @@ export class AddLayerPanel extends Component { fill > @@ -135,7 +135,7 @@ export class AddLayerPanel extends Component { iconType="arrowLeft" > @@ -165,7 +165,7 @@ export class AddLayerPanel extends Component {

diff --git a/x-pack/plugins/maps/public/components/layer_panel/flyout_footer/view.js b/x-pack/plugins/maps/public/components/layer_panel/flyout_footer/view.js index c1118ed1eded4..c729e17e7d311 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/flyout_footer/view.js +++ b/x-pack/plugins/maps/public/components/layer_panel/flyout_footer/view.js @@ -26,7 +26,7 @@ export const FlyoutFooter = ({ cancelLayerPanel, saveLayerEdits, removeLayer, data-test-subj="mapRemoveLayerButton" > diff --git a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join.js b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join.js index bf7527227aacd..6981daef89c4b 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join.js +++ b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join.js @@ -203,8 +203,12 @@ export class Join extends Component { className="mapJoinItem__delete" iconType="trash" color="danger" - aria-label={getDeleteJoin()} - title={getDeleteJoin()} + aria-label={i18n.translate('xpack.maps.layerPanel.join.deleteJoinAriaLabel', { + defaultMessage: 'Delete join' + })} + title={i18n.translate('xpack.maps.layerPanel.join.deleteJoinTitle', { + defaultMessage: 'Delete join' + })} onClick={onRemove} /> @@ -212,10 +216,3 @@ export class Join extends Component { ); } } - - -function getDeleteJoin() { - return i18n.translate('xpack.maps.layerPanel.join.deleteJoin', { - defaultMessage: 'Delete join' - }); -} diff --git a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join_expression.js b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join_expression.js index 3c879a4b05dfe..603aaa9bb0d3f 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join_expression.js +++ b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join_expression.js @@ -88,13 +88,13 @@ export class JoinExpression extends Component { return ( @@ -246,8 +246,8 @@ JoinExpression.propTypes = { onRightFieldChange: PropTypes.func.isRequired, }; -function getSelectField() { - i18n.translate('xpack.maps.layerPanel.joinExpression.selectField', { +function getSelectFieldPlaceholder() { + i18n.translate('xpack.maps.layerPanel.joinExpression.selectFieldPlaceholder', { defaultMessage: 'selectField' }); } diff --git a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/metrics_expression.js b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/metrics_expression.js index 4049729d69291..87a393e6d440b 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/metrics_expression.js +++ b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/metrics_expression.js @@ -38,7 +38,7 @@ export class MetricsExpression extends Component { return ( @@ -74,11 +74,13 @@ export class MetricsExpression extends Component { return `${type} ${field}`; }); - const useMetricDescription = metricExpressions.length > 1 ? i18n.translate('xpack.maps.layerPanel.metricsExpression.useMetrics', { - defaultMessage: 'and use metrics' - }) : i18n.translate('xpack.maps.layerPanel.metricsExpression.useMetric', { - defaultMessage: 'and use metric' - }); + const useMetricDescription = metricExpressions.length > 1 ? + i18n.translate('xpack.maps.layerPanel.metricsExpression.useMetricsMultipleDescription', { + defaultMessage: 'and use metrics' + }) : + i18n.translate('xpack.maps.layerPanel.metricsExpression.useMetricsSingleDescription', { + defaultMessage: 'and use metric' + }); return ( diff --git a/x-pack/plugins/maps/public/components/layer_panel/join_editor/view.js b/x-pack/plugins/maps/public/components/layer_panel/join_editor/view.js index bb217fedd9897..d491ae8f25ea9 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/join_editor/view.js +++ b/x-pack/plugins/maps/public/components/layer_panel/join_editor/view.js @@ -74,7 +74,7 @@ export function JoinEditor({ joins, layer, onChange }) {
diff --git a/x-pack/plugins/maps/public/components/layer_panel/settings_panel/settings_panel.js b/x-pack/plugins/maps/public/components/layer_panel/settings_panel/settings_panel.js index b77b23540ff2e..a14c74d4032a0 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/settings_panel/settings_panel.js +++ b/x-pack/plugins/maps/public/components/layer_panel/settings_panel/settings_panel.js @@ -55,7 +55,7 @@ export function SettingsPanel(props) { @@ -48,7 +48,7 @@ export function LayerControl({ isReadOnly, showAddLayerWizard }) {

diff --git a/x-pack/plugins/maps/public/components/widget_overlay/view_control/view_control.js b/x-pack/plugins/maps/public/components/widget_overlay/view_control/view_control.js index 1cc23defa403b..cf113d071c5cc 100644 --- a/x-pack/plugins/maps/public/components/widget_overlay/view_control/view_control.js +++ b/x-pack/plugins/maps/public/components/widget_overlay/view_control/view_control.js @@ -39,7 +39,7 @@ export function ViewControl({ isSetViewOpen, closeSetView, openSetView, mouseCoo data-test-subj="toggleSetViewVisibilityButton" > )} @@ -63,13 +63,13 @@ export function ViewControl({ isSetViewOpen, closeSetView, openSetView, mouseCoo

{lat},{' '} {lon} diff --git a/x-pack/plugins/maps/public/elasticsearch_geo_utils.js b/x-pack/plugins/maps/public/elasticsearch_geo_utils.js index d0c61a782f00d..f926ceee1cd52 100644 --- a/x-pack/plugins/maps/public/elasticsearch_geo_utils.js +++ b/x-pack/plugins/maps/public/elasticsearch_geo_utils.js @@ -28,7 +28,7 @@ export function hitsToGeoJson(hits, flattenHit, geoFieldName, geoFieldType) { } else if (geoFieldType === 'geo_shape') { geometries = geoShapeToGeometry(properties[geoFieldName]); } else { - const errorMessage = i18n.translate('xpack.maps.elasticsearch_geo_utils.unsupportedFieldType', { + const errorMessage = i18n.translate('xpack.maps.elasticsearch_geo_utils.unsupportedFieldTypeErrorMessage', { defaultMessage: 'Unsupported field type, expected: geo_shape or geo_point, you provided: {geoFieldType}', values: { geoFieldType } }); @@ -68,7 +68,7 @@ export function geoPointToGeometry(value) { if (typeof value === 'string') { const commaSplit = value.split(','); if (commaSplit.length === 1) { - const errorMessage = i18n.translate('xpack.maps.elasticsearch_geo_utils.geohashIsUnsupported', { + const errorMessage = i18n.translate('xpack.maps.elasticsearch_geo_utils.geohashIsUnsupportedErrorMessage', { defaultMessage: `Unable to convert to geojson, geohash not supported` }); @@ -86,7 +86,7 @@ export function geoPointToGeometry(value) { } if (!Array.isArray(value)) { - const errorMessage = i18n.translate('xpack.maps.elasticsearch_geo_utils.unsupportedGeoPointValue', { + const errorMessage = i18n.translate('xpack.maps.elasticsearch_geo_utils.unsupportedGeoPointValueErrorMessage', { defaultMessage: `Unsupported geo_point value: {geoPointValue}`, values: { geoPointValue: value @@ -130,7 +130,7 @@ export function geoShapeToGeometry(value) { // TODO handle case where value is WKT and convert to geojson if (typeof value === 'string') { - const errorMessage = i18n.translate('xpack.maps.elasticsearch_geo_utils.wktIsUnsupported', { + const errorMessage = i18n.translate('xpack.maps.elasticsearch_geo_utils.wktIsUnsupportedErrorMessage', { defaultMessage: `Unable to convert WKT to geojson, not supported`, }); throw new Error(errorMessage); @@ -197,7 +197,7 @@ export function createExtentFilter(mapExtent, geoFieldName, geoFieldType) { } }; } else { - const errorMessage = i18n.translate('xpack.maps.elasticsearch_geo_utils.unsupportedGeoFieldType', { + const errorMessage = i18n.translate('xpack.maps.elasticsearch_geo_utils.unsupportedGeoFieldTypeErrorMessage', { defaultMessage: `Unsupported field type, expected: geo_shape or geo_point, you provided: {geoFieldType}`, values: { geoFieldType } }); diff --git a/x-pack/plugins/maps/public/inspector/views/map_details.js b/x-pack/plugins/maps/public/inspector/views/map_details.js index b42af15780066..389b69f005861 100644 --- a/x-pack/plugins/maps/public/inspector/views/map_details.js +++ b/x-pack/plugins/maps/public/inspector/views/map_details.js @@ -26,13 +26,13 @@ class MapDetails extends Component { tabs = [{ id: DETAILS_TAB_ID, - name: i18n.translate('xpack.maps.inspector.mapDetails', { + name: i18n.translate('xpack.maps.inspector.mapDetailsTitle', { defaultMessage: 'Map details' }), dataTestSubj: 'mapDetailsTab', }, { id: STYLE_TAB_ID, - name: i18n.translate('xpack.maps.inspector.mapboxStyle', { + name: i18n.translate('xpack.maps.inspector.mapboxStyleTitle', { defaultMessage: 'Mapbox style' }), dataTestSubj: 'mapboxStyleTab', @@ -68,7 +68,7 @@ class MapDetails extends Component { @@ -78,7 +78,7 @@ class MapDetails extends Component { @@ -88,7 +88,7 @@ class MapDetails extends Component { diff --git a/x-pack/plugins/maps/public/inspector/views/map_view.js b/x-pack/plugins/maps/public/inspector/views/map_view.js index d4e12223b9fac..9c347cf75763e 100644 --- a/x-pack/plugins/maps/public/inspector/views/map_view.js +++ b/x-pack/plugins/maps/public/inspector/views/map_view.js @@ -55,11 +55,11 @@ MapViewComponent.propTypes = { }; const MapView = { - title: i18n.translate('xpack.maps.inspector.mapDetailsView', { + title: i18n.translate('xpack.maps.inspector.mapDetailsViewTitle', { defaultMessage: 'Map details' }), order: 30, - help: i18n.translate('xpack.maps.inspector.viewMapState', { + help: i18n.translate('xpack.maps.inspector.viewMapStateTitle', { defaultMessage: 'View the map state' }), shouldShow(adapters) { diff --git a/x-pack/plugins/maps/public/shared/components/layer_toc_actions.js b/x-pack/plugins/maps/public/shared/components/layer_toc_actions.js index 19726be1028e8..158d51b6fcfbb 100644 --- a/x-pack/plugins/maps/public/shared/components/layer_toc_actions.js +++ b/x-pack/plugins/maps/public/shared/components/layer_toc_actions.js @@ -104,7 +104,7 @@ export class LayerTocActions extends Component { if (layer.hasErrors()) { smallLegendIcon = ( ), 'data-test-subj': 'fitToBoundsButton', - toolTipContent: this.state.supportsFitToBounds ? null : i18n.translate('xpack.maps.layerTocActions.noFitSupport', { + toolTipContent: this.state.supportsFitToBounds ? null : i18n.translate('xpack.maps.layerTocActions.noFitSupportTooltip', { defaultMessage: 'Layer does not support fit to data', }), disabled: !this.state.supportsFitToBounds, @@ -165,9 +165,9 @@ export class LayerTocActions extends Component { }, }, { - name: this.props.layer.isVisible() ? i18n.translate('xpack.maps.layerTocActions.hideLayer', { + name: this.props.layer.isVisible() ? i18n.translate('xpack.maps.layerTocActions.hideLayerTitle', { defaultMessage: 'Hide layer', - }) : i18n.translate('xpack.maps.layerTocActions.showLayer', { + }) : i18n.translate('xpack.maps.layerTocActions.showLayerTitle', { defaultMessage: 'Show layer', }), icon: visibilityToggle, diff --git a/x-pack/plugins/maps/public/shared/components/map_listing.js b/x-pack/plugins/maps/public/shared/components/map_listing.js index 818a022348736..ecd0dfc3bda1c 100644 --- a/x-pack/plugins/maps/public/shared/components/map_listing.js +++ b/x-pack/plugins/maps/public/shared/components/map_listing.js @@ -88,7 +88,7 @@ export class MapListing extends React.Component { await this.props.delete(this.state.selectedIds); } catch (error) { toastNotifications.addDanger({ - title: i18n.translate('xpack.maps.mapListing.unableToDelete', { + title: i18n.translate('xpack.maps.mapListing.unableToDeleteToastTitle', { defaultMessage: `Unable to delete map(s)` }), text: `${error}`, @@ -172,15 +172,15 @@ export class MapListing extends React.Component { return ( . @@ -241,12 +241,12 @@ export class MapListing extends React.Component { } if (this.hasNoItems()) { - return i18n.translate('xpack.maps.mapListing.noItems', { + return i18n.translate('xpack.maps.mapListing.noItemsDescription', { defaultMessage: `Looks like you don't have any maps. Click the create button to create one.` }); } - return i18n.translate('xpack.maps.mapListing.noMatch', { + return i18n.translate('xpack.maps.mapListing.noMatchDescription', { defaultMessage: 'No items matched your search.' }); } @@ -263,7 +263,7 @@ export class MapListing extends React.Component { key="delete" > @@ -276,7 +276,7 @@ export class MapListing extends React.Component { {deleteBtn} @@ -387,7 +387,7 @@ export class MapListing extends React.Component {

@@ -398,7 +398,7 @@ export class MapListing extends React.Component { @@ -124,8 +128,12 @@ export function MetricsEditor({ fields, metrics, onChange, allowMultipleMetrics, return (); } @@ -165,16 +173,3 @@ MetricsEditor.defaultProps = { ], allowMultipleMetrics: true }; - - -function getAddMetric() { - return i18n.translate('xpack.maps.metricsEditor.addMetric', { - defaultMessage: 'Add metric' - }); -} - -function getDeleteMetric() { - return i18n.translate('xpack.maps.metricsEditor.deleteMetric', { - defaultMessage: 'Delete metric' - }); -} diff --git a/x-pack/plugins/maps/public/shared/components/no_index_pattern_callout.js b/x-pack/plugins/maps/public/shared/components/no_index_pattern_callout.js index df1a3249e1f9d..129d27b54c0ea 100644 --- a/x-pack/plugins/maps/public/shared/components/no_index_pattern_callout.js +++ b/x-pack/plugins/maps/public/shared/components/no_index_pattern_callout.js @@ -15,7 +15,7 @@ export function NoIndexPatternCallout() { return (

diff --git a/x-pack/plugins/maps/public/shared/components/validated_range.js b/x-pack/plugins/maps/public/shared/components/validated_range.js index 04f027e320f43..fc399e62f0d4b 100644 --- a/x-pack/plugins/maps/public/shared/components/validated_range.js +++ b/x-pack/plugins/maps/public/shared/components/validated_range.js @@ -70,7 +70,7 @@ export class ValidatedRange extends React.Component { errorMessage = ( diff --git a/x-pack/plugins/maps/public/shared/layers/styles/heatmap_style.js b/x-pack/plugins/maps/public/shared/layers/styles/heatmap_style.js index a7a0ff6d3bb7b..c5fdfe7fdef17 100644 --- a/x-pack/plugins/maps/public/shared/layers/styles/heatmap_style.js +++ b/x-pack/plugins/maps/public/shared/layers/styles/heatmap_style.js @@ -28,7 +28,7 @@ export class HeatmapStyle extends AbstractStyle { } static getDisplayName() { - return i18n.translate('xpack.maps.style.heatmap.displayName', { + return i18n.translate('xpack.maps.style.heatmap.displayNameLabel', { defaultMessage: 'Heatmap style' }); } diff --git a/x-pack/plugins/maps/public/shared/layers/styles/tile_style.js b/x-pack/plugins/maps/public/shared/layers/styles/tile_style.js index 848198a05dcfc..20e8429e6e115 100644 --- a/x-pack/plugins/maps/public/shared/layers/styles/tile_style.js +++ b/x-pack/plugins/maps/public/shared/layers/styles/tile_style.js @@ -30,7 +30,7 @@ export class TileStyle extends AbstractStyle { } static getDisplayName() { - return i18n.translate('xpack.maps.style.tile.displayName', { + return i18n.translate('xpack.maps.style.tile.displayNameLabel', { defaultMessage: 'Tile style' }); } diff --git a/x-pack/plugins/maps/public/shared/layers/styles/vector_style.js b/x-pack/plugins/maps/public/shared/layers/styles/vector_style.js index 764c24ca2a0ce..92fdfd4ea65d1 100644 --- a/x-pack/plugins/maps/public/shared/layers/styles/vector_style.js +++ b/x-pack/plugins/maps/public/shared/layers/styles/vector_style.js @@ -45,7 +45,7 @@ export class VectorStyle extends AbstractStyle { } static getDisplayName() { - return i18n.translate('xpack.maps.style.vector.displayName', { + return i18n.translate('xpack.maps.style.vector.displayNameLabel', { defaultMessage: 'Vector style' }); } diff --git a/x-pack/plugins/maps/server/maps_telemetry/telemetry_task.js b/x-pack/plugins/maps/server/maps_telemetry/telemetry_task.js index a484a69cb2c26..06123e81ee133 100644 --- a/x-pack/plugins/maps/server/maps_telemetry/telemetry_task.js +++ b/x-pack/plugins/maps/server/maps_telemetry/telemetry_task.js @@ -23,7 +23,7 @@ export function scheduleTask(server, taskManager) { }); }catch(e) { server.log(['warning', 'maps'], - i18n.translate('xpack.maps.telemetry.scheduleError', { + i18n.translate('xpack.maps.telemetry.scheduleErrorMessage', { defaultMessage: `Error scheduling telemetry task, received {message}`, values: { message: e.message @@ -65,7 +65,7 @@ export function telemetryTaskRunner() { mapsTelemetry = await getMapsTelemetry(server, callCluster); } catch (err) { server.log(['warning'], - i18n.translate('xpack.maps.telemetry.loadError', { + i18n.translate('xpack.maps.telemetry.loadErrorMessage', { defaultMessage: `Error loading maps telemetry: {error}`, values: { error: err diff --git a/x-pack/plugins/maps/server/routes.js b/x-pack/plugins/maps/server/routes.js index 20efa60e7d4e3..9f3e998c3b560 100644 --- a/x-pack/plugins/maps/server/routes.js +++ b/x-pack/plugins/maps/server/routes.js @@ -31,7 +31,7 @@ export function initRoutes(server, licenseUid) { if (!request.query.id) { server.log('warning', - i18n.translate('xpack.maps.server.missingEMSId', { + i18n.translate('xpack.maps.server.missingEMSIdErrorMessage', { defaultMessage: 'Must supply id parameters to retrieve EMS file' })); return null; From 15eebd181b253ff46dbbe4347fc56b56f3726c8a Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 5 Mar 2019 10:47:20 -0500 Subject: [PATCH 36/84] feedback (2) --- .../maps/public/shared/layers/styles/heatmap_style.js | 6 +++++- x-pack/plugins/maps/public/shared/utils/color_utils.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/styles/heatmap_style.js b/x-pack/plugins/maps/public/shared/layers/styles/heatmap_style.js index c5fdfe7fdef17..1b90cd71fe073 100644 --- a/x-pack/plugins/maps/public/shared/layers/styles/heatmap_style.js +++ b/x-pack/plugins/maps/public/shared/layers/styles/heatmap_style.js @@ -46,7 +46,11 @@ export class HeatmapStyle extends AbstractStyle { } else if (resolution === GRID_RESOLUTION.MOST_FINE) { radius = 32; } else { - throw new Error(`Resolution param not recognized: ${this._descriptor.refinement}`); + const errorMessage = i18n.translate('xpack.maps.style.heatmap.displayNameLabel', { + defaultMessage: `Resolution param not recognized: {resolution}`, + values: { resolution } + }); + throw new Error(errorMessage); } mbMap.setPaintProperty(layerId, 'heatmap-radius', radius); mbMap.setPaintProperty(layerId, 'heatmap-weight', { diff --git a/x-pack/plugins/maps/public/shared/utils/color_utils.js b/x-pack/plugins/maps/public/shared/utils/color_utils.js index 38c91c44cf0f4..187fcd7293e79 100644 --- a/x-pack/plugins/maps/public/shared/utils/color_utils.js +++ b/x-pack/plugins/maps/public/shared/utils/color_utils.js @@ -11,7 +11,7 @@ import chroma from 'chroma-js'; export function getRGBColorRangeStrings(colorName, numberColors) { const colorKeys = Object.keys(vislibColorMaps); if (!colorKeys.includes(colorName)) { - //This is an internal error and should never occur. It it does, it is a bug. + //This is an internal error and should never occur. If it does, then it is a bug. throw new Error(`${colorName} not found. Expected one of following values: \ ${colorKeys}`); } From 9a86cf2cf29ace80819992e3a0720457de5dbbf9 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 5 Mar 2019 10:54:49 -0500 Subject: [PATCH 37/84] feedback (3) --- .../public/shared/components/no_index_pattern_callout.js | 2 +- .../maps/public/shared/components/validated_range.js | 2 +- .../plugins/maps/public/shared/layers/sources/wms_source.js | 6 +++--- .../maps/public/shared/layers/sources/xyz_tms_source.js | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/components/no_index_pattern_callout.js b/x-pack/plugins/maps/public/shared/components/no_index_pattern_callout.js index 129d27b54c0ea..5a240ad65cba5 100644 --- a/x-pack/plugins/maps/public/shared/components/no_index_pattern_callout.js +++ b/x-pack/plugins/maps/public/shared/components/no_index_pattern_callout.js @@ -44,7 +44,7 @@ export function NoIndexPatternCallout() { /> diff --git a/x-pack/plugins/maps/public/shared/components/validated_range.js b/x-pack/plugins/maps/public/shared/components/validated_range.js index fc399e62f0d4b..7b8ead00c2e5a 100644 --- a/x-pack/plugins/maps/public/shared/components/validated_range.js +++ b/x-pack/plugins/maps/public/shared/components/validated_range.js @@ -70,7 +70,7 @@ export class ValidatedRange extends React.Component { errorMessage = ( diff --git a/x-pack/plugins/maps/public/shared/layers/sources/wms_source.js b/x-pack/plugins/maps/public/shared/layers/sources/wms_source.js index bc0f6d592410d..84f66298e0a02 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/wms_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/wms_source.js @@ -19,10 +19,10 @@ import { getDataSourceLabel, getUrlLabel } from '../../../../common/i18n_getters export class WMSSource extends AbstractTMSSource { static type = 'WMS'; - static title = i18n.translate('xpack.maps.source.wms.title', { + static title = i18n.translate('xpack.maps.source.wmsTitle', { defaultMessage: 'Web Map Service' }); - static description = i18n.translate('xpack.maps.source.wms.description', { + static description = i18n.translate('xpack.maps.source.wmsDescription', { defaultMessage: 'Maps from OGC Standard WMS' }); static icon = 'grid'; @@ -77,7 +77,7 @@ export class WMSSource extends AbstractTMSSource { } getUrlTemplate() { - const styles = this._descriptor.styles ? this._descriptor.styles : ''; + const styles = this._descriptor.styles || ''; // eslint-disable-next-line max-len return `${this._descriptor.serviceUrl}?bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&srs=EPSG:3857&transparent=true&width=256&height=256&layers=${this._descriptor.layers}&styles=${styles}`; } diff --git a/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js b/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js index aad82bd966d54..3737561cf6cca 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js @@ -19,10 +19,10 @@ import { getDataSourceLabel, getUrlLabel } from '../../../../common/i18n_getters export class XYZTMSSource extends AbstractTMSSource { static type = 'EMS_XYZ'; - static title = i18n.translate('xpack.maps.source.ems_xyz.title', { + static title = i18n.translate('xpack.maps.source.ems_xyzTitle', { defaultMessage: 'Tile Map Service from URL' }); - static description = i18n.translate('xpack.maps.source.ems_xyz.description', { + static description = i18n.translate('xpack.maps.source.ems_xyzDescription', { defaultMessage: 'Map tiles from a URL that includes the XYZ coordinates' }); static icon = 'grid'; From 63a3c0e047c14f930afab4aee5e2d5ecec8b6625 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 5 Mar 2019 10:57:13 -0500 Subject: [PATCH 38/84] feedback (4) --- .../maps/public/components/layer_addpanel/view.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/maps/public/components/layer_addpanel/view.js b/x-pack/plugins/maps/public/components/layer_addpanel/view.js index 4a8b0743177c5..9f4425414a9ee 100644 --- a/x-pack/plugins/maps/public/components/layer_addpanel/view.js +++ b/x-pack/plugins/maps/public/components/layer_addpanel/view.js @@ -106,7 +106,12 @@ export class AddLayerPanel extends Component { return ( -

Choose data source

+

+ +

{this._renderSourceCards()}
@@ -187,7 +192,10 @@ export class AddLayerPanel extends Component { flush="left" data-test-subj="layerAddCancelButton" > - Cancel + From 4ea4d06015d0157cf25dc01781f5f22e2f5f308a Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 5 Mar 2019 11:00:55 -0500 Subject: [PATCH 39/84] feedback (5) --- .../layer_panel/flyout_footer/view.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/maps/public/components/layer_panel/flyout_footer/view.js b/x-pack/plugins/maps/public/components/layer_panel/flyout_footer/view.js index c729e17e7d311..7e29c400d89c6 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/flyout_footer/view.js +++ b/x-pack/plugins/maps/public/components/layer_panel/flyout_footer/view.js @@ -33,6 +33,16 @@ export const FlyoutFooter = ({ cancelLayerPanel, saveLayerEdits, removeLayer, ); + + const cancelButtonLabel = hasStateChanged ? () : (); + + return ( @@ -40,7 +50,7 @@ export const FlyoutFooter = ({ cancelLayerPanel, saveLayerEdits, removeLayer, onClick={cancelLayerPanel} flush="left" > - {hasStateChanged ? 'Cancel' : 'Close'} + {cancelButtonLabel} @@ -54,7 +64,10 @@ export const FlyoutFooter = ({ cancelLayerPanel, saveLayerEdits, removeLayer, onClick={saveLayerEdits} fill > - Save & close + From 312b0493348f7eaf4b27fc6929f3de2b4d4be792 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 5 Mar 2019 11:03:28 -0500 Subject: [PATCH 40/84] feedback (6) --- .../layer_panel/join_editor/resources/join_expression.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join_expression.js b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join_expression.js index 603aaa9bb0d3f..36657f7822489 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join_expression.js +++ b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join_expression.js @@ -205,7 +205,11 @@ export class JoinExpression extends Component { /> Date: Tue, 5 Mar 2019 11:04:20 -0500 Subject: [PATCH 41/84] feedback (7) --- .../maps/public/components/layer_panel/join_editor/view.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/maps/public/components/layer_panel/join_editor/view.js b/x-pack/plugins/maps/public/components/layer_panel/join_editor/view.js index d491ae8f25ea9..600e645f1462b 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/join_editor/view.js +++ b/x-pack/plugins/maps/public/components/layer_panel/join_editor/view.js @@ -85,7 +85,10 @@ export function JoinEditor({ joins, layer, onChange }) { Date: Tue, 5 Mar 2019 11:40:30 -0500 Subject: [PATCH 42/84] feedback (8) --- .../components/layer_panel/join_editor/resources/join.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join.js b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join.js index 6981daef89c4b..d487fb3030c17 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join.js +++ b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join.js @@ -73,7 +73,10 @@ export class Join extends Component { } catch (err) { if (this._isMounted) { this.setState({ - loadError: `Unable to find Index pattern ${indexPatternId}` + loadError: i18n.translate('xpack.maps.layerPanel.join.noIndexPatternErrorMessage', { + defaultMessage: `Unable to find Index pattern {indexPatternId}`, + values: { indexPatternId } + }) }); } return; From 14afb9cc632963c331dd8ec0daca3e9819eee700 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 5 Mar 2019 11:46:47 -0500 Subject: [PATCH 43/84] controller --- .../plugins/maps/public/angular/map_controller.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/maps/public/angular/map_controller.js b/x-pack/plugins/maps/public/angular/map_controller.js index 3de30f134239f..c3ac884539804 100644 --- a/x-pack/plugins/maps/public/angular/map_controller.js +++ b/x-pack/plugins/maps/public/angular/map_controller.js @@ -7,6 +7,7 @@ import chrome from 'ui/chrome'; import React from 'react'; import { I18nProvider } from '@kbn/i18n/react'; +import { i18n } from '@kbn/i18n'; import { render, unmountComponentAtNode } from 'react-dom'; import { uiModules } from 'ui/modules'; import { timefilter } from 'ui/timefilter'; @@ -201,7 +202,9 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage // TODO subscribe to store change and change when store updates title chrome.breadcrumbs.set([ - { text: 'Maps', href: '#' }, + { text: i18n.translate('xpack.maps.mapController.mapsBreadcrumbLabel', { + defaultMessage: 'Maps' + }), href: '#' }, { text: $scope.map.title } ]); @@ -216,7 +219,10 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage docTitle.change(savedMap.title); } catch(err) { toastNotifications.addDanger({ - title: `Error on saving '${savedMap.title}'`, + title: i18n.translate('xpack.maps.mapController.saveErrorMessage', { + defaultMessage: `Error on saving '{title}'`, + values: { title: savedMap.title } + }), text: err.message, 'data-test-subj': 'saveMapError', }); @@ -225,7 +231,10 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage if (id) { toastNotifications.addSuccess({ - title: `Saved '${savedMap.title}'`, + title: i18n.translate('xpack.maps.mapController.saveDescription', { + defaultMessage: `Saved '{title}'`, + values: { title: savedMap.title } + }), 'data-test-subj': 'saveMapSuccess', }); From 9d5d9af47d541037717d92dce0c401c68e625710 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 5 Mar 2019 11:51:09 -0500 Subject: [PATCH 44/84] settings panel --- .../settings_panel/settings_panel.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/maps/public/components/layer_panel/settings_panel/settings_panel.js b/x-pack/plugins/maps/public/components/layer_panel/settings_panel/settings_panel.js index a14c74d4032a0..c203892e455c1 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/settings_panel/settings_panel.js +++ b/x-pack/plugins/maps/public/components/layer_panel/settings_panel/settings_panel.js @@ -19,6 +19,7 @@ import { } from '@elastic/eui'; import { ValidatedRange } from '../../../shared/components/validated_range'; import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; export function SettingsPanel(props) { @@ -81,7 +82,9 @@ export function SettingsPanel(props) { -
Settings
+ +
+ +
+
From 1cf11b200d5aa4197d465c3e90dd37f00e26d054 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 5 Mar 2019 14:42:11 -0500 Subject: [PATCH 45/84] layer panel --- .../public/components/layer_panel/view.js | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/x-pack/plugins/maps/public/components/layer_panel/view.js b/x-pack/plugins/maps/public/components/layer_panel/view.js index 225381ad1b0af..e1da8f747d73d 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/view.js +++ b/x-pack/plugins/maps/public/components/layer_panel/view.js @@ -25,6 +25,8 @@ import { EuiLink, } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; + export class LayerPanel extends React.Component { static getDerivedStateFromProps(nextProps, prevState) { @@ -40,22 +42,22 @@ export class LayerPanel extends React.Component { return null; } - state = {} + state = {} - componentDidMount() { - this._isMounted = true; - this.loadDisplayName(); - this.loadImmutableSourceProperties(); - } + componentDidMount() { + this._isMounted = true; + this.loadDisplayName(); + this.loadImmutableSourceProperties(); + } - componentDidUpdate() { - this.loadDisplayName(); - this.loadImmutableSourceProperties(); - } + componentDidUpdate() { + this.loadDisplayName(); + this.loadImmutableSourceProperties(); + } - componentWillUnmount() { - this._isMounted = false; - } + componentWillUnmount() { + this._isMounted = false; + } loadDisplayName = async () => { if (!this.props.selectedLayer) { @@ -143,7 +145,11 @@ export class LayerPanel extends React.Component {
From f6591e57a917602a31f418ad76f51dffba383c62 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 5 Mar 2019 14:48:18 -0500 Subject: [PATCH 46/84] sources --- .../public/shared/layers/sources/wms_source.js | 18 ++++++++++++++++-- .../shared/layers/sources/xyz_tms_source.js | 4 +++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/sources/wms_source.js b/x-pack/plugins/maps/public/shared/layers/sources/wms_source.js index 84f66298e0a02..85bca3f4903fb 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/wms_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/wms_source.js @@ -134,12 +134,26 @@ class WMSEditor extends React.Component { onChange={(e) => this._handleServiceUrlChange(e)} /> - + this._handleLayersChange(e)} /> - + this._handleStylesChange(e)} /> diff --git a/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js b/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js index 3737561cf6cca..b6e34fd69f8bb 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js @@ -98,7 +98,9 @@ class XYZTMSEditor extends React.Component { return ( this._handleTMSInputChange(e)} /> From ccb2f7915303ae05a1f3482171971b19f2bb31f2 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 5 Mar 2019 14:56:21 -0500 Subject: [PATCH 47/84] ems file --- .../ems_file_source/create_source_editor.js | 13 +++++++++++-- .../sources/ems_file_source/ems_file_source.js | 16 +++++++++++++--- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/sources/ems_file_source/create_source_editor.js b/x-pack/plugins/maps/public/shared/layers/sources/ems_file_source/create_source_editor.js index 312ec9539b32c..03409e09fbbb3 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/ems_file_source/create_source_editor.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/ems_file_source/create_source_editor.js @@ -13,6 +13,7 @@ import { import { getEmsVectorFilesMeta } from '../../../../meta'; import { getEmsUnavailableMessage } from '../ems_unavailable_message'; +import { i18n } from '@kbn/i18n'; export class EMSFileCreateSourceEditor extends React.Component { @@ -63,11 +64,19 @@ export class EMSFileCreateSourceEditor extends React.Component { return ( source.id === this._descriptor.id)); if (!meta) { - throw new Error(`Unable to find EMS vector shapes for id: ${this._descriptor.id}`); + throw new Error(i18n.translate('xpack.maps.source.emsFile.errorMessage', { + defaultMessage: `Unable to find EMS vector shapes for id: {id}`, + values: { + id: this._descriptor.id + } + })); } return meta; } From 85f7a59511827f467bab81cd8e449619903df6e5 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 5 Mar 2019 15:00:34 -0500 Subject: [PATCH 48/84] tms source --- .../sources/ems_tms_source/create_source_editor.js | 5 ++++- .../sources/ems_tms_source/ems_tms_source.js | 14 +++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/sources/ems_tms_source/create_source_editor.js b/x-pack/plugins/maps/public/shared/layers/sources/ems_tms_source/create_source_editor.js index ac5c2c5f3cfd1..cdc61b1defe7b 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/ems_tms_source/create_source_editor.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/ems_tms_source/create_source_editor.js @@ -13,6 +13,7 @@ import { import { getEmsTMSServices } from '../../../../meta'; import { getEmsUnavailableMessage } from '../ems_unavailable_message'; +import { i18n } from '@kbn/i18n'; export class EMSTMSCreateSourceEditor extends React.Component { @@ -53,7 +54,9 @@ export class EMSTMSCreateSourceEditor extends React.Component { return ( Date: Tue, 5 Mar 2019 15:20:38 -0500 Subject: [PATCH 49/84] es grid --- .../create_source_editor.js | 40 +++++++++++---- .../es_geo_grid_source/es_geo_grid_source.js | 50 ++++++++++++++++--- .../es_geo_grid_source/resolution_editor.js | 22 ++++++-- .../update_source_editor.js | 8 ++- 4 files changed, 99 insertions(+), 21 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/create_source_editor.js b/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/create_source_editor.js index c041ccc51746a..2fbeee1b3a4d3 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/create_source_editor.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/create_source_editor.js @@ -13,6 +13,7 @@ import { SingleFieldSelect } from '../../../components/single_field_select'; import { RENDER_AS } from './render_as'; import { indexPatternService } from '../../../../kibana_services'; import { NoIndexPatternCallout } from '../../../components/no_index_pattern_callout'; +import { i18n } from '@kbn/i18n'; import { EuiFormRow, @@ -26,15 +27,21 @@ function filterGeoField({ type }) { const requestTypeOptions = [ { - label: 'points', + label: i18n.translate('xpack.maps.source.esGeoGrid.pointsDropdownOption', { + defaultMessage: 'points' + }), value: RENDER_AS.POINT }, { - label: 'grid rectangles', + label: i18n.translate('xpack.maps.source.esGeoGrid.gridRectangleDropdownOption', { + defaultMessage: 'grid rectangles' + }), value: RENDER_AS.GRID }, { - label: 'heat map', + label: i18n.translate('xpack.maps.source.esGeoGrid.heatmapDropdownOption', { + defaultMessage: 'heat map' + }), value: RENDER_AS.HEATMAP } ]; @@ -146,9 +153,14 @@ export class CreateSourceEditor extends Component { } return ( - + + + diff --git a/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/es_geo_grid_source.js b/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/es_geo_grid_source.js index 3ce3167edd2b0..b0c0ede3b654a 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/es_geo_grid_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/es_geo_grid_source.js @@ -21,6 +21,7 @@ import { UpdateSourceEditor } from './update_source_editor'; import { GRID_RESOLUTION } from '../../grid_resolution'; import { SOURCE_DATA_ID_ORIGIN, ES_GEO_GRID } from '../../../../../common/constants'; import { filterPropertiesForTooltip } from '../../util'; +import { i18n } from '@kbn/i18n'; const COUNT_PROP_LABEL = 'count'; const COUNT_PROP_NAME = 'doc_count'; @@ -51,8 +52,12 @@ const aggSchemas = new Schemas([ export class ESGeoGridSource extends AbstractESSource { static type = ES_GEO_GRID; - static title = 'Grid aggregation'; - static description = 'Geospatial data grouped in grids with metrics for each gridded cell'; + static title = i18n.translate('xpack.maps.source.esGridTitle', { + defaultMessage: 'Grid aggregation' + }); + static description = i18n.translate('xpack.maps.source.esGridDescription', { + defaultMessage: 'Geospatial data grouped in grids with metrics for each gridded cell' + }); static createDescriptor({ indexPatternId, geoField, requestType, resolution }) { return { @@ -102,10 +107,29 @@ export class ESGeoGridSource extends AbstractESSource { } return [ - { label: 'Data source', value: ESGeoGridSource.title }, - { label: 'Index pattern', value: indexPatternTitle }, - { label: 'Geospatial field', value: this._descriptor.geoField }, - { label: 'Show as', value: this._descriptor.requestType }, + { + label: i18n.translate('xpack.maps.source.esGrid.dataSourceLabel', { + defaultMessage: 'Data source' + }), + value: ESGeoGridSource.title + }, + { + label: i18n.translate('xpack.maps.source.esGrid.indexPatternLabel', { + defaultMessage: 'Index pattern' + }), + value: indexPatternTitle }, + { + label: i18n.translate('xpack.maps.source.esGrid.geospatialFieldLabel', { + defaultMessage: 'Geospatial field' + }), + value: this._descriptor.geoField + }, + { + label: i18n.translate('xpack.maps.source.esGrid.showasFieldLabel', { + defaultMessage: 'Show as' + }), + value: this._descriptor.requestType + }, ]; } @@ -145,7 +169,12 @@ export class ESGeoGridSource extends AbstractESSource { return 4; } - throw new Error(`Grid resolution param not recognized: ${this._descriptor.resolution}`); + throw new Error(i18n.translate('xpack.maps.source.esGrid.showasFieldLabel', { + defaultMessage: `Grid resolution param not recognized: {resolution}`, + values: { + resolution: this._descriptor.resolution + } + })); } async getGeoJsonWithMeta(layerName, searchFilters) { @@ -172,7 +201,12 @@ export class ESGeoGridSource extends AbstractESSource { const searchSource = await this._makeSearchSource(searchFilters, 0); const aggConfigs = new AggConfigs(indexPattern, this._makeAggConfigs(searchFilters.geogridPrecision), aggSchemas.all); searchSource.setField('aggs', aggConfigs.toDsl()); - const esResponse = await this._runEsQuery(layerName, searchSource, 'Elasticsearch geohash_grid aggregation request'); + const esResponse = await this._runEsQuery(layerName, searchSource, i18n.translate('xpack.maps.source.esGrid.inspectorDescription', { + defaultMessage: `'Elasticsearch geohash_grid aggregation request'`, + values: { + resolution: this._descriptor.resolution + } + })); const tabifiedResp = tabifyAggResponse(aggConfigs, esResponse); const { featureCollection } = convertToGeoJson({ diff --git a/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/resolution_editor.js b/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/resolution_editor.js index 16ea2c9e9b7db..91c067c09e97a 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/resolution_editor.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/resolution_editor.js @@ -12,12 +12,28 @@ import { EuiFlexItem, EuiFormLabel } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; const OPTIONS = [ - { value: GRID_RESOLUTION.COARSE, inputDisplay: 'coarse' }, - { value: GRID_RESOLUTION.FINE, inputDisplay: 'fine' }, - { value: GRID_RESOLUTION.MOST_FINE, inputDisplay: 'finest' } + { + value: GRID_RESOLUTION.COARSE, + inputDisplay: i18n.translate('xpack.maps.source.esGrid.coarseDropdownOption', { + defaultMessage: 'coarse' + }) + }, + { value: GRID_RESOLUTION.FINE, + inputDisplay: i18n.translate('xpack.maps.source.esGrid.fineDropdownOption', { + defaultMessage: 'fine' + }) + + }, + { + value: GRID_RESOLUTION.MOST_FINE, + inputDisplay: i18n.translate('xpack.maps.source.esGrid.finestDropdownOption', { + defaultMessage: 'finest' + }) + } ]; export function ResolutionEditor({ resolution, onChange }) { diff --git a/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/update_source_editor.js b/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/update_source_editor.js index 1293fc3f5db2d..a876216b2b7d6 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/update_source_editor.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/update_source_editor.js @@ -10,6 +10,7 @@ import { RENDER_AS } from './render_as'; import { MetricsEditor } from '../../../components/metrics_editor'; import { indexPatternService } from '../../../../kibana_services'; import { ResolutionEditor } from './resolution_editor'; +import { i18n } from '@kbn/i18n'; export class UpdateSourceEditor extends Component { @@ -33,7 +34,12 @@ export class UpdateSourceEditor extends Component { } catch (err) { if (this._isMounted) { this.setState({ - loadError: `Unable to find Index pattern ${this.props.indexPatternId}` + loadError: i18n.translate('xpack.maps.source.esGrid.noIndexPatternErrorMessage', { + defaultMessage: `Unable to find Index pattern {id}`, + values: { + id: this.props.indexPatternId + } + }) }); } return; From 87487148b269a642dad68c898237c9f4fce41181 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 5 Mar 2019 15:39:34 -0500 Subject: [PATCH 50/84] format --- .../public/components/layer_panel/view.js | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/x-pack/plugins/maps/public/components/layer_panel/view.js b/x-pack/plugins/maps/public/components/layer_panel/view.js index e1da8f747d73d..c3fba3d14beaf 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/view.js +++ b/x-pack/plugins/maps/public/components/layer_panel/view.js @@ -42,22 +42,22 @@ export class LayerPanel extends React.Component { return null; } - state = {} + state = {}; - componentDidMount() { - this._isMounted = true; - this.loadDisplayName(); - this.loadImmutableSourceProperties(); - } + componentDidMount() { + this._isMounted = true; + this.loadDisplayName(); + this.loadImmutableSourceProperties(); + } - componentDidUpdate() { - this.loadDisplayName(); - this.loadImmutableSourceProperties(); - } + componentDidUpdate() { + this.loadDisplayName(); + this.loadImmutableSourceProperties(); + } - componentWillUnmount() { - this._isMounted = false; - } + componentWillUnmount() { + this._isMounted = false; + } loadDisplayName = async () => { if (!this.props.selectedLayer) { From 4b5728a2d99120d16795fa200ed38747b79addbd Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 5 Mar 2019 15:40:01 -0500 Subject: [PATCH 51/84] format --- .../public/components/layer_panel/view.js | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/x-pack/plugins/maps/public/components/layer_panel/view.js b/x-pack/plugins/maps/public/components/layer_panel/view.js index c3fba3d14beaf..a2bd718650da3 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/view.js +++ b/x-pack/plugins/maps/public/components/layer_panel/view.js @@ -42,22 +42,22 @@ export class LayerPanel extends React.Component { return null; } - state = {}; + state = {}; - componentDidMount() { - this._isMounted = true; - this.loadDisplayName(); - this.loadImmutableSourceProperties(); - } + componentDidMount() { + this._isMounted = true; + this.loadDisplayName(); + this.loadImmutableSourceProperties(); + } - componentDidUpdate() { - this.loadDisplayName(); - this.loadImmutableSourceProperties(); - } + componentDidUpdate() { + this.loadDisplayName(); + this.loadImmutableSourceProperties(); + } - componentWillUnmount() { - this._isMounted = false; - } + componentWillUnmount() { + this._isMounted = false; + } loadDisplayName = async () => { if (!this.props.selectedLayer) { From 4bb7c04d777bc1cf22c09ec60f74d0c9a4bd674a Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 5 Mar 2019 15:54:38 -0500 Subject: [PATCH 52/84] es search --- .../ems_file_source/ems_file_source.js | 14 ++++++- .../es_search_source/create_source_editor.js | 24 ++++++++---- .../es_search_source/es_search_source.js | 37 ++++++++++++++++--- .../es_search_source/update_source_editor.js | 26 +++++++++++-- 4 files changed, 82 insertions(+), 19 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/sources/ems_file_source/ems_file_source.js b/x-pack/plugins/maps/public/shared/layers/sources/ems_file_source/ems_file_source.js index 40203f75bbcb9..0360594db006b 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/ems_file_source/ems_file_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/ems_file_source/ems_file_source.js @@ -69,8 +69,18 @@ export class EMSFileSource extends AbstractVectorSource { async getImmutableProperties() { const emsLink = await emsServiceSettings.getEMSHotLink({ id: this._descriptor.id }); return [ - { label: 'Data source', value: EMSFileSource.title }, - { label: 'Layer', value: this._descriptor.id, link: emsLink } + { + label: i18n.translate('xpack.maps.source.emsFile.dataSourceLabel', { + defaultMessage: `Data source`, + }), + value: EMSFileSource.title + }, + { + label: i18n.translate('xpack.maps.source.emsFile.layerLabel', { + defaultMessage: `Layer`, + }), + value: this._descriptor.id, + link: emsLink } ]; } diff --git a/x-pack/plugins/maps/public/shared/layers/sources/es_search_source/create_source_editor.js b/x-pack/plugins/maps/public/shared/layers/sources/es_search_source/create_source_editor.js index 7d385daf83e6b..d806fd95d316e 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/es_search_source/create_source_editor.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/es_search_source/create_source_editor.js @@ -13,6 +13,7 @@ import { IndexPatternSelect } from 'ui/index_patterns/components/index_pattern_s import { SingleFieldSelect } from '../../../components/single_field_select'; import { indexPatternService } from '../../../../kibana_services'; import { NoIndexPatternCallout } from '../../../components/no_index_pattern_callout'; +import { i18n } from '@kbn/i18n'; function filterGeoField(field) { return ['geo_point', 'geo_shape'].includes(field.type); @@ -22,14 +23,14 @@ export class CreateSourceEditor extends Component { static propTypes = { onSelect: PropTypes.func.isRequired, - } + }; state = { isLoadingIndexPattern: false, indexPatternId: '', geoField: '', noGeoIndexPatternsExist: false, - } + }; componentWillUnmount() { this._isMounted = false; @@ -52,7 +53,7 @@ export class CreateSourceEditor extends Component { indexPattern: undefined, geoField: undefined, }, this.debouncedLoad.bind(null, indexPatternId)); - } + }; debouncedLoad = _.debounce(async (indexPatternId) => { if (!indexPatternId || indexPatternId.length === 0) { @@ -126,10 +127,14 @@ export class CreateSourceEditor extends Component { return ( diff --git a/x-pack/plugins/maps/public/shared/layers/sources/es_search_source/es_search_source.js b/x-pack/plugins/maps/public/shared/layers/sources/es_search_source/es_search_source.js index c8b9b74a49a2c..a1567f45e0808 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/es_search_source/es_search_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/es_search_source/es_search_source.js @@ -13,14 +13,19 @@ import { hitsToGeoJson } from '../../../../elasticsearch_geo_utils'; import { CreateSourceEditor } from './create_source_editor'; import { UpdateSourceEditor } from './update_source_editor'; import { ES_SEARCH } from '../../../../../common/constants'; +import { i18n } from '@kbn/i18n'; const DEFAULT_LIMIT = 2048; export class ESSearchSource extends AbstractESSource { static type = ES_SEARCH; - static title = 'Documents'; - static description = 'Geospatial data from a Kibana index pattern'; + static title = i18n.translate('xpack.maps.source.esSearch.geofieldTitle', { + defaultMessage: 'Documents' + }); + static description = i18n.translate('xpack.maps.source.esSearch.geofieldDescription', { + defaultMessage: 'Geospatial data from a Kibana index pattern' + }); static renderEditor({ onPreviewSource, inspectorAdapters }) { const onSelect = (sourceConfig) => { @@ -96,10 +101,30 @@ export class ESSearchSource extends AbstractESSource { } return [ - { label: 'Data source', value: ESSearchSource.title }, - { label: 'Index pattern', value: indexPatternTitle }, - { label: 'Geospatial field', value: this._descriptor.geoField }, - { label: 'Geospatial field type', value: geoFieldType }, + { + label: i18n.translate('xpack.maps.source.esSearch.dataSourceLabel', { + defaultMessage: `Data source`, + }), + value: ESSearchSource.title + }, + { + label: i18n.translate('xpack.maps.source.esSearch.indexPatternLabel', { + defaultMessage: `Index pattern`, + }), + value: indexPatternTitle + }, + { + label: i18n.translate('xpack.maps.source.esSearch.geoFieldLabel', { + defaultMessage: 'Geospatial field', + }), + value: this._descriptor.geoField + }, + { + label: i18n.translate('xpack.maps.source.esSearch.geoFieldTypeLabel', { + defaultMessage: 'Geospatial field type', + }), + value: geoFieldType + }, ]; } diff --git a/x-pack/plugins/maps/public/shared/layers/sources/es_search_source/update_source_editor.js b/x-pack/plugins/maps/public/shared/layers/sources/es_search_source/update_source_editor.js index 7aec6c1714f03..596ae7b763ea7 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/es_search_source/update_source_editor.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/es_search_source/update_source_editor.js @@ -13,6 +13,7 @@ import { import { MultiFieldSelect } from '../../../components/multi_field_select'; import { indexPatternService } from '../../../../kibana_services'; +import { i18n } from '@kbn/i18n'; export class UpdateSourceEditor extends Component { @@ -43,7 +44,12 @@ export class UpdateSourceEditor extends Component { } catch (err) { if (this._isMounted) { this.setState({ - loadError: `Unable to find Index pattern ${this.props.indexPatternId}` + loadError: i18n.translate('xpack.maps.source.esSearch.loadErrorMessage', { + defaultMessage: `Unable to find Index pattern {id}`, + values: { + id: this.props.indexPatternId + } + }) }); } return; @@ -68,10 +74,17 @@ export class UpdateSourceEditor extends Component { return ( From 39083107d4bf3cf315758b70876a31876e409fe4 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 5 Mar 2019 23:58:38 -0500 Subject: [PATCH 53/84] localize --- .../create_source_editor.js | 18 ++++++++++-------- .../kibana_regionmap_source.js | 1 - 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/sources/kibana_regionmap_source/create_source_editor.js b/x-pack/plugins/maps/public/shared/layers/sources/kibana_regionmap_source/create_source_editor.js index c740df0129ad6..c7b7fbf71bb7f 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/kibana_regionmap_source/create_source_editor.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/kibana_regionmap_source/create_source_editor.js @@ -11,10 +11,7 @@ import { EuiFormRow, } from '@elastic/eui'; import { getKibanaRegionList } from '../../../../meta'; - -const NO_REGIONMAP_LAYERS_MSG = - 'No vector layers are available.' + - ' Ask your system administrator to set "map.regionmap" in kibana.yml.'; +import { i18n } from '@kbn/i18n'; export class CreateSourceEditor extends React.Component { @@ -42,8 +39,6 @@ export class CreateSourceEditor extends React.Component { render() { - - const onChange = ({ target }) => { const selectedName = target.options[target.selectedIndex].text; this.props.onSelect({ name: selectedName }); @@ -58,8 +53,15 @@ export class CreateSourceEditor extends React.Component { return ( Date: Wed, 6 Mar 2019 00:04:56 -0500 Subject: [PATCH 54/84] kbn regionmap (2) --- .../kibana_regionmap_source.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/sources/kibana_regionmap_source/kibana_regionmap_source.js b/x-pack/plugins/maps/public/shared/layers/sources/kibana_regionmap_source/kibana_regionmap_source.js index c2e9bf251821a..32f69f561d6e5 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/kibana_regionmap_source/kibana_regionmap_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/kibana_regionmap_source/kibana_regionmap_source.js @@ -8,12 +8,18 @@ import { AbstractVectorSource } from '../vector_source'; import React from 'react'; import { CreateSourceEditor } from './create_source_editor'; import { getKibanaRegionList } from '../../../../meta'; +import { i18n } from '@kbn/i18n'; export class KibanaRegionmapSource extends AbstractVectorSource { static type = 'REGIONMAP_FILE'; - static title = 'Custom vector shapes'; - static description = 'Vector shapes from static files configured in kibana.yml'; + static title = i18n.translate('xpack.maps.source.kbnRegionMapTitle', { + defaultMessage: 'Custom vector shapes' + }); + static description = i18n.translate('xpack.maps.source.kbnRegionMapDescription', { + defaultMessage: 'Vector shapes from static files configured in kibana.yml' + }) + ; static icon = 'logoKibana'; static createDescriptor(options) { @@ -48,7 +54,13 @@ export class KibanaRegionmapSource extends AbstractVectorSource { const regionList = await getKibanaRegionList(); const meta = regionList.find(source => source.name === this._descriptor.name); if (!meta) { - throw new Error(`Unable to find map.regionmap configuration for ${this._descriptor.name}`); + throw new Error(i18n.translate('xpack.maps.source.kbnRegionMap.noConfigErrorMessage', { + defaultMessage: `Unable to find map.regionmap configuration for {name}`, + values: { + name: this._descriptor.name + } + }) + ); } return meta; } From 59a86b9fae1f57495c0189a3f430ef8845a8b3f8 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 00:09:47 -0500 Subject: [PATCH 55/84] kbn tms --- .../create_source_editor.js | 18 ++++++++++-------- .../kibana_tilemap_source.js | 10 ++++++++-- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/sources/kibana_tilemap_source/create_source_editor.js b/x-pack/plugins/maps/public/shared/layers/sources/kibana_tilemap_source/create_source_editor.js index b5b2b6130ac2c..858bec1b855e1 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/kibana_tilemap_source/create_source_editor.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/kibana_tilemap_source/create_source_editor.js @@ -12,12 +12,7 @@ import { } from '@elastic/eui'; import { getKibanaTileMap } from '../../../../meta'; - -const NO_TILEMAP_LAYER_MSG = - 'No tilemap layer is available.' + - ' Ask your system administrator to set "map.tilemap.url" in kibana.yml.'; - - +import { i18n } from '@kbn/i18n'; export class CreateSourceEditor extends Component { @@ -56,8 +51,15 @@ export class CreateSourceEditor extends Component { return ( Date: Wed, 6 Mar 2019 00:10:48 -0500 Subject: [PATCH 56/84] kbn tms (2) --- .../sources/kibana_tilemap_source/kibana_tilemap_source.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/maps/public/shared/layers/sources/kibana_tilemap_source/kibana_tilemap_source.js b/x-pack/plugins/maps/public/shared/layers/sources/kibana_tilemap_source/kibana_tilemap_source.js index 66239aff705f2..0cfdb1bc9d373 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/kibana_tilemap_source/kibana_tilemap_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/kibana_tilemap_source/kibana_tilemap_source.js @@ -61,7 +61,9 @@ export class KibanaTilemapSource extends AbstractTMSSource { async getUrlTemplate() { const tilemap = await getKibanaTileMap(); if (!tilemap.url) { - throw new Error(`Unable to find map.tilemap.url configuration in the kibana.yml`); + throw new Error(i18n.translate('xpack.maps.source.kbnTMS.noConfigErrorMessage', { + defaultMessage: `Unable to find map.tilemap.url configuration in the kibana.yml` + })); } return tilemap.url; } From a9ccdb7425599b2310ca3f2539abbad88a60c69b Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 00:14:44 -0500 Subject: [PATCH 57/84] ems unavailable --- .../layers/sources/ems_unavailable_message.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/sources/ems_unavailable_message.js b/x-pack/plugins/maps/public/shared/layers/sources/ems_unavailable_message.js index 23f2db698dfd9..c15351f421b32 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/ems_unavailable_message.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/ems_unavailable_message.js @@ -5,19 +5,18 @@ */ import chrome from 'ui/chrome'; - -const NO_EMS_ACCESS_MSG = - 'Kibana is unable to access Elastic Maps Service. Contact your system administrator'; - -const EMS_ACCESS_DISABLED_MSG = - 'Access to Elastic Maps Service has been disabled.' + - ' Ask your system administrator to set "map.includeElasticMapsService" in kibana.yml.'; +import { i18n } from '@kbn/i18n'; export function getEmsUnavailableMessage() { const isEmsEnabled = chrome.getInjected('isEmsEnabled', true); if (isEmsEnabled) { - return NO_EMS_ACCESS_MSG; + return i18n.translate('xpack.maps.source.ems.noAccessDescription', { + defaultMessage: 'Kibana is unable to access Elastic Maps Service. Contact your system administrator' + }); } - return EMS_ACCESS_DISABLED_MSG; + return i18n.translate('xpack.maps.source.ems.noAccessDescription', { + // eslint-disable-next-line max-len + defaultMessage: 'Access to Elastic Maps Service has been disabled. Ask your system administrator to set "map.includeElasticMapsService" in kibana.yml.' + }); } From 25d21561544342084c85bbc573ac357cf3c4c0fc Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 00:27:49 -0500 Subject: [PATCH 58/84] es join source --- .../shared/layers/sources/es_join_source.js | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/sources/es_join_source.js b/x-pack/plugins/maps/public/shared/layers/sources/es_join_source.js index ded6824ea4525..bf2bf0f1f8cf6 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/es_join_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/es_join_source.js @@ -14,6 +14,7 @@ import { } from '../../../kibana_services'; import { AggConfigs } from 'ui/vis/agg_configs'; import { timefilter } from 'ui/timefilter/timefilter'; +import { i18n } from '@kbn/i18n'; const TERMS_AGG_NAME = 'join'; @@ -62,6 +63,7 @@ export class ESJoinSource extends AbstractESSource { static renderEditor({}) { + //no need to localize. this editor is never rendered. return `
editor details
`; } @@ -123,7 +125,12 @@ export class ESJoinSource extends AbstractESSource { requestDesc: this.getJoinDescription(leftSourceName, leftFieldName), }); } catch (error) { - throw new Error(`Elasticsearch search request failed, error: ${error.message}`); + throw new Error(i18n.translate('xpack.maps.source.esJoin.errorMessage', { + defaultMessage: `Elasticsearch search request failed, error: {message}`, + values: { + message: error.message + } + })); } const metricPropertyNames = configStates @@ -154,10 +161,24 @@ export class ESJoinSource extends AbstractESSource { return metric.type !== 'count' ? `${metric.type} ${metric.field}` : 'count'; }); const joinStatement = []; - joinStatement.push(`Join ${leftSourceName}:${leftFieldName} with`); - joinStatement.push(`${this._descriptor.indexPatternTitle}:${this._descriptor.term}`); - joinStatement.push(`for metrics ${metrics.join(',')}`); - return `Elasticsearch terms aggregation request for ${joinStatement.join(' ')}`; + joinStatement.push(i18n.translate('xpack.maps.source.esJoin.joinLeftDescription', { + defaultMessage: `Join {leftSourceName}:{leftFieldName} with`, + values: { leftSourceName, leftFieldName } + })); + joinStatement.push(i18n.translate('xpack.maps.source.esJoin.joinTermDescription', { + defaultMessage: `{indexPatternTitle}:{term}`, + values: { indexPatternTitle: this._descriptor.indexPatternTitle, term: this._descriptor.term } + })); + joinStatement.push(i18n.translate('xpack.maps.source.esJoin.joinMetricsDescription', { + defaultMessage: `for metrics {metrics}`, + values: { metrlcs: metrics.join(',') } + })); + return i18n.translate('xpack.maps.source.esJoin.joinDescription', { + defaultMessage: `Elasticsearch terms aggregation request for {description}`, + values: { + description: joinStatement.join(' ') + } + }); } _makeAggConfigs() { @@ -191,6 +212,7 @@ export class ESJoinSource extends AbstractESSource { } async getDisplayName() { + //no need to localize. this is never rendered. return `es_table ${this._descriptor.indexPatternId}`; } } From d10dfd3a5adb051050da3c1fccd5a666c7f29a13 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 00:31:13 -0500 Subject: [PATCH 59/84] typo --- .../plugins/maps/public/shared/layers/sources/es_join_source.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/maps/public/shared/layers/sources/es_join_source.js b/x-pack/plugins/maps/public/shared/layers/sources/es_join_source.js index bf2bf0f1f8cf6..f70e70cadb083 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/es_join_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/es_join_source.js @@ -171,7 +171,7 @@ export class ESJoinSource extends AbstractESSource { })); joinStatement.push(i18n.translate('xpack.maps.source.esJoin.joinMetricsDescription', { defaultMessage: `for metrics {metrics}`, - values: { metrlcs: metrics.join(',') } + values: { metrics: metrics.join(',') } })); return i18n.translate('xpack.maps.source.esJoin.joinDescription', { defaultMessage: `Elasticsearch terms aggregation request for {description}`, From 638d3c48668a253fadbd80738f732670eabdedb7 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 00:35:57 -0500 Subject: [PATCH 60/84] es source --- .../maps/public/shared/layers/sources/es_source.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/sources/es_source.js b/x-pack/plugins/maps/public/shared/layers/sources/es_source.js index d31d668341d15..94e603468f994 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/es_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/es_source.js @@ -14,6 +14,7 @@ import { createExtentFilter } from '../../../elasticsearch_geo_utils'; import { timefilter } from 'ui/timefilter/timefilter'; import _ from 'lodash'; import { AggConfigs } from 'ui/vis/agg_configs'; +import { i18n } from '@kbn/i18n'; export class AbstractESSource extends AbstractVectorSource { @@ -174,7 +175,10 @@ export class AbstractESSource extends AbstractVectorSource { this.indexPattern = await indexPatternService.get(this._descriptor.indexPatternId); return this.indexPattern; } catch (error) { - throw new Error(`Unable to find Index pattern for id: ${this._descriptor.indexPatternId}`); + throw new Error(i18n.translate('xpack.maps.source.esSource.noIndexPatternErrorMessage', { + defaultMessage: `Unable to find Index pattern for id: {indexPatternId}`, + values: { indexPatternId: this._descriptor.indexPatternId } + })); } } @@ -194,7 +198,10 @@ export class AbstractESSource extends AbstractVectorSource { const indexPattern = await this._getIndexPattern(); const geoField = indexPattern.fields.byName[this._descriptor.geoField]; if (!geoField) { - throw new Error(`Index pattern ${indexPattern.title} no longer contains the geo field ${this._descriptor.geoField}`); + throw new Error(i18n.translate('xpack.maps.source.esSource.noGeoFieldErrorMessage', { + defaultMessage: `Index pattern {indexPatternTitle} no longer contains the geo field {geoField}`, + values: { indexPatternTitle: indexPattern.title, geoField: this._descriptor.geoField } + })); } return geoField; } From c32602030f9f533b08cbc296fc354e30334fb462 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 00:43:44 -0500 Subject: [PATCH 61/84] vector source --- .../public/shared/layers/sources/vector_source.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/sources/vector_source.js b/x-pack/plugins/maps/public/shared/layers/sources/vector_source.js index 6024a8a97865e..1e66d9f9990c3 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/vector_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/vector_source.js @@ -10,6 +10,7 @@ import { VectorStyle } from '../styles/vector_style'; import { AbstractSource } from './source'; import * as topojson from 'topojson-client'; import _ from 'lodash'; +import { i18n } from '@kbn/i18n'; export class AbstractVectorSource extends AbstractSource { @@ -24,7 +25,10 @@ export class AbstractVectorSource extends AbstractSource { } fetchedJson = await response.json(); } catch (e) { - throw new Error(`Unable to fetch vector shapes from url: ${fetchUrl}`); + throw new Error(i18n.translate('xpack.maps.source.vetorSource.requestFailedErrorMessage', { + defaultMessage: `Unable to fetch vector shapes from url: {fetchUrl}`, + values: { fetchUrl } + })); } if (format === 'geojson') { @@ -36,7 +40,10 @@ export class AbstractVectorSource extends AbstractSource { return topojson.feature(fetchedJson, features); } - throw new Error(`Unrecognized vector shape format: ${format}`); + throw new Error(i18n.translate('xpack.maps.source.vetorSource.formatErrorMessage', { + defaultMessage: `Unable to fetch vector shapes from url: {format}`, + values: { format } + })); } _createDefaultLayerDescriptor(options, mapColors) { From f6b3c1470dd37e5b701650ec9705ce872fad8370 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 00:51:55 -0500 Subject: [PATCH 62/84] static/dyn row --- .../layers/styles/components/static_dynamic_style_row.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/maps/public/shared/layers/styles/components/static_dynamic_style_row.js b/x-pack/plugins/maps/public/shared/layers/styles/components/static_dynamic_style_row.js index d1e8ac6b8e26a..f4ef285e94b9c 100644 --- a/x-pack/plugins/maps/public/shared/layers/styles/components/static_dynamic_style_row.js +++ b/x-pack/plugins/maps/public/shared/layers/styles/components/static_dynamic_style_row.js @@ -7,6 +7,7 @@ import React from 'react'; import { VectorStyle } from '../vector_style'; import _ from 'lodash'; +import { i18n } from '@kbn/i18n'; import { EuiFlexGroup, @@ -93,7 +94,13 @@ export class StaticDynamicStyleRow extends React.Component { render() { const isDynamic = this._isDynamic(); const dynamicTooltipContent = - isDynamic ? 'Use static styling properties to symbolize features.' : 'Use property values to symbolize features.'; + isDynamic ? + i18n.translate('xpack.maps.styles.staticDynamic.staticDescription', { + defaultMessage: 'Use static styling properties to symbolize features.' + }) : + i18n.translate('xpack.maps.styles.staticDynamic.dynamicDescription', { + defaultMessage: 'Use property values to symbolize features.' + }); return ( From fcd8d55c91f69b8f6e273968c21354db6123b346 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 00:56:25 -0500 Subject: [PATCH 63/84] vector style editor --- .../components/vector/vector_style_editor.js | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/styles/components/vector/vector_style_editor.js b/x-pack/plugins/maps/public/shared/layers/styles/components/vector/vector_style_editor.js index 87810548d4144..0d31585aff71e 100644 --- a/x-pack/plugins/maps/public/shared/layers/styles/components/vector/vector_style_editor.js +++ b/x-pack/plugins/maps/public/shared/layers/styles/components/vector/vector_style_editor.js @@ -12,6 +12,7 @@ import { VectorStyleSizeEditor } from './size/vector_style_size_editor'; import { getDefaultDynamicProperties, getDefaultStaticProperties } from '../../vector_style_defaults'; import { EuiSpacer } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; export class VectorStyleEditor extends Component { state = { @@ -49,7 +50,11 @@ export class VectorStyleEditor extends Component { Date: Wed, 6 Mar 2019 00:58:42 -0500 Subject: [PATCH 64/84] field selct --- .../shared/layers/styles/components/vector/field_select.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/maps/public/shared/layers/styles/components/vector/field_select.js b/x-pack/plugins/maps/public/shared/layers/styles/components/vector/field_select.js index 5163a2fe46d23..47ee4277236bd 100644 --- a/x-pack/plugins/maps/public/shared/layers/styles/components/vector/field_select.js +++ b/x-pack/plugins/maps/public/shared/layers/styles/components/vector/field_select.js @@ -9,6 +9,7 @@ import React from 'react'; import { EuiComboBox } from '@elastic/eui'; import { SOURCE_DATA_ID_ORIGIN } from '../../../../../../common/constants'; +import { i18n } from '@kbn/i18n'; export function FieldSelect({ fields, selectedField, onChange }) { @@ -64,7 +65,11 @@ export function FieldSelect({ fields, selectedField, onChange }) { singleSelection={{ asPlainText: true }} isClearable={false} fullWidth - placeholder="Select a field" + placeholder={ + i18n.translate('xpack.maps.styles.vector.selectFieldPlaceholder', { + defaultMessage: 'Select a field' + }) + } /> ); } From 6d4bfcdae304c6e55afdda4185430ec7e1d731d6 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 01:01:06 -0500 Subject: [PATCH 65/84] size range --- .../components/vector/size/size_range_selector.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/styles/components/vector/size/size_range_selector.js b/x-pack/plugins/maps/public/shared/layers/styles/components/vector/size/size_range_selector.js index 88b5926e2cf36..0ebb46495308f 100644 --- a/x-pack/plugins/maps/public/shared/layers/styles/components/vector/size/size_range_selector.js +++ b/x-pack/plugins/maps/public/shared/layers/styles/components/vector/size/size_range_selector.js @@ -12,6 +12,7 @@ import { EuiFlexItem, } from '@elastic/eui'; import { ValidatedRange } from '../../../../../components/validated_range'; +import { i18n } from '@kbn/i18n'; import { DEFAULT_MIN_SIZE, DEFAULT_MAX_SIZE } from '../../../vector_style_defaults'; export function SizeRangeSelector({ minSize, maxSize, onChange }) { @@ -35,7 +36,11 @@ export function SizeRangeSelector({ minSize, maxSize, onChange }) { Date: Wed, 6 Mar 2019 07:44:45 -0500 Subject: [PATCH 66/84] update snapshot --- .../layer_control/__snapshots__/view.test.js.snap | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/maps/public/components/widget_overlay/layer_control/__snapshots__/view.test.js.snap b/x-pack/plugins/maps/public/components/widget_overlay/layer_control/__snapshots__/view.test.js.snap index 4373d88a399ee..0b1d9f96eade8 100644 --- a/x-pack/plugins/maps/public/components/widget_overlay/layer_control/__snapshots__/view.test.js.snap +++ b/x-pack/plugins/maps/public/components/widget_overlay/layer_control/__snapshots__/view.test.js.snap @@ -32,7 +32,7 @@ exports[`LayerControl is rendered 1`] = `

@@ -53,7 +53,7 @@ exports[`LayerControl is rendered 1`] = ` > @@ -102,7 +102,7 @@ exports[`LayerControl props isReadOnly 1`] = `

From bc4e5c0a4091e7ffcc5d3fd6ddf555f2e226a57b Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 09:34:29 -0500 Subject: [PATCH 67/84] feedback --- .../es_geo_grid_source/es_geo_grid_source.js | 5 +---- .../es_geo_grid_source/resolution_editor.js | 6 +++++- .../maps/public/shared/layers/sources/es_source.js | 5 ++++- .../kibana_regionmap_source.js | 13 +++++++++++-- .../kibana_tilemap_source/kibana_tilemap_source.js | 14 ++++++++++++-- 5 files changed, 33 insertions(+), 10 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/es_geo_grid_source.js b/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/es_geo_grid_source.js index b0c0ede3b654a..1413ceb3c221c 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/es_geo_grid_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/es_geo_grid_source.js @@ -202,10 +202,7 @@ export class ESGeoGridSource extends AbstractESSource { const aggConfigs = new AggConfigs(indexPattern, this._makeAggConfigs(searchFilters.geogridPrecision), aggSchemas.all); searchSource.setField('aggs', aggConfigs.toDsl()); const esResponse = await this._runEsQuery(layerName, searchSource, i18n.translate('xpack.maps.source.esGrid.inspectorDescription', { - defaultMessage: `'Elasticsearch geohash_grid aggregation request'`, - values: { - resolution: this._descriptor.resolution - } + defaultMessage: `'Elasticsearch geohash_grid aggregation request'` })); const tabifiedResp = tabifyAggResponse(aggConfigs, esResponse); diff --git a/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/resolution_editor.js b/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/resolution_editor.js index 91c067c09e97a..fded85cc2fd49 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/resolution_editor.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/resolution_editor.js @@ -13,6 +13,7 @@ import { EuiFormLabel } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; const OPTIONS = [ @@ -42,7 +43,10 @@ export function ResolutionEditor({ resolution, onChange }) { - Grid resolution + diff --git a/x-pack/plugins/maps/public/shared/layers/sources/es_source.js b/x-pack/plugins/maps/public/shared/layers/sources/es_source.js index 94e603468f994..24a6fc932f4e8 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/es_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/es_source.js @@ -88,7 +88,10 @@ export class AbstractESSource extends AbstractVectorSource { requestDesc: requestDescription }); } catch(error) { - throw new Error(`Elasticsearch search request failed, error: ${error.message}`); + throw new Error('xpack.maps.source.esSource.requestFailedErrorMessage', { + defaultMessage: `Elasticsearch search request failed, error: {message}`, + values: { message: error.message } + }); } } diff --git a/x-pack/plugins/maps/public/shared/layers/sources/kibana_regionmap_source/kibana_regionmap_source.js b/x-pack/plugins/maps/public/shared/layers/sources/kibana_regionmap_source/kibana_regionmap_source.js index 32f69f561d6e5..6e3a1d9938f53 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/kibana_regionmap_source/kibana_regionmap_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/kibana_regionmap_source/kibana_regionmap_source.js @@ -45,8 +45,17 @@ export class KibanaRegionmapSource extends AbstractVectorSource { async getImmutableProperties() { return [ - { label: 'Data source', value: KibanaRegionmapSource.title }, - { label: 'Vector layer', value: this._descriptor.name }, + { + label: i18n.translate('xpack.maps.source.kbnRegionMap.dataSourceLabel', { + defaultMessage: 'Data source' + }), + value: KibanaRegionmapSource.title }, + { + label: i18n.translate('xpack.maps.source.kbnRegionMap.vectorLayerLabel', { + defaultMessage: 'Vector layer' + }), + value: this._descriptor.name + }, ]; } diff --git a/x-pack/plugins/maps/public/shared/layers/sources/kibana_tilemap_source/kibana_tilemap_source.js b/x-pack/plugins/maps/public/shared/layers/sources/kibana_tilemap_source/kibana_tilemap_source.js index 0cfdb1bc9d373..9838ba6b7e47c 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/kibana_tilemap_source/kibana_tilemap_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/kibana_tilemap_source/kibana_tilemap_source.js @@ -39,8 +39,18 @@ export class KibanaTilemapSource extends AbstractTMSSource { async getImmutableProperties() { return [ - { label: 'Data source', value: KibanaTilemapSource.title }, - { label: 'Tilemap url', value: (await this.getUrlTemplate()) }, + { + label: i18n.translate('xpack.maps.source.kbnTMS.dataSourceLabel', { + defaultMessage: 'Data source' + }), + value: KibanaTilemapSource.title + }, + { + label: i18n.translate('xpack.maps.source.kbnTMS.urlLabel', { + defaultMessage: 'Tilemap url' + }), + value: (await this.getUrlTemplate()) + }, ]; } From 929b1142ab9e17c931a4087157d6bea61c5f5d01 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 10:37:25 -0500 Subject: [PATCH 68/84] revert --- x-pack/plugins/maps/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/maps/index.js b/x-pack/plugins/maps/index.js index 133f5bc62ca9d..473b8f45918a6 100644 --- a/x-pack/plugins/maps/index.js +++ b/x-pack/plugins/maps/index.js @@ -67,7 +67,7 @@ export function maps(kibana) { }).default(); }, - init: function (server) { + init(server) { const mapsEnabled = server.config().get('xpack.maps.enabled'); if (!mapsEnabled) { From d9b060e3b7cb81de79e4165214e22c5204a5af45 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 10:44:01 -0500 Subject: [PATCH 69/84] feedback (1) --- x-pack/plugins/maps/index.js | 5 +---- .../public/shared/layers/sources/es_join_source.js | 5 +---- .../maps/server/maps_telemetry/telemetry_task.js | 13 ++----------- x-pack/plugins/maps/server/routes.js | 5 +---- 4 files changed, 5 insertions(+), 23 deletions(-) diff --git a/x-pack/plugins/maps/index.js b/x-pack/plugins/maps/index.js index 473b8f45918a6..7ba530beb203b 100644 --- a/x-pack/plugins/maps/index.js +++ b/x-pack/plugins/maps/index.js @@ -71,10 +71,7 @@ export function maps(kibana) { const mapsEnabled = server.config().get('xpack.maps.enabled'); if (!mapsEnabled) { - server.log(['info', 'maps'], - i18n.translate('xpack.maps.appDisabled', { - defaultMessage: 'Maps app disabled by configuration' - })); + server.log(['info', 'maps'], 'Maps app disabled by configuration'); return; } initTelemetryCollection(server); diff --git a/x-pack/plugins/maps/public/shared/layers/sources/es_join_source.js b/x-pack/plugins/maps/public/shared/layers/sources/es_join_source.js index f70e70cadb083..3af36a696da13 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/es_join_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/es_join_source.js @@ -165,10 +165,7 @@ export class ESJoinSource extends AbstractESSource { defaultMessage: `Join {leftSourceName}:{leftFieldName} with`, values: { leftSourceName, leftFieldName } })); - joinStatement.push(i18n.translate('xpack.maps.source.esJoin.joinTermDescription', { - defaultMessage: `{indexPatternTitle}:{term}`, - values: { indexPatternTitle: this._descriptor.indexPatternTitle, term: this._descriptor.term } - })); + joinStatement.push(`${this._descriptor.indexPatternTitle}:${this._descriptor.term}`); joinStatement.push(i18n.translate('xpack.maps.source.esJoin.joinMetricsDescription', { defaultMessage: `for metrics {metrics}`, values: { metrics: metrics.join(',') } diff --git a/x-pack/plugins/maps/server/maps_telemetry/telemetry_task.js b/x-pack/plugins/maps/server/maps_telemetry/telemetry_task.js index 06123e81ee133..96fa183b1f1ab 100644 --- a/x-pack/plugins/maps/server/maps_telemetry/telemetry_task.js +++ b/x-pack/plugins/maps/server/maps_telemetry/telemetry_task.js @@ -37,9 +37,7 @@ export function scheduleTask(server, taskManager) { export function registerMapsTelemetryTask(taskManager) { taskManager.registerTaskDefinitions({ [TELEMETRY_TASK_TYPE]: { - title: i18n.translate('xpack.maps.telemetry.taskTitle', { - defaultMessage: 'Maps telemetry fetch task', - }), + title: 'Maps telemetry fetch task', type: TELEMETRY_TASK_TYPE, timeout: '1m', numWorkers: 2, @@ -64,14 +62,7 @@ export function telemetryTaskRunner() { try { mapsTelemetry = await getMapsTelemetry(server, callCluster); } catch (err) { - server.log(['warning'], - i18n.translate('xpack.maps.telemetry.loadErrorMessage', { - defaultMessage: `Error loading maps telemetry: {error}`, - values: { - error: err - } - }) - ); + server.log(['warning'], `Error loading maps telemetry: ${err}`); } finally { return { state: { diff --git a/x-pack/plugins/maps/server/routes.js b/x-pack/plugins/maps/server/routes.js index 9f3e998c3b560..4139749907042 100644 --- a/x-pack/plugins/maps/server/routes.js +++ b/x-pack/plugins/maps/server/routes.js @@ -30,10 +30,7 @@ export function initRoutes(server, licenseUid) { handler: async (request) => { if (!request.query.id) { - server.log('warning', - i18n.translate('xpack.maps.server.missingEMSIdErrorMessage', { - defaultMessage: 'Must supply id parameters to retrieve EMS file' - })); + server.log('warning', 'Must supply id parameters to retrieve EMS file'); return null; } From 59e47482c7e5180af63eed1c212c768806d1b749 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 10:50:21 -0500 Subject: [PATCH 70/84] plural --- .../join_editor/resources/metrics_expression.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/metrics_expression.js b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/metrics_expression.js index 87a393e6d440b..5131a2b42d4e5 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/metrics_expression.js +++ b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/metrics_expression.js @@ -73,14 +73,12 @@ export class MetricsExpression extends Component { return `${type} ${field}`; }); - - const useMetricDescription = metricExpressions.length > 1 ? - i18n.translate('xpack.maps.layerPanel.metricsExpression.useMetricsMultipleDescription', { - defaultMessage: 'and use metrics' - }) : - i18n.translate('xpack.maps.layerPanel.metricsExpression.useMetricsSingleDescription', { - defaultMessage: 'and use metric' - }); + const useMetricDescription = i18n.translate('xpack.maps.layerPanel.metricsExpression.useMetricsDescription', { + defaultMessage: '{metricsLength, plural, one {and use metric} other {and use metrics}}', + values: { + metricsLength: metricExpressions.length + } + }); return ( Date: Wed, 6 Mar 2019 10:57:04 -0500 Subject: [PATCH 71/84] config errors --- .../public/shared/layers/sources/ems_unavailable_message.js | 2 +- .../layers/sources/es_geo_grid_source/es_geo_grid_source.js | 2 +- .../sources/kibana_tilemap_source/kibana_tilemap_source.js | 2 +- .../maps/public/shared/layers/sources/xyz_tms_source.js | 3 ++- .../plugins/maps/public/shared/layers/styles/heatmap_style.js | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/sources/ems_unavailable_message.js b/x-pack/plugins/maps/public/shared/layers/sources/ems_unavailable_message.js index c15351f421b32..01314b364ab9d 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/ems_unavailable_message.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/ems_unavailable_message.js @@ -15,7 +15,7 @@ export function getEmsUnavailableMessage() { }); } - return i18n.translate('xpack.maps.source.ems.noAccessDescription', { + return i18n.translate('xpack.maps.source.ems.disabledDescription', { // eslint-disable-next-line max-len defaultMessage: 'Access to Elastic Maps Service has been disabled. Ask your system administrator to set "map.includeElasticMapsService" in kibana.yml.' }); diff --git a/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/es_geo_grid_source.js b/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/es_geo_grid_source.js index 1413ceb3c221c..22004a783f123 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/es_geo_grid_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/es_geo_grid_source.js @@ -169,7 +169,7 @@ export class ESGeoGridSource extends AbstractESSource { return 4; } - throw new Error(i18n.translate('xpack.maps.source.esGrid.showasFieldLabel', { + throw new Error(i18n.translate('xpack.maps.source.esGrid.resolutionParamErrorMessage', { defaultMessage: `Grid resolution param not recognized: {resolution}`, values: { resolution: this._descriptor.resolution diff --git a/x-pack/plugins/maps/public/shared/layers/sources/kibana_tilemap_source/kibana_tilemap_source.js b/x-pack/plugins/maps/public/shared/layers/sources/kibana_tilemap_source/kibana_tilemap_source.js index 9838ba6b7e47c..05830dc1c743f 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/kibana_tilemap_source/kibana_tilemap_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/kibana_tilemap_source/kibana_tilemap_source.js @@ -16,7 +16,7 @@ export class KibanaTilemapSource extends AbstractTMSSource { static title = i18n.translate('xpack.maps.source.kbnTMSTitle', { defaultMessage: 'Custom Tile Map Service' }); - static description = i18n.translate('xpack.maps.source.kbnTMSTitle', { + static description = i18n.translate('xpack.maps.source.kbnTMSDescription', { defaultMessage: 'Map tiles configured in kibana.yml' }); diff --git a/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js b/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js index b6e34fd69f8bb..6f52c5fbe71df 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js @@ -99,7 +99,8 @@ class XYZTMSEditor extends React.Component { this._handleTMSInputChange(e)} /> diff --git a/x-pack/plugins/maps/public/shared/layers/styles/heatmap_style.js b/x-pack/plugins/maps/public/shared/layers/styles/heatmap_style.js index 1b90cd71fe073..675b38e3a44d1 100644 --- a/x-pack/plugins/maps/public/shared/layers/styles/heatmap_style.js +++ b/x-pack/plugins/maps/public/shared/layers/styles/heatmap_style.js @@ -46,7 +46,7 @@ export class HeatmapStyle extends AbstractStyle { } else if (resolution === GRID_RESOLUTION.MOST_FINE) { radius = 32; } else { - const errorMessage = i18n.translate('xpack.maps.style.heatmap.displayNameLabel', { + const errorMessage = i18n.translate('xpack.maps.style.heatmap.resolutionStyleErrorMessage', { defaultMessage: `Resolution param not recognized: {resolution}`, values: { resolution } }); From 8f51d00cff7228b3b7fc0281ca3c553146965770 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 10:58:59 -0500 Subject: [PATCH 72/84] remove trailing i18n --- .../maps/server/maps_telemetry/telemetry_task.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/x-pack/plugins/maps/server/maps_telemetry/telemetry_task.js b/x-pack/plugins/maps/server/maps_telemetry/telemetry_task.js index 96fa183b1f1ab..7fbbe8ef77ff5 100644 --- a/x-pack/plugins/maps/server/maps_telemetry/telemetry_task.js +++ b/x-pack/plugins/maps/server/maps_telemetry/telemetry_task.js @@ -5,7 +5,6 @@ */ import { getMapsTelemetry } from './maps_telemetry'; -import { i18n } from '@kbn/i18n'; const TELEMETRY_TASK_TYPE = 'maps_telemetry'; @@ -22,14 +21,7 @@ export function scheduleTask(server, taskManager) { state: { stats: {}, runs: 0 }, }); }catch(e) { - server.log(['warning', 'maps'], - i18n.translate('xpack.maps.telemetry.scheduleErrorMessage', { - defaultMessage: `Error scheduling telemetry task, received {message}`, - values: { - message: e.message - }, - }) - ); + server.log(['warning', 'maps'], `Error scheduling telemetry task, received ${e.message}`); } }); } From 488f24718e761417e818019eac006318c6ed7dfb Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 11:22:36 -0500 Subject: [PATCH 73/84] localize sample data --- x-pack/plugins/maps/index.js | 12 ++-- .../sample_data/ecommerce_saved_objects.js | 64 +++++++++++++++++++ .../sample_data/ecommerce_saved_objects.json | 51 --------------- .../sample_data/flights_saved_objects.js | 50 +++++++++++++++ .../sample_data/flights_saved_objects.json | 36 ----------- .../sample_data/web_logs_saved_objects.js | 49 ++++++++++++++ .../sample_data/web_logs_saved_objects.json | 36 ----------- 7 files changed, 169 insertions(+), 129 deletions(-) create mode 100644 x-pack/plugins/maps/server/sample_data/ecommerce_saved_objects.js delete mode 100644 x-pack/plugins/maps/server/sample_data/ecommerce_saved_objects.json create mode 100644 x-pack/plugins/maps/server/sample_data/flights_saved_objects.js delete mode 100644 x-pack/plugins/maps/server/sample_data/flights_saved_objects.json create mode 100644 x-pack/plugins/maps/server/sample_data/web_logs_saved_objects.js delete mode 100644 x-pack/plugins/maps/server/sample_data/web_logs_saved_objects.json diff --git a/x-pack/plugins/maps/index.js b/x-pack/plugins/maps/index.js index 7ba530beb203b..77fade2420c40 100644 --- a/x-pack/plugins/maps/index.js +++ b/x-pack/plugins/maps/index.js @@ -6,9 +6,9 @@ import { resolve } from 'path'; import { initRoutes } from './server/routes'; -import ecommerceSavedObjects from './server/sample_data/ecommerce_saved_objects.json'; -import fligthsSavedObjects from './server/sample_data/flights_saved_objects.json'; -import webLogsSavedObjects from './server/sample_data/web_logs_saved_objects.json'; +import { getSavedObjects as ecommerceSavedObjects } from './server/sample_data/ecommerce_saved_objects'; +import { getSavedObjects as fligthsSavedObjects } from './server/sample_data/flights_saved_objects.js'; +import { getSavedObjects as webLogsSavedObjects } from './server/sample_data/web_logs_saved_objects.js'; import mappings from './mappings.json'; import { checkLicense } from './check_license'; import { migrations } from './migrations'; @@ -91,9 +91,9 @@ export function maps(kibana) { .feature(this.id) .registerLicenseCheckResultsGenerator(checkLicense); - server.addSavedObjectsToSampleDataset('ecommerce', ecommerceSavedObjects); - server.addSavedObjectsToSampleDataset('flights', fligthsSavedObjects); - server.addSavedObjectsToSampleDataset('logs', webLogsSavedObjects); + server.addSavedObjectsToSampleDataset('ecommerce', ecommerceSavedObjects()); + server.addSavedObjectsToSampleDataset('flights', fligthsSavedObjects()); + server.addSavedObjectsToSampleDataset('logs', webLogsSavedObjects()); server.injectUiAppVars('maps', async () => { return await server.getInjectedUiAppVars('kibana'); }); diff --git a/x-pack/plugins/maps/server/sample_data/ecommerce_saved_objects.js b/x-pack/plugins/maps/server/sample_data/ecommerce_saved_objects.js new file mode 100644 index 0000000000000..d8cd1ec6cc2b7 --- /dev/null +++ b/x-pack/plugins/maps/server/sample_data/ecommerce_saved_objects.js @@ -0,0 +1,64 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +/* eslint-disable max-len */ + +import { i18n } from '@kbn/i18n'; + +export const getSavedObjects = () => { + return [ + { + 'id': '2c9c1f60-1909-11e9-919b-ffe5949a18d2', + 'type': 'map', + 'updated_at': '2019-01-15T21:12:56.253Z', + 'version': 5, + 'references': [ + { + 'name': 'layer_1_join_0_index_pattern', + 'type': 'index-pattern', + 'id': 'ff959d40-b880-11e8-a6d9-e546fe2bba5f' + }, + { + 'name': 'layer_2_join_0_index_pattern', + 'type': 'index-pattern', + 'id': 'ff959d40-b880-11e8-a6d9-e546fe2bba5f' + }, + { + 'name': 'layer_3_join_0_index_pattern', + 'type': 'index-pattern', + 'id': 'ff959d40-b880-11e8-a6d9-e546fe2bba5f' + }, + { + 'name': 'layer_4_join_0_index_pattern', + 'type': 'index-pattern', + 'id': 'ff959d40-b880-11e8-a6d9-e546fe2bba5f' + }, + { + 'name': 'layer_5_source_index_pattern', + 'type': 'index-pattern', + 'id': 'ff959d40-b880-11e8-a6d9-e546fe2bba5f' + }, + { + 'name': 'layer_6_source_index_pattern', + 'type': 'index-pattern', + 'id': 'ff959d40-b880-11e8-a6d9-e546fe2bba5f' + } + ], + 'migrationVersion': { + 'map': '7.1.0' + }, + 'attributes': { + 'title': i18n.translate('server.sampleData.ecommerceSpec.mapsTitle', { + defaultMessage: '[eCommerce] Orders by Country', + }), + 'description': '', + 'mapStateJSON': '{"zoom":2.11,"center":{"lon":-15.07605,"lat":45.88578},"timeFilters":{"from":"now-7d","to":"now"},"refreshConfig":{"isPaused":true,"interval":0},"query":{"query":"","language":"kuery"}}', + 'layerListJSON': '[{"id":"0hmz5","alpha":1,"sourceDescriptor":{"type":"EMS_TMS","id":"road_map"},"visible":true,"style":{"type":"TILE","properties":{}},"type":"TILE","minZoom":0,"maxZoom":24},{"id":"7ameq","label":null,"minZoom":0,"maxZoom":24,"alpha":1,"sourceDescriptor":{"type":"EMS_FILE","id":"world_countries"},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"DYNAMIC","options":{"field":{"label":"count of kibana_sample_data_ecommerce:geoip.country_iso_code","name":"__kbnjoin__count_groupby_kibana_sample_data_ecommerce.geoip.country_iso_code","origin":"join"},"color":"Green to Red"}},"lineColor":{"type":"STATIC","options":{"color":"#FFFFFF"}},"lineWidth":{"type":"STATIC","options":{"size":1}},"iconSize":{"type":"STATIC","options":{"size":10}}}},"type":"VECTOR","joins":[{"leftField":"iso2","right":{"id":"741db9c6-8ebb-4ea9-9885-b6b4ac019d14","indexPatternTitle":"kibana_sample_data_ecommerce","term":"geoip.country_iso_code","indexPatternRefName":"layer_1_join_0_index_pattern"}}]},{"id":"jmtgf","label":"United States","minZoom":0,"maxZoom":24,"alpha":1,"sourceDescriptor":{"type":"EMS_FILE","id":"usa_states"},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"DYNAMIC","options":{"field":{"label":"count of kibana_sample_data_ecommerce:geoip.region_name","name":"__kbnjoin__count_groupby_kibana_sample_data_ecommerce.geoip.region_name","origin":"join"},"color":"Blues"}},"lineColor":{"type":"STATIC","options":{"color":"#FFFFFF"}},"lineWidth":{"type":"STATIC","options":{"size":1}},"iconSize":{"type":"STATIC","options":{"size":10}}}},"type":"VECTOR","joins":[{"leftField":"name","right":{"id":"30a0ec24-49b6-476a-b4ed-6c1636333695","indexPatternTitle":"kibana_sample_data_ecommerce","term":"geoip.region_name","indexPatternRefName":"layer_2_join_0_index_pattern"}}]},{"id":"ui5f8","label":"France","minZoom":0,"maxZoom":24,"alpha":1,"sourceDescriptor":{"type":"EMS_FILE","id":"france_departments"},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"DYNAMIC","options":{"field":{"label":"count of kibana_sample_data_ecommerce:geoip.region_name","name":"__kbnjoin__count_groupby_kibana_sample_data_ecommerce.geoip.region_name","origin":"join"},"color":"Blues"}},"lineColor":{"type":"STATIC","options":{"color":"#FFFFFF"}},"lineWidth":{"type":"STATIC","options":{"size":1}},"iconSize":{"type":"STATIC","options":{"size":10}}}},"type":"VECTOR","joins":[{"leftField":"label_en","right":{"id":"e325c9da-73fa-4b3b-8b59-364b99370826","indexPatternTitle":"kibana_sample_data_ecommerce","term":"geoip.region_name","indexPatternRefName":"layer_3_join_0_index_pattern"}}]},{"id":"y3fjb","label":"United Kingdom","minZoom":0,"maxZoom":24,"alpha":1,"sourceDescriptor":{"type":"EMS_FILE","id":"uk_subdivisions"},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"DYNAMIC","options":{"field":{"label":"count of kibana_sample_data_ecommerce:geoip.region_name","name":"__kbnjoin__count_groupby_kibana_sample_data_ecommerce.geoip.region_name","origin":"join"},"color":"Blues"}},"lineColor":{"type":"STATIC","options":{"color":"#FFFFFF"}},"lineWidth":{"type":"STATIC","options":{"size":1}},"iconSize":{"type":"STATIC","options":{"size":10}}}},"type":"VECTOR","joins":[{"leftField":"label_en","right":{"id":"612d805d-8533-43a9-ac0e-cbf51fe63dcd","indexPatternTitle":"kibana_sample_data_ecommerce","term":"geoip.region_name","indexPatternRefName":"layer_4_join_0_index_pattern"}}]},{"id":"c54wk","label":"Sales","minZoom":9,"maxZoom":24,"alpha":1,"sourceDescriptor":{"id":"04c983b0-8cfa-4e6a-a64b-52c10b7008fe","type":"ES_SEARCH","geoField":"geoip.location","limit":2048,"filterByMapBounds":true,"tooltipProperties":["category","customer_gender","manufacturer","order_id","total_quantity","total_unique_products","taxful_total_price","order_date","geoip.region_name","geoip.country_iso_code"],"indexPatternRefName":"layer_5_source_index_pattern"},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"DYNAMIC","options":{"field":{"label":"taxful_total_price","name":"taxful_total_price","origin":"source"},"color":"Greens"}},"lineColor":{"type":"STATIC","options":{"color":"#FFFFFF"}},"lineWidth":{"type":"STATIC","options":{"size":1}},"iconSize":{"type":"STATIC","options":{"size":10}}}},"type":"VECTOR"},{"id":"qvhh3","label":"Total Sales Revenue","minZoom":0,"maxZoom":9,"alpha":1,"sourceDescriptor":{"type":"ES_GEO_GRID","resolution":"COARSE","id":"aa7f87b8-9dc5-42be-b19e-1a2fa09b6cad","geoField":"geoip.location","requestType":"point","metrics":[{"type":"count"},{"type":"sum","field":"taxful_total_price"}],"indexPatternRefName":"layer_6_source_index_pattern"},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"DYNAMIC","options":{"field":{"label":"Count","name":"doc_count","origin":"source"},"color":"Greens"}},"lineColor":{"type":"STATIC","options":{"color":"#cccccc"}},"lineWidth":{"type":"STATIC","options":{"size":1}},"iconSize":{"type":"DYNAMIC","options":{"field":{"label":"sum of taxful_total_price","name":"sum_of_taxful_total_price","origin":"source"},"minSize":1,"maxSize":20}}}},"type":"VECTOR"}]', + 'uiStateJSON': '{"isDarkMode":false}', + 'bounds': { 'type': 'envelope', 'coordinates': [[-117.50707, 72.64116], [87.35497, -4.16541]] } + } + } + ]; +}; diff --git a/x-pack/plugins/maps/server/sample_data/ecommerce_saved_objects.json b/x-pack/plugins/maps/server/sample_data/ecommerce_saved_objects.json deleted file mode 100644 index 60082162e605b..0000000000000 --- a/x-pack/plugins/maps/server/sample_data/ecommerce_saved_objects.json +++ /dev/null @@ -1,51 +0,0 @@ -[ - { - "id":"2c9c1f60-1909-11e9-919b-ffe5949a18d2", - "type":"map", - "updated_at":"2019-01-15T21:12:56.253Z", - "version":5, - "references" : [ - { - "name" : "layer_1_join_0_index_pattern", - "type" : "index-pattern", - "id" : "ff959d40-b880-11e8-a6d9-e546fe2bba5f" - }, - { - "name" : "layer_2_join_0_index_pattern", - "type" : "index-pattern", - "id" : "ff959d40-b880-11e8-a6d9-e546fe2bba5f" - }, - { - "name" : "layer_3_join_0_index_pattern", - "type" : "index-pattern", - "id" : "ff959d40-b880-11e8-a6d9-e546fe2bba5f" - }, - { - "name" : "layer_4_join_0_index_pattern", - "type" : "index-pattern", - "id" : "ff959d40-b880-11e8-a6d9-e546fe2bba5f" - }, - { - "name" : "layer_5_source_index_pattern", - "type" : "index-pattern", - "id" : "ff959d40-b880-11e8-a6d9-e546fe2bba5f" - }, - { - "name" : "layer_6_source_index_pattern", - "type" : "index-pattern", - "id" : "ff959d40-b880-11e8-a6d9-e546fe2bba5f" - } - ], - "migrationVersion" : { - "map" : "7.1.0" - }, - "attributes":{ - "title":"[eCommerce] Orders by Country", - "description":"", - "mapStateJSON":"{\"zoom\":2.11,\"center\":{\"lon\":-15.07605,\"lat\":45.88578},\"timeFilters\":{\"from\":\"now-7d\",\"to\":\"now\"},\"refreshConfig\":{\"isPaused\":true,\"interval\":0},\"query\":{\"query\":\"\",\"language\":\"kuery\"}}", - "layerListJSON" : "[{\"id\":\"0hmz5\",\"alpha\":1,\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"id\":\"road_map\"},\"visible\":true,\"style\":{\"type\":\"TILE\",\"properties\":{}},\"type\":\"TILE\",\"minZoom\":0,\"maxZoom\":24},{\"id\":\"7ameq\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":1,\"sourceDescriptor\":{\"type\":\"EMS_FILE\",\"id\":\"world_countries\"},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"label\":\"count of kibana_sample_data_ecommerce:geoip.country_iso_code\",\"name\":\"__kbnjoin__count_groupby_kibana_sample_data_ecommerce.geoip.country_iso_code\",\"origin\":\"join\"},\"color\":\"Green to Red\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}}}},\"type\":\"VECTOR\",\"joins\":[{\"leftField\":\"iso2\",\"right\":{\"id\":\"741db9c6-8ebb-4ea9-9885-b6b4ac019d14\",\"indexPatternTitle\":\"kibana_sample_data_ecommerce\",\"term\":\"geoip.country_iso_code\",\"indexPatternRefName\":\"layer_1_join_0_index_pattern\"}}]},{\"id\":\"jmtgf\",\"label\":\"United States\",\"minZoom\":0,\"maxZoom\":24,\"alpha\":1,\"sourceDescriptor\":{\"type\":\"EMS_FILE\",\"id\":\"usa_states\"},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"label\":\"count of kibana_sample_data_ecommerce:geoip.region_name\",\"name\":\"__kbnjoin__count_groupby_kibana_sample_data_ecommerce.geoip.region_name\",\"origin\":\"join\"},\"color\":\"Blues\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}}}},\"type\":\"VECTOR\",\"joins\":[{\"leftField\":\"name\",\"right\":{\"id\":\"30a0ec24-49b6-476a-b4ed-6c1636333695\",\"indexPatternTitle\":\"kibana_sample_data_ecommerce\",\"term\":\"geoip.region_name\",\"indexPatternRefName\":\"layer_2_join_0_index_pattern\"}}]},{\"id\":\"ui5f8\",\"label\":\"France\",\"minZoom\":0,\"maxZoom\":24,\"alpha\":1,\"sourceDescriptor\":{\"type\":\"EMS_FILE\",\"id\":\"france_departments\"},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"label\":\"count of kibana_sample_data_ecommerce:geoip.region_name\",\"name\":\"__kbnjoin__count_groupby_kibana_sample_data_ecommerce.geoip.region_name\",\"origin\":\"join\"},\"color\":\"Blues\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}}}},\"type\":\"VECTOR\",\"joins\":[{\"leftField\":\"label_en\",\"right\":{\"id\":\"e325c9da-73fa-4b3b-8b59-364b99370826\",\"indexPatternTitle\":\"kibana_sample_data_ecommerce\",\"term\":\"geoip.region_name\",\"indexPatternRefName\":\"layer_3_join_0_index_pattern\"}}]},{\"id\":\"y3fjb\",\"label\":\"United Kingdom\",\"minZoom\":0,\"maxZoom\":24,\"alpha\":1,\"sourceDescriptor\":{\"type\":\"EMS_FILE\",\"id\":\"uk_subdivisions\"},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"label\":\"count of kibana_sample_data_ecommerce:geoip.region_name\",\"name\":\"__kbnjoin__count_groupby_kibana_sample_data_ecommerce.geoip.region_name\",\"origin\":\"join\"},\"color\":\"Blues\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}}}},\"type\":\"VECTOR\",\"joins\":[{\"leftField\":\"label_en\",\"right\":{\"id\":\"612d805d-8533-43a9-ac0e-cbf51fe63dcd\",\"indexPatternTitle\":\"kibana_sample_data_ecommerce\",\"term\":\"geoip.region_name\",\"indexPatternRefName\":\"layer_4_join_0_index_pattern\"}}]},{\"id\":\"c54wk\",\"label\":\"Sales\",\"minZoom\":9,\"maxZoom\":24,\"alpha\":1,\"sourceDescriptor\":{\"id\":\"04c983b0-8cfa-4e6a-a64b-52c10b7008fe\",\"type\":\"ES_SEARCH\",\"geoField\":\"geoip.location\",\"limit\":2048,\"filterByMapBounds\":true,\"tooltipProperties\":[\"category\",\"customer_gender\",\"manufacturer\",\"order_id\",\"total_quantity\",\"total_unique_products\",\"taxful_total_price\",\"order_date\",\"geoip.region_name\",\"geoip.country_iso_code\"],\"indexPatternRefName\":\"layer_5_source_index_pattern\"},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"label\":\"taxful_total_price\",\"name\":\"taxful_total_price\",\"origin\":\"source\"},\"color\":\"Greens\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}}}},\"type\":\"VECTOR\"},{\"id\":\"qvhh3\",\"label\":\"Total Sales Revenue\",\"minZoom\":0,\"maxZoom\":9,\"alpha\":1,\"sourceDescriptor\":{\"type\":\"ES_GEO_GRID\",\"resolution\":\"COARSE\",\"id\":\"aa7f87b8-9dc5-42be-b19e-1a2fa09b6cad\",\"geoField\":\"geoip.location\",\"requestType\":\"point\",\"metrics\":[{\"type\":\"count\"},{\"type\":\"sum\",\"field\":\"taxful_total_price\"}],\"indexPatternRefName\":\"layer_6_source_index_pattern\"},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"label\":\"Count\",\"name\":\"doc_count\",\"origin\":\"source\"},\"color\":\"Greens\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#cccccc\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"label\":\"sum of taxful_total_price\",\"name\":\"sum_of_taxful_total_price\",\"origin\":\"source\"},\"minSize\":1,\"maxSize\":20}}}},\"type\":\"VECTOR\"}]", - "uiStateJSON":"{\"isDarkMode\":false}", - "bounds":{"type":"envelope","coordinates":[[-117.50707,72.64116],[87.35497,-4.16541]]} - } - } -] diff --git a/x-pack/plugins/maps/server/sample_data/flights_saved_objects.js b/x-pack/plugins/maps/server/sample_data/flights_saved_objects.js new file mode 100644 index 0000000000000..994a577b2a8ed --- /dev/null +++ b/x-pack/plugins/maps/server/sample_data/flights_saved_objects.js @@ -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; + * you may not use this file except in compliance with the Elastic License. + */ +/* eslint-disable max-len */ + +import { i18n } from '@kbn/i18n'; + +export const getSavedObjects = () => { + return [ + { + 'id': '5dd88580-1906-11e9-919b-ffe5949a18d2', + 'type': 'map', + 'updated_at': '2019-01-15T20:44:54.767Z', + 'version': 2, + 'references': [ + { + 'name': 'layer_1_source_index_pattern', + 'type': 'index-pattern', + 'id': 'd3d7af60-4c81-11e8-b3d7-01146121b73d' + }, + { + 'name': 'layer_2_source_index_pattern', + 'type': 'index-pattern', + 'id': 'd3d7af60-4c81-11e8-b3d7-01146121b73d' + }, + { + 'name': 'layer_3_source_index_pattern', + 'type': 'index-pattern', + 'id': 'd3d7af60-4c81-11e8-b3d7-01146121b73d' + } + ], + 'migrationVersion': { + 'map': '7.1.0' + }, + 'attributes': { + 'title': i18n.translate('server.sampleData.flightaSpec.mapsTitle', { + defaultMessage: '[Flights] Origin and Destination Flight Time' + }), + 'description': '', + 'mapStateJSON': '{"zoom":3.14,"center":{"lon":-89.58746,"lat":38.38637},"timeFilters":{"from":"now-7d","to":"now"},"refreshConfig":{"isPaused":true,"interval":0},"query":{"query":"","language":"kuery"}}', + 'layerListJSON': '[{"id":"0hmz5","alpha":1,"sourceDescriptor":{"type":"EMS_TMS","id":"road_map"},"visible":true,"style":{"type":"TILE","properties":{}},"type":"TILE","minZoom":0,"maxZoom":24},{"id":"jzppx","label":"Flights","minZoom":9,"maxZoom":24,"alpha":1,"sourceDescriptor":{"id":"040e0f25-9687-4569-a1e0-76f1a108da56","type":"ES_SEARCH","geoField":"DestLocation","limit":2048,"filterByMapBounds":true,"tooltipProperties":["Carrier","DestCityName","DestCountry","OriginCityName","OriginCountry","FlightDelayMin","FlightTimeMin","DistanceMiles","AvgTicketPrice","FlightDelay"],"indexPatternRefName":"layer_1_source_index_pattern"},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"DYNAMIC","options":{"field":{"label":"FlightTimeMin","name":"FlightTimeMin","origin":"source"},"color":"Greens"}},"lineColor":{"type":"STATIC","options":{"color":"#FFFFFF"}},"lineWidth":{"type":"STATIC","options":{"size":1}},"iconSize":{"type":"DYNAMIC","options":{"field":{"label":"DistanceMiles","name":"DistanceMiles","origin":"source"},"minSize":1,"maxSize":32}}}},"type":"VECTOR"},{"id":"y4jsz","label":"Flight Origin Location","minZoom":0,"maxZoom":9,"alpha":1,"sourceDescriptor":{"type":"ES_GEO_GRID","resolution":"COARSE","id":"fe893f84-388e-4865-8df4-650748533a77","geoField":"OriginLocation","requestType":"point","metrics":[{"type":"count"},{"type":"avg","field":"FlightTimeMin"}],"indexPatternRefName":"layer_2_source_index_pattern"},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"DYNAMIC","options":{"field":{"label":"Count","name":"doc_count","origin":"source"},"color":"Blues"}},"lineColor":{"type":"STATIC","options":{"color":"#110081"}},"lineWidth":{"type":"STATIC","options":{"size":1}},"iconSize":{"type":"DYNAMIC","options":{"field":{"label":"avg of FlightTimeMin","name":"avg_of_FlightTimeMin","origin":"source"},"minSize":1,"maxSize":32}}}},"type":"VECTOR"},{"id":"x8xpo","label":"Flight Destination Location","minZoom":0,"maxZoom":9,"alpha":1,"sourceDescriptor":{"type":"ES_GEO_GRID","resolution":"COARSE","id":"60a7346a-8c5f-4c03-b7d1-e8b36e847551","geoField":"DestLocation","requestType":"point","metrics":[{"type":"count"},{"type":"avg","field":"FlightDelayMin"}],"indexPatternRefName":"layer_3_source_index_pattern"},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"DYNAMIC","options":{"field":{"label":"Count","name":"doc_count","origin":"source"},"color":"Reds"}},"lineColor":{"type":"STATIC","options":{"color":"#af0303"}},"lineWidth":{"type":"STATIC","options":{"size":1}},"iconSize":{"type":"DYNAMIC","options":{"field":{"label":"avg of FlightDelayMin","name":"avg_of_FlightDelayMin","origin":"source"},"minSize":1,"maxSize":32}}}},"type":"VECTOR"}]', + 'uiStateJSON': '{"isDarkMode":false}', + 'bounds': { + 'type': 'envelope', 'coordinates': [[-139.83779, 56.64828], [-39.33713, 14.04811]] } + } + } + ]; +}; diff --git a/x-pack/plugins/maps/server/sample_data/flights_saved_objects.json b/x-pack/plugins/maps/server/sample_data/flights_saved_objects.json deleted file mode 100644 index 333a529b9d927..0000000000000 --- a/x-pack/plugins/maps/server/sample_data/flights_saved_objects.json +++ /dev/null @@ -1,36 +0,0 @@ -[ - { - "id":"5dd88580-1906-11e9-919b-ffe5949a18d2", - "type":"map", - "updated_at":"2019-01-15T20:44:54.767Z", - "version":2, - "references" : [ - { - "name" : "layer_1_source_index_pattern", - "type" : "index-pattern", - "id" : "d3d7af60-4c81-11e8-b3d7-01146121b73d" - }, - { - "name" : "layer_2_source_index_pattern", - "type" : "index-pattern", - "id" : "d3d7af60-4c81-11e8-b3d7-01146121b73d" - }, - { - "name" : "layer_3_source_index_pattern", - "type" : "index-pattern", - "id" : "d3d7af60-4c81-11e8-b3d7-01146121b73d" - } - ], - "migrationVersion" : { - "map" : "7.1.0" - }, - "attributes":{ - "title":"[Flights] Origin and Destination Flight Time", - "description":"", - "mapStateJSON":"{\"zoom\":3.14,\"center\":{\"lon\":-89.58746,\"lat\":38.38637},\"timeFilters\":{\"from\":\"now-7d\",\"to\":\"now\"},\"refreshConfig\":{\"isPaused\":true,\"interval\":0},\"query\":{\"query\":\"\",\"language\":\"kuery\"}}", - "layerListJSON" : "[{\"id\":\"0hmz5\",\"alpha\":1,\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"id\":\"road_map\"},\"visible\":true,\"style\":{\"type\":\"TILE\",\"properties\":{}},\"type\":\"TILE\",\"minZoom\":0,\"maxZoom\":24},{\"id\":\"jzppx\",\"label\":\"Flights\",\"minZoom\":9,\"maxZoom\":24,\"alpha\":1,\"sourceDescriptor\":{\"id\":\"040e0f25-9687-4569-a1e0-76f1a108da56\",\"type\":\"ES_SEARCH\",\"geoField\":\"DestLocation\",\"limit\":2048,\"filterByMapBounds\":true,\"tooltipProperties\":[\"Carrier\",\"DestCityName\",\"DestCountry\",\"OriginCityName\",\"OriginCountry\",\"FlightDelayMin\",\"FlightTimeMin\",\"DistanceMiles\",\"AvgTicketPrice\",\"FlightDelay\"],\"indexPatternRefName\":\"layer_1_source_index_pattern\"},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"label\":\"FlightTimeMin\",\"name\":\"FlightTimeMin\",\"origin\":\"source\"},\"color\":\"Greens\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"label\":\"DistanceMiles\",\"name\":\"DistanceMiles\",\"origin\":\"source\"},\"minSize\":1,\"maxSize\":32}}}},\"type\":\"VECTOR\"},{\"id\":\"y4jsz\",\"label\":\"Flight Origin Location\",\"minZoom\":0,\"maxZoom\":9,\"alpha\":1,\"sourceDescriptor\":{\"type\":\"ES_GEO_GRID\",\"resolution\":\"COARSE\",\"id\":\"fe893f84-388e-4865-8df4-650748533a77\",\"geoField\":\"OriginLocation\",\"requestType\":\"point\",\"metrics\":[{\"type\":\"count\"},{\"type\":\"avg\",\"field\":\"FlightTimeMin\"}],\"indexPatternRefName\":\"layer_2_source_index_pattern\"},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"label\":\"Count\",\"name\":\"doc_count\",\"origin\":\"source\"},\"color\":\"Blues\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#110081\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"label\":\"avg of FlightTimeMin\",\"name\":\"avg_of_FlightTimeMin\",\"origin\":\"source\"},\"minSize\":1,\"maxSize\":32}}}},\"type\":\"VECTOR\"},{\"id\":\"x8xpo\",\"label\":\"Flight Destination Location\",\"minZoom\":0,\"maxZoom\":9,\"alpha\":1,\"sourceDescriptor\":{\"type\":\"ES_GEO_GRID\",\"resolution\":\"COARSE\",\"id\":\"60a7346a-8c5f-4c03-b7d1-e8b36e847551\",\"geoField\":\"DestLocation\",\"requestType\":\"point\",\"metrics\":[{\"type\":\"count\"},{\"type\":\"avg\",\"field\":\"FlightDelayMin\"}],\"indexPatternRefName\":\"layer_3_source_index_pattern\"},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"label\":\"Count\",\"name\":\"doc_count\",\"origin\":\"source\"},\"color\":\"Reds\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#af0303\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"label\":\"avg of FlightDelayMin\",\"name\":\"avg_of_FlightDelayMin\",\"origin\":\"source\"},\"minSize\":1,\"maxSize\":32}}}},\"type\":\"VECTOR\"}]", - "uiStateJSON":"{\"isDarkMode\":false}", - "bounds":{"type":"envelope","coordinates":[[-139.83779,56.64828],[-39.33713,14.04811]]} - } - } -] diff --git a/x-pack/plugins/maps/server/sample_data/web_logs_saved_objects.js b/x-pack/plugins/maps/server/sample_data/web_logs_saved_objects.js new file mode 100644 index 0000000000000..c80e52770dc46 --- /dev/null +++ b/x-pack/plugins/maps/server/sample_data/web_logs_saved_objects.js @@ -0,0 +1,49 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +/* eslint-disable max-len */ + +import { i18n } from '@kbn/i18n'; + +export const getSavedObjects = () => { + return [ + { + 'id': 'de71f4f0-1902-11e9-919b-ffe5949a18d2', + 'type': 'map', + 'updated_at': '2019-01-15T20:30:25.436Z', + 'version': 5, + 'references': [ + { + 'name': 'layer_1_join_0_index_pattern', + 'type': 'index-pattern', + 'id': '90943e30-9a47-11e8-b64d-95841ca0b247' + }, + { + 'name': 'layer_2_source_index_pattern', + 'type': 'index-pattern', + 'id': '90943e30-9a47-11e8-b64d-95841ca0b247' + }, + { + 'name': 'layer_3_source_index_pattern', + 'type': 'index-pattern', + 'id': '90943e30-9a47-11e8-b64d-95841ca0b247' + } + ], + 'migrationVersion': { + 'map': '7.1.0' + }, + 'attributes': { + 'title': i18n.translate('server.sampleData.flightaSpec.logsTitle', { + defaultMessage: '[Logs] Total Requests and Bytes' + }), + 'description': '', + 'mapStateJSON': '{"zoom":3.64,"center":{"lon":-88.92107,"lat":42.16337},"timeFilters":{"from":"now-7d","to":"now"},"refreshConfig":{"isPaused":true,"interval":0},"query":{"language":"kuery","query":""}}', + 'layerListJSON': '[{"id":"0hmz5","alpha":1,"sourceDescriptor":{"type":"EMS_TMS","id":"road_map"},"visible":true,"style":{"type":"TILE","properties":{}},"type":"TILE","minZoom":0,"maxZoom":24},{"id":"edh66","label":"Total Requests by Country","minZoom":0,"maxZoom":24,"alpha":0.5,"sourceDescriptor":{"type":"EMS_FILE","id":"world_countries"},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"DYNAMIC","options":{"field":{"label":"count of kibana_sample_data_logs:geo.src","name":"__kbnjoin__count_groupby_kibana_sample_data_logs.geo.src","origin":"join"},"color":"Greys"}},"lineColor":{"type":"STATIC","options":{"color":"#FFFFFF"}},"lineWidth":{"type":"STATIC","options":{"size":1}},"iconSize":{"type":"STATIC","options":{"size":10}}}},"type":"VECTOR","joins":[{"leftField":"iso2","right":{"id":"673ff994-fc75-4c67-909b-69fcb0e1060e","indexPatternTitle":"kibana_sample_data_logs","term":"geo.src","indexPatternRefName":"layer_1_join_0_index_pattern"}}]},{"id":"gaxya","label":"Actual Requests","minZoom":9,"maxZoom":24,"alpha":1,"sourceDescriptor":{"id":"b7486535-171b-4d3b-bb2e-33c1a0a2854c","type":"ES_SEARCH","geoField":"geo.coordinates","limit":2048,"filterByMapBounds":true,"tooltipProperties":["clientip","timestamp","host","request","response","machine.os","agent","bytes"],"indexPatternRefName":"layer_2_source_index_pattern"},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"STATIC","options":{"color":"#2200ff"}},"lineColor":{"type":"STATIC","options":{"color":"#FFFFFF"}},"lineWidth":{"type":"STATIC","options":{"size":2}},"iconSize":{"type":"DYNAMIC","options":{"field":{"label":"bytes","name":"bytes","origin":"source"},"minSize":1,"maxSize":23}}}},"type":"VECTOR"},{"id":"tfi3f","label":"Total Requests and Bytes","minZoom":0,"maxZoom":9,"alpha":1,"sourceDescriptor":{"type":"ES_GEO_GRID","resolution":"COARSE","id":"8aaa65b5-a4e9-448b-9560-c98cb1c5ac5b","geoField":"geo.coordinates","requestType":"point","metrics":[{"type":"count"},{"type":"sum","field":"bytes"}],"indexPatternRefName":"layer_3_source_index_pattern"},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"DYNAMIC","options":{"field":{"label":"Count","name":"doc_count","origin":"source"},"color":"Blues"}},"lineColor":{"type":"STATIC","options":{"color":"#cccccc"}},"lineWidth":{"type":"STATIC","options":{"size":1}},"iconSize":{"type":"DYNAMIC","options":{"field":{"label":"sum of bytes","name":"sum_of_bytes","origin":"source"},"minSize":1,"maxSize":25}}}},"type":"VECTOR"}]', + 'uiStateJSON': '{"isDarkMode":false}', + 'bounds': { 'type': 'envelope', 'coordinates': [[-124.45342, 54.91445], [-53.38872, 26.21461]] } + } + } + ]; +}; diff --git a/x-pack/plugins/maps/server/sample_data/web_logs_saved_objects.json b/x-pack/plugins/maps/server/sample_data/web_logs_saved_objects.json deleted file mode 100644 index f446931792bb0..0000000000000 --- a/x-pack/plugins/maps/server/sample_data/web_logs_saved_objects.json +++ /dev/null @@ -1,36 +0,0 @@ -[ - { - "id":"de71f4f0-1902-11e9-919b-ffe5949a18d2", - "type":"map", - "updated_at":"2019-01-15T20:30:25.436Z", - "version":5, - "references" : [ - { - "name" : "layer_1_join_0_index_pattern", - "type" : "index-pattern", - "id" : "90943e30-9a47-11e8-b64d-95841ca0b247" - }, - { - "name" : "layer_2_source_index_pattern", - "type" : "index-pattern", - "id" : "90943e30-9a47-11e8-b64d-95841ca0b247" - }, - { - "name" : "layer_3_source_index_pattern", - "type" : "index-pattern", - "id" : "90943e30-9a47-11e8-b64d-95841ca0b247" - } - ], - "migrationVersion" : { - "map" : "7.1.0" - }, - "attributes":{ - "title":"[Logs] Total Requests and Bytes", - "description":"", - "mapStateJSON":"{\"zoom\":3.64,\"center\":{\"lon\":-88.92107,\"lat\":42.16337},\"timeFilters\":{\"from\":\"now-7d\",\"to\":\"now\"},\"refreshConfig\":{\"isPaused\":true,\"interval\":0},\"query\":{\"language\":\"kuery\",\"query\":\"\"}}", - "layerListJSON" : "[{\"id\":\"0hmz5\",\"alpha\":1,\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"id\":\"road_map\"},\"visible\":true,\"style\":{\"type\":\"TILE\",\"properties\":{}},\"type\":\"TILE\",\"minZoom\":0,\"maxZoom\":24},{\"id\":\"edh66\",\"label\":\"Total Requests by Country\",\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.5,\"sourceDescriptor\":{\"type\":\"EMS_FILE\",\"id\":\"world_countries\"},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"label\":\"count of kibana_sample_data_logs:geo.src\",\"name\":\"__kbnjoin__count_groupby_kibana_sample_data_logs.geo.src\",\"origin\":\"join\"},\"color\":\"Greys\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}}}},\"type\":\"VECTOR\",\"joins\":[{\"leftField\":\"iso2\",\"right\":{\"id\":\"673ff994-fc75-4c67-909b-69fcb0e1060e\",\"indexPatternTitle\":\"kibana_sample_data_logs\",\"term\":\"geo.src\",\"indexPatternRefName\":\"layer_1_join_0_index_pattern\"}}]},{\"id\":\"gaxya\",\"label\":\"Actual Requests\",\"minZoom\":9,\"maxZoom\":24,\"alpha\":1,\"sourceDescriptor\":{\"id\":\"b7486535-171b-4d3b-bb2e-33c1a0a2854c\",\"type\":\"ES_SEARCH\",\"geoField\":\"geo.coordinates\",\"limit\":2048,\"filterByMapBounds\":true,\"tooltipProperties\":[\"clientip\",\"timestamp\",\"host\",\"request\",\"response\",\"machine.os\",\"agent\",\"bytes\"],\"indexPatternRefName\":\"layer_2_source_index_pattern\"},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#2200ff\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":2}},\"iconSize\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"label\":\"bytes\",\"name\":\"bytes\",\"origin\":\"source\"},\"minSize\":1,\"maxSize\":23}}}},\"type\":\"VECTOR\"},{\"id\":\"tfi3f\",\"label\":\"Total Requests and Bytes\",\"minZoom\":0,\"maxZoom\":9,\"alpha\":1,\"sourceDescriptor\":{\"type\":\"ES_GEO_GRID\",\"resolution\":\"COARSE\",\"id\":\"8aaa65b5-a4e9-448b-9560-c98cb1c5ac5b\",\"geoField\":\"geo.coordinates\",\"requestType\":\"point\",\"metrics\":[{\"type\":\"count\"},{\"type\":\"sum\",\"field\":\"bytes\"}],\"indexPatternRefName\":\"layer_3_source_index_pattern\"},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"label\":\"Count\",\"name\":\"doc_count\",\"origin\":\"source\"},\"color\":\"Blues\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#cccccc\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"label\":\"sum of bytes\",\"name\":\"sum_of_bytes\",\"origin\":\"source\"},\"minSize\":1,\"maxSize\":25}}}},\"type\":\"VECTOR\"}]", - "uiStateJSON":"{\"isDarkMode\":false}", - "bounds":{"type":"envelope","coordinates":[[-124.45342,54.91445],[-53.38872,26.21461]]} - } - } -] From c5311270fd34a7b7be6c6e9040b5c7716754f9f8 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 11:43:11 -0500 Subject: [PATCH 74/84] rename for clarity --- x-pack/plugins/maps/index.js | 12 ++++++------ .../server/sample_data/ecommerce_saved_objects.js | 2 +- .../maps/server/sample_data/flights_saved_objects.js | 2 +- .../server/sample_data/web_logs_saved_objects.js | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/x-pack/plugins/maps/index.js b/x-pack/plugins/maps/index.js index 77fade2420c40..567e8c5e97deb 100644 --- a/x-pack/plugins/maps/index.js +++ b/x-pack/plugins/maps/index.js @@ -6,9 +6,9 @@ import { resolve } from 'path'; import { initRoutes } from './server/routes'; -import { getSavedObjects as ecommerceSavedObjects } from './server/sample_data/ecommerce_saved_objects'; -import { getSavedObjects as fligthsSavedObjects } from './server/sample_data/flights_saved_objects.js'; -import { getSavedObjects as webLogsSavedObjects } from './server/sample_data/web_logs_saved_objects.js'; +import { getEcommerceSavedObjects } from './server/sample_data/ecommerce_saved_objects'; +import { getFlightsSavedObjects } from './server/sample_data/flights_saved_objects.js'; +import { getWebLogsSavedObjects } from './server/sample_data/web_logs_saved_objects.js'; import mappings from './mappings.json'; import { checkLicense } from './check_license'; import { migrations } from './migrations'; @@ -91,9 +91,9 @@ export function maps(kibana) { .feature(this.id) .registerLicenseCheckResultsGenerator(checkLicense); - server.addSavedObjectsToSampleDataset('ecommerce', ecommerceSavedObjects()); - server.addSavedObjectsToSampleDataset('flights', fligthsSavedObjects()); - server.addSavedObjectsToSampleDataset('logs', webLogsSavedObjects()); + server.addSavedObjectsToSampleDataset('ecommerce', getEcommerceSavedObjects()); + server.addSavedObjectsToSampleDataset('flights', getFlightsSavedObjects()); + server.addSavedObjectsToSampleDataset('logs', getWebLogsSavedObjects()); server.injectUiAppVars('maps', async () => { return await server.getInjectedUiAppVars('kibana'); }); diff --git a/x-pack/plugins/maps/server/sample_data/ecommerce_saved_objects.js b/x-pack/plugins/maps/server/sample_data/ecommerce_saved_objects.js index d8cd1ec6cc2b7..ea7a71ed240cf 100644 --- a/x-pack/plugins/maps/server/sample_data/ecommerce_saved_objects.js +++ b/x-pack/plugins/maps/server/sample_data/ecommerce_saved_objects.js @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; -export const getSavedObjects = () => { +export const getEcommerceSavedObjects = () => { return [ { 'id': '2c9c1f60-1909-11e9-919b-ffe5949a18d2', diff --git a/x-pack/plugins/maps/server/sample_data/flights_saved_objects.js b/x-pack/plugins/maps/server/sample_data/flights_saved_objects.js index 994a577b2a8ed..d93241d1498c3 100644 --- a/x-pack/plugins/maps/server/sample_data/flights_saved_objects.js +++ b/x-pack/plugins/maps/server/sample_data/flights_saved_objects.js @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; -export const getSavedObjects = () => { +export const getFlightsSavedObjects = () => { return [ { 'id': '5dd88580-1906-11e9-919b-ffe5949a18d2', diff --git a/x-pack/plugins/maps/server/sample_data/web_logs_saved_objects.js b/x-pack/plugins/maps/server/sample_data/web_logs_saved_objects.js index c80e52770dc46..eba8777abb574 100644 --- a/x-pack/plugins/maps/server/sample_data/web_logs_saved_objects.js +++ b/x-pack/plugins/maps/server/sample_data/web_logs_saved_objects.js @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; -export const getSavedObjects = () => { +export const getWebLogsSavedObjects = () => { return [ { 'id': 'de71f4f0-1902-11e9-919b-ffe5949a18d2', From 0567df2d1355432102933308ea321d06bc96ba2d Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 12:02:21 -0500 Subject: [PATCH 75/84] fix namespace --- .../plugins/maps/server/sample_data/ecommerce_saved_objects.js | 2 +- x-pack/plugins/maps/server/sample_data/flights_saved_objects.js | 2 +- .../plugins/maps/server/sample_data/web_logs_saved_objects.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/maps/server/sample_data/ecommerce_saved_objects.js b/x-pack/plugins/maps/server/sample_data/ecommerce_saved_objects.js index ea7a71ed240cf..8fcc191a77917 100644 --- a/x-pack/plugins/maps/server/sample_data/ecommerce_saved_objects.js +++ b/x-pack/plugins/maps/server/sample_data/ecommerce_saved_objects.js @@ -50,7 +50,7 @@ export const getEcommerceSavedObjects = () => { 'map': '7.1.0' }, 'attributes': { - 'title': i18n.translate('server.sampleData.ecommerceSpec.mapsTitle', { + 'title': i18n.translate('xpack.maps.sampleData.ecommerceSpec.mapsTitle', { defaultMessage: '[eCommerce] Orders by Country', }), 'description': '', diff --git a/x-pack/plugins/maps/server/sample_data/flights_saved_objects.js b/x-pack/plugins/maps/server/sample_data/flights_saved_objects.js index d93241d1498c3..b05690bb0d5fe 100644 --- a/x-pack/plugins/maps/server/sample_data/flights_saved_objects.js +++ b/x-pack/plugins/maps/server/sample_data/flights_saved_objects.js @@ -35,7 +35,7 @@ export const getFlightsSavedObjects = () => { 'map': '7.1.0' }, 'attributes': { - 'title': i18n.translate('server.sampleData.flightaSpec.mapsTitle', { + 'title': i18n.translate('xpack.maps.sampleData.flightaSpec.mapsTitle', { defaultMessage: '[Flights] Origin and Destination Flight Time' }), 'description': '', diff --git a/x-pack/plugins/maps/server/sample_data/web_logs_saved_objects.js b/x-pack/plugins/maps/server/sample_data/web_logs_saved_objects.js index eba8777abb574..5d7ea053b66da 100644 --- a/x-pack/plugins/maps/server/sample_data/web_logs_saved_objects.js +++ b/x-pack/plugins/maps/server/sample_data/web_logs_saved_objects.js @@ -35,7 +35,7 @@ export const getWebLogsSavedObjects = () => { 'map': '7.1.0' }, 'attributes': { - 'title': i18n.translate('server.sampleData.flightaSpec.logsTitle', { + 'title': i18n.translate('xpack.maps.sampleData.flightaSpec.logsTitle', { defaultMessage: '[Logs] Total Requests and Bytes' }), 'description': '', From 39f20b43cdf98b9cc78964a1621cdbfacda2fd39 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 12:41:53 -0500 Subject: [PATCH 76/84] top nav --- x-pack/plugins/maps/public/angular/map_controller.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/maps/public/angular/map_controller.js b/x-pack/plugins/maps/public/angular/map_controller.js index c3ac884539804..5583b086dbd39 100644 --- a/x-pack/plugins/maps/public/angular/map_controller.js +++ b/x-pack/plugins/maps/public/angular/map_controller.js @@ -253,14 +253,18 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage $scope.showDatePicker = true; // used by query-bar directive to enable timepikcer in query bar $scope.topNavMenu = [{ key: 'full screen', - description: 'full screen', + description: i18n.translate('xpack.maps.mapController.fullScreenLabel', { + defaultMessage: `full screen` + }), testId: 'mapsFullScreenMode', run() { store.dispatch(enableFullScreen()); } }, { key: 'inspect', - description: 'Open Inspector', + description: i18n.translate('xpack.maps.mapController.openInspectorLabel', { + defaultMessage: `Open Inspector` + }), testId: 'openInspectorButton', run() { const inspectorAdapters = getInspectorAdapters(store.getState()); @@ -268,7 +272,9 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage } }, { key: 'save', - description: 'Save map', + description: i18n.translate('xpack.maps.mapController.saveMapLabels', { + defaultMessage: `Save map` + }), testId: 'mapSaveButton', run: async () => { const onSave = ({ newTitle, newCopyOnSave, isTitleDuplicateConfirmed, onTitleDuplicate }) => { From 226d604976feb08da02cfad22888e83e520b7992 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 12:48:38 -0500 Subject: [PATCH 77/84] top nav --- .../maps/public/angular/map_controller.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/maps/public/angular/map_controller.js b/x-pack/plugins/maps/public/angular/map_controller.js index 5583b086dbd39..b6787ad2ae3c3 100644 --- a/x-pack/plugins/maps/public/angular/map_controller.js +++ b/x-pack/plugins/maps/public/angular/map_controller.js @@ -252,8 +252,10 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage timefilter.disableAutoRefreshSelector(); $scope.showDatePicker = true; // used by query-bar directive to enable timepikcer in query bar $scope.topNavMenu = [{ - key: 'full screen', - description: i18n.translate('xpack.maps.mapController.fullScreenLabel', { + key: i18n.translate('xpack.maps.mapController.fullScreenButtonLabel', { + defaultMessage: `full screen` + }), + description: i18n.translate('xpack.maps.mapController.fullScreenDescription', { defaultMessage: `full screen` }), testId: 'mapsFullScreenMode', @@ -261,8 +263,10 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage store.dispatch(enableFullScreen()); } }, { - key: 'inspect', - description: i18n.translate('xpack.maps.mapController.openInspectorLabel', { + key: i18n.translate('xpack.maps.mapController.openInspectorButtonLabel', { + defaultMessage: `inspect` + }), + description: i18n.translate('xpack.maps.mapController.openInspectorDescription', { defaultMessage: `Open Inspector` }), testId: 'openInspectorButton', @@ -271,8 +275,10 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage Inspector.open(inspectorAdapters, {}); } }, { - key: 'save', - description: i18n.translate('xpack.maps.mapController.saveMapLabels', { + key: i18n.translate('xpack.maps.mapController.saveMapButtonLabel', { + defaultMessage: `save` + }), + description: i18n.translate('xpack.maps.mapController.saveMapDescription', { defaultMessage: `Save map` }), testId: 'mapSaveButton', From 48814ff5d4fbcd4a44b1409302a854c7eadcd568 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 13:01:28 -0500 Subject: [PATCH 78/84] update shallow imports --- .../public/components/layer_panel/view.test.js | 6 +++--- .../attribution_control/view.test.js | 4 ++-- .../layer_control/layer_toc/toc_entry/view.test.js | 6 +++--- .../widget_overlay/layer_control/view.test.js | 6 +++--- .../shared/components/layer_toc_actions.test.js | 14 +++++++------- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/x-pack/plugins/maps/public/components/layer_panel/view.test.js b/x-pack/plugins/maps/public/components/layer_panel/view.test.js index ab9cb7b9735fd..200345bf92b74 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/view.test.js +++ b/x-pack/plugins/maps/public/components/layer_panel/view.test.js @@ -29,7 +29,7 @@ jest.mock('./settings_panel', () => ({ })); import React from 'react'; -import { shallow } from 'enzyme'; +import { shallowWithIntl } from 'test_utils/enzyme_helpers'; import { LayerPanel } from './view'; @@ -53,7 +53,7 @@ const defaultProps = { describe('LayerPanel', () => { test('is rendered', async () => { - const component = shallow( + const component = shallowWithIntl( @@ -69,7 +69,7 @@ describe('LayerPanel', () => { }); test('should render empty panel when selectedLayer is null', async () => { - const component = shallow( + const component = shallowWithIntl( { ]; } }; - const component = shallow( + const component = shallowWithIntl( diff --git a/x-pack/plugins/maps/public/components/widget_overlay/layer_control/layer_toc/toc_entry/view.test.js b/x-pack/plugins/maps/public/components/widget_overlay/layer_control/layer_toc/toc_entry/view.test.js index 8b5fba602b0a9..5622a17fd39b8 100644 --- a/x-pack/plugins/maps/public/components/widget_overlay/layer_control/layer_toc/toc_entry/view.test.js +++ b/x-pack/plugins/maps/public/components/widget_overlay/layer_control/layer_toc/toc_entry/view.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallow } from 'enzyme'; +import { shallowWithIntl } from 'test_utils/enzyme_helpers'; import { TOCEntry } from './view'; @@ -30,7 +30,7 @@ const defaultProps = { describe('TOCEntry', () => { test('is rendered', async () => { - const component = shallow( + const component = shallowWithIntl( @@ -47,7 +47,7 @@ describe('TOCEntry', () => { describe('props', () => { test('isReadOnly', async () => { - const component = shallow( + const component = shallowWithIntl( ({ })); import React from 'react'; -import { shallow } from 'enzyme'; +import { shallowWithIntl } from 'test_utils/enzyme_helpers'; import { LayerControl } from './view'; @@ -21,7 +21,7 @@ const defaultProps = { describe('LayerControl', () => { test('is rendered', () => { - const component = shallow( + const component = shallowWithIntl( @@ -33,7 +33,7 @@ describe('LayerControl', () => { describe('props', () => { test('isReadOnly', () => { - const component = shallow( + const component = shallowWithIntl( { }); test('is rendered', async () => { - const component = shallow( + const component = shallowWithIntl( @@ -58,7 +58,7 @@ describe('LayerTocActions', () => { test('should disable fit to data when supportsFitToBounds is false', async () => { supportsFitToBounds = false; - const component = shallow( + const component = shallowWithIntl( @@ -75,7 +75,7 @@ describe('LayerTocActions', () => { test('should display spinner when layer is loading', async () => { isLayerLoading = true; - const component = shallow( + const component = shallowWithIntl( @@ -92,7 +92,7 @@ describe('LayerTocActions', () => { test('should show warning when layer has errors', async () => { hasErrors = true; - const component = shallow( + const component = shallowWithIntl( @@ -109,7 +109,7 @@ describe('LayerTocActions', () => { test('should show visible toggle when layer is not visible', async () => { isVisible = false; - const component = shallow( + const component = shallowWithIntl( @@ -126,7 +126,7 @@ describe('LayerTocActions', () => { test('should provide feedback when layer is not visible because of current zoom level', async () => { showAtZoomLevel = false; - const component = shallow( + const component = shallowWithIntl( From 88d62c1ab926f7d33a1fe2fe23cf88a29a845279 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 15:04:55 -0500 Subject: [PATCH 79/84] tms source --- .../sources/ems_tms_source/ems_tms_source.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/sources/ems_tms_source/ems_tms_source.js b/x-pack/plugins/maps/public/shared/layers/sources/ems_tms_source/ems_tms_source.js index 326b940abb2b6..1a6f02f3777c0 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/ems_tms_source/ems_tms_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/ems_tms_source/ems_tms_source.js @@ -44,8 +44,18 @@ export class EMSTMSSource extends AbstractTMSSource { async getImmutableProperties() { return [ - { label: 'Data source', value: EMSTMSSource.title }, - { label: 'Tile service', value: this._descriptor.id } + { + label: i18n.translate('xpack.maps.source.emsTile.dataSourceLabel', { + defaultMessage: `Data source`, + }), + value: EMSTMSSource.title + }, + { + label: i18n.translate('xpack.maps.source.emsTile.serviceId', { + defaultMessage: `Tile service`, + }), + value: this._descriptor.id + } ]; } From d1506bb0afa5dc30077f47335a9a97b9c88d1a12 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 15:22:21 -0500 Subject: [PATCH 80/84] feedback --- .../maps/public/angular/map_controller.js | 2 +- .../public/components/layer_addpanel/view.js | 4 ++-- .../join_editor/resources/join_expression.js | 2 +- .../public/components/layer_panel/view.js | 19 +++++++++++++++++-- .../maps/public/inspector/views/map_view.js | 2 +- .../public/shared/components/map_listing.js | 4 ++-- .../public/shared/components/metric_select.js | 8 ++++---- .../components/no_index_pattern_callout.js | 4 ++-- .../ems_file_source/ems_file_source.js | 2 +- 9 files changed, 31 insertions(+), 16 deletions(-) diff --git a/x-pack/plugins/maps/public/angular/map_controller.js b/x-pack/plugins/maps/public/angular/map_controller.js index b6787ad2ae3c3..c5a7f598ebcc4 100644 --- a/x-pack/plugins/maps/public/angular/map_controller.js +++ b/x-pack/plugins/maps/public/angular/map_controller.js @@ -231,7 +231,7 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage if (id) { toastNotifications.addSuccess({ - title: i18n.translate('xpack.maps.mapController.saveDescription', { + title: i18n.translate('xpack.maps.mapController.saveSuccessMessage', { defaultMessage: `Saved '{title}'`, values: { title: savedMap.title } }), diff --git a/x-pack/plugins/maps/public/components/layer_addpanel/view.js b/x-pack/plugins/maps/public/components/layer_addpanel/view.js index 9f4425414a9ee..0808d4ab31804 100644 --- a/x-pack/plugins/maps/public/components/layer_addpanel/view.js +++ b/x-pack/plugins/maps/public/components/layer_addpanel/view.js @@ -73,7 +73,7 @@ export class AddLayerPanel extends Component { fill > @@ -170,7 +170,7 @@ export class AddLayerPanel extends Component {

diff --git a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join_expression.js b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join_expression.js index 36657f7822489..fa6ad3bdd9571 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join_expression.js +++ b/x-pack/plugins/maps/public/components/layer_panel/join_editor/resources/join_expression.js @@ -251,7 +251,7 @@ JoinExpression.propTypes = { }; function getSelectFieldPlaceholder() { - i18n.translate('xpack.maps.layerPanel.joinExpression.selectFieldPlaceholder', { + return i18n.translate('xpack.maps.layerPanel.joinExpression.selectFieldPlaceholder', { defaultMessage: 'selectField' }); } diff --git a/x-pack/plugins/maps/public/components/layer_panel/view.js b/x-pack/plugins/maps/public/components/layer_panel/view.js index a2bd718650da3..36e4ac6f484f6 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/view.js +++ b/x-pack/plugins/maps/public/components/layer_panel/view.js @@ -11,7 +11,7 @@ import { JoinEditor } from './join_editor'; import { FlyoutFooter } from './flyout_footer'; import { SettingsPanel } from './settings_panel'; import { - EuiIcon, + EuiButtonIcon, EuiFlexItem, EuiTitle, EuiPanel, @@ -26,6 +26,7 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; export class LayerPanel extends React.Component { @@ -133,7 +134,21 @@ export class LayerPanel extends React.Component { - + + + + diff --git a/x-pack/plugins/maps/public/inspector/views/map_view.js b/x-pack/plugins/maps/public/inspector/views/map_view.js index 9c347cf75763e..e1bdcbdf191b7 100644 --- a/x-pack/plugins/maps/public/inspector/views/map_view.js +++ b/x-pack/plugins/maps/public/inspector/views/map_view.js @@ -59,7 +59,7 @@ const MapView = { defaultMessage: 'Map details' }), order: 30, - help: i18n.translate('xpack.maps.inspector.viewMapStateTitle', { + help: i18n.translate('xpack.maps.inspector.mapDetailsViewHelpText', { defaultMessage: 'View the map state' }), shouldShow(adapters) { diff --git a/x-pack/plugins/maps/public/shared/components/map_listing.js b/x-pack/plugins/maps/public/shared/components/map_listing.js index ecd0dfc3bda1c..c3e6e42b577a1 100644 --- a/x-pack/plugins/maps/public/shared/components/map_listing.js +++ b/x-pack/plugins/maps/public/shared/components/map_listing.js @@ -276,7 +276,7 @@ export class MapListing extends React.Component { {deleteBtn}

diff --git a/x-pack/plugins/maps/public/shared/components/metric_select.js b/x-pack/plugins/maps/public/shared/components/metric_select.js index 19e2fa27f042e..3be3b13969cac 100644 --- a/x-pack/plugins/maps/public/shared/components/metric_select.js +++ b/x-pack/plugins/maps/public/shared/components/metric_select.js @@ -14,19 +14,19 @@ const AGG_OPTIONS = [ defaultMessage: 'Average' }), value: 'avg' }, - { label: i18n.translate('xpack.maps.metricSelect.count.averageDropDownOptionLabel', { + { label: i18n.translate('xpack.maps.metricSelect.countDropDownOptionLabel', { defaultMessage: 'Count' }), value: 'count' }, - { label: i18n.translate('xpack.maps.metricSelect.max.averageDropDownOptionLabel', { + { label: i18n.translate('xpack.maps.metricSelect.maxDropDownOptionLabel', { defaultMessage: 'Max' }), value: 'max' }, - { label: i18n.translate('xpack.maps.metricSelect.min.averageDropDownOptionLabel', { + { label: i18n.translate('xpack.maps.metricSelect.minDropDownOptionLabel', { defaultMessage: 'Min' }), value: 'min' }, - { label: i18n.translate('xpack.maps.metricSelect.sum.averageDropDownOptionLabel', { + { label: i18n.translate('xpack.maps.metricSelect.sumDropDownOptionLabel', { defaultMessage: 'Sum' }), value: 'sum' }, diff --git a/x-pack/plugins/maps/public/shared/components/no_index_pattern_callout.js b/x-pack/plugins/maps/public/shared/components/no_index_pattern_callout.js index 5a240ad65cba5..6744cc1b3e8ec 100644 --- a/x-pack/plugins/maps/public/shared/components/no_index_pattern_callout.js +++ b/x-pack/plugins/maps/public/shared/components/no_index_pattern_callout.js @@ -23,7 +23,7 @@ export function NoIndexPatternCallout() { >

@@ -33,7 +33,7 @@ export function NoIndexPatternCallout() { />

diff --git a/x-pack/plugins/maps/public/shared/layers/sources/ems_file_source/ems_file_source.js b/x-pack/plugins/maps/public/shared/layers/sources/ems_file_source/ems_file_source.js index 0360594db006b..6fc25124a1eab 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/ems_file_source/ems_file_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/ems_file_source/ems_file_source.js @@ -43,7 +43,7 @@ export class EMSFileSource extends AbstractVectorSource { const emsFiles = await getEmsVectorFilesMeta(); const meta = emsFiles.find((source => source.id === this._descriptor.id)); if (!meta) { - throw new Error(i18n.translate('xpack.maps.source.emsFile.errorMessage', { + throw new Error(i18n.translate('xpack.maps.source.emsFile.unableToFindIdErrorMessage', { defaultMessage: `Unable to find EMS vector shapes for id: {id}`, values: { id: this._descriptor.id From f259247f05af865a63d75c72a9839ef0f01a9427 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 15:38:59 -0500 Subject: [PATCH 81/84] update snaps --- .../__snapshots__/view.test.js.snap | 18 ++++++++++++++---- .../join_editor/resources/join_expression.js | 2 +- .../components/no_index_pattern_callout.js | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/maps/public/components/layer_panel/__snapshots__/view.test.js.snap b/x-pack/plugins/maps/public/components/layer_panel/__snapshots__/view.test.js.snap index 13d972217a7ed..52eec2aea9dc6 100644 --- a/x-pack/plugins/maps/public/components/layer_panel/__snapshots__/view.test.js.snap +++ b/x-pack/plugins/maps/public/components/layer_panel/__snapshots__/view.test.js.snap @@ -27,10 +27,20 @@ exports[`LayerPanel is rendered 1`] = ` component="div" grow={false} > - + + +

From 87ef04b893108837993b3e2dbf0c13314bb73834 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 15:47:16 -0500 Subject: [PATCH 82/84] feedback (2) --- .../layers/sources/es_geo_grid_source/create_source_editor.js | 4 ++-- .../layers/sources/es_geo_grid_source/es_geo_grid_source.js | 2 +- .../layers/sources/es_search_source/es_search_source.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/create_source_editor.js b/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/create_source_editor.js index 2fbeee1b3a4d3..6ad05379a9f50 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/create_source_editor.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/create_source_editor.js @@ -176,12 +176,12 @@ export class CreateSourceEditor extends Component { } return ( - Date: Wed, 6 Mar 2019 15:55:48 -0500 Subject: [PATCH 83/84] use function --- .../shared/layers/sources/ems_file_source/ems_file_source.js | 5 ++--- .../shared/layers/sources/ems_tms_source/ems_tms_source.js | 5 ++--- .../layers/sources/es_geo_grid_source/es_geo_grid_source.js | 5 ++--- .../layers/sources/es_search_source/es_search_source.js | 5 ++--- .../kibana_regionmap_source/kibana_regionmap_source.js | 5 ++--- .../sources/kibana_tilemap_source/kibana_tilemap_source.js | 5 ++--- 6 files changed, 12 insertions(+), 18 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/sources/ems_file_source/ems_file_source.js b/x-pack/plugins/maps/public/shared/layers/sources/ems_file_source/ems_file_source.js index 6fc25124a1eab..61bde7a07bf42 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/ems_file_source/ems_file_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/ems_file_source/ems_file_source.js @@ -11,6 +11,7 @@ import { emsServiceSettings } from '../../../../kibana_services'; import { getEmsVectorFilesMeta } from '../../../../meta'; import { EMSFileCreateSourceEditor } from './create_source_editor'; import { i18n } from '@kbn/i18n'; +import { getDataSourceLabel } from '../../../../../common/i18n_getters'; export class EMSFileSource extends AbstractVectorSource { @@ -70,9 +71,7 @@ export class EMSFileSource extends AbstractVectorSource { const emsLink = await emsServiceSettings.getEMSHotLink({ id: this._descriptor.id }); return [ { - label: i18n.translate('xpack.maps.source.emsFile.dataSourceLabel', { - defaultMessage: `Data source`, - }), + label: getDataSourceLabel(), value: EMSFileSource.title }, { diff --git a/x-pack/plugins/maps/public/shared/layers/sources/ems_tms_source/ems_tms_source.js b/x-pack/plugins/maps/public/shared/layers/sources/ems_tms_source/ems_tms_source.js index 1a6f02f3777c0..c3b0a2062d888 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/ems_tms_source/ems_tms_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/ems_tms_source/ems_tms_source.js @@ -10,6 +10,7 @@ import { TileLayer } from '../../tile_layer'; import { getEmsTMSServices } from '../../../../meta'; import { EMSTMSCreateSourceEditor } from './create_source_editor'; import { i18n } from '@kbn/i18n'; +import { getDataSourceLabel } from '../../../../../common/i18n_getters'; export class EMSTMSSource extends AbstractTMSSource { @@ -45,9 +46,7 @@ export class EMSTMSSource extends AbstractTMSSource { async getImmutableProperties() { return [ { - label: i18n.translate('xpack.maps.source.emsTile.dataSourceLabel', { - defaultMessage: `Data source`, - }), + label: getDataSourceLabel(), value: EMSTMSSource.title }, { diff --git a/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/es_geo_grid_source.js b/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/es_geo_grid_source.js index 7397d376d8fec..d15a9df61ea5e 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/es_geo_grid_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/es_geo_grid_source/es_geo_grid_source.js @@ -22,6 +22,7 @@ import { GRID_RESOLUTION } from '../../grid_resolution'; import { SOURCE_DATA_ID_ORIGIN, ES_GEO_GRID } from '../../../../../common/constants'; import { filterPropertiesForTooltip } from '../../util'; import { i18n } from '@kbn/i18n'; +import { getDataSourceLabel } from '../../../../../common/i18n_getters'; const COUNT_PROP_LABEL = 'count'; const COUNT_PROP_NAME = 'doc_count'; @@ -108,9 +109,7 @@ export class ESGeoGridSource extends AbstractESSource { return [ { - label: i18n.translate('xpack.maps.source.esGrid.dataSourceLabel', { - defaultMessage: 'Data source' - }), + label: getDataSourceLabel(), value: ESGeoGridSource.title }, { diff --git a/x-pack/plugins/maps/public/shared/layers/sources/es_search_source/es_search_source.js b/x-pack/plugins/maps/public/shared/layers/sources/es_search_source/es_search_source.js index 714bf44e8ab21..91c323868c563 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/es_search_source/es_search_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/es_search_source/es_search_source.js @@ -14,6 +14,7 @@ import { CreateSourceEditor } from './create_source_editor'; import { UpdateSourceEditor } from './update_source_editor'; import { ES_SEARCH } from '../../../../../common/constants'; import { i18n } from '@kbn/i18n'; +import { getDataSourceLabel } from '../../../../../common/i18n_getters'; const DEFAULT_LIMIT = 2048; @@ -102,9 +103,7 @@ export class ESSearchSource extends AbstractESSource { return [ { - label: i18n.translate('xpack.maps.source.esSearch.dataSourceLabel', { - defaultMessage: `Data source`, - }), + label: getDataSourceLabel(), value: ESSearchSource.title }, { diff --git a/x-pack/plugins/maps/public/shared/layers/sources/kibana_regionmap_source/kibana_regionmap_source.js b/x-pack/plugins/maps/public/shared/layers/sources/kibana_regionmap_source/kibana_regionmap_source.js index 6e3a1d9938f53..153f6a6d240c2 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/kibana_regionmap_source/kibana_regionmap_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/kibana_regionmap_source/kibana_regionmap_source.js @@ -9,6 +9,7 @@ import React from 'react'; import { CreateSourceEditor } from './create_source_editor'; import { getKibanaRegionList } from '../../../../meta'; import { i18n } from '@kbn/i18n'; +import { getDataSourceLabel } from '../../../../../common/i18n_getters'; export class KibanaRegionmapSource extends AbstractVectorSource { @@ -46,9 +47,7 @@ export class KibanaRegionmapSource extends AbstractVectorSource { async getImmutableProperties() { return [ { - label: i18n.translate('xpack.maps.source.kbnRegionMap.dataSourceLabel', { - defaultMessage: 'Data source' - }), + label: getDataSourceLabel(), value: KibanaRegionmapSource.title }, { label: i18n.translate('xpack.maps.source.kbnRegionMap.vectorLayerLabel', { diff --git a/x-pack/plugins/maps/public/shared/layers/sources/kibana_tilemap_source/kibana_tilemap_source.js b/x-pack/plugins/maps/public/shared/layers/sources/kibana_tilemap_source/kibana_tilemap_source.js index 05830dc1c743f..6f9464d38bec5 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/kibana_tilemap_source/kibana_tilemap_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/kibana_tilemap_source/kibana_tilemap_source.js @@ -9,6 +9,7 @@ import { TileLayer } from '../../tile_layer'; import { CreateSourceEditor } from './create_source_editor'; import { getKibanaTileMap } from '../../../../meta'; import { i18n } from '@kbn/i18n'; +import { getDataSourceLabel } from '../../../../../common/i18n_getters'; export class KibanaTilemapSource extends AbstractTMSSource { @@ -40,9 +41,7 @@ export class KibanaTilemapSource extends AbstractTMSSource { async getImmutableProperties() { return [ { - label: i18n.translate('xpack.maps.source.kbnTMS.dataSourceLabel', { - defaultMessage: 'Data source' - }), + label: getDataSourceLabel(), value: KibanaTilemapSource.title }, { From 09851c0af3f5230e7248b73fa3d10db119294ba1 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 6 Mar 2019 15:57:00 -0500 Subject: [PATCH 84/84] no need to internationalize url --- .../maps/public/shared/layers/sources/xyz_tms_source.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js b/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js index 6f52c5fbe71df..dac1d4b7aeba6 100644 --- a/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js +++ b/x-pack/plugins/maps/public/shared/layers/sources/xyz_tms_source.js @@ -98,10 +98,7 @@ class XYZTMSEditor extends React.Component { return ( this._handleTMSInputChange(e)} />