diff --git a/x-pack/plugins/ml/public/components/anomalies_table/anomaly_details.js b/x-pack/plugins/ml/public/components/anomalies_table/anomaly_details.js index c2deb6759641a..7bbc59dddad5b 100644 --- a/x-pack/plugins/ml/public/components/anomalies_table/anomaly_details.js +++ b/x-pack/plugins/ml/public/components/anomalies_table/anomaly_details.js @@ -217,6 +217,15 @@ function getDetailsItems(anomaly, examples, filter) { } export class AnomalyDetails extends Component { + static propTypes = { + anomaly: PropTypes.object.isRequired, + examples: PropTypes.array, + definition: PropTypes.object, + isAggregatedData: PropTypes.bool, + filter: PropTypes.func, + influencersLimit: PropTypes.number, + tabIndex: PropTypes.number.isRequired + }; constructor(props) { super(props); @@ -274,14 +283,26 @@ export class AnomalyDetails extends Component { -

Terms

  +

+ { + i18n.translate('xpack.ml.anomaliesTable.anomalyDetails.termsTitle', { + defaultMessage: 'Terms' + }) + } +

  } />
@@ -294,14 +315,26 @@ export class AnomalyDetails extends Component { -

Regex

  +

+ { + i18n.translate('xpack.ml.anomaliesTable.anomalyDetails.regexTitle', { + defaultMessage: 'Regex' + }) + } +

  } />
@@ -316,7 +349,13 @@ export class AnomalyDetails extends Component { {(i === 0 && definition !== undefined) && -

Examples

+

+ { + i18n.translate('xpack.ml.anomaliesTable.anomalyDetails.examplesTitle', { + defaultMessage: 'Examples' + }) + } +

} {example}
@@ -528,13 +567,3 @@ export class AnomalyDetails extends Component { } } } - -AnomalyDetails.propTypes = { - anomaly: PropTypes.object.isRequired, - examples: PropTypes.array, - definition: PropTypes.object, - isAggregatedData: PropTypes.bool, - filter: PropTypes.func, - influencersLimit: PropTypes.number, - tabIndex: PropTypes.number.isRequired -}; diff --git a/x-pack/plugins/ml/public/components/anomalies_table/anomaly_details.test.js b/x-pack/plugins/ml/public/components/anomalies_table/anomaly_details.test.js index 3f603f6590407..44428d21c0c22 100644 --- a/x-pack/plugins/ml/public/components/anomalies_table/anomaly_details.test.js +++ b/x-pack/plugins/ml/public/components/anomalies_table/anomaly_details.test.js @@ -6,7 +6,7 @@ import React from 'react'; -import { shallow, mount } from 'enzyme'; +import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; import { AnomalyDetails } from './anomaly_details'; const props = { @@ -68,7 +68,7 @@ const props = { describe('AnomalyDetails', () => { test('Renders with anomaly details tab selected by default', () => { - const wrapper = shallow( + const wrapper = shallowWithIntl( ); @@ -81,7 +81,7 @@ describe('AnomalyDetails', () => { ...props, tabIndex: 1 }; - const wrapper = shallow( + const wrapper = shallowWithIntl( ); expect(wrapper.prop('initialSelectedTab').id).toBe('Category examples'); @@ -97,7 +97,7 @@ describe('AnomalyDetails', () => { } }; - const wrapper = mount( + const wrapper = mountWithIntl( ); @@ -113,7 +113,7 @@ describe('AnomalyDetails', () => { definition: undefined }; - const wrapper = mount( + const wrapper = mountWithIntl( ); @@ -131,7 +131,7 @@ describe('AnomalyDetails', () => { } }; - const wrapper = mount( + const wrapper = mountWithIntl( ); @@ -149,7 +149,7 @@ describe('AnomalyDetails', () => { } }; - const wrapper = mount( + const wrapper = mountWithIntl( ); diff --git a/x-pack/plugins/ml/public/components/anomalies_table/links_menu.js b/x-pack/plugins/ml/public/components/anomalies_table/links_menu.js index a7c8aab0ee57e..82f0c9c689a48 100644 --- a/x-pack/plugins/ml/public/components/anomalies_table/links_menu.js +++ b/x-pack/plugins/ml/public/components/anomalies_table/links_menu.js @@ -140,7 +140,6 @@ export const LinksMenu = injectI18n(class LinksMenu extends Component { }; viewSeries = () => { - const { intl } = this.props; const record = this.props.anomaly.source; const bounds = this.props.timefilter.getActiveBounds(); const from = bounds.min.toISOString(); // e.g. 2016-02-08T16:00:00.000Z @@ -175,10 +174,7 @@ export const LinksMenu = injectI18n(class LinksMenu extends Component { jobIds: [record.job_id] }, refreshInterval: { - display: intl.formatMessage({ - id: 'xpack.ml.anomaliesTable.linksMenu.offLabel', - defaultMessage: 'Off' - }), + display: 'Off', pause: false, value: 0 }, @@ -297,10 +293,7 @@ export const LinksMenu = injectI18n(class LinksMenu extends Component { // Use rison to build the URL . const _g = rison.encode({ refreshInterval: { - display: intl.formatMessage({ - id: 'xpack.ml.anomaliesTable.linksMenu.offLabel', - defaultMessage: 'Off' - }), + display: 'Off', pause: false, value: 0 }, diff --git a/x-pack/plugins/ml/public/file_datavisualizer/components/import_view/importer/importer.js b/x-pack/plugins/ml/public/file_datavisualizer/components/import_view/importer/importer.js index dcd46262b0961..f00daea4b2681 100644 --- a/x-pack/plugins/ml/public/file_datavisualizer/components/import_view/importer/importer.js +++ b/x-pack/plugins/ml/public/file_datavisualizer/components/import_view/importer/importer.js @@ -8,6 +8,7 @@ import { ml } from '../../../../services/ml_api_service'; import { chunk } from 'lodash'; import moment from 'moment'; +import { i18n } from '@kbn/i18n'; const CHUNK_SIZE = 10000; const IMPORT_RETRIES = 5; @@ -51,7 +52,9 @@ export class Importer { if (!id || !index) { return { success: false, - error: 'no ID or index supplied' + error: i18n.translate('xpack.ml.fileDatavisualizer.importView.noIdOrIndexSuppliedErrorMessage', { + defaultMessage: 'no ID or index supplied' + }) }; } diff --git a/x-pack/plugins/ml/public/jobs/components/job_timepicker_modal/job_timepicker_modal.html b/x-pack/plugins/ml/public/jobs/components/job_timepicker_modal/job_timepicker_modal.html index 094f96f6b2df6..de2ea6fd94721 100644 --- a/x-pack/plugins/ml/public/jobs/components/job_timepicker_modal/job_timepicker_modal.html +++ b/x-pack/plugins/ml/public/jobs/components/job_timepicker_modal/job_timepicker_modal.html @@ -1,7 +1,10 @@

} color="warning" iconType="alert" >

- Please contact your administrator +

); } else if (loading === true) { diff --git a/x-pack/plugins/ml/public/jobs/jobs_list/components/jobs_list/jobs_list.js b/x-pack/plugins/ml/public/jobs/jobs_list/components/jobs_list/jobs_list.js index 4b35d38982a80..b166415302433 100644 --- a/x-pack/plugins/ml/public/jobs/jobs_list/components/jobs_list/jobs_list.js +++ b/x-pack/plugins/ml/public/jobs/jobs_list/components/jobs_list/jobs_list.js @@ -255,7 +255,16 @@ class JobsListUI extends Component { return ( j.id); @@ -54,7 +55,13 @@ function createSelectedGroups(jobs, groups) { return selectedGroups; } -export class GroupSelector extends Component { +export const GroupSelector = injectI18n(class GroupSelector extends Component { + static propTypes = { + jobs: PropTypes.array.isRequired, + allJobIds: PropTypes.array.isRequired, + refreshJobs: PropTypes.func.isRequired, + }; + constructor(props) { super(props); @@ -191,6 +198,7 @@ export class GroupSelector extends Component { } render() { + const { intl } = this.props; const { groups, selectedGroups, @@ -199,17 +207,22 @@ export class GroupSelector extends Component { const button = ( } > this.togglePopover()} disabled={this.canUpdateJob === false} /> ); - const s = (this.props.jobs.length > 1 ? 's' : ''); return ( this.closePopover()} >
- Apply groups to job{s} + + + - Apply + @@ -254,9 +276,4 @@ export class GroupSelector extends Component { ); } -} -GroupSelector.propTypes = { - jobs: PropTypes.array.isRequired, - allJobIds: PropTypes.array.isRequired, - refreshJobs: PropTypes.func.isRequired, -}; +}); diff --git a/x-pack/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/new_group_input/new_group_input.js b/x-pack/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/new_group_input/new_group_input.js index 29167b7fd2200..58d95b2471868 100644 --- a/x-pack/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/new_group_input/new_group_input.js +++ b/x-pack/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/new_group_input/new_group_input.js @@ -19,9 +19,16 @@ import { keyCodes, } from '@elastic/eui'; +import { injectI18n } from '@kbn/i18n/react'; + import { validateGroupNames } from '../../../validate_job'; -export class NewGroupInput extends Component { +export const NewGroupInput = injectI18n(class NewGroupInput extends Component { + static propTypes = { + addNewGroup: PropTypes.func.isRequired, + allJobIds: PropTypes.array.isRequired, + }; + constructor(props) { super(props); @@ -38,7 +45,10 @@ export class NewGroupInput extends Component { if (tempNewGroupName === '') { groupsValidationError = ''; } else if (this.props.allJobIds.includes(tempNewGroupName)) { - groupsValidationError = 'A job with this ID already exists. Groups and jobs cannot use the same ID.'; + groupsValidationError = this.props.intl.formatMessage({ + id: 'xpack.ml.jobsList.multiJobActions.groupSelector.groupsAndJobsCanNotUseSameIdErrorMessage', + defaultMessage: 'A job with this ID already exists. Groups and jobs cannot use the same ID.' + }); } else { groupsValidationError = validateGroupNames([tempNewGroupName]).message; } @@ -65,6 +75,7 @@ export class NewGroupInput extends Component { } render() { + const { intl } = this.props; const { tempNewGroupName, groupsValidationError, @@ -82,7 +93,10 @@ export class NewGroupInput extends Component { > @@ -105,9 +122,4 @@ export class NewGroupInput extends Component {
); } -} - -NewGroupInput.propTypes = { - addNewGroup: PropTypes.func.isRequired, - allJobIds: PropTypes.array.isRequired, -}; +}); diff --git a/x-pack/plugins/ml/public/jobs/new_job/simple/components/bucket_span_estimator/bucket_span_estimator_directive.js b/x-pack/plugins/ml/public/jobs/new_job/simple/components/bucket_span_estimator/bucket_span_estimator_directive.js index 6106035a789a0..91c41b0fcf71b 100644 --- a/x-pack/plugins/ml/public/jobs/new_job/simple/components/bucket_span_estimator/bucket_span_estimator_directive.js +++ b/x-pack/plugins/ml/public/jobs/new_job/simple/components/bucket_span_estimator/bucket_span_estimator_directive.js @@ -39,7 +39,9 @@ module.directive('mlBucketSpanEstimator', function (i18n) { const errorHandler = (error) => { console.log('Bucket span could not be estimated', error); $scope.ui.bucketSpanEstimator.status = STATUS.FAILED; - $scope.ui.bucketSpanEstimator.message = 'Bucket span could not be estimated'; + $scope.ui.bucketSpanEstimator.message = i18n('xpack.ml.newJob.simple.bucketSpanEstimator.bucketSpanCouldNotBeEstimatedMessage', { + defaultMessage: 'Bucket span could not be estimated' + }); $scope.$applyAsync(); }; diff --git a/x-pack/plugins/ml/public/jobs/new_job/simple/components/fields_selection_population/fields_selection.html b/x-pack/plugins/ml/public/jobs/new_job/simple/components/fields_selection_population/fields_selection.html index a4dbd09e7e6af..399804952ec2e 100644 --- a/x-pack/plugins/ml/public/jobs/new_job/simple/components/fields_selection_population/fields_selection.html +++ b/x-pack/plugins/ml/public/jobs/new_job/simple/components/fields_selection_population/fields_selection.html @@ -14,7 +14,7 @@ on-select="selectField()" ng-disabled="formConfig.overField === undefined || jobState === JOB_STATE.RUNNING || jobState === JOB_STATE.STOPPING || jobState === JOB_STATE.FINISHED" append-to-body=true> - + {{$select.selected.name}} diff --git a/x-pack/plugins/ml/public/jobs/new_job/simple/components/general_job_details/general_job_details.html b/x-pack/plugins/ml/public/jobs/new_job/simple/components/general_job_details/general_job_details.html index 64411293a09da..7fe1b10853ae9 100644 --- a/x-pack/plugins/ml/public/jobs/new_job/simple/components/general_job_details/general_job_details.html +++ b/x-pack/plugins/ml/public/jobs/new_job/simple/components/general_job_details/general_job_details.html @@ -13,7 +13,7 @@ ng-change="changeJobIDCase(formConfig)" ng-disabled="jobState === JOB_STATE.RUNNING || jobState === JOB_STATE.STOPPING || jobState === JOB_STATE.FINISHED" class="form-control lowercase" /> -
{{ ( ui.validation.checks.jobId.message || "Enter a name for the job" ) }}
+
{{ ( ui.validation.checks.jobId.message || enterNameForJobLabel ) }}

diff --git a/x-pack/plugins/ml/public/jobs/new_job/simple/components/general_job_details/general_job_details_directive.js b/x-pack/plugins/ml/public/jobs/new_job/simple/components/general_job_details/general_job_details_directive.js index a4495e239e85c..0862f7ca1f19a 100644 --- a/x-pack/plugins/ml/public/jobs/new_job/simple/components/general_job_details/general_job_details_directive.js +++ b/x-pack/plugins/ml/public/jobs/new_job/simple/components/general_job_details/general_job_details_directive.js @@ -26,6 +26,9 @@ module.directive('mlGeneralJobDetails', function () { $scope.showAdvancedButtonAriaLabel = i18n('xpack.ml.newJob.simple.generalJobDetails.showAdvancedButtonAriaLabel', { defaultMessage: 'Show Advanced' }); + $scope.enterNameForJobLabel = i18n('xpack.ml.newJob.simple.generalJobDetails.enterNameForJobLabel', { + defaultMessage: 'Enter a name for the job' + }); } }; }); diff --git a/x-pack/plugins/ml/public/settings/__snapshots__/settings.test.js.snap b/x-pack/plugins/ml/public/settings/__snapshots__/settings.test.js.snap index 0d573849d96fb..7de30a916576d 100644 --- a/x-pack/plugins/ml/public/settings/__snapshots__/settings.test.js.snap +++ b/x-pack/plugins/ml/public/settings/__snapshots__/settings.test.js.snap @@ -22,7 +22,11 @@ exports[`Settings Renders settings page 1`] = ` textTransform="none" >

- Job Management +

@@ -48,7 +52,11 @@ exports[`Settings Renders settings page 1`] = ` size="l" type="button" > - Calendar management + - Filter Lists + diff --git a/x-pack/plugins/ml/public/settings/breadcrumbs.js b/x-pack/plugins/ml/public/settings/breadcrumbs.js index 2fa1a6e782f03..a8671a8f4bd16 100644 --- a/x-pack/plugins/ml/public/settings/breadcrumbs.js +++ b/x-pack/plugins/ml/public/settings/breadcrumbs.js @@ -6,6 +6,7 @@ import { ML_BREADCRUMB } from '../breadcrumbs'; +import { i18n } from '@kbn/i18n'; export function getSettingsBreadcrumbs() { @@ -20,7 +21,9 @@ export function getCalendarManagementBreadcrumbs() { return [ ...getSettingsBreadcrumbs(), { - text: 'Calendar management', + text: i18n.translate('xpack.ml.settings.breadcrumbs.calendarManagementLabel', { + defaultMessage: 'Calendar management' + }), href: '#/settings/calendars_list' } ]; @@ -30,7 +33,9 @@ export function getCreateCalendarBreadcrumbs() { return [ ...getCalendarManagementBreadcrumbs(), { - text: 'Create', + text: i18n.translate('xpack.ml.settings.breadcrumbs.calendarManagement.createLabel', { + defaultMessage: 'Create' + }), href: '#/settings/calendars_list/new_calendar' } ]; @@ -40,7 +45,9 @@ export function getEditCalendarBreadcrumbs() { return [ ...getCalendarManagementBreadcrumbs(), { - text: 'Edit', + text: i18n.translate('xpack.ml.settings.breadcrumbs.calendarManagement.editLabel', { + defaultMessage: 'Edit' + }), href: '#/settings/calendars_list/edit_calendar' } ]; @@ -50,7 +57,9 @@ export function getFilterListsBreadcrumbs() { return [ ...getSettingsBreadcrumbs(), { - text: 'Filter lists', + text: i18n.translate('xpack.ml.settings.breadcrumbs.filterListsLabel', { + defaultMessage: 'Filter lists' + }), href: '#/settings/filter_lists' } ]; @@ -60,7 +69,9 @@ export function getCreateFilterListBreadcrumbs() { return [ ...getFilterListsBreadcrumbs(), { - text: 'Create', + text: i18n.translate('xpack.ml.settings.breadcrumbs.filterLists.createLabel', { + defaultMessage: 'Create' + }), href: '#/settings/filter_lists/new' } ]; @@ -70,7 +81,9 @@ export function getEditFilterListBreadcrumbs() { return [ ...getFilterListsBreadcrumbs(), { - text: 'Edit', + text: i18n.translate('xpack.ml.settings.breadcrumbs.filterLists.editLabel', { + defaultMessage: 'Edit' + }), href: '#/settings/filter_lists/edit' } ]; diff --git a/x-pack/plugins/ml/public/settings/settings.js b/x-pack/plugins/ml/public/settings/settings.js index 2fc7c18d49bc0..d4f6aa1e8f270 100644 --- a/x-pack/plugins/ml/public/settings/settings.js +++ b/x-pack/plugins/ml/public/settings/settings.js @@ -22,6 +22,7 @@ import { import chrome from 'ui/chrome'; +import { FormattedMessage } from '@kbn/i18n/react'; export function Settings({ canGetFilters, @@ -36,7 +37,12 @@ export function Settings({ > -

Job Management

+

+ +

@@ -49,7 +55,10 @@ export function Settings({ href={`${chrome.getBasePath()}/app/ml#/settings/calendars_list`} isDisabled={canGetCalendars === false} > - Calendar management + @@ -61,7 +70,10 @@ export function Settings({ href={`${chrome.getBasePath()}/app/ml#/settings/filter_lists`} isDisabled={canGetFilters === false} > - Filter Lists + diff --git a/x-pack/plugins/ml/public/settings/settings_directive.js b/x-pack/plugins/ml/public/settings/settings_directive.js index f1749dd644ed0..d9272cda344ff 100644 --- a/x-pack/plugins/ml/public/settings/settings_directive.js +++ b/x-pack/plugins/ml/public/settings/settings_directive.js @@ -19,6 +19,7 @@ import { getSettingsBreadcrumbs } from './breadcrumbs'; import uiRoutes from 'ui/routes'; import { timefilter } from 'ui/timefilter'; +import { I18nProvider } from '@kbn/i18n/react'; const template = ` @@ -55,10 +56,14 @@ module.directive('mlSettings', function () { scope: {}, link: function (scope, element) { ReactDOM.render( - React.createElement(Settings, { - canGetFilters, - canGetCalendars - }), + + {React.createElement( + Settings, { + canGetFilters, + canGetCalendars + }) + } + , element[0] ); } diff --git a/x-pack/plugins/ml/public/timeseriesexplorer/timeseriesexplorer.html b/x-pack/plugins/ml/public/timeseriesexplorer/timeseriesexplorer.html index b97257a4147d8..d272d68f76e25 100644 --- a/x-pack/plugins/ml/public/timeseriesexplorer/timeseriesexplorer.html +++ b/x-pack/plugins/ml/public/timeseriesexplorer/timeseriesexplorer.html @@ -67,7 +67,7 @@