diff --git a/x-pack/plugins/ml/public/explorer/explorer.html b/x-pack/plugins/ml/public/explorer/explorer.html index 881f078325d30..1d668f949ccfe 100644 --- a/x-pack/plugins/ml/public/explorer/explorer.html +++ b/x-pack/plugins/ml/public/explorer/explorer.html @@ -11,21 +11,38 @@
-
No jobs found
-
Create new job
+
+
+ +
-
No results found
-
Try widening the time selection or moving further back in time
+
+
@@ -34,22 +51,25 @@
+ tooltip-html-unsafe="{{ ::'xpack.ml.explorer.noConfiguredInfluencersTooltip' | i18n: {defaultMessage: 'The Top Influencers list is hidden because no influencers have been configured for the selected jobs.'} }}" >
- - Top Influencers - +
- - Anomaly timeline - +
- +
-

No {{swimlaneViewByFieldName}} influencers found

+

@@ -102,9 +139,11 @@

No {{swimlaneViewByFieldName}} influencers

- - Annotations - + No {{swimlaneViewByFieldName}} influencers

- - Anomalies - +
- +
@@ -130,7 +176,12 @@

No {{swimlaneViewByFieldName}} influencers

- +
diff --git a/x-pack/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/__snapshots__/explorer_chart_label.test.js.snap b/x-pack/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/__snapshots__/explorer_chart_label.test.js.snap index aed47581bfc7a..05150c9925afc 100644 --- a/x-pack/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/__snapshots__/explorer_chart_label.test.js.snap +++ b/x-pack/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/__snapshots__/explorer_chart_label.test.js.snap @@ -34,7 +34,7 @@ exports[`ExplorerChartLabelBadge Render the chart label in one line. 1`] = ` aria-label="Info" className="ml-explorer-chart-eui-icon-tip" content={ - 0 ? score : '< 1'); - contents += `anomaly score: ${displayScore}`; + contents += intl.formatMessage({ + id: 'xpack.ml.explorer.distributionChart.anomalyScoreLabel', + defaultMessage: 'anomaly score: {displayScore}' + }, { displayScore }); if (chartType !== CHART_TYPE.EVENT_DISTRIBUTION) { - contents += (`
value: ${formatValue(marker.value, config.functionDescription, fieldFormat)}`); + contents += intl.formatMessage({ + id: 'xpack.ml.explorer.distributionChart.valueLabel', + defaultMessage: '{br}value: {value}' + }, { + br: '
', + value: formatValue(marker.value, config.functionDescription, fieldFormat) + }); if (typeof marker.numberOfCauses === 'undefined' || marker.numberOfCauses === 1) { - contents += (`
typical: ${formatValue(marker.typical, config.functionDescription, fieldFormat)}`); + contents += intl.formatMessage({ + id: 'xpack.ml.explorer.distributionChart.typicalLabel', + defaultMessage: '{br}typical: {typicalValue}' + }, { + br: '
', + typicalValue: formatValue(marker.typical, config.functionDescription, fieldFormat) + }); } if (typeof marker.byFieldName !== 'undefined' && _.has(marker, 'numberOfCauses')) { const numberOfCauses = marker.numberOfCauses; const byFieldName = mlEscape(marker.byFieldName); - if (numberOfCauses === 1) { - contents += `
1 unusual ${byFieldName} value`; - } else if (numberOfCauses < 10) { - contents += `
${numberOfCauses} unusual ${byFieldName} values`; - } else { + contents += intl.formatMessage({ + id: 'xpack.ml.explorer.distributionChart.unusualByFieldValuesLabel', + defaultMessage: + '{br} { numberOfCauses, plural, one {# unusual {byFieldName} value} other {#{plusSign} unusual {byFieldName} values}}' + }, { + br: '
', + numberOfCauses, + byFieldName, // Maximum of 10 causes are stored in the record, so '10' may mean more than 10. - contents += `
${numberOfCauses}+ unusual ${byFieldName} values`; - } + plusSign: numberOfCauses < 10 ? '' : '+', + }); } } } else if (chartType !== CHART_TYPE.EVENT_DISTRIBUTION) { - contents += `value: ${formatValue(marker.value, config.functionDescription, fieldFormat)}`; + contents += intl.formatMessage({ + id: 'xpack.ml.explorer.distributionChart.valueWithoutAnomalyScoreLabel', + defaultMessage: 'value: {value}' + }, { + value: formatValue(marker.value, config.functionDescription, fieldFormat) + }); } if (_.has(marker, 'scheduledEvents')) { - contents += `

Scheduled events:
${marker.scheduledEvents.map(mlEscape).join('
')}
`; + contents += '

' + intl.formatMessage({ + id: 'xpack.ml.explorer.distributionChart.scheduledEventsLabel', + defaultMessage: 'Scheduled events:{br}{scheduledEventsValue}' + }, { + br: '
', + scheduledEventsValue: marker.scheduledEvents.map(mlEscape).join('
') + }) + '
'; } mlChartTooltipService.show(contents, circle, { @@ -481,4 +513,4 @@ export class ExplorerChartDistribution extends React.Component {
); } -} +}); diff --git a/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_chart_distribution.test.js b/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_chart_distribution.test.js index 9e2a3fc85122f..ccc479abd54fe 100644 --- a/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_chart_distribution.test.js +++ b/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_chart_distribution.test.js @@ -28,7 +28,7 @@ jest.mock('ui/chrome', () => ({ }), })); -import { mount } from 'enzyme'; +import { mountWithIntl } from 'test_utils/enzyme_helpers'; import React from 'react'; import { ExplorerChartDistribution } from './explorer_chart_distribution'; @@ -49,7 +49,7 @@ describe('ExplorerChart', () => { afterEach(() => (SVGElement.prototype.getBBox = originalGetBBox)); test('Initialize', () => { - const wrapper = mount(); + const wrapper = mountWithIntl(); // without setting any attributes and corresponding data // the directive just ends up being empty. @@ -63,7 +63,9 @@ describe('ExplorerChart', () => { loading: true }; - const wrapper = mount(); + const wrapper = mountWithIntl( + + ); // test if the loading indicator is shown expect(wrapper.find('.ml-loading-indicator .loading-spinner')).toHaveLength(1); @@ -83,9 +85,9 @@ describe('ExplorerChart', () => { }; // We create the element including a wrapper which sets the width: - return mount( + return mountWithIntl(
- +
); } diff --git a/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_chart_info_tooltip.js b/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_chart_info_tooltip.js index 8c937767e215f..ad53cb12d3ad7 100644 --- a/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_chart_info_tooltip.js +++ b/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_chart_info_tooltip.js @@ -10,10 +10,19 @@ import React from 'react'; import { CHART_TYPE } from '../explorer_constants'; +import { i18n } from '@kbn/i18n'; +import { injectI18n } from '@kbn/i18n/react'; + const CHART_DESCRIPTION = { - [CHART_TYPE.EVENT_DISTRIBUTION]: 'The gray dots depict the distribution of occurences over time for a sample of by_field_values with \ -more frequent event types at the top and rarer ones at the bottom.', - [CHART_TYPE.POPULATION_DISTRIBUTION]: 'The gray dots depict the distribution of values over time for a sample of over_field_values.' + [CHART_TYPE.EVENT_DISTRIBUTION]: i18n.translate('xpack.ml.explorer.charts.infoTooltip.chartEventDistributionDescription', { + defaultMessage: 'The gray dots depict the distribution of occurences over time for a sample of {byFieldValuesParam} with' + + 'more frequent event types at the top and rarer ones at the bottom.', + values: { byFieldValuesParam: 'by_field_values' } + }), + [CHART_TYPE.POPULATION_DISTRIBUTION]: i18n.translate('xpack.ml.explorer.charts.infoTooltip.chartPopulationDistributionDescription', { + defaultMessage: 'The gray dots depict the distribution of values over time for a sample of {overFieldValuesParam}.', + values: { overFieldValuesParam: 'over_field_values' } + }), }; import { EuiSpacer } from '@elastic/eui'; @@ -31,26 +40,30 @@ function TooltipDefinitionList({ toolTipData }) { ); } -export function ExplorerChartInfoTooltip({ +export const ExplorerChartInfoTooltip = injectI18n(function ExplorerChartInfoTooltip({ jobId, aggregationInterval, chartFunction, chartType, entityFields = [], + intl }) { const chartDescription = CHART_DESCRIPTION[chartType]; const toolTipData = [ { - title: 'job ID', + title: intl.formatMessage({ id: 'xpack.ml.explorer.charts.infoTooltip.jobIdTitle', defaultMessage: 'job ID' }), description: jobId, }, { - title: 'aggregation interval', + title: intl.formatMessage({ + id: 'xpack.ml.explorer.charts.infoTooltip.aggregationIntervalTitle', + defaultMessage: 'aggregation interval' + }), description: aggregationInterval, }, { - title: 'chart function', + title: intl.formatMessage({ id: 'xpack.ml.explorer.charts.infoTooltip.chartFunctionTitle', defaultMessage: 'chart function' }), description: chartFunction, }, ]; @@ -73,8 +86,8 @@ export function ExplorerChartInfoTooltip({ )}
); -} -ExplorerChartInfoTooltip.propTypes = { +}); +ExplorerChartInfoTooltip.WrappedComponent.propTypes = { jobId: PropTypes.string.isRequired, aggregationInterval: PropTypes.string, chartFunction: PropTypes.string, diff --git a/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_chart_info_tooltip.test.js b/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_chart_info_tooltip.test.js index 6db4360fa7f20..09ad176ed4a23 100644 --- a/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_chart_info_tooltip.test.js +++ b/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_chart_info_tooltip.test.js @@ -5,7 +5,7 @@ */ -import { shallow } from 'enzyme'; +import { shallowWithIntl } from 'test_utils/enzyme_helpers'; import React from 'react'; import { ExplorerChartInfoTooltip } from './explorer_chart_info_tooltip'; @@ -22,7 +22,7 @@ describe('ExplorerChartTooltip', () => { jobId: 'mock-job-id' }; - const wrapper = shallow(); + const wrapper = shallowWithIntl(); expect(wrapper).toMatchSnapshot(); }); }); diff --git a/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_chart_single_metric.js b/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_chart_single_metric.js index 6a72a89e11539..2ced3a79d7b94 100644 --- a/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_chart_single_metric.js +++ b/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_chart_single_metric.js @@ -42,10 +42,12 @@ import { mlEscape } from '../../util/string_utils'; import { mlFieldFormatService } from '../../services/field_format_service'; import { mlChartTooltipService } from '../../components/chart_tooltip/chart_tooltip_service'; +import { injectI18n } from '@kbn/i18n/react'; + const CONTENT_WRAPPER_HEIGHT = 215; const CONTENT_WRAPPER_CLASS = 'ml-explorer-chart-content-wrapper'; -export class ExplorerChartSingleMetric extends React.Component { +export const ExplorerChartSingleMetric = injectI18n(class ExplorerChartSingleMetric extends React.Component { static propTypes = { tooManyBuckets: PropTypes.bool, seriesConfig: PropTypes.object, @@ -63,7 +65,8 @@ export class ExplorerChartSingleMetric extends React.Component { renderChart() { const { tooManyBuckets, - mlSelectSeverityService + mlSelectSeverityService, + intl, } = this.props; const element = this.rootNode; @@ -341,10 +344,19 @@ export class ExplorerChartSingleMetric extends React.Component { if (_.has(marker, 'anomalyScore')) { const score = parseInt(marker.anomalyScore); const displayScore = (score > 0 ? score : '< 1'); - contents += ('anomaly score: ' + displayScore); + contents += intl.formatMessage({ + id: 'xpack.ml.explorer.singleMetricChart.anomalyScoreLabel', + defaultMessage: 'anomaly score: {displayScore}' + }, { displayScore }); if (showMultiBucketAnomalyTooltip(marker) === true) { - contents += `
multi-bucket impact: ${getMultiBucketImpactLabel(marker.multiBucketImpact)}`; + contents += intl.formatMessage({ + id: 'xpack.ml.explorer.singleMetricChart.multiBucketImpactLabel', + defaultMessage: '{br}multi-bucket impact: {multiBucketImpactLabel}' + }, { + br: '
', + multiBucketImpactLabel: getMultiBucketImpactLabel(marker.multiBucketImpact) + }); } // Show actual/typical when available except for rare detectors. @@ -353,29 +365,61 @@ export class ExplorerChartSingleMetric extends React.Component { if (_.has(marker, 'actual') && config.functionDescription !== 'rare') { // Display the record actual in preference to the chart value, which may be // different depending on the aggregation interval of the chart. - contents += (`
actual: ${formatValue(marker.actual, config.functionDescription, fieldFormat)}`); - contents += (`
typical: ${formatValue(marker.typical, config.functionDescription, fieldFormat)}`); + contents += intl.formatMessage({ + id: 'xpack.ml.explorer.singleMetricChart.actualLabel', + defaultMessage: '{br}actual: {actualValue}' + }, { + br: '
', + actualValue: formatValue(marker.actual, config.functionDescription, fieldFormat) + }); + contents += intl.formatMessage({ + id: 'xpack.ml.explorer.singleMetricChart.typicalLabel', + defaultMessage: '{br}typical: {typicalValue}' + }, { + br: '
', + typicalValue: formatValue(marker.typical, config.functionDescription, fieldFormat) + }); } else { - contents += (`
value: ${formatValue(marker.value, config.functionDescription, fieldFormat)}`); + contents += intl.formatMessage({ + id: 'xpack.ml.explorer.singleMetricChart.valueLabel', + defaultMessage: '{br}value: {value}' + }, { + br: '
', + value: formatValue(marker.value, config.functionDescription, fieldFormat) + }); if (_.has(marker, 'byFieldName') && _.has(marker, 'numberOfCauses')) { const numberOfCauses = marker.numberOfCauses; const byFieldName = mlEscape(marker.byFieldName); - if (numberOfCauses === 1) { - contents += `
1 unusual ${byFieldName} value`; - } else if (numberOfCauses < 10) { - contents += `
${numberOfCauses} unusual ${byFieldName} values`; - } else { + intl.formatMessage({ + id: 'xpack.ml.explorer.singleMetricChart.unusualByFieldValuesLabel', + defaultMessage: + '{br} { numberOfCauses, plural, one {# unusual {byFieldName} value} other {#{plusSign} unusual {byFieldName} values}}' + }, { + br: '
', + numberOfCauses, + byFieldName, // Maximum of 10 causes are stored in the record, so '10' may mean more than 10. - contents += `
${numberOfCauses}+ unusual ${byFieldName} values`; - } + plusSign: numberOfCauses < 10 ? '' : '+', + }); } } } else { - contents += `value: ${formatValue(marker.value, config.functionDescription, fieldFormat)}`; + contents += intl.formatMessage({ + id: 'xpack.ml.explorer.singleMetricChart.valueWithoutAnomalyScoreLabel', + defaultMessage: 'value: {value}' + }, { + value: formatValue(marker.value, config.functionDescription, fieldFormat) + }); } if (_.has(marker, 'scheduledEvents')) { - contents += `

Scheduled events:
${marker.scheduledEvents.map(mlEscape).join('
')}`; + contents += '

' + intl.formatMessage({ + id: 'xpack.ml.explorer.singleMetricChart.scheduledEventsLabel', + defaultMessage: 'Scheduled events:{br}{scheduledEventsValue}' + }, { + br: '
', + scheduledEventsValue: marker.scheduledEvents.map(mlEscape).join('
') + }); } mlChartTooltipService.show(contents, circle, { @@ -418,4 +462,4 @@ export class ExplorerChartSingleMetric extends React.Component {
); } -} +}); diff --git a/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_chart_single_metric.test.js b/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_chart_single_metric.test.js index fd922c9805cb8..ad8a04e1af75d 100644 --- a/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_chart_single_metric.test.js +++ b/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_chart_single_metric.test.js @@ -28,7 +28,7 @@ jest.mock('ui/chrome', () => ({ }), })); -import { mount } from 'enzyme'; +import { mountWithIntl } from 'test_utils/enzyme_helpers'; import React from 'react'; import { ExplorerChartSingleMetric } from './explorer_chart_single_metric'; @@ -49,7 +49,7 @@ describe('ExplorerChart', () => { afterEach(() => (SVGElement.prototype.getBBox = originalGetBBox)); test('Initialize', () => { - const wrapper = mount(); + const wrapper = mountWithIntl(); // without setting any attributes and corresponding data // the directive just ends up being empty. @@ -63,7 +63,9 @@ describe('ExplorerChart', () => { loading: true }; - const wrapper = mount(); + const wrapper = mountWithIntl( + + ); // test if the loading indicator is shown expect(wrapper.find('.ml-loading-indicator .loading-spinner')).toHaveLength(1); @@ -83,9 +85,9 @@ describe('ExplorerChart', () => { }; // We create the element including a wrapper which sets the width: - return mount( + return mountWithIntl(
- +
); } diff --git a/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_charts_container.js b/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_charts_container.js index b860a6e4f26a5..a0f87d585a632 100644 --- a/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_charts_container.js +++ b/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_charts_container.js @@ -26,10 +26,16 @@ import { ExplorerChartSingleMetric } from './explorer_chart_single_metric'; import { ExplorerChartLabel } from './components/explorer_chart_label'; import { CHART_TYPE } from '../explorer_constants'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; -const textTooManyBuckets = `This selection contains too many buckets to be displayed. - The dashboard is best viewed over a shorter time range.`; -const textViewButton = 'Open in Single Metric Viewer'; +const textTooManyBuckets = i18n.translate('xpack.ml.explorer.charts.tooManyBucketsDescription', { + defaultMessage: 'This selection contains too many buckets to be displayed.' + + 'The dashboard is best viewed over a shorter time range.' +}); +const textViewButton = i18n.translate('xpack.ml.explorer.charts.openInSingleMetricViewerButtonLabel', { + defaultMessage: 'Open in Single Metric Viewer' +}); // create a somewhat unique ID // from charts metadata for React's key attribute @@ -64,7 +70,15 @@ function ExplorerChartContainer({ if (typeof byField !== 'undefined') { DetectorLabel = ( - {detectorLabel}
y-axis event distribution split by "{byField.fieldName}" + , + fieldName: byField.fieldName + }} + />
); wrapLabel = true; @@ -105,7 +119,10 @@ function ExplorerChartContainer({ size="xs" onClick={() => window.open(getExploreSeriesLink(series), '_blank')} > - View +
diff --git a/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_charts_container.test.js b/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_charts_container.test.js index b5eb2a5339f52..4d8998ef7131b 100644 --- a/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_charts_container.test.js +++ b/x-pack/plugins/ml/public/explorer/explorer_charts/explorer_charts_container.test.js @@ -62,7 +62,7 @@ timefilter.setTime({ to: moment(seriesConfig.selectedLatest).toISOString() }); -import { shallow, mount } from 'enzyme'; +import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; import React from 'react'; import { chartLimits } from '../../util/chart_utils'; @@ -86,7 +86,7 @@ describe('ExplorerChartsContainer', () => { afterEach(() => (SVGElement.prototype.getBBox = originalGetBBox)); test('Minimal Initialization', () => { - const wrapper = shallow( { }); test('Initialization with chart data', () => { - const wrapper = mount( { }); test('Initialization with rare detector', () => { - const wrapper = mount( + {React.createElement(ExplorerChartsContainer, props)} + , element[0] ); } diff --git a/x-pack/plugins/ml/public/explorer/explorer_controller.js b/x-pack/plugins/ml/public/explorer/explorer_controller.js index 4cff3ab1ec3e7..13783b4c24d5f 100644 --- a/x-pack/plugins/ml/public/explorer/explorer_controller.js +++ b/x-pack/plugins/ml/public/explorer/explorer_controller.js @@ -92,7 +92,8 @@ module.controller('MlExplorerController', function ( mlCheckboxShowChartsService, mlSelectLimitService, mlSelectIntervalService, - mlSelectSeverityService) { + mlSelectSeverityService, + i18n) { $scope.annotationsData = []; $scope.anomalyChartRecords = []; @@ -114,7 +115,7 @@ module.controller('MlExplorerController', function ( const $mlExplorer = $('.ml-explorer'); const MAX_INFLUENCER_FIELD_VALUES = 10; const MAX_CATEGORY_EXAMPLES = 10; - const VIEW_BY_JOB_LABEL = 'job ID'; + const VIEW_BY_JOB_LABEL = i18n('xpack.ml.explorer.jobIdLabel', { defaultMessage: 'job ID' }); const ALLOW_CELL_RANGE_SELECTION = mlExplorerDashboardService.allowCellRangeSelection; // make sure dragSelect is only available if the mouse pointer is actually over a swimlane @@ -1150,8 +1151,9 @@ module.controller('MlExplorerController', function ( } function processOverallResults(scoresByTime, searchBounds) { + const overallLabel = i18n('xpack.ml.explorer.overallLabel', { defaultMessage: 'Overall' }); const dataset = { - laneLabels: ['Overall'], + laneLabels: [overallLabel], points: [], interval: $scope.swimlaneBucketInterval.asSeconds(), earliest: searchBounds.min.valueOf() / 1000, @@ -1164,7 +1166,7 @@ module.controller('MlExplorerController', function ( _.each(scoresByTime, (score, timeMs) => { const time = timeMs / 1000; dataset.points.push({ - laneLabel: 'Overall', + laneLabel: overallLabel, time, value: score }); diff --git a/x-pack/plugins/ml/public/explorer/explorer_swimlane.js b/x-pack/plugins/ml/public/explorer/explorer_swimlane.js index c589f952db56c..fe3af0c3dd42a 100644 --- a/x-pack/plugins/ml/public/explorer/explorer_swimlane.js +++ b/x-pack/plugins/ml/public/explorer/explorer_swimlane.js @@ -26,8 +26,9 @@ import { mlEscape } from '../util/string_utils'; import { mlChartTooltipService } from '../components/chart_tooltip/chart_tooltip_service'; import { mlExplorerDashboardService } from './explorer_dashboard_service'; import { DRAG_SELECT_ACTION } from './explorer_constants'; +import { injectI18n } from '@kbn/i18n/react'; -export class ExplorerSwimlane extends React.Component { +export const ExplorerSwimlane = injectI18n(class ExplorerSwimlane extends React.Component { static propTypes = { chartWidth: PropTypes.number.isRequired, MlTimeBuckets: PropTypes.func.isRequired, @@ -220,7 +221,8 @@ export class ExplorerSwimlane extends React.Component { MlTimeBuckets, swimlaneData, swimlaneType, - selection + selection, + intl } = this.props; const { @@ -280,7 +282,10 @@ export class ExplorerSwimlane extends React.Component { if (swimlaneData.fieldName !== undefined) { contents += `${mlEscape(swimlaneData.fieldName)}: ${mlEscape(laneLabel)}

`; } - contents += `Max anomaly score: ${displayScore}`; + contents += intl.formatMessage( + { id: 'xpack.ml.explorer.swimlane.maxAnomalyScoreLabel', defaultMessage: 'Max anomaly score: {displayScore}' }, + { displayScore } + ); const offsets = (target.className === 'sl-cell-inner' ? { x: 0, y: 0 } : { x: 2, y: 1 }); mlChartTooltipService.show(contents, target, { @@ -480,4 +485,4 @@ export class ExplorerSwimlane extends React.Component { render() { return
; } -} +}); diff --git a/x-pack/plugins/ml/public/explorer/explorer_swimlane.test.js b/x-pack/plugins/ml/public/explorer/explorer_swimlane.test.js index fecaaaec41344..4f40a5a7a1965 100644 --- a/x-pack/plugins/ml/public/explorer/explorer_swimlane.test.js +++ b/x-pack/plugins/ml/public/explorer/explorer_swimlane.test.js @@ -7,7 +7,7 @@ import mockOverallSwimlaneData from './__mocks__/mock_overall_swimlane.json'; import moment from 'moment-timezone'; -import { mount } from 'enzyme'; +import { mountWithIntl } from 'test_utils/enzyme_helpers'; import React from 'react'; import { mlExplorerDashboardService } from './explorer_dashboard_service'; @@ -69,7 +69,7 @@ describe('ExplorerSwimlane', () => { test('Minimal initialization', () => { const mocks = getExplorerSwimlaneMocks(); - const wrapper = mount( { test('Overall swimlane', () => { const mocks = getExplorerSwimlaneMocks(); - const wrapper = mount( + {React.createElement(ExplorerSwimlane, props)} + , element[0] ); } diff --git a/x-pack/plugins/ml/public/explorer/select_limit/select_limit.html b/x-pack/plugins/ml/public/explorer/select_limit/select_limit.html index b1ac06eb94485..bbbde7c40015c 100644 --- a/x-pack/plugins/ml/public/explorer/select_limit/select_limit.html +++ b/x-pack/plugins/ml/public/explorer/select_limit/select_limit.html @@ -1,6 +1,6 @@