diff --git a/x-pack/plugins/logstash/public/components/pipeline_list/__snapshots__/pipelines_table.test.js.snap b/x-pack/plugins/logstash/public/components/pipeline_list/__snapshots__/pipelines_table.test.js.snap index f43378e68d01..b788aace7f9f 100644 --- a/x-pack/plugins/logstash/public/components/pipeline_list/__snapshots__/pipelines_table.test.js.snap +++ b/x-pack/plugins/logstash/public/components/pipeline_list/__snapshots__/pipelines_table.test.js.snap @@ -6,26 +6,42 @@ exports[`PipelinesTable component renders component as expected 1`] = ` Array [ Object { "field": "id", - "name": "Id", + "name": , "render": [Function], "sortable": true, }, Object { "field": "description", - "name": "Description", + "name": , "render": [Function], "sortable": true, "truncateText": true, }, Object { "field": "lastModifiedHumanized", - "name": "Last Modified", + "name": , "render": [Function], "sortable": true, }, Object { "field": "username", - "name": "Modified By", + "name": , "render": [Function], "sortable": true, }, @@ -73,7 +89,11 @@ exports[`PipelinesTable component renders component as expected 1`] = ` Object { "field": "id", "multiSelect": false, - "name": "Filter by ID", + "name": , "options": Array [ Object { "name": "testPipeline", @@ -94,7 +114,11 @@ exports[`PipelinesTable component renders component as expected 1`] = ` onClick={[MockFunction]} type="button" > - Create pipeline + , } } diff --git a/x-pack/plugins/logstash/public/components/pipeline_list/pipeline_list.js b/x-pack/plugins/logstash/public/components/pipeline_list/pipeline_list.js index b98311172426..15daf1f3208b 100644 --- a/x-pack/plugins/logstash/public/components/pipeline_list/pipeline_list.js +++ b/x-pack/plugins/logstash/public/components/pipeline_list/pipeline_list.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import pluralize from 'pluralize'; +import { injectI18n, FormattedMessage } from '@kbn/i18n/react'; import { EuiCallOut, @@ -19,7 +19,7 @@ import { InfoAlerts } from './info_alerts'; import { PipelinesTable } from './pipelines_table'; import { ConfirmDeleteModal } from './confirm_delete_modal'; -export class PipelineList extends React.Component { +class PipelineListUi extends React.Component { constructor(props) { super(props); @@ -50,28 +50,55 @@ export class PipelineList extends React.Component { getEmptyPrompt = () => ( No pipelines} + title={( +

+ +

+ )} titleSize="xs" - body="There are no pipelines defined." + body={( + + )} /> ); getErrorPrompt = () => ( Error} + title={( +

+ +

+ )} titleSize="xs" - body="Error encountered while loading pipelines." + body={( + + )} /> ); loadPipelines = () => { - const { isReadOnly, licenseService, pipelinesService, toastNotifications } = this.props; + const { isReadOnly, licenseService, pipelinesService, toastNotifications, intl } = this.props; this.setState({ message: (
-   Loading pipelines.... +  
), }); @@ -110,7 +137,12 @@ export class PipelineList extends React.Component { } } else { this.setState({ isForbidden: false }); - toastNotifications.addDanger(`Couldn't load pipeline. Error: "${err.statusText}".`); + toastNotifications.addDanger(intl.formatMessage({ + id: 'xpack.logstash.pipelineList.pipelineLoadingErrorNotification', + defaultMessage: `Couldn't load pipeline. Error: "{errStatusText}".` + }, { + errStatusText: err.statusText, + })); } }); }); @@ -133,9 +165,19 @@ export class PipelineList extends React.Component { + )} > -

Please contact your administrator.

+

+ +

) : null; }; @@ -158,32 +200,54 @@ export class PipelineList extends React.Component { deleteSelectedPipelines = () => { this.hideDeletePipelinesModal(); - const { licenseService, pipelinesService, toastNotifications } = this.props; + const { licenseService, pipelinesService, toastNotifications, intl } = this.props; const { selection } = this.state; const numPipelinesSelected = selection.length; - const totalPluralized = pluralize('Pipeline', numPipelinesSelected); const pipelineIds = selection.map(({ id }) => id); return pipelinesService .deletePipelines(pipelineIds) .then(results => { const { numSuccesses, numErrors } = results; - const errorPluralized = pluralize('Pipeline', numErrors); if (numSuccesses === 1 && numErrors === 0) { - toastNotifications.addSuccess(`Deleted "${selection[0].id}"`); + toastNotifications.addSuccess(intl.formatMessage({ + id: 'xpack.logstash.pipelineList.pipelinesSuccessfullyDeletedNotification', + defaultMessage: 'Deleted "{id}"', + }, { + id: selection[0].id, + })); } else if (numSuccesses) { let text; if (numErrors) { - text = `But ${numErrors} ${errorPluralized} couldn't be deleted.`; + text = intl.formatMessage({ + id: 'xpack.logstash.pipelineList.pipelinesCouldNotBeDeletedDescription', + defaultMessage: `But {numErrors, plural, one {# Pipeline} other {# Pipelines}} couldn't be deleted.`, + }, { + numErrors, + }); } toastNotifications.addSuccess({ - title: `Deleted ${numSuccesses} out of ${numPipelinesSelected} ${totalPluralized}`, + title: intl.formatMessage({ + id: 'xpack.logstash.pipelineList.successfullyDeletedPipelinesNotification', + defaultMessage: + 'Deleted {numSuccesses} out of {numPipelinesSelected, plural, one {# Pipeline} other {# Pipelines}}', + }, { + numSuccesses, + numPipelinesSelected, + numPipelinesSelected, + }), text, }); } else if (numErrors) { - toastNotifications.addError(`Failed to delete ${numErrors} ${errorPluralized}`); + toastNotifications.addError(intl.formatMessage({ + id: 'xpack.logstash.pipelineList.couldNotDeletePipelinesNotification', + defaultMessage: + 'Failed to delete {numErrors, plural, one {# Pipeline} other {# Pipelines}}', + }, { + numErrors, + })); } this.loadPipelines(); @@ -233,3 +297,5 @@ export class PipelineList extends React.Component { ); } } + +export const PipelineList = injectI18n(PipelineListUi); diff --git a/x-pack/plugins/logstash/public/components/pipeline_list/pipeline_list.test.js b/x-pack/plugins/logstash/public/components/pipeline_list/pipeline_list.test.js index d5197aae0036..db0b1375c604 100644 --- a/x-pack/plugins/logstash/public/components/pipeline_list/pipeline_list.test.js +++ b/x-pack/plugins/logstash/public/components/pipeline_list/pipeline_list.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallow } from 'enzyme'; +import { shallowWithIntl } from 'test_utils/enzyme_helpers'; import { PipelineList } from './pipeline_list'; describe('PipelineList component', () => { @@ -54,7 +54,7 @@ describe('PipelineList component', () => { }); async function renderWithProps() { - const wrapper = shallow(); + const wrapper = shallowWithIntl(); await Promise.all([wrapper.instance().componentDidMount]); return wrapper; } diff --git a/x-pack/plugins/logstash/public/components/pipeline_list/pipelines_table.js b/x-pack/plugins/logstash/public/components/pipeline_list/pipelines_table.js index 62ca8dc0634b..85f80795ce24 100644 --- a/x-pack/plugins/logstash/public/components/pipeline_list/pipelines_table.js +++ b/x-pack/plugins/logstash/public/components/pipeline_list/pipelines_table.js @@ -6,13 +6,19 @@ import React from 'react'; import { EuiButton, EuiButtonEmpty, EuiIconTip, EuiInMemoryTable, EuiLink } from '@elastic/eui'; +import { injectI18n, FormattedMessage } from '@kbn/i18n/react'; import { PIPELINE_LIST } from './constants'; function getColumns(openPipeline, clonePipeline) { return [ { field: 'id', - name: 'Id', + name: ( + + ), sortable: true, render: (id, { isCentrallyManaged }) => { const openPipelineClicked = () => openPipeline(id); @@ -33,20 +39,35 @@ function getColumns(openPipeline, clonePipeline) { }, { field: 'description', - name: 'Description', + name: ( + + ), render: description => {description}, sortable: true, truncateText: true, }, { field: 'lastModifiedHumanized', - name: 'Last Modified', + name: ( + + ), render: lastModified => {lastModified}, sortable: true, }, { field: 'username', - name: 'Modified By', + name: ( + + ), render: username => {username}, sortable: true, }, @@ -64,7 +85,10 @@ function getColumns(openPipeline, clonePipeline) { onClick={cloneClicked} size="xs" > - Clone + ) : null; }, @@ -74,7 +98,7 @@ function getColumns(openPipeline, clonePipeline) { ]; } -export function PipelinesTable({ +function PipelinesTableUi({ clonePipeline, createPipeline, isReadOnly, @@ -86,6 +110,7 @@ export function PipelinesTable({ pipelines, selection, pageIndex, + intl, }) { const pagination = { pageIndex, @@ -96,7 +121,12 @@ export function PipelinesTable({ const selectableMessage = (selectable, { id }) => selectable - ? `Select pipeline "${id}"` + ? intl.formatMessage({ + id: 'xpack.logstash.pipelinesTable.selectablePipelineMessage', + defaultMessage: `Select pipeline "{id}"` + }, { + id, + }) : PIPELINE_LIST.PIPELINE_NOT_CENTRALLY_MANAGED_TOOLTIP_TEXT; const selectionOptions = isSelectable @@ -116,7 +146,10 @@ export function PipelinesTable({ onClick={onDeleteSelectedPipelines} data-test-subj="btnDeletePipeline" > - Delete + ) : null; @@ -126,7 +159,12 @@ export function PipelinesTable({ { type: 'field_value_selection', field: 'id', - name: 'Filter by ID', + name: ( + + ), multiSelect: false, options: pipelines.map(({ id }) => { return { @@ -146,7 +184,10 @@ export function PipelinesTable({ onClick={createPipeline} data-test-subj="btnAdd" > - Create pipeline + ), }; @@ -168,3 +209,5 @@ export function PipelinesTable({ /> ); } + +export const PipelinesTable = injectI18n(PipelinesTableUi); diff --git a/x-pack/plugins/logstash/public/components/pipeline_list/pipelines_table.test.js b/x-pack/plugins/logstash/public/components/pipeline_list/pipelines_table.test.js index 2d5412da3293..2c25ae69ae72 100644 --- a/x-pack/plugins/logstash/public/components/pipeline_list/pipelines_table.test.js +++ b/x-pack/plugins/logstash/public/components/pipeline_list/pipelines_table.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { mount, shallow } from 'enzyme'; +import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; import { PipelinesTable } from './pipelines_table'; describe('PipelinesTable component', () => { @@ -38,33 +38,33 @@ describe('PipelinesTable component', () => { }); it('renders component as expected', () => { - const wrapper = shallow(); + const wrapper = shallowWithIntl(); expect(wrapper).toMatchSnapshot(); }); it('calls clone when cloned button clicked', () => { props.pipelines = [{ id: 'testPipeline', isCentrallyManaged: true }]; - const wrapper = mount(); + const wrapper = mountWithIntl(); wrapper.find('[iconType="copy"]').simulate('click'); expect(clonePipeline).toHaveBeenCalled(); }); it('calls createPipeline on create button clicked', () => { - const wrapper = mount(); + const wrapper = mountWithIntl(); wrapper.find('.euiButton--primary').simulate('click'); expect(createPipeline).toHaveBeenCalled(); }); it('calls delete prompt on delete click', () => { props.selection = [{ id: 'testPipeline' }]; - const wrapper = mount(); + const wrapper = mountWithIntl(); wrapper.find('.euiButton--danger').simulate('click'); expect(onDeleteSelectedPipelines).toHaveBeenCalled(); }); it('calls openPipeline on id click', () => { props.pipelines = [{ id: 'testPipeline', isCentrallyManaged: true }]; - const wrapper = mount(); + const wrapper = mountWithIntl(); wrapper.find('EuiLink').simulate('click'); expect(openPipeline).toHaveBeenCalledWith('testPipeline'); }); diff --git a/x-pack/plugins/logstash/public/components/upgrade_failure/__snapshots__/upgrade_failure.test.js.snap b/x-pack/plugins/logstash/public/components/upgrade_failure/__snapshots__/upgrade_failure.test.js.snap index 5d5efb47dc8a..e5357d6fa04f 100644 --- a/x-pack/plugins/logstash/public/components/upgrade_failure/__snapshots__/upgrade_failure.test.js.snap +++ b/x-pack/plugins/logstash/public/components/upgrade_failure/__snapshots__/upgrade_failure.test.js.snap @@ -2,6 +2,88 @@ exports[`UpgradeFailure component passes expected text for new pipeline 1`] = ` - Go back + + Go back + @@ -304,6 +392,88 @@ exports[`UpgradeFailure component passes expected text for new pipeline 1`] = ` exports[`UpgradeFailure component passes expected text for not manual upgrade 1`] = ` - Go back + + Go back + @@ -606,6 +782,88 @@ exports[`UpgradeFailure component passes expected text for not manual upgrade 1` exports[`UpgradeFailure component passes expected text for not new pipeline 1`] = ` - Go back + + Go back + diff --git a/x-pack/plugins/logstash/public/components/upgrade_failure/__snapshots__/upgrade_failure_actions.test.js.snap b/x-pack/plugins/logstash/public/components/upgrade_failure/__snapshots__/upgrade_failure_actions.test.js.snap index c68cd8315f8a..7497fc1cbaeb 100644 --- a/x-pack/plugins/logstash/public/components/upgrade_failure/__snapshots__/upgrade_failure_actions.test.js.snap +++ b/x-pack/plugins/logstash/public/components/upgrade_failure/__snapshots__/upgrade_failure_actions.test.js.snap @@ -34,7 +34,11 @@ exports[`UpgradeFailureActions component renders component as expected 1`] = ` onClick={[MockFunction]} type="button" > - Go back + diff --git a/x-pack/plugins/logstash/public/components/upgrade_failure/constants.js b/x-pack/plugins/logstash/public/components/upgrade_failure/constants.js index 1c0d59878287..99c727b3ad96 100644 --- a/x-pack/plugins/logstash/public/components/upgrade_failure/constants.js +++ b/x-pack/plugins/logstash/public/components/upgrade_failure/constants.js @@ -4,17 +4,31 @@ * you may not use this file except in compliance with the Elastic License. */ +import { i18n } from '@kbn/i18n'; + export const UPGRADE_FAILURE = { TITLE: { - IS_MANUAL_UPGRADE: 'Upgrade failed', - NOT_MANUAL_UPGRADE: 'Time for an upgrade!', + IS_MANUAL_UPGRADE: i18n.translate('xpack.logstash.upgradeFailedTitle', { + defaultMessage: 'Upgrade failed', + }), + NOT_MANUAL_UPGRADE: i18n.translate('xpack.logstash.notManualUpgradeTitle', { + defaultMessage: 'Time for an upgrade!', + }), }, MESSAGE: { - IS_NEW_PIPELINE: 'Before you can add a pipeline, we need to upgrade your configuration.', - NOT_NEW_PIPELINE: 'Before you can edit this pipeline, we need to upgrade your configuration.', + IS_NEW_PIPELINE: i18n.translate('xpack.logstash.newPipelineMessage', { + defaultMessage: 'Before you can add a pipeline, we need to upgrade your configuration.', + }), + NOT_NEW_PIPELINE: i18n.translate('xpack.logstash.notNewPipelineMessage', { + defaultMessage: 'Before you can edit this pipeline, we need to upgrade your configuration.', + }), }, UPGRADE_BUTTON_TEXT: { - IS_MANUAL_UPGRADE: 'Try again', - NOT_MANUAL_UPGRADE: 'Upgrade', + IS_MANUAL_UPGRADE: i18n.translate('xpack.logstash.manualUpgradeButtonLabel', { + defaultMessage: 'Try again', + }), + NOT_MANUAL_UPGRADE: i18n.translate('xpack.logstash.notManualUpgradeButtonLabel', { + defaultMessage: 'Upgrade', + }), }, }; diff --git a/x-pack/plugins/logstash/public/components/upgrade_failure/upgrade_failure.test.js b/x-pack/plugins/logstash/public/components/upgrade_failure/upgrade_failure.test.js index 2d9e02e0d294..d9d6c544141d 100644 --- a/x-pack/plugins/logstash/public/components/upgrade_failure/upgrade_failure.test.js +++ b/x-pack/plugins/logstash/public/components/upgrade_failure/upgrade_failure.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { mount, shallow } from 'enzyme'; +import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; import { UpgradeFailure } from './upgrade_failure'; describe('UpgradeFailure component', () => { @@ -26,29 +26,29 @@ describe('UpgradeFailure component', () => { }); it('renders component as expected', () => { - const wrapper = shallow(); + const wrapper = shallowWithIntl(); expect(wrapper).toMatchSnapshot(); }); it('passes expected text for new pipeline', () => { - const wrapper = mount(); + const wrapper = mountWithIntl(); expect(wrapper).toMatchSnapshot(); }); it('passes expected text for not new pipeline', () => { props.isNewPipeline = false; - const wrapper = mount(); + const wrapper = mountWithIntl(); expect(wrapper).toMatchSnapshot(); }); it('passes expected text for not manual upgrade', () => { props.isManualUpgrade = false; - const wrapper = mount(); + const wrapper = mountWithIntl(); expect(wrapper).toMatchSnapshot(); }); it('propogates onClose and onRetry functions to child', () => { - const wrapper = mount(); + const wrapper = mountWithIntl(); expect(wrapper.find('UpgradeFailureActions').props().onClose).toEqual(onClose); expect(wrapper.find('UpgradeFailureActions').props().onRetry).toEqual(onRetry); }); diff --git a/x-pack/plugins/logstash/public/components/upgrade_failure/upgrade_failure_actions.js b/x-pack/plugins/logstash/public/components/upgrade_failure/upgrade_failure_actions.js index bb9abff27714..7a3eaef45bb5 100644 --- a/x-pack/plugins/logstash/public/components/upgrade_failure/upgrade_failure_actions.js +++ b/x-pack/plugins/logstash/public/components/upgrade_failure/upgrade_failure_actions.js @@ -7,6 +7,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { EuiButton, EuiButtonEmpty, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; export function UpgradeFailureActions({ onClose, onRetry, upgradeButtonText }) { return ( @@ -18,7 +19,10 @@ export function UpgradeFailureActions({ onClose, onRetry, upgradeButtonText }) { - Go back + diff --git a/x-pack/plugins/logstash/public/components/upgrade_failure/upgrade_failure_actions.test.js b/x-pack/plugins/logstash/public/components/upgrade_failure/upgrade_failure_actions.test.js index 0408dd2ca468..6ff28a1d36a6 100644 --- a/x-pack/plugins/logstash/public/components/upgrade_failure/upgrade_failure_actions.test.js +++ b/x-pack/plugins/logstash/public/components/upgrade_failure/upgrade_failure_actions.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { mount, shallow } from 'enzyme'; +import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; import { UpgradeFailureActions } from './upgrade_failure_actions'; describe('UpgradeFailureActions component', () => { @@ -24,18 +24,18 @@ describe('UpgradeFailureActions component', () => { }); it('renders component as expected', () => { - const wrapper = shallow(); + const wrapper = shallowWithIntl(); expect(wrapper).toMatchSnapshot(); }); it('calls onRetry on update click', () => { - const wrapper = mount(); + const wrapper = mountWithIntl(); wrapper.find('EuiButton').simulate('click'); expect(onRetry).toHaveBeenCalledTimes(1); }); it('calls onClose on "Go back" click', () => { - const wrapper = mount(); + const wrapper = mountWithIntl(); wrapper.find('EuiButtonEmpty').simulate('click'); expect(onClose).toHaveBeenCalledTimes(1); }); diff --git a/x-pack/plugins/logstash/public/lib/register_home_feature/register_home_feature.js b/x-pack/plugins/logstash/public/lib/register_home_feature/register_home_feature.js index 106008dc4190..7cf5469e79cc 100755 --- a/x-pack/plugins/logstash/public/lib/register_home_feature/register_home_feature.js +++ b/x-pack/plugins/logstash/public/lib/register_home_feature/register_home_feature.js @@ -6,7 +6,7 @@ import { FeatureCatalogueRegistryProvider, FeatureCatalogueCategory } from 'ui/registry/feature_catalogue'; -FeatureCatalogueRegistryProvider.register(($injector) => { +FeatureCatalogueRegistryProvider.register(($injector, i18n) => { const licenseService = $injector.get('logstashLicenseService'); if (!licenseService.enableLinks) { @@ -15,8 +15,12 @@ FeatureCatalogueRegistryProvider.register(($injector) => { return { id: 'management_logstash', - title: 'Logstash Pipelines', - description: 'Create, delete, update, and clone data ingestion pipelines.', + title: i18n('xpack.logstash.homeFeature.logstashPipelinesTitle', { + defaultMessage: 'Logstash Pipelines', + }), + description: i18n('xpack.logstash.homeFeature.logstashPipelinesDescription', { + defaultMessage: 'Create, delete, update, and clone data ingestion pipelines.', + }), icon: 'pipelineApp', path: '/app/kibana#/management/logstash/pipelines', showOnHomePage: true, diff --git a/x-pack/plugins/logstash/public/sections/pipeline_edit/components/upgrade_failure/upgrade_failure.js b/x-pack/plugins/logstash/public/sections/pipeline_edit/components/upgrade_failure/upgrade_failure.js index 4d46fb7e5d2a..cf67b88c1de1 100755 --- a/x-pack/plugins/logstash/public/sections/pipeline_edit/components/upgrade_failure/upgrade_failure.js +++ b/x-pack/plugins/logstash/public/sections/pipeline_edit/components/upgrade_failure/upgrade_failure.js @@ -8,6 +8,7 @@ import React from 'react'; import { render } from 'react-dom'; import { isEmpty } from 'lodash'; import { uiModules } from 'ui/modules'; +import { I18nProvider } from '@kbn/i18n/react'; import { UpgradeFailure } from '../../../../components/upgrade_failure'; const app = uiModules.get('xpack/logstash'); @@ -29,12 +30,14 @@ app.directive('upgradeFailure', $injector => { const isManualUpgrade = !!$route.current.params.retry; render( - , + + + , el[0] ); }, diff --git a/x-pack/plugins/logstash/public/sections/pipeline_edit/pipeline_edit_route.js b/x-pack/plugins/logstash/public/sections/pipeline_edit/pipeline_edit_route.js index e943b3411186..4eca1c970d82 100755 --- a/x-pack/plugins/logstash/public/sections/pipeline_edit/pipeline_edit_route.js +++ b/x-pack/plugins/logstash/public/sections/pipeline_edit/pipeline_edit_route.js @@ -6,6 +6,7 @@ import routes from 'ui/routes'; import { toastNotifications } from 'ui/notify'; +import { i18n } from '@kbn/i18n'; import template from './pipeline_edit_route.html'; import 'plugins/logstash/services/pipeline'; import 'plugins/logstash/services/license'; @@ -50,7 +51,12 @@ routes return licenseService.checkValidity() .then(() => { if (err.status !== 403) { - toastNotifications.addDanger(`Couldn't load pipeline. Error: '${err.statusText}'.`); + toastNotifications.addDanger(i18n.translate('xpack.logstash.couldNotLoadPipelineErrorNotification', { + defaultMessage: `Couldn't load pipeline. Error: '{errStatusText}'.`, + values: { + errStatusText: err.statusText, + }, + })); } kbnUrl.redirect('/management/logstash/pipelines'); diff --git a/x-pack/plugins/logstash/public/sections/pipeline_list/register_management_section.js b/x-pack/plugins/logstash/public/sections/pipeline_list/register_management_section.js index 2df4ff9838d0..9c7c5b0f4145 100755 --- a/x-pack/plugins/logstash/public/sections/pipeline_list/register_management_section.js +++ b/x-pack/plugins/logstash/public/sections/pipeline_list/register_management_section.js @@ -5,9 +5,12 @@ */ import { management } from 'ui/management'; +import { i18n } from '@kbn/i18n'; management.getSection('logstash').register('pipelines', { - display: 'Pipelines', + display: i18n.translate('xpack.logstash.managementSection.pipelinesTitle', { + defaultMessage: 'Pipelines', + }), order: 10, url: '#/management/logstash/pipelines/' }); @@ -17,13 +20,17 @@ management.getSection('logstash/pipelines').register('pipeline', { }); management.getSection('logstash/pipelines/pipeline').register('edit', { - display: 'Edit pipeline', + display: i18n.translate('xpack.logstash.managementSection.editPipelineTitle', { + defaultMessage: 'Edit pipeline', + }), order: 1, visible: false }); management.getSection('logstash/pipelines/pipeline').register('new', { - display: 'Create pipeline', + display: i18n.translate('xpack.logstash.managementSection.createPipelineTitle', { + defaultMessage: 'Create pipeline', + }), order: 1, visible: false }); diff --git a/x-pack/plugins/logstash/server/lib/check_license/check_license.js b/x-pack/plugins/logstash/server/lib/check_license/check_license.js index aa1704cc0273..f09abef93226 100755 --- a/x-pack/plugins/logstash/server/lib/check_license/check_license.js +++ b/x-pack/plugins/logstash/server/lib/check_license/check_license.js @@ -4,6 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ +import { i18n } from '@kbn/i18n'; + export function checkLicense(xpackLicenseInfo) { // If, for some reason, we cannot get the license information // from Elasticsearch, assume worst case and disable the Logstash pipeline UI @@ -12,7 +14,9 @@ export function checkLicense(xpackLicenseInfo) { isAvailable: false, enableLinks: false, isReadOnly: false, - message: 'You cannot manage Logstash pipelines because license information is not available at this time.' + message: i18n.translate('xpack.logstash.managementSection.notPossibleToManagePipelinesMessage', { + defaultMessage: 'You cannot manage Logstash pipelines because license information is not available at this time.', + }) }; } @@ -30,8 +34,10 @@ export function checkLicense(xpackLicenseInfo) { // Security is not enabled in ES if (!isSecurityEnabled) { - const message = 'Security must be enabled in order to use Logstash pipeline management features.' - + ' Please set xpack.security.enabled: true in your elasticsearch.yml.'; + const message = i18n.translate('xpack.logstash.managementSection.enableSecurityDescription', { + defaultMessage: 'Security must be enabled in order to use Logstash pipeline management features.' + + ' Please set xpack.security.enabled: true in your elasticsearch.yml.', + }); return { isAvailable: false, enableLinks: false, @@ -46,7 +52,10 @@ export function checkLicense(xpackLicenseInfo) { isAvailable: false, enableLinks: false, isReadOnly: false, - message: `Your ${licenseType} license does not support Logstash pipeline management features. Please upgrade your license.` + message: i18n.translate('xpack.logstash.managementSection.licenseDoesNotSupportDescription', { + defaultMessage: 'Your {licenseType} license does not support Logstash pipeline management features. Please upgrade your license.', + values: { licenseType }, + }), }; } @@ -56,7 +65,10 @@ export function checkLicense(xpackLicenseInfo) { isAvailable: true, enableLinks: true, isReadOnly: true, - message: `You cannot edit, create, or delete your Logstash pipelines because your ${licenseType} license has expired.` + message: i18n.translate('xpack.logstash.managementSection.pipelineCrudOperationsNotAllowedDescription', { + defaultMessage: 'You cannot edit, create, or delete your Logstash pipelines because your {licenseType} license has expired.', + values: { licenseType }, + }), }; } diff --git a/x-pack/plugins/logstash/server/lib/error_wrappers/wrap_es_error.js b/x-pack/plugins/logstash/server/lib/error_wrappers/wrap_es_error.js index 112efc6749ae..7bb21fc7270f 100755 --- a/x-pack/plugins/logstash/server/lib/error_wrappers/wrap_es_error.js +++ b/x-pack/plugins/logstash/server/lib/error_wrappers/wrap_es_error.js @@ -5,6 +5,7 @@ */ import Boom from 'boom'; +import { i18n } from '@kbn/i18n'; /** * Wraps ES errors into a Boom error response and returns it @@ -16,7 +17,9 @@ import Boom from 'boom'; export function wrapEsError(err) { const statusCode = err.statusCode; if (statusCode === 403) { - return Boom.forbidden('Insufficient user permissions for managing Logstash pipelines'); + return Boom.forbidden(i18n.translate('xpack.logstash.insufficientUserPermissionsDescription', { + defaultMessage: 'Insufficient user permissions for managing Logstash pipelines', + })); } return Boom.boomify(err, { statusCode: err.statusCode }); } diff --git a/x-pack/plugins/logstash/server/models/pipeline/pipeline.js b/x-pack/plugins/logstash/server/models/pipeline/pipeline.js index 1636c7a5262f..4b546886697b 100755 --- a/x-pack/plugins/logstash/server/models/pipeline/pipeline.js +++ b/x-pack/plugins/logstash/server/models/pipeline/pipeline.js @@ -7,6 +7,7 @@ import moment from 'moment'; import { badRequest } from 'boom'; import { get } from 'lodash'; +import { i18n } from '@kbn/i18n'; /** * This model deals with a pipeline object from ES and converts it to Kibana downstream @@ -70,7 +71,9 @@ export class Pipeline { // generate Pipeline object from elasticsearch response static fromUpstreamJSON(upstreamPipeline) { if (!upstreamPipeline._id) { - throw badRequest('upstreamPipeline argument must contain an id property'); + throw badRequest(i18n.translate('xpack.logstash.upstreamPipelineArgumentMustContainAnIdPropertyErrorMessage', { + defaultMessage: 'upstreamPipeline argument must contain an id property', + })); } const id = get(upstreamPipeline, '_id'); const description = get(upstreamPipeline, '_source.description');