Skip to content

Commit

Permalink
Fixed eslint issues and added labels for buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
yuliacech committed Feb 15, 2021
1 parent c806392 commit d2f49db
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ import { usePhaseTimings } from '../../form';

import { InfinityIconSvg } from '../infinity_icon/infinity_icon.svg';

const deleteDataLabel = i18n.translate(
'xpack.indexLifecycleMgmt.editPolicy.phaseTiming.beforeDeleteDescription',
{
defaultMessage: 'Delete data after this phase',
}
);

const keepDataLabel = i18n.translate(
'xpack.indexLifecycleMgmt.editPolicy.phaseTiming.foreverTimingDescription',
{
defaultMessage: 'Keep data in this phase forever',
}
);

interface Props {
phase: PhasesExceptDelete;
}
Expand All @@ -31,38 +45,19 @@ export const PhaseFooter: FunctionComponent<Props> = ({ phase }) => {
if (!phaseConfiguration.isFinalDataPhase) {
return null;
}

const phaseDescription = isDeletePhaseEnabled
? i18n.translate('xpack.indexLifecycleMgmt.editPolicy.phaseTiming.beforeDeleteDescription', {
defaultMessage: 'Delete data after this phase',
})
: i18n.translate('xpack.indexLifecycleMgmt.editPolicy.phaseTiming.foreverTimingDescription', {
defaultMessage: 'Keep data in this phase forever',
});

const selectedButton = isDeletePhaseEnabled
? 'ilmEnableDeletePhaseButton'
: 'ilmDisableDeletePhaseButton';

const buttons = [
{
id: `ilmDisableDeletePhaseButton`,
label: i18n.translate(
'xpack.indexLifecycleMgmt.editPolicy.deletePhase.disablePhaseButtonLabel',
{
defaultMessage: 'Keep data in this phase forever',
}
),
label: keepDataLabel,
iconType: InfinityIconSvg,
},
{
id: `ilmEnableDeletePhaseButton`,
label: i18n.translate(
'xpack.indexLifecycleMgmt.editPolicy.deletePhase.enablePhaseButtonLabel',
{
defaultMessage: 'Delete data after this phase',
}
),
label: deleteDataLabel,
iconType: 'trash',
'data-test-subj': 'enableDeletePhaseButton',
},
Expand All @@ -72,7 +67,7 @@ export const PhaseFooter: FunctionComponent<Props> = ({ phase }) => {
<EuiFlexGroup alignItems="center" gutterSize="s" wrap>
<EuiFlexItem grow={false}>
<EuiText size="s" color="subdued">
{phaseDescription}
{isDeletePhaseEnabled ? deleteDataLabel : keepDataLabel}
</EuiText>
</EuiFlexItem>
<EuiFlexItem grow={false}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,12 @@ export const i18nTexts = {
}),
cold: i18n.translate('xpack.indexLifecycleMgmt.editPolicy.coldPhase.coldPhaseDescription', {
defaultMessage:
'Move data to the cold tier, which is optimized for cost savings over search performance. Data is normally read-only in the cold phase.,
'Move data to the cold tier, which is optimized for cost savings over search performance. Data is normally read-only in the cold phase.',
}),
delete: i18n.translate(
'xpack.indexLifecycleMgmt.editPolicy.deletePhase.deletePhaseDescription',
{
defaultMessage:
'Delete data you no longer need.',
defaultMessage: 'Delete data you no longer need.',
}
),
},
Expand Down

0 comments on commit d2f49db

Please sign in to comment.