From 69687d4f66d44ef47414678a09aa096a658f4415 Mon Sep 17 00:00:00 2001 From: Shahzad Date: Thu, 10 Sep 2020 13:23:02 +0200 Subject: [PATCH] added some constants --- x-pack/plugins/apm/common/apm_index_pattern.ts | 7 +++++++ .../RumDashboard/VisitorBreakdownMap/LayerList.ts | 5 +++-- .../RumDashboard/VisitorBreakdownMap/MapToolTip.tsx | 3 ++- .../app/RumDashboard/VisitorBreakdownMap/index.tsx | 3 ++- .../VisitorBreakdownMap/useMapFilters.ts | 7 ++++--- .../components/app/RumDashboard/translations.ts | 12 ++++++++++++ 6 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 x-pack/plugins/apm/common/apm_index_pattern.ts diff --git a/x-pack/plugins/apm/common/apm_index_pattern.ts b/x-pack/plugins/apm/common/apm_index_pattern.ts new file mode 100644 index 0000000000000..bedda56452e0a --- /dev/null +++ b/x-pack/plugins/apm/common/apm_index_pattern.ts @@ -0,0 +1,7 @@ +/* + * 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. + */ + +export const APM_STATIC_INDEX_PATTERN_ID = 'apm_static_index_pattern_id'; diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/LayerList.ts b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/LayerList.ts index 928f97ac7e0bf..467105617b437 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/LayerList.ts +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/LayerList.ts @@ -18,6 +18,7 @@ import { STYLE_TYPE, SYMBOLIZE_AS_TYPES, } from '../../../../../../maps/common/constants'; +import { APM_STATIC_INDEX_PATTERN_ID } from '../../../../../common/apm_index_pattern'; const ES_TERM_SOURCE: ESTermSourceDescriptor = { type: 'ES_TERM_SOURCE', @@ -31,7 +32,7 @@ const ES_TERM_SOURCE: ESTermSourceDescriptor = { label: 'Page load duration', }, ], - indexPatternId: 'apm_static_index_pattern_id', + indexPatternId: APM_STATIC_INDEX_PATTERN_ID, applyGlobalQuery: true, }; @@ -136,7 +137,7 @@ export function getLayerList() { indexPatternTitle: 'apm-*', term: 'client.geo.region_iso_code', metrics: [{ type: AGG_TYPE.AVG, field: 'transaction.duration.us' }], - indexPatternId: 'apm_static_index_pattern_id', + indexPatternId: APM_STATIC_INDEX_PATTERN_ID, }, }, ], diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/MapToolTip.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/MapToolTip.tsx index 071af8c5e1db4..07b40addedec3 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/MapToolTip.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/MapToolTip.tsx @@ -20,6 +20,7 @@ import { TRANSACTION_DURATION_REGION, } from './LayerList'; import { RenderTooltipContentParams } from '../../../../../../maps/public'; +import { I18LABELS } from '../translations'; type MapToolTipProps = Partial; @@ -96,7 +97,7 @@ function MapToolTipComponent({ style={{ width: 300 }} > - Average page load duration + {I18LABELS.avgPageLoadDuration} {pageLoadDuration} diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/index.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/index.tsx index f62e38d1e0c02..44bfe5abbaca2 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/index.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/index.tsx @@ -7,12 +7,13 @@ import React from 'react'; import { EuiTitle, EuiSpacer } from '@elastic/eui'; import { EmbeddedMap } from './EmbeddedMap'; +import { I18LABELS } from '../translations'; export function VisitorBreakdownMap() { return ( <> -

Page load duration by region

+

{I18LABELS.pageLoadDurationByRegion}

diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/useMapFilters.ts b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/useMapFilters.ts index 148e731a4ee27..250a125765e31 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/useMapFilters.ts +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/useMapFilters.ts @@ -14,11 +14,12 @@ import { USER_AGENT_NAME, USER_AGENT_OS, } from '../../../../../common/elasticsearch_fieldnames'; +import { APM_STATIC_INDEX_PATTERN_ID } from '../../../../../common/apm_index_pattern'; const getMatchFilter = (field: string, value: string): Filter => { return { meta: { - index: 'apm_static_index_pattern_id', + index: APM_STATIC_INDEX_PATTERN_ID, alias: null, negate: false, disabled: false, @@ -33,7 +34,7 @@ const getMatchFilter = (field: string, value: string): Filter => { const getMultiMatchFilter = (field: string, values: string[]): Filter => { return { meta: { - index: 'apm_static_index_pattern_id', + index: APM_STATIC_INDEX_PATTERN_ID, type: 'phrases', key: field, value: values.join(', '), @@ -61,7 +62,7 @@ export const useMapFilters = (): Filter[] => { const existFilter: Filter = { meta: { - index: 'apm_static_index_pattern_id', + index: APM_STATIC_INDEX_PATTERN_ID, alias: null, negate: false, disabled: false, diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/translations.ts b/x-pack/plugins/apm/public/components/app/RumDashboard/translations.ts index 660ed5a92a0e6..ec135168729b4 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/translations.ts +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/translations.ts @@ -64,6 +64,18 @@ export const I18LABELS = { defaultMessage: 'Operating system', } ), + avgPageLoadDuration: i18n.translate( + 'xpack.apm.rum.visitorBreakdownMap.avgPageLoadDuration', + { + defaultMessage: 'Average page load duration', + } + ), + pageLoadDurationByRegion: i18n.translate( + 'xpack.apm.rum.visitorBreakdownMap.pageLoadDurationByRegion', + { + defaultMessage: 'Page load duration by region', + } + ), }; export const VisitorBreakdownLabel = i18n.translate(