Skip to content

Commit

Permalink
added some constants
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 committed Sep 10, 2020
1 parent e94d3cb commit 69687d4
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 7 deletions.
7 changes: 7 additions & 0 deletions x-pack/plugins/apm/common/apm_index_pattern.ts
Original file line number Diff line number Diff line change
@@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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,
};

Expand Down Expand Up @@ -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,
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
TRANSACTION_DURATION_REGION,
} from './LayerList';
import { RenderTooltipContentParams } from '../../../../../../maps/public';
import { I18LABELS } from '../translations';

type MapToolTipProps = Partial<RenderTooltipContentParams>;

Expand Down Expand Up @@ -96,7 +97,7 @@ function MapToolTipComponent({
style={{ width: 300 }}
>
<TitleItem className="eui-textNoWrap">
Average page load duration
{I18LABELS.avgPageLoadDuration}
</TitleItem>
<DescriptionItem>{pageLoadDuration}</DescriptionItem>
</EuiDescriptionList>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<>
<EuiTitle size="xs">
<h3>Page load duration by region</h3>
<h3>{I18LABELS.pageLoadDurationByRegion}</h3>
</EuiTitle>
<EuiSpacer size="s" />
<div style={{ height: 400 }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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(', '),
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 69687d4

Please sign in to comment.