Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions x-pack/plugins/cross_cluster_replication/public/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Route, Switch, Redirect } from 'react-router-dom';
import chrome from 'ui/chrome';
import { fatalError } from 'ui/notify';
import { i18n } from '@kbn/i18n';
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
import { FormattedMessage } from '@kbn/i18n/react';

import {
EuiEmptyPrompt,
Expand All @@ -36,8 +36,7 @@ import {
FollowerIndexEdit,
} from './sections';

export const App = injectI18n(
class extends Component {
export class App extends Component {
static contextTypes = {
router: PropTypes.shape({
history: PropTypes.shape({
Expand Down Expand Up @@ -139,17 +138,17 @@ export const App = injectI18n(
if (isFetchingPermissions) {
return (
<EuiPageContent horizontalPosition="center">
<EuiFlexGroup>
<EuiFlexItem>
<EuiLoadingSpinner size="xl"/>
<EuiFlexGroup alignItems="center" gutterSize="m">
<EuiFlexItem grow={false}>
<EuiLoadingSpinner size="l" />
</EuiFlexItem>

<EuiFlexItem>
<EuiTitle>
<EuiTitle size="s">
<h2>
<FormattedMessage
id="xpack.crossClusterReplication.app.permissionCheckTitle"
defaultMessage="Checking permissions..."
defaultMessage="Checking permissions"
/>
</h2>
</EuiTitle>
Expand Down Expand Up @@ -194,9 +193,12 @@ export const App = injectI18n(
<p>
<FormattedMessage
id="xpack.crossClusterReplication.app.deniedPermissionDescription"
defaultMessage="To use Cross Cluster Replication, you must have {clusterPrivileges,
defaultMessage="To use Cross Cluster Replication, you must have {clusterPrivilegesCount,
plural, one {this cluster privilege} other {these cluster privileges}}: {clusterPrivileges}."
values={{ clusterPrivileges: missingClusterPrivileges.join(', ') }}
values={{
clusterPrivileges: missingClusterPrivileges.join(', '),
clusterPrivilegesCount: missingClusterPrivileges.length,
}}
/>
</p>}
/>
Expand All @@ -218,4 +220,3 @@ export const App = injectI18n(
);
}
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

import React, { PureComponent, Fragment } from 'react';
import { connect } from 'react-redux';
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import {
EuiConfirmModal,
EuiOverlayMask,
Expand All @@ -16,7 +17,7 @@ import {
import { deleteAutoFollowPattern } from '../store/actions';
import { arrify } from '../../../common/services/utils';

class Provider extends PureComponent {
class AutoFollowPatternDeleteProviderUi extends PureComponent {
state = {
isModalOpen: false,
ids: null
Expand Down Expand Up @@ -44,18 +45,22 @@ class Provider extends PureComponent {
};

renderModal = () => {
const { intl } = this.props;
const { ids } = this.state;
const isSingle = ids.length === 1;
const title = isSingle
? intl.formatMessage({
id: 'xpack.crossClusterReplication.deleteAutoFollowPattern.confirmModal.deleteSingleTitle',
defaultMessage: 'Remove auto-follow pattern \'{name}\'?',
}, { name: ids[0] })
: intl.formatMessage({
id: 'xpack.crossClusterReplication.deleteAutoFollowPattern.confirmModal.deleteMultipleTitle',
defaultMessage: 'Remove {count} auto-follow patterns?',
}, { count: ids.length });
? i18n.translate(
'xpack.crossClusterReplication.deleteAutoFollowPattern.confirmModal.deleteSingleTitle',
{
defaultMessage: `Remove auto-follow pattern '{name}'?`,
values: { name: ids[0] }
}
) : i18n.translate(
'xpack.crossClusterReplication.deleteAutoFollowPattern.confirmModal.deleteMultipleTitle',
{
defaultMessage: `Remove {count} auto-follow patterns?`,
values: { count: ids.length }
}
);

return (
<EuiOverlayMask>
Expand All @@ -65,17 +70,21 @@ class Provider extends PureComponent {
onCancel={this.closeConfirmModal}
onConfirm={this.onConfirm}
cancelButtonText={
intl.formatMessage({
id: 'xpack.crossClusterReplication.deleteAutoFollowPattern.confirmModal.cancelButtonText',
defaultMessage: 'Cancel',
})
i18n.translate(
'xpack.crossClusterReplication.deleteAutoFollowPattern.confirmModal.cancelButtonText',
{
defaultMessage: 'Cancel'
}
)
}
buttonColor="danger"
confirmButtonText={
intl.formatMessage({
id: 'xpack.crossClusterReplication.deleteAutoFollowPattern.confirmModal.confirmButtonText',
defaultMessage: 'Remove',
})
i18n.translate(
'xpack.crossClusterReplication.deleteAutoFollowPattern.confirmModal.confirmButtonText',
{
defaultMessage: 'Remove'
}
)
}
onMouseOver={this.onMouseOverModal}
>
Expand Down Expand Up @@ -115,5 +124,5 @@ const mapDispatchToProps = dispatch => ({
export const AutoFollowPatternDeleteProvider = connect(
undefined,
mapDispatchToProps
)(injectI18n(Provider));
)(AutoFollowPatternDeleteProviderUi);

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

import React, { PureComponent, Fragment } from 'react';
import PropTypes from 'prop-types';
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';

import {
EuiButton,
Expand Down Expand Up @@ -58,7 +59,7 @@ export const updateFormErrors = (errors, existingErrors) => ({
}
});

export class AutoFollowPatternFormUI extends PureComponent {
export class AutoFollowPatternForm extends PureComponent {
static propTypes = {
saveAutoFollowPattern: PropTypes.func.isRequired,
autoFollowPattern: PropTypes.object,
Expand Down Expand Up @@ -154,11 +155,12 @@ export class AutoFollowPatternFormUI extends PureComponent {
const { autoFollowPattern: { leaderIndexPatterns } } = this.state;

if (leaderIndexPatterns.includes(leaderIndexPattern)) {
const { intl } = this.props;
const errorMsg = intl.formatMessage({
id: 'xpack.crossClusterReplication.autoFollowPatternForm.leaderIndexPatternError.duplicateMessage',
defaultMessage: `Duplicate leader index pattern aren't allowed.`,
});
const errorMsg = i18n.translate(
'xpack.crossClusterReplication.autoFollowPatternForm.leaderIndexPatternError.duplicateMessage',
{
defaultMessage: `Duplicate leader index pattern aren't allowed.`
}
);

const errors = {
leaderIndexPatterns: {
Expand Down Expand Up @@ -212,12 +214,11 @@ export class AutoFollowPatternFormUI extends PureComponent {
* Secctions Renders
*/
renderApiErrors() {
const { apiError, intl } = this.props;
const { apiError } = this.props;

if (apiError) {
const title = intl.formatMessage({
id: 'xpack.crossClusterReplication.autoFollowPatternForm.savingErrorTitle',
defaultMessage: `Can't create auto-follow pattern`,
const title = i18n.translate('xpack.crossClusterReplication.autoFollowPatternForm.savingErrorTitle', {
defaultMessage: `Can't create auto-follow pattern`
});

return (
Expand All @@ -232,7 +233,6 @@ export class AutoFollowPatternFormUI extends PureComponent {
}

renderForm = () => {
const { intl } = this.props;
const {
autoFollowPattern: {
name,
Expand Down Expand Up @@ -436,10 +436,12 @@ export class AutoFollowPatternFormUI extends PureComponent {
>
<EuiComboBox
noSuggestions
placeholder={intl.formatMessage({
id: 'xpack.crossClusterReplication.autoFollowPatternForm.fieldLeaderIndexPatternsPlaceholder',
defaultMessage: 'Type and then hit ENTER',
})}
placeholder={i18n.translate(
'xpack.crossClusterReplication.autoFollowPatternForm.fieldLeaderIndexPatternsPlaceholder',
{
defaultMessage: 'Type and then hit ENTER'
}
)}
selectedOptions={formattedLeaderIndexPatterns}
onCreateOption={this.onCreateLeaderIndexPattern}
onChange={this.onLeaderIndexPatternChange}
Expand Down Expand Up @@ -670,5 +672,3 @@ export class AutoFollowPatternFormUI extends PureComponent {
);
}
}

export const AutoFollowPatternForm = injectI18n(AutoFollowPatternFormUI);
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,23 @@
import React from 'react';

import { EuiCallOut } from '@elastic/eui';
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { getPreviewIndicesFromAutoFollowPattern } from '../services/auto_follow_pattern';

export const AutoFollowPatternIndicesPreview = injectI18n(({ prefix, suffix, leaderIndexPatterns, intl }) => {
export const AutoFollowPatternIndicesPreview = ({ prefix, suffix, leaderIndexPatterns }) => {
const { indicesPreview } = getPreviewIndicesFromAutoFollowPattern({
prefix,
suffix,
leaderIndexPatterns
});

const title = intl.formatMessage({
id: 'xpack.crossClusterReplication.autoFollowPatternForm.indicesPreviewTitle',
defaultMessage: 'Index name examples',
});
const title = i18n.translate(
'xpack.crossClusterReplication.autoFollowPatternForm.indicesPreviewTitle',
{
defaultMessage: 'Index name examples'
}
);

return (
<EuiCallOut
Expand All @@ -40,4 +43,4 @@ export const AutoFollowPatternIndicesPreview = injectI18n(({ prefix, suffix, lea
</ul>
</EuiCallOut>
);
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ export const advancedSettingsFields = [
),
description: i18n.translate(
'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxWriteBufferCountDescription', {
defaultMessage: `The maximum number of operations that can be queued for writing; when this
limit is reached, reads from the remote cluster will be deferred until the number of queued
operations goes below the limit.`
defaultMessage: 'The maximum number of operations that can be queued for writing; when this ' +
'limit is reached, reads from the remote cluster will be deferred until the number of queued ' +
'operations goes below the limit.'
}
),
label: i18n.translate(
Expand All @@ -181,9 +181,9 @@ export const advancedSettingsFields = [
),
description: i18n.translate(
'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxWriteBufferSizeDescription', {
defaultMessage: `The maximum total bytes of operations that can be queued for writing; when
this limit is reached, reads from the remote cluster will be deferred until the total bytes
of queued operations goes below the limit.`
defaultMessage: 'The maximum total bytes of operations that can be queued for writing; when ' +
'this limit is reached, reads from the remote cluster will be deferred until the total bytes ' +
'of queued operations goes below the limit.'
}
),
label: i18n.translate(
Expand All @@ -202,8 +202,8 @@ export const advancedSettingsFields = [
),
description: i18n.translate(
'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxRetryDelayDescription', {
defaultMessage: `The maximum time to wait before retrying an operation that failed exceptionally;
an exponential backoff strategy is employed when retrying.`
defaultMessage: 'The maximum time to wait before retrying an operation that failed exceptionally; ' +
'an exponential backoff strategy is employed when retrying.'
}
),
label: i18n.translate(
Expand All @@ -222,10 +222,10 @@ export const advancedSettingsFields = [
),
description: i18n.translate(
'xpack.crossClusterReplication.followerIndexForm.advancedSettings.readPollTimeoutDescription', {
defaultMessage: `The maximum time to wait for new operations on the remote cluster when the
follower index is synchronized with the leader index; when the timeout has elapsed, the
poll for operations will return to the follower so that it can update some statistics, and
then the follower will immediately attempt to read from the leader again.`
defaultMessage: 'The maximum time to wait for new operations on the remote cluster when the ' +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maryia-lapata The fact that we can't use template literals for multiple lines, is it because the translators don't have the text wrapped in their translation tool? It seems like going backward for us 😊 (as template literals were brought to solve this concatenating problem)

'follower index is synchronized with the leader index; when the timeout has elapsed, the ' +
'poll for operations will return to the follower so that it can update some statistics, and ' +
'then the follower will immediately attempt to read from the leader again.'
}
),
label: i18n.translate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import React, { PureComponent, Fragment } from 'react';
import PropTypes from 'prop-types';
import { debounce } from 'lodash';
import { i18n } from '@kbn/i18n';
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
import { FormattedMessage } from '@kbn/i18n/react';
import { INDEX_ILLEGAL_CHARACTERS_VISIBLE } from 'ui/indices';
import { fatalError } from 'ui/notify';

Expand Down Expand Up @@ -83,8 +83,7 @@ export const updateFormErrors = (errors) => ({ fieldsErrors }) => ({
}
});

export const FollowerIndexForm = injectI18n(
class extends PureComponent {
export class FollowerIndexForm extends PureComponent {
static propTypes = {
saveFollowerIndex: PropTypes.func.isRequired,
clearApiError: PropTypes.func.isRequired,
Expand Down Expand Up @@ -284,22 +283,21 @@ export const FollowerIndexForm = injectI18n(
* Sections Renders
*/
renderApiErrors() {
const { apiError, intl } = this.props;
const { apiError } = this.props;

if (apiError) {
const title = intl.formatMessage({
id: 'xpack.crossClusterReplication.followerIndexForm.savingErrorTitle',
const title = i18n.translate('xpack.crossClusterReplication.followerIndexForm.savingErrorTitle', {
defaultMessage: `Can't create follower index`,
});
const { leaderIndex } = this.state.followerIndex;
const error = apiError.status === 404
? {
data: {
message: intl.formatMessage({
id: 'xpack.crossClusterReplication.followerIndexForm.leaderIndexNotFoundError',
message: i18n.translate('xpack.crossClusterReplication.followerIndexForm.leaderIndexNotFoundError', {
defaultMessage: `The leader index '{leaderIndex}' does not exist.`,
}, { leaderIndex })
}
values: { leaderIndex },
}),
},
}
: apiError;

Expand Down Expand Up @@ -334,7 +332,7 @@ export const FollowerIndexForm = injectI18n(
<p>
<FormattedMessage
id="xpack.crossClusterReplication.followerIndexForm.indexNameValidatingLabel"
defaultMessage="Checking availability..."
defaultMessage="Checking availability"
/>
</p>
)}
Expand Down Expand Up @@ -714,6 +712,3 @@ export const FollowerIndexForm = injectI18n(
);
}
}
);


Loading