From 54d07e0e11486a08bef14fd235d5f8840f03feae Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Thu, 4 Oct 2018 08:26:56 -0700 Subject: [PATCH 01/12] Internationalize job details tabs and wrap instances in EuiErrorBoundary to visually localize the error. --- .../crud_app/sections/components/index.js | 1 + .../sections/components/job_details/index.js | 1 + .../components/job_details/job_details.js | 54 +++++++++++++++---- .../sections/job_create/steps/step_review.js | 16 +++--- .../job_list/detail_panel/detail_panel.js | 18 ++++--- 5 files changed, 67 insertions(+), 23 deletions(-) diff --git a/x-pack/plugins/rollup/public/crud_app/sections/components/index.js b/x-pack/plugins/rollup/public/crud_app/sections/components/index.js index 7caf2ba79631e..2dd9533a23817 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/components/index.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/components/index.js @@ -15,6 +15,7 @@ export { JOB_DETAILS_TAB_HISTOGRAM, JOB_DETAILS_TAB_METRICS, JOB_DETAILS_TAB_JSON, + tabToHumanizedMap, } from './job_details'; export { JobStatus } from './job_status'; diff --git a/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/index.js b/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/index.js index 314f49e563f4c..a860284e6d010 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/index.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/index.js @@ -11,4 +11,5 @@ export { JOB_DETAILS_TAB_HISTOGRAM, JOB_DETAILS_TAB_METRICS, JOB_DETAILS_TAB_JSON, + tabToHumanizedMap, } from './job_details'; diff --git a/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/job_details.js b/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/job_details.js index bbb35b9b35015..1d5afc6942aa9 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/job_details.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/job_details.js @@ -6,6 +6,7 @@ import React from 'react'; import PropTypes from 'prop-types'; +import { FormattedMessage } from '@kbn/i18n/react'; import { TabSummary, @@ -15,11 +16,44 @@ import { TabHistogram, } from './tabs'; -export const JOB_DETAILS_TAB_SUMMARY = 'Summary'; -export const JOB_DETAILS_TAB_TERMS = 'Terms'; -export const JOB_DETAILS_TAB_HISTOGRAM = 'Histogram'; -export const JOB_DETAILS_TAB_METRICS = 'Metrics'; -export const JOB_DETAILS_TAB_JSON = 'JSON'; +export const JOB_DETAILS_TAB_SUMMARY = 'JOB_DETAILS_TAB_SUMMARY'; +export const JOB_DETAILS_TAB_TERMS = 'JOB_DETAILS_TAB_TERMS'; +export const JOB_DETAILS_TAB_HISTOGRAM = 'JOB_DETAILS_TAB_HISTOGRAM'; +export const JOB_DETAILS_TAB_METRICS = 'JOB_DETAILS_TAB_METRICS'; +export const JOB_DETAILS_TAB_JSON = 'JOB_DETAILS_TAB_JSON'; + +export const tabToHumanizedMap = { + [JOB_DETAILS_TAB_SUMMARY]: ( + + ), + [JOB_DETAILS_TAB_TERMS]: ( + + ), + [JOB_DETAILS_TAB_HISTOGRAM]: ( + + ), + [JOB_DETAILS_TAB_METRICS]: ( + + ), + [JOB_DETAILS_TAB_JSON]: ( + + ), +}; const JOB_DETAILS_TABS = [ JOB_DETAILS_TAB_SUMMARY, @@ -43,22 +77,22 @@ export const JobDetails = ({ } = job; const tabToContentMap = { - Summary: ( + [JOB_DETAILS_TAB_SUMMARY]: ( ), - Terms: ( + [JOB_DETAILS_TAB_TERMS]: ( ), - Histogram: ( + [JOB_DETAILS_TAB_HISTOGRAM]: ( ), - Metrics: ( + [JOB_DETAILS_TAB_METRICS]: ( ), - JSON: ( + [JOB_DETAILS_TAB_JSON]: ( ), }; diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_review.js b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_review.js index 390ae10a7714b..bccc20f8b555b 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_review.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_review.js @@ -9,6 +9,7 @@ import PropTypes from 'prop-types'; import { injectI18n, FormattedMessage } from '@kbn/i18n/react'; import { + EuiErrorBoundary, EuiSpacer, EuiTab, EuiTabs, @@ -24,6 +25,7 @@ import { JOB_DETAILS_TAB_HISTOGRAM, JOB_DETAILS_TAB_METRICS, JOB_DETAILS_TAB_JSON, + tabToHumanizedMap, } from '../../components'; const JOB_DETAILS_TABS = [ @@ -81,7 +83,7 @@ export class StepReviewUi extends Component { data-test-subj={`stepReviewTab${isSelected ? 'Selected' : ''}`} key={index} > - {tab} + {tabToHumanizedMap[tab]} ); }); @@ -119,11 +121,13 @@ export class StepReviewUi extends Component { {this.renderTabs()} - + + + ); } diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_list/detail_panel/detail_panel.js b/x-pack/plugins/rollup/public/crud_app/sections/job_list/detail_panel/detail_panel.js index 42be5ccf9e857..cfb6903fcb6d2 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_list/detail_panel/detail_panel.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_list/detail_panel/detail_panel.js @@ -9,6 +9,7 @@ import PropTypes from 'prop-types'; import { injectI18n, FormattedMessage } from '@kbn/i18n/react'; import { + EuiErrorBoundary, EuiFlexGroup, EuiFlexItem, EuiFlyout, @@ -33,6 +34,7 @@ import { JOB_DETAILS_TAB_HISTOGRAM, JOB_DETAILS_TAB_METRICS, JOB_DETAILS_TAB_JSON, + tabToHumanizedMap, } from '../../components'; const JOB_DETAILS_TABS = [ @@ -98,7 +100,7 @@ export class DetailPanelUi extends Component { data-test-subj={`detailPanelTab${isSelected ? 'Selected' : ''}`} key={index} > - {tab} + {tabToHumanizedMap[tab]} ); }); @@ -136,12 +138,14 @@ export class DetailPanelUi extends Component { return ( - + + + From 1cf52a6038217dff53145cbee4fd705f8e1197aa Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Thu, 4 Oct 2018 08:41:22 -0700 Subject: [PATCH 02/12] Localize no default index pattern message. --- .../indices/index_pattern_list/components/list/list.js | 10 ++++++++-- .../index_pattern_creation_config.js | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/list/list.js b/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/list/list.js index 07dd4efbfbcb6..f2ed3d265be61 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/list/list.js +++ b/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/list/list.js @@ -19,6 +19,7 @@ import React, { Component, Fragment } from 'react'; import PropTypes from 'prop-types'; +import { FormattedMessage } from '@kbn/i18n/react'; import { EuiButtonEmpty, @@ -42,7 +43,7 @@ export class List extends Component { return (
- {pattern.default ? : ''} + {pattern.default ? : ''} {pattern.active ? {pattern.title} : pattern.title} {pattern.tag ? ( {{pattern.tag.name} } @@ -66,7 +67,12 @@ export class List extends Component { color="warning" size="s" iconType="alert" - title="No default index pattern. You must select or create one to continue." + title={( + + )} />
) : null; diff --git a/src/ui/public/management/index_pattern_creation/index_pattern_creation_config.js b/src/ui/public/management/index_pattern_creation/index_pattern_creation_config.js index a367e18fea654..6f4877b13bddc 100644 --- a/src/ui/public/management/index_pattern_creation/index_pattern_creation_config.js +++ b/src/ui/public/management/index_pattern_creation/index_pattern_creation_config.js @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ + import { i18n } from '@kbn/i18n'; const indexPatternTypeName = i18n.translate('common.ui.management.editIndexPattern.createIndex.defaultTypeName', From 74585395f7d8400e48fd9cdbd7f76930db75de4b Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Thu, 4 Oct 2018 09:37:01 -0700 Subject: [PATCH 03/12] Localize es interval errors. --- .../invalid_es_calendar_interval_error.ts | 7 ++++++- .../invalid_es_interval_format_error.ts | 10 +++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/ui/public/utils/parse_es_interval/invalid_es_calendar_interval_error.ts b/src/ui/public/utils/parse_es_interval/invalid_es_calendar_interval_error.ts index f5cf91ae092fd..52819bdeceddc 100644 --- a/src/ui/public/utils/parse_es_interval/invalid_es_calendar_interval_error.ts +++ b/src/ui/public/utils/parse_es_interval/invalid_es_calendar_interval_error.ts @@ -24,7 +24,12 @@ export class InvalidEsCalendarIntervalError extends Error { public readonly unit: string, public readonly type: string ) { - super(`Invalid calendar interval: ${interval}, value must be 1`); + super( + i18n.translate('common.ui.parseEsInterval.invalidEsCalendarIntervalErrorMessage', { + defaultMessage: 'Invalid calendar interval: {interval}, value must be 1', + values: { interval }, + }) + ); this.name = 'InvalidEsCalendarIntervalError'; this.value = value; diff --git a/src/ui/public/utils/parse_es_interval/invalid_es_interval_format_error.ts b/src/ui/public/utils/parse_es_interval/invalid_es_interval_format_error.ts index b13004592e271..ac6b85f447b29 100644 --- a/src/ui/public/utils/parse_es_interval/invalid_es_interval_format_error.ts +++ b/src/ui/public/utils/parse_es_interval/invalid_es_interval_format_error.ts @@ -17,9 +17,17 @@ * under the License. */ +import { i18n } from '@kbn/i18n'; + export class InvalidEsIntervalFormatError extends Error { constructor(public readonly interval: string) { - super(`Invalid interval format: ${interval}`); + super( + i18n.translate('common.ui.parseEsInterval.invalidEsIntervalFormatErrorMessage', { + defaultMessage: 'Invalid interval format: {interval}', + values: { interval }, + }) + ); + this.name = 'InvalidEsIntervalFormatError'; // captureStackTrace is only available in the V8 engine, so any browser using From 8657cfbf0c76b9b67f23191bba1b2d47c7ca1528 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Thu, 4 Oct 2018 09:39:59 -0700 Subject: [PATCH 04/12] Localize job action menu and confirm delete modal. --- .../confirm_delete_modal.js | 16 +++----- .../job_action_menu/job_action_menu.js | 41 +++++++++---------- 2 files changed, 25 insertions(+), 32 deletions(-) diff --git a/x-pack/plugins/rollup/public/crud_app/sections/components/job_action_menu/confirm_delete_modal/confirm_delete_modal.js b/x-pack/plugins/rollup/public/crud_app/sections/components/job_action_menu/confirm_delete_modal/confirm_delete_modal.js index 4e97adf063109..ea810eedcfd38 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/components/job_action_menu/confirm_delete_modal/confirm_delete_modal.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/components/job_action_menu/confirm_delete_modal/confirm_delete_modal.js @@ -16,7 +16,6 @@ import { class ConfirmDeleteModalUi extends Component { static propTypes = { isSingleSelection: PropTypes.bool.isRequired, - entity: PropTypes.string.isRequired, jobs: PropTypes.array.isRequired, onCancel: PropTypes.func.isRequired, onConfirm: PropTypes.func.isRequired, @@ -39,7 +38,6 @@ class ConfirmDeleteModalUi extends Component { render() { const { isSingleSelection, - entity, jobs, onCancel, onConfirm, @@ -52,7 +50,7 @@ class ConfirmDeleteModalUi extends Component { if (isSingleSelection) { const { id, status } = jobs[0]; title = intl.formatMessage({ - id: 'xpack.rollupJobs.jobActionMenu.deleteJob.confirmModal.modalTitleSingle', + id: 'xpack.rollupJobs.jobActionMenu.deleteJob.confirmModal.deleteSingleJobTitle', defaultMessage: 'Delete rollup job \'{id}\'?', }, { id }); @@ -60,7 +58,7 @@ class ConfirmDeleteModalUi extends Component { content = (

@@ -68,7 +66,7 @@ class ConfirmDeleteModalUi extends Component { } } else { title = intl.formatMessage({ - id: 'xpack.rollupJobs.jobActionMenu.deleteJob.confirmModal.modalTitleMultiple', + id: 'xpack.rollupJobs.jobActionMenu.deleteJob.confirmModal.multipleDeletionTitle', defaultMessage: 'Delete {count} rollup jobs?', }, { count: jobs.length }); @@ -76,12 +74,10 @@ class ConfirmDeleteModalUi extends Component {

- {' '} - {entity}:

{this.renderJobs()}
diff --git a/x-pack/plugins/rollup/public/crud_app/sections/components/job_action_menu/job_action_menu.js b/x-pack/plugins/rollup/public/crud_app/sections/components/job_action_menu/job_action_menu.js index b4e3597d007c6..6e7a7de948d3d 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/components/job_action_menu/job_action_menu.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/components/job_action_menu/job_action_menu.js @@ -53,8 +53,7 @@ class JobActionMenuUi extends Component { intl, } = this.props; - const isSingleSelection = this.isSingleSelection(); - const entity = this.getEntity(isSingleSelection); + const isSingleSelection = this.isSingleSelection() ? 1 : 0; const items = []; @@ -62,8 +61,10 @@ class JobActionMenuUi extends Component { items.push({ name: intl.formatMessage({ id: 'xpack.rollupJobs.jobActionMenu.startJobLabel', - defaultMessage: 'Start {entity}', - }, { entity }), + defaultMessage: 'Start {isSingleSelection, plural, one {job} other {jobs}}', + }, { + isSingleSelection, + }), icon: , onClick: () => { this.closePopover(); @@ -76,8 +77,10 @@ class JobActionMenuUi extends Component { items.push({ name: intl.formatMessage({ id: 'xpack.rollupJobs.jobActionMenu.stopJobLabel', - defaultMessage: 'Stop {entity}', - }, { entity }), + defaultMessage: 'Stop {isSingleSelection, plural, one {job} other {jobs}}', + }, { + isSingleSelection, + }), icon: , onClick: () => { this.closePopover(); @@ -89,8 +92,10 @@ class JobActionMenuUi extends Component { items.push({ name: intl.formatMessage({ id: 'xpack.rollupJobs.jobActionMenu.deleteJobLabel', - defaultMessage: 'Delete {entity}', - }, { entity }), + defaultMessage: 'Delete {isSingleSelection, plural, one {job} other {jobs}}', + }, { + isSingleSelection, + }), icon: , onClick: () => { this.closePopover(); @@ -98,13 +103,12 @@ class JobActionMenuUi extends Component { }, }); - const upperCasedEntity = `${entity[0].toUpperCase()}${entity.slice(1)}`; const panelTree = { id: 0, title: intl.formatMessage({ id: 'xpack.rollupJobs.jobActionMenu.panelTitle', - defaultMessage: '{upperCasedEntity} options', - }, { upperCasedEntity }), + defaultMessage: 'Job options', + }), items, }; @@ -159,12 +163,10 @@ class JobActionMenuUi extends Component { }; const isSingleSelection = this.isSingleSelection(); - const entity = this.getEntity(isSingleSelection); return ( { - return isSingleSelection ? 'job' : 'jobs'; - }; - render() { const { intl } = this.props; const jobCount = this.props.jobs.length; @@ -195,12 +193,12 @@ class JobActionMenuUi extends Component { } = this.props; const panels = this.panels(); - const isSingleSelection = this.isSingleSelection(); - const entity = this.getEntity(isSingleSelection); + const actionsAriaLabel = intl.formatMessage({ id: 'xpack.rollupJobs.jobActionMenu.jobActionMenuButtonAriaLabel', - defaultMessage: '{entity} options', - }, { entity }); + defaultMessage: 'Job options', + }); + const button = ( {this.confirmDeleteModal()} Date: Thu, 4 Oct 2018 13:27:12 -0700 Subject: [PATCH 05/12] Remove unnecessary use of injectI18n from tabs. --- .../sections/components/job_details/tabs/tab_histogram.js | 6 ++---- .../sections/components/job_details/tabs/tab_summary.js | 6 ++---- .../sections/components/job_details/tabs/tab_terms.js | 5 +---- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/tabs/tab_histogram.js b/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/tabs/tab_histogram.js index 224a27ccf6b07..f2005d60d1ad0 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/tabs/tab_histogram.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/tabs/tab_histogram.js @@ -5,7 +5,7 @@ */ import React, { Fragment } from 'react'; -import { injectI18n, FormattedMessage } from '@kbn/i18n/react'; +import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; import { @@ -25,7 +25,7 @@ const columns = [{ sortable: true, }]; -export const TabHistogramUi = ({ histogram, histogramInterval }) => ( +export const TabHistogram = ({ histogram, histogramInterval }) => ( @@ -48,5 +48,3 @@ export const TabHistogramUi = ({ histogram, histogramInterval }) => ( /> ); - -export const TabHistogram = injectI18n(TabHistogramUi); diff --git a/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/tabs/tab_summary.js b/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/tabs/tab_summary.js index 3279916252320..16d65f295d9d5 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/tabs/tab_summary.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/tabs/tab_summary.js @@ -6,7 +6,7 @@ import React, { Component, Fragment } from 'react'; import PropTypes from 'prop-types'; -import { injectI18n, FormattedMessage } from '@kbn/i18n/react'; +import { FormattedMessage } from '@kbn/i18n/react'; import { EuiDescriptionList, @@ -21,7 +21,7 @@ import { import { JobStatus } from '../../job_status'; -export class TabSummaryUi extends Component { +export class TabSummary extends Component { static propTypes = { job: PropTypes.object.isRequired, stats: PropTypes.object, @@ -292,5 +292,3 @@ export class TabSummaryUi extends Component { ); } } - -export const TabSummary = injectI18n(TabSummaryUi); diff --git a/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/tabs/tab_terms.js b/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/tabs/tab_terms.js index 82fd0c2ca1824..2f7af57c62976 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/tabs/tab_terms.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/tabs/tab_terms.js @@ -5,7 +5,6 @@ */ import React from 'react'; -import { injectI18n } from '@kbn/i18n/react'; import { FieldList } from '../../field_list'; @@ -16,11 +15,9 @@ const columns = [{ sortable: true, }]; -export const TabTermsUi = ({ terms }) => ( +export const TabTerms = ({ terms }) => ( ); - -export const TabTerms = injectI18n(TabTermsUi); From 30067bf6384ef8c5916e4f810ad9a18d1a4514c0 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Thu, 4 Oct 2018 13:27:28 -0700 Subject: [PATCH 06/12] Localize job status. --- .../components/job_status/job_status.js | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/rollup/public/crud_app/sections/components/job_status/job_status.js b/x-pack/plugins/rollup/public/crud_app/sections/components/job_status/job_status.js index 1bd9c4821c54c..2e830bd02e05c 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/components/job_status/job_status.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/components/job_status/job_status.js @@ -5,6 +5,7 @@ */ import React from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; import { EuiHealth, @@ -13,22 +14,34 @@ import { const statusToHealthMap = { stopped: ( - Stopped + ), started: ( - Started + ), indexing: ( - Indexing + ), abort: ( - Aborting + ), }; From fc41aa4ac929db67b9a5cde4ba4670dd4efab0e8 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Thu, 4 Oct 2018 13:35:49 -0700 Subject: [PATCH 07/12] Localize steps. --- .../sections/job_create/job_create.js | 4 +- .../job_create/steps/step_date_histogram.js | 14 +++---- .../job_create/steps/step_histogram.js | 18 ++++----- .../job_create/steps/step_logistics.js | 39 +++++++------------ .../sections/job_create/steps/step_metrics.js | 8 ++-- .../sections/job_create/steps/step_terms.js | 10 ++--- .../crud_app/sections/job_list/job_list.js | 2 +- 7 files changed, 40 insertions(+), 55 deletions(-) diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_create/job_create.js b/x-pack/plugins/rollup/public/crud_app/sections/job_create/job_create.js index 446e968b9eb19..4649c10310de0 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_create/job_create.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_create/job_create.js @@ -416,7 +416,7 @@ export class JobCreateUi extends Component { const breadcrumbs = [{ text: ( ), @@ -424,7 +424,7 @@ export class JobCreateUi extends Component { }, { text: ( ), diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_date_histogram.js b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_date_histogram.js index 743b871b8f8b1..e88bd8d833a39 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_date_histogram.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_date_histogram.js @@ -234,7 +234,7 @@ export class StepDateHistogramUi extends Component { link: ( @@ -246,12 +246,12 @@ export class StepDateHistogramUi extends Component {

diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_histogram.js b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_histogram.js index 2d921c7dd30da..0f3234bd372cd 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_histogram.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_histogram.js @@ -96,10 +96,8 @@ export class StepHistogramUi extends Component {

@@ -190,12 +188,12 @@ export class StepHistogramUi extends Component { description={( )} fullWidth diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js index bcb3222ca8617..e880fe4c58c65 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js @@ -158,22 +158,14 @@ export class StepLogisticsUi extends Component { error={errorRollupCron} isInvalid={Boolean(areStepErrorsVisible && errorRollupCron)} helpText={( - -

+

+ - - - ) }} + id="xpack.rollupJobs.create.stepLogistics.fieldCron.helpReference.link" + defaultMessage="Learn more about cron syntax" /> -

-
+ +

)} fullWidth > @@ -271,7 +263,7 @@ export class StepLogisticsUi extends Component {

@@ -417,9 +409,7 @@ export class StepLogisticsUi extends Component { description={( )} fullWidth @@ -441,10 +431,7 @@ export class StepLogisticsUi extends Component { description={( )} fullWidth @@ -484,10 +471,10 @@ export class StepLogisticsUi extends Component { description={( )} fullWidth diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_metrics.js b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_metrics.js index 3a1788682101a..2999862e2eec4 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_metrics.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_metrics.js @@ -189,10 +189,10 @@ export class StepMetricsUi extends Component {

diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_terms.js b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_terms.js index 8df9da5724d37..937340b92de3e 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_terms.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_terms.js @@ -96,11 +96,11 @@ export class StepTermsUi extends Component {

diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_list.js b/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_list.js index 207e7b701350d..bc3391850f0ae 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_list.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_list.js @@ -142,7 +142,7 @@ export class JobListUi extends Component {

From d7aa4562c0995f51d1a03d11e42256fc8543d72f Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Fri, 26 Oct 2018 15:17:04 -0700 Subject: [PATCH 08/12] Remove template literals from FormattedMessages. --- .../invalid_es_calendar_interval_error.ts | 2 ++ .../sections/job_create/steps/step_date_histogram.js | 11 +++++------ .../sections/job_create/steps/step_histogram.js | 11 +++++------ .../sections/job_create/steps/step_logistics.js | 7 +++---- .../sections/job_create/steps/step_metrics.js | 7 +++---- .../crud_app/sections/job_create/steps/step_terms.js | 9 ++++----- .../public/crud_app/sections/job_list/job_list.js | 6 +++--- 7 files changed, 25 insertions(+), 28 deletions(-) diff --git a/src/ui/public/utils/parse_es_interval/invalid_es_calendar_interval_error.ts b/src/ui/public/utils/parse_es_interval/invalid_es_calendar_interval_error.ts index 52819bdeceddc..a9e02476c725a 100644 --- a/src/ui/public/utils/parse_es_interval/invalid_es_calendar_interval_error.ts +++ b/src/ui/public/utils/parse_es_interval/invalid_es_calendar_interval_error.ts @@ -17,6 +17,8 @@ * under the License. */ +import { i18n } from '@kbn/i18n'; + export class InvalidEsCalendarIntervalError extends Error { constructor( public readonly interval: string, diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_date_histogram.js b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_date_histogram.js index e88bd8d833a39..7caa63fb3a4e8 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_date_histogram.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_date_histogram.js @@ -246,12 +246,11 @@ export class StepDateHistogramUi extends Component {

diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_histogram.js b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_histogram.js index 0f3234bd372cd..ef06f46640724 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_histogram.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_histogram.js @@ -188,12 +188,11 @@ export class StepHistogramUi extends Component { description={( )} fullWidth diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js index e880fe4c58c65..22997342cf433 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js @@ -471,10 +471,9 @@ export class StepLogisticsUi extends Component { description={( )} fullWidth diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_metrics.js b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_metrics.js index 2999862e2eec4..f9c2cef0006f5 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_metrics.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_metrics.js @@ -189,10 +189,9 @@ export class StepMetricsUi extends Component {

diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_terms.js b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_terms.js index 937340b92de3e..535e6bc2c51a9 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_terms.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_terms.js @@ -96,11 +96,10 @@ export class StepTermsUi extends Component {

diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_list.js b/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_list.js index bc3391850f0ae..c019be1e5461a 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_list.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_list.js @@ -141,9 +141,9 @@ export class JobListUi extends Component {

From 0360fbaf4809e9425fbb16dd2f757733c4da6a06 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Fri, 26 Oct 2018 15:37:15 -0700 Subject: [PATCH 09/12] Address other feedback. --- .../components/list/list.js | 86 ++++++++++++++----- .../job_create/steps/step_logistics.js | 2 +- 2 files changed, 66 insertions(+), 22 deletions(-) diff --git a/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/list/list.js b/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/list/list.js index f2ed3d265be61..d93494ec1a436 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/list/list.js +++ b/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/list/list.js @@ -36,27 +36,71 @@ export class List extends Component { renderList() { const { indexPatterns } = this.props; - return indexPatterns && indexPatterns.length ? ( -
- { - indexPatterns.map(pattern => { - return ( -
- - {pattern.default ? : ''} - {pattern.active ? {pattern.title} : pattern.title} {pattern.tag ? ( - - {{pattern.tag.name} } - - ) : null} - - -
- ); - }) - } -
- ) : null; + + if (indexPatterns && indexPatterns.length) { + return ( +
+ { + indexPatterns.map(pattern => { + const { id, default: isDefault, active, url, title, tag } = pattern; + + let icon; + + if (isDefault) { + icon = ( + + + )} + className="fa fa-star" + /> + {' '} + + ); + } + + let titleElement; + + if (active) { + titleElement = {title}; + } else { + titleElement = title; + } + + let tagElement; + + if (tag) { + const { key, color, name } = tag; + + tagElement = ( + + {' '} + {name} + + ); + } + + return ( +
+ + {icon} + {titleElement} + {tagElement} + + +
+ ); + }) + } +
+ ); + } + + return null; } renderNoDefaultMessage() { diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js index 22997342cf433..1b64d70db51ba 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js @@ -161,7 +161,7 @@ export class StepLogisticsUi extends Component {

From f9bf9bad0ca007b0efc957544b12dc2683102cbc Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Fri, 26 Oct 2018 15:42:51 -0700 Subject: [PATCH 10/12] Add rollups to i18nrc.json. Fix ID collisions. --- .i18nrc.json | 3 ++- .../crud_app/sections/job_create/job_create.js | 12 ++++++------ .../sections/job_create/steps/step_logistics.js | 4 ++-- .../job_create/steps_config/validate_rollup_index.js | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.i18nrc.json b/.i18nrc.json index 2b15e16458650..c29160f84a234 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -9,7 +9,8 @@ "statusPage": "src/core_plugins/status_page", "tagCloud": "src/core_plugins/tagcloud", "xpack.idxMgmt": "x-pack/plugins/index_management", - "xpack.watcher": "x-pack/plugins/watcher" + "xpack.watcher": "x-pack/plugins/watcher", + "xpack.rollupJobs": "x-pack/plugins/rollup" }, "exclude": [ "src/ui/ui_render/bootstrap/app_bootstrap.js", diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_create/job_create.js b/x-pack/plugins/rollup/public/crud_app/sections/job_create/job_create.js index 4649c10310de0..57ba9681c2d62 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_create/job_create.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_create/job_create.js @@ -56,22 +56,22 @@ import { } from './steps_config'; const stepIdToTitleMap = { - [STEP_LOGISTICS]: i18n.translate('xpack.rollupJobs.create.stepLogisticsTitle', { + [STEP_LOGISTICS]: i18n.translate('xpack.rollupJobs.create.steps.stepLogisticsTitle', { defaultMessage: 'Logistics', }), - [STEP_DATE_HISTOGRAM]: i18n.translate('xpack.rollupJobs.create.stepDateHistogramTitle', { + [STEP_DATE_HISTOGRAM]: i18n.translate('xpack.rollupJobs.create.steps.stepDateHistogramTitle', { defaultMessage: 'Date histogram', }), - [STEP_TERMS]: i18n.translate('xpack.rollupJobs.create.stepTermsTitle', { + [STEP_TERMS]: i18n.translate('xpack.rollupJobs.create.steps.stepTermsTitle', { defaultMessage: 'Terms', }), - [STEP_HISTOGRAM]: i18n.translate('xpack.rollupJobs.create.stepHistogramTitle', { + [STEP_HISTOGRAM]: i18n.translate('xpack.rollupJobs.create.steps.stepHistogramTitle', { defaultMessage: 'Histogram', }), - [STEP_METRICS]: i18n.translate('xpack.rollupJobs.create.stepMetricsTitle', { + [STEP_METRICS]: i18n.translate('xpack.rollupJobs.create.steps.stepMetricsTitle', { defaultMessage: 'Metrics', }), - [STEP_REVIEW]: i18n.translate('xpack.rollupJobs.create.stepReviewTitle', { + [STEP_REVIEW]: i18n.translate('xpack.rollupJobs.create.steps.stepReviewTitle', { defaultMessage: 'Review and save', }), }; diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js index 1b64d70db51ba..b289d6e1e71b6 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js @@ -180,7 +180,7 @@ export class StepLogisticsUi extends Component { @@ -462,7 +462,7 @@ export class StepLogisticsUi extends Component {

diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps_config/validate_rollup_index.js b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps_config/validate_rollup_index.js index cb7d99400b3fd..0c4976a85cced 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps_config/validate_rollup_index.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps_config/validate_rollup_index.js @@ -67,7 +67,7 @@ export function validateRollupIndex(rollupIndex, indexPattern) { if (rollupIndex[0] === '.') { return [( )]; From 9f94a308364204f52dcc54b20bbdbab9220a9b0f Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Tue, 30 Oct 2018 07:28:29 -0700 Subject: [PATCH 11/12] Address feedback. --- .../management/sections/indices/index.js | 13 ++++++++----- .../index_pattern_list/components/list/list.js | 18 +++++++++--------- .../job_create/steps/step_date_histogram.js | 9 ++++----- .../job_create/steps/step_histogram.js | 9 ++++----- .../job_create/steps/step_logistics.js | 6 +++--- .../sections/job_create/steps/step_metrics.js | 5 ++--- .../sections/job_create/steps/step_terms.js | 7 +++---- .../crud_app/sections/job_list/job_list.js | 3 +-- 8 files changed, 34 insertions(+), 36 deletions(-) diff --git a/src/core_plugins/kibana/public/management/sections/indices/index.js b/src/core_plugins/kibana/public/management/sections/indices/index.js index fbe715c6f0f07..e08b52fa1f2e2 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/index.js +++ b/src/core_plugins/kibana/public/management/sections/indices/index.js @@ -28,6 +28,7 @@ import indexTemplate from './index.html'; import { SavedObjectsClientProvider } from 'ui/saved_objects'; import { FeatureCatalogueRegistryProvider, FeatureCatalogueCategory } from 'ui/registry/feature_catalogue'; import { i18n } from '@kbn/i18n'; +import { I18nProvider } from '@kbn/i18n/react'; import React from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; @@ -47,11 +48,13 @@ export function updateIndexPatternList( } render( - , + + + , node, ); } diff --git a/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/list/list.js b/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/list/list.js index d93494ec1a436..7cd7292cab441 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/list/list.js +++ b/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/list/list.js @@ -19,7 +19,7 @@ import React, { Component, Fragment } from 'react'; import PropTypes from 'prop-types'; -import { FormattedMessage } from '@kbn/i18n/react'; +import { injectI18n, FormattedMessage } from '@kbn/i18n/react'; import { EuiButtonEmpty, @@ -28,14 +28,14 @@ import { EuiSpacer, } from '@elastic/eui'; -export class List extends Component { +export class ListUi extends Component { static propTypes = { indexPatterns: PropTypes.array, defaultIndex: PropTypes.string, } renderList() { - const { indexPatterns } = this.props; + const { indexPatterns, intl } = this.props; if (indexPatterns && indexPatterns.length) { return ( @@ -50,12 +50,10 @@ export class List extends Component { icon = ( - )} + aria-label={intl.formatMessage({ + id: 'kbn.management.indexPatternList.defaultIndexPatternIconAriaLabel', + defaultMessage: 'Default index pattern', + })} className="fa fa-star" /> {' '} @@ -131,3 +129,5 @@ export class List extends Component { ); } } + +export const List = injectI18n(ListUi); diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_date_histogram.js b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_date_histogram.js index 7caa63fb3a4e8..d1e849c1330d7 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_date_histogram.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_date_histogram.js @@ -246,11 +246,10 @@ export class StepDateHistogramUi extends Component {

diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_histogram.js b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_histogram.js index ef06f46640724..775f98e8e57e7 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_histogram.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_histogram.js @@ -188,11 +188,10 @@ export class StepHistogramUi extends Component { description={( )} fullWidth diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js index b289d6e1e71b6..f91ec5fdf4763 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js @@ -471,9 +471,9 @@ export class StepLogisticsUi extends Component { description={( )} fullWidth diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_metrics.js b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_metrics.js index f9c2cef0006f5..4d9ccbc8ea254 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_metrics.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_metrics.js @@ -189,9 +189,8 @@ export class StepMetricsUi extends Component {

diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_terms.js b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_terms.js index 535e6bc2c51a9..b05280926c2a1 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_terms.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_terms.js @@ -96,10 +96,9 @@ export class StepTermsUi extends Component {

diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_list.js b/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_list.js index c019be1e5461a..7c292181e76da 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_list.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_list.js @@ -141,8 +141,7 @@ export class JobListUi extends Component {

From 0671f0769c30a6a7fea0461706dc59ca7783c933 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Tue, 30 Oct 2018 11:21:49 -0700 Subject: [PATCH 12/12] Feedback. --- .../sections/indices/index_pattern_list/components/list/list.js | 2 +- .../sections/job_create/steps_config/validate_rollup_index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/list/list.js b/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/list/list.js index 7cd7292cab441..f5ebd8ca70f08 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/list/list.js +++ b/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/list/list.js @@ -28,7 +28,7 @@ import { EuiSpacer, } from '@elastic/eui'; -export class ListUi extends Component { +class ListUi extends Component { static propTypes = { indexPatterns: PropTypes.array, defaultIndex: PropTypes.string, diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps_config/validate_rollup_index.js b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps_config/validate_rollup_index.js index 2b029799e46ec..487f70c55428a 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps_config/validate_rollup_index.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_create/steps_config/validate_rollup_index.js @@ -68,7 +68,7 @@ export function validateRollupIndex(rollupIndex, indexPattern) { return [( )]; }