Skip to content

Commit

Permalink
Localize reindexing flyout
Browse files Browse the repository at this point in the history
  • Loading branch information
joshdover committed Feb 11, 2019
1 parent 409320a commit 24a21cc
Show file tree
Hide file tree
Showing 10 changed files with 513 additions and 249 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import React, { Fragment, ReactNode } from 'react';
import { Subscription } from 'rxjs';

import { EuiButton, EuiLoadingSpinner } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { kfetch } from 'ui/kfetch';
import { ReindexStatus, UIReindexOption } from '../../../../../../common/types';
import { LoadingState } from '../../../../types';
Expand Down Expand Up @@ -63,11 +64,21 @@ export class ReindexButton extends React.Component<ReindexButtonProps, ReindexBu
const { flyoutVisible, reindexState } = this.state;

const buttonProps: any = { size: 's', onClick: this.showFlyout };
let buttonContent: ReactNode = 'Reindex';
let buttonContent: ReactNode = (
<FormattedMessage
id="xpack.upgradeAssistant.checkupTab.reindexing.reindexButton.reindexLabel"
defaultMessage="Reindex"
/>
);

if (reindexState.loadingState === LoadingState.Loading) {
buttonProps.disabled = true;
buttonContent = 'Loading…';
buttonContent = (
<FormattedMessage
id="xpack.upgradeAssistant.checkupTab.reindexing.reindexButton.loadingLabel"
defaultMessage="Loading…"
/>
);
} else {
switch (reindexState.status) {
case ReindexStatus.inProgress:
Expand All @@ -81,24 +92,44 @@ export class ReindexButton extends React.Component<ReindexButtonProps, ReindexBu
buttonProps.color = 'secondary';
buttonProps.iconSide = 'left';
buttonProps.iconType = 'check';
buttonContent = 'Done';
buttonContent = (
<FormattedMessage
id="xpack.upgradeAssistant.checkupTab.reindexing.reindexButton.doneLabel"
defaultMessage="Done"
/>
);
break;
case ReindexStatus.failed:
buttonProps.color = 'danger';
buttonProps.iconSide = 'left';
buttonProps.iconType = 'cross';
buttonContent = 'Failed';
buttonContent = (
<FormattedMessage
id="xpack.upgradeAssistant.checkupTab.reindexing.reindexButton.failedLabel"
defaultMessage="Failed"
/>
);
break;
case ReindexStatus.paused:
buttonProps.color = 'warning';
buttonProps.iconSide = 'left';
buttonProps.iconType = 'pause';
buttonContent = 'Paused';
buttonContent = (
<FormattedMessage
id="xpack.upgradeAssistant.checkupTab.reindexing.reindexButton.pausedLabel"
defaultMessage="Paused"
/>
);
case ReindexStatus.cancelled:
buttonProps.color = 'danger';
buttonProps.iconSide = 'left';
buttonProps.iconType = 'cross';
buttonContent = 'Cancelled';
buttonContent = (
<FormattedMessage
id="xpack.upgradeAssistant.checkupTab.reindexing.reindexButton.cancelledLabel"
defaultMessage="Cancelled"
/>
);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,29 @@ exports[`ChecklistFlyout renders 1`] = `
color="warning"
iconType="alert"
size="m"
title="Index is unable to ingest, update, or delete documents while reindexing"
title={
<FormattedMessage
defaultMessage="Index is unable to ingest, update, or delete documents while reindexing"
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.readonlyCallout.calloutTitle"
values={Object {}}
/>
}
>
<p>
If you can’t stop document updates or need to reindex into a new cluster, consider using a different upgrade strategy.
<FormattedMessage
defaultMessage="If you can’t stop document updates or need to reindex into a new cluster,
consider using a different upgrade strategy."
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.readonlyCallout.cantStopDetail"
values={Object {}}
/>
</p>
<p>
Reindexing will continue in the background, but if Kibana shuts down or restarts you will need to return to this page to resume reindexing.
<FormattedMessage
defaultMessage="Reindexing will continue in the background, but if Kibana shuts down or restarts you will
need to return to this page to resume reindexing."
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.readonlyCallout.backgroundResumeDetail"
values={Object {}}
/>
</p>
</EuiCallOut>
<EuiSpacer
Expand All @@ -24,7 +40,11 @@ exports[`ChecklistFlyout renders 1`] = `
textTransform="none"
>
<h3>
Reindexing process
<FormattedMessage
defaultMessage="Reindexing process"
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklistTitle"
values={Object {}}
/>
</h3>
</EuiTitle>
<Component
Expand Down Expand Up @@ -66,7 +86,11 @@ exports[`ChecklistFlyout renders 1`] = `
onClick={[MockFunction]}
type="button"
>
Close
<FormattedMessage
defaultMessage="Close"
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.closeButtonLabel"
values={Object {}}
/>
</EuiButtonEmpty>
</EuiFlexItem>
<EuiFlexItem
Expand All @@ -82,7 +106,11 @@ exports[`ChecklistFlyout renders 1`] = `
onClick={[MockFunction]}
type="button"
>
Run reindex
<FormattedMessage
defaultMessage="Run reindex"
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.startLabel"
values={Object {}}
/>
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Loading

0 comments on commit 24a21cc

Please sign in to comment.