Skip to content

Commit

Permalink
fixed i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
gmmorris committed Nov 10, 2020
1 parent b6df73b commit 72f0816
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const ExpressionWithPopover: ({
iconType="cross"
color="danger"
aria-label={i18n.translate(
'xpack.triggersActionsUI.sections.alertAdd.geoThreshold.closePopoverLabel',
'xpack.stackAlerts.geoThreshold.ui.expressionPopover.closePopoverLabel',
{
defaultMessage: 'Close',
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const IndexThresholdAlertTypeExpression: React.FunctionComponent<AlertTyp
);

const expressionErrorMessage = i18n.translate(
'xpack.triggersActionsUI.sections.alertAdd.threshold.fixErrorInExpressionBelowValidationMessage',
'xpack.stackAlerts.threshold.ui.alertParams.fixErrorInExpressionBelowValidationMessage',
{
defaultMessage: 'Expression contains errors.',
}
Expand Down Expand Up @@ -158,15 +158,15 @@ export const IndexThresholdAlertTypeExpression: React.FunctionComponent<AlertTyp
fullWidth
label={
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertAdd.threshold.indicesToQueryLabel"
id="xpack.stackAlerts.threshold.ui.alertParams.indicesToQueryLabel"
defaultMessage="Indices to query"
/>
}
isInvalid={errors.index.length > 0 && index !== undefined}
error={errors.index}
helpText={
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertAdd.threshold.howToBroadenSearchQueryDescription"
id="xpack.stackAlerts.threshold.ui.alertParams.howToBroadenSearchQueryDescription"
defaultMessage="Use * to broaden your query."
/>
}
Expand Down Expand Up @@ -232,7 +232,7 @@ export const IndexThresholdAlertTypeExpression: React.FunctionComponent<AlertTyp
fullWidth
label={
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertAdd.threshold.timeFieldLabel"
id="xpack.stackAlerts.threshold.ui.alertParams.timeFieldLabel"
defaultMessage="Time field"
/>
}
Expand Down Expand Up @@ -283,7 +283,7 @@ export const IndexThresholdAlertTypeExpression: React.FunctionComponent<AlertTyp
<EuiTitle size="xs">
<h5>
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertAdd.selectIndex"
id="xpack.stackAlerts.threshold.ui.selectIndex"
defaultMessage="Select an index"
/>
</h5>
Expand All @@ -295,12 +295,9 @@ export const IndexThresholdAlertTypeExpression: React.FunctionComponent<AlertTyp
<EuiExpression
display="columns"
data-test-subj="selectIndexExpression"
description={i18n.translate(
'xpack.triggersActionsUI.sections.alertAdd.threshold.indexLabel',
{
defaultMessage: 'index',
}
)}
description={i18n.translate('xpack.stackAlerts.threshold.ui.alertParams.indexLabel', {
defaultMessage: 'index',
})}
value={index && index.length > 0 ? renderIndices(index) : firstFieldOption.text}
isActive={indexPopoverOpen}
onClick={() => {
Expand All @@ -320,20 +317,17 @@ export const IndexThresholdAlertTypeExpression: React.FunctionComponent<AlertTyp
<EuiPopoverTitle>
<EuiFlexGroup alignItems="center" gutterSize="s">
<EuiFlexItem>
{i18n.translate(
'xpack.triggersActionsUI.sections.alertAdd.threshold.indexButtonLabel',
{
defaultMessage: 'index',
}
)}
{i18n.translate('xpack.stackAlerts.threshold.ui.alertParams.indexButtonLabel', {
defaultMessage: 'index',
})}
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonIcon
data-test-subj="closePopover"
iconType="cross"
color="danger"
aria-label={i18n.translate(
'xpack.triggersActionsUI.sections.alertAdd.threshold.closeIndexPopoverLabel',
'xpack.stackAlerts.threshold.ui.alertParams.closeIndexPopoverLabel',
{
defaultMessage: 'Close',
}
Expand Down Expand Up @@ -385,7 +379,7 @@ export const IndexThresholdAlertTypeExpression: React.FunctionComponent<AlertTyp
<EuiTitle size="xs">
<h5>
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertAdd.conditionPrompt"
id="xpack.stackAlerts.threshold.ui.conditionPrompt"
defaultMessage="Define the condition"
/>
</h5>
Expand Down Expand Up @@ -426,7 +420,7 @@ export const IndexThresholdAlertTypeExpression: React.FunctionComponent<AlertTyp
body={
<EuiText color="subdued">
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertAdd.previewAlertVisualizationDescription"
id="xpack.stackAlerts.threshold.ui.previewAlertVisualizationDescription"
defaultMessage="Complete the expression to generate a preview."
/>
</EuiText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import { AlertTypeModel, AlertsContextValue } from '../../../../triggers_actions
export function getAlertType(): AlertTypeModel<IndexThresholdAlertParams, AlertsContextValue> {
return {
id: '.index-threshold',
name: i18n.translate('xpack.triggersActionsUI.indexThresholdAlert.nameText', {
name: i18n.translate('xpack.stackAlerts.threshold.ui.alertType.nameText', {
defaultMessage: 'Index threshold',
}),
description: i18n.translate('xpack.triggersActionsUI.indexThresholdAlert.descriptionText', {
description: i18n.translate('xpack.stackAlerts.threshold.ui.alertType.descriptionText', {
defaultMessage: 'Alert when an aggregated query meets the threshold.',
}),
iconClass: 'alert',
Expand All @@ -25,7 +25,7 @@ export function getAlertType(): AlertTypeModel<IndexThresholdAlertParams, Alerts
alertParamsExpression: lazy(() => import('./expression')),
validate: validateExpression,
defaultActionMessage: i18n.translate(
'xpack.triggersActionsUI.components.builtinAlertTypes.threshold.alertDefaultActionMessage',
'xpack.stackAlerts.threshold.ui.alertType.defaultActionMessage',
{
defaultMessage: `alert \\{\\{alertName\\}\\} group \\{\\{context.group\\}\\} value \\{\\{context.value\\}\\} exceeded threshold \\{\\{context.function\\}\\} over \\{\\{params.timeWindowSize\\}\\}\\{\\{params.timeWindowUnit\\}\\} on \\{\\{context.date\\}\\}`,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@ export const validateExpression = (alertParams: IndexThresholdAlertParams): Vali
validationResult.errors = errors;
if (!index || index.length === 0) {
errors.index.push(
i18n.translate('xpack.triggersActionsUI.sections.addAlert.error.requiredIndexText', {
i18n.translate('xpack.stackAlerts.threshold.ui.validation.error.requiredIndexText', {
defaultMessage: 'Index is required.',
})
);
}
if (!timeField) {
errors.timeField.push(
i18n.translate('xpack.triggersActionsUI.sections.addAlert.error.requiredTimeFieldText', {
i18n.translate('xpack.stackAlerts.threshold.ui.validation.error.requiredTimeFieldText', {
defaultMessage: 'Time field is required.',
})
);
}
if (aggType && builtInAggregationTypes[aggType].fieldRequired && !aggField) {
errors.aggField.push(
i18n.translate('xpack.triggersActionsUI.sections.addAlert.error.requiredAggFieldText', {
i18n.translate('xpack.stackAlerts.threshold.ui.validation.error.requiredAggFieldText', {
defaultMessage: 'Aggregation field is required.',
})
);
Expand All @@ -65,7 +65,7 @@ export const validateExpression = (alertParams: IndexThresholdAlertParams): Vali
!termSize
) {
errors.termSize.push(
i18n.translate('xpack.triggersActionsUI.sections.addAlert.error.requiredTermSizedText', {
i18n.translate('xpack.stackAlerts.threshold.ui.validation.error.requiredTermSizedText', {
defaultMessage: 'Term size is required.',
})
);
Expand All @@ -77,21 +77,21 @@ export const validateExpression = (alertParams: IndexThresholdAlertParams): Vali
!termField
) {
errors.termField.push(
i18n.translate('xpack.triggersActionsUI.sections.addAlert.error.requiredtTermFieldText', {
i18n.translate('xpack.stackAlerts.threshold.ui.validation.error.requiredTermFieldText', {
defaultMessage: 'Term field is required.',
})
);
}
if (!timeWindowSize) {
errors.timeWindowSize.push(
i18n.translate('xpack.triggersActionsUI.sections.addAlert.error.requiredTimeWindowSizeText', {
i18n.translate('xpack.stackAlerts.threshold.ui.validation.error.requiredTimeWindowSizeText', {
defaultMessage: 'Time window size is required.',
})
);
}
if (!threshold || threshold.length === 0 || threshold[0] === undefined) {
errors.threshold0.push(
i18n.translate('xpack.triggersActionsUI.sections.addAlert.error.requiredThreshold0Text', {
i18n.translate('xpack.stackAlerts.threshold.ui.validation.error.requiredThreshold0Text', {
defaultMessage: 'Threshold0 is required.',
})
);
Expand All @@ -104,14 +104,14 @@ export const validateExpression = (alertParams: IndexThresholdAlertParams): Vali
(threshold && threshold.length < builtInComparators[thresholdComparator!].requiredValues))
) {
errors.threshold1.push(
i18n.translate('xpack.triggersActionsUI.sections.addAlert.error.requiredThreshold1Text', {
i18n.translate('xpack.stackAlerts.threshold.ui.validation.error.requiredThreshold1Text', {
defaultMessage: 'Threshold1 is required.',
})
);
}
if (threshold && threshold.length === 2 && threshold[0] > threshold[1]) {
errors.threshold1.push(
i18n.translate('xpack.triggersActionsUI.sections.addAlert.error.greaterThenThreshold0Text', {
i18n.translate('xpack.stackAlerts.threshold.ui.validation.error.greaterThenThreshold0Text', {
defaultMessage: 'Threshold1 should be > Threshold0.',
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export const ThresholdVisualization: React.FunctionComponent<Props> = ({
if (toastNotifications) {
toastNotifications.addDanger({
title: i18n.translate(
'xpack.triggersActionsUI.sections.alertAdd.unableToLoadVisualizationMessage',
'xpack.stackAlerts.threshold.ui.visualization.unableToLoadVisualizationMessage',
{ defaultMessage: 'Unable to load visualization' }
),
});
Expand Down Expand Up @@ -205,7 +205,7 @@ export const ThresholdVisualization: React.FunctionComponent<Props> = ({
body={
<EuiText color="subdued">
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertAdd.loadingAlertVisualizationDescription"
id="xpack.stackAlerts.threshold.ui.visualization.loadingAlertVisualizationDescription"
defaultMessage="Loading alert visualization…"
/>
</EuiText>
Expand All @@ -221,7 +221,7 @@ export const ThresholdVisualization: React.FunctionComponent<Props> = ({
<EuiCallOut
title={
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertAdd.errorLoadingAlertVisualizationTitle"
id="xpack.stackAlerts.threshold.ui.visualization.errorLoadingAlertVisualizationTitle"
defaultMessage="Cannot load alert visualization"
values={{}}
/>
Expand Down Expand Up @@ -311,14 +311,14 @@ export const ThresholdVisualization: React.FunctionComponent<Props> = ({
size="s"
title={
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertAdd.thresholdPreviewChart.noDataTitle"
id="xpack.stackAlerts.threshold.ui.visualization.thresholdPreviewChart.noDataTitle"
defaultMessage="No data matches this query"
/>
}
color="warning"
>
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertAdd.thresholdPreviewChart.dataDoesNotExistTextMessage"
id="xpack.stackAlerts.threshold.ui.visualization.thresholdPreviewChart.dataDoesNotExistTextMessage"
defaultMessage="Check that your time range and filters are correct."
/>
</EuiCallOut>
Expand Down
Loading

0 comments on commit 72f0816

Please sign in to comment.