UI changes due to the text review (#61019)

* Fixed UI due to text review

* Fixed due to comments

* Fixed due to review comments
This commit is contained in:
Yuliia Naumenko 2020-03-24 10:11:36 -07:00 committed by GitHub
parent 03877d09ef
commit 5ff4c4ca6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 346 additions and 251 deletions

View file

@ -137,7 +137,7 @@ export function getActionType(): ActionTypeModel {
const errorText = i18n.translate(
'xpack.triggersActionsUI.components.builtinActionTypes.error.requiredEntryText',
{
defaultMessage: 'No [to], [cc], or [bcc] entries. At least one entry is required.',
defaultMessage: 'No To, Cc, or Bcc entry. At least one entry is required.',
}
);
errors.to.push(errorText);
@ -396,7 +396,7 @@ const EmailParamsFields: React.FunctionComponent<ActionParamsProps<EmailActionPa
label={i18n.translate(
'xpack.triggersActionsUI.sections.builtinActionTypes.emailAction.recipientTextFieldLabel',
{
defaultMessage: 'To:',
defaultMessage: 'To',
}
)}
labelAppend={
@ -405,7 +405,7 @@ const EmailParamsFields: React.FunctionComponent<ActionParamsProps<EmailActionPa
{!addCC ? (
<EuiButtonEmpty size="xs" onClick={() => setAddCC(true)}>
<FormattedMessage
defaultMessage="Add CC"
defaultMessage="Add Cc"
id="xpack.triggersActionsUI.sections.builtinActionTypes.emailAction.addCcButton"
/>
</EuiButtonEmpty>
@ -415,7 +415,7 @@ const EmailParamsFields: React.FunctionComponent<ActionParamsProps<EmailActionPa
<FormattedMessage
defaultMessage="{titleBcc}"
id="xpack.triggersActionsUI.sections.builtinActionTypes.emailAction.addBccButton"
values={{ titleBcc: !addCC ? '/ BCC' : 'Add BCC' }}
values={{ titleBcc: !addCC ? '/ Bcc' : 'Add Bcc' }}
/>
</EuiButtonEmpty>
) : null}
@ -459,7 +459,7 @@ const EmailParamsFields: React.FunctionComponent<ActionParamsProps<EmailActionPa
label={i18n.translate(
'xpack.triggersActionsUI.sections.builtinActionTypes.emailAction.recipientCopyTextFieldLabel',
{
defaultMessage: 'Cc:',
defaultMessage: 'Cc',
}
)}
>
@ -500,7 +500,7 @@ const EmailParamsFields: React.FunctionComponent<ActionParamsProps<EmailActionPa
label={i18n.translate(
'xpack.triggersActionsUI.sections.builtinActionTypes.emailAction.recipientBccTextFieldLabel',
{
defaultMessage: 'Bcc:',
defaultMessage: 'Bcc',
}
)}
>
@ -540,7 +540,7 @@ const EmailParamsFields: React.FunctionComponent<ActionParamsProps<EmailActionPa
label={i18n.translate(
'xpack.triggersActionsUI.sections.builtinActionTypes.emailAction.subjectTextFieldLabel',
{
defaultMessage: 'Subject:',
defaultMessage: 'Subject',
}
)}
>
@ -550,7 +550,6 @@ const EmailParamsFields: React.FunctionComponent<ActionParamsProps<EmailActionPa
name="subject"
data-test-subj="emailSubjectInput"
value={subject || ''}
placeholder="Text field (placeholder)"
onChange={e => {
editAction('subject', e.target.value, index);
}}
@ -568,7 +567,7 @@ const EmailParamsFields: React.FunctionComponent<ActionParamsProps<EmailActionPa
label={i18n.translate(
'xpack.triggersActionsUI.sections.builtinActionTypes.emailAction.messageTextAreaFieldLabel',
{
defaultMessage: 'Message:',
defaultMessage: 'Message',
}
)}
labelAppend={

View file

@ -42,6 +42,12 @@ export function getActionType(): ActionTypeModel {
defaultMessage: 'Index data into Elasticsearch.',
}
),
actionTypeTitle: i18n.translate(
'xpack.triggersActionsUI.components.builtinActionTypes.indexAction.actionTypeTitle',
{
defaultMessage: 'Index data',
}
),
validateConnector: (action: EsIndexActionConnector): ValidationResult => {
const validationResult = { errors: {} };
const errors = {
@ -179,7 +185,7 @@ const IndexActionConnectorFields: React.FunctionComponent<ActionConnectorFieldsP
<>
<FormattedMessage
id="xpack.triggersActionsUI.components.builtinActionTypes.indexAction.refreshLabel"
defaultMessage="Refresh"
defaultMessage="Refresh index"
/>{' '}
<EuiIconTip
position="right"

View file

@ -125,7 +125,7 @@ const PagerDutyActionConnectorFields: React.FunctionComponent<ActionConnectorFie
>
<FormattedMessage
id="xpack.triggersActionsUI.components.builtinActionTypes.pagerDutyAction.routingKeyNameHelpLabel"
defaultMessage="Learn how to configure PagerDuty Accounts"
defaultMessage="Configure a PagerDuty account."
/>
</EuiLink>
}
@ -270,12 +270,20 @@ const PagerDutyParamsFields: React.FunctionComponent<ActionParamsProps<PagerDuty
</EuiContextMenuItem>
));
const addVariableButtonTitle = i18n.translate(
'xpack.triggersActionsUI.components.builtinActionTypes.pagerDutyAction.addVariableTitle',
{
defaultMessage: 'Add alert variable',
}
);
const getAddVariableComponent = (paramsProperty: string, buttonName: string) => {
return (
<EuiPopover
button={
<EuiButtonIcon
data-test-subj={`${paramsProperty}AddVariableButton`}
title={addVariableButtonTitle}
onClick={() =>
setIsVariablesPopoverOpen({ ...isVariablesPopoverOpen, [paramsProperty]: true })
}

View file

@ -134,6 +134,12 @@ export const ServerLogParamsFields: React.FunctionComponent<ActionParamsProps<
<EuiButtonIcon
onClick={() => setIsVariablesPopoverOpen(true)}
iconType="indexOpen"
title={i18n.translate(
'xpack.triggersActionsUI.components.builtinActionTypes.serverLogAction.addVariableTitle',
{
defaultMessage: 'Add variable',
}
)}
aria-label={i18n.translate(
'xpack.triggersActionsUI.components.builtinActionTypes.serverLogAction.addVariablePopoverButton',
{

View file

@ -98,7 +98,7 @@ const SlackActionFields: React.FunctionComponent<ActionConnectorFieldsProps<
>
<FormattedMessage
id="xpack.triggersActionsUI.components.builtinActionTypes.slackAction.webhookUrlHelpLabel"
defaultMessage="Learn how to create a Slack webhook URL"
defaultMessage="Create a Slack webhook URL"
/>
</EuiLink>
}
@ -115,7 +115,7 @@ const SlackActionFields: React.FunctionComponent<ActionConnectorFieldsProps<
fullWidth
isInvalid={errors.webhookUrl.length > 0 && webhookUrl !== undefined}
name="webhookUrl"
placeholder="URL like https://hooks.slack.com/services"
placeholder="Example: https://hooks.slack.com/services"
value={webhookUrl || ''}
data-test-subj="slackWebhookUrlInput"
onChange={e => {
@ -182,10 +182,16 @@ const SlackParamsFields: React.FunctionComponent<ActionParamsProps<SlackActionPa
data-test-subj="slackAddVariableButton"
onClick={() => setIsVariablesPopoverOpen(true)}
iconType="indexOpen"
title={i18n.translate(
'xpack.triggersActionsUI.components.builtinActionTypes.slackAction.addVariableTitle',
{
defaultMessage: 'Add alert variable',
}
)}
aria-label={i18n.translate(
'xpack.triggersActionsUI.components.builtinActionTypes.slackAction.addVariablePopoverButton',
{
defaultMessage: 'Add variable',
defaultMessage: 'Add alert variable',
}
)}
/>

View file

@ -47,6 +47,12 @@ export function getActionType(): ActionTypeModel {
defaultMessage: 'Send a request to a web service.',
}
),
actionTypeTitle: i18n.translate(
'xpack.triggersActionsUI.components.builtinActionTypes.webhookAction.actionTypeTitle',
{
defaultMessage: 'Webhook data',
}
),
validateConnector: (action: WebhookActionConnector): ValidationResult => {
const validationResult = { errors: {} };
const errors = {
@ -142,7 +148,7 @@ const WebhookActionConnectorFields: React.FunctionComponent<ActionConnectorField
i18n.translate(
'xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredHeaderKeyText',
{
defaultMessage: 'Header key is required.',
defaultMessage: 'Key is required.',
}
)
);
@ -152,7 +158,7 @@ const WebhookActionConnectorFields: React.FunctionComponent<ActionConnectorField
i18n.translate(
'xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredHeaderValueText',
{
defaultMessage: 'Header value is required.',
defaultMessage: 'Value is required.',
}
)
);
@ -195,7 +201,7 @@ const WebhookActionConnectorFields: React.FunctionComponent<ActionConnectorField
<EuiTitle size="xxs">
<h5>
<FormattedMessage
defaultMessage="Add a new header"
defaultMessage="Add header"
id="xpack.triggersActionsUI.components.builtinActionTypes.webhookAction.addHeader"
/>
</h5>
@ -496,6 +502,12 @@ const WebhookParamsFields: React.FunctionComponent<ActionParamsProps<WebhookActi
data-test-subj="webhookAddVariableButton"
onClick={() => setIsVariablesPopoverOpen(true)}
iconType="indexOpen"
title={i18n.translate(
'xpack.triggersActionsUI.components.builtinActionTypes.webhookAction.addVariableTitle',
{
defaultMessage: 'Add variable',
}
)}
aria-label={i18n.translate(
'xpack.triggersActionsUI.components.builtinActionTypes.webhookAction.addVariablePopoverButton',
{

View file

@ -10,7 +10,6 @@ import { FormattedMessage } from '@kbn/i18n/react';
import {
EuiFlexItem,
EuiFlexGroup,
EuiFormLabel,
EuiExpression,
EuiPopover,
EuiPopoverTitle,
@ -23,6 +22,8 @@ import {
EuiEmptyPrompt,
EuiText,
} from '@elastic/eui';
import { EuiSteps } from '@elastic/eui';
import { EuiButtonIcon } from '@elastic/eui';
import {
firstFieldOption,
getIndexPatterns,
@ -213,6 +214,7 @@ export const IndexThresholdAlertTypeExpression: React.FunctionComponent<IndexThr
timeWindowUnit: DEFAULT_VALUES.TIME_WINDOW_UNIT,
groupBy: DEFAULT_VALUES.GROUP_BY,
threshold: DEFAULT_VALUES.THRESHOLD,
timeField: '',
});
return;
}
@ -271,6 +273,164 @@ export const IndexThresholdAlertTypeExpression: React.FunctionComponent<IndexThr
</Fragment>
);
const firstSetOfSteps = [
{
title: i18n.translate('xpack.triggersActionsUI.sections.alertAdd.selectIndex', {
defaultMessage: 'Select an index.',
}),
children: (
<>
<EuiFlexGroup wrap>
<EuiFlexItem grow={false}>
<EuiPopover
id="indexPopover"
button={
<EuiExpression
data-test-subj="selectIndexExpression"
description={i18n.translate(
'xpack.triggersActionsUI.sections.alertAdd.threshold.indexLabel',
{
defaultMessage: 'index',
}
)}
value={index ? index.join(' ') : firstFieldOption.text}
isActive={indexPopoverOpen}
onClick={() => {
setIndexPopoverOpen(true);
}}
color={index ? 'secondary' : 'danger'}
/>
}
isOpen={indexPopoverOpen}
closePopover={() => {
setIndexPopoverOpen(false);
}}
ownFocus
withTitle
anchorPosition="downLeft"
zIndex={8000}
>
<div style={{ width: '450px' }}>
<EuiPopoverTitle>
<EuiFlexGroup alignItems="center" gutterSize="s">
<EuiFlexItem>
{i18n.translate(
'xpack.triggersActionsUI.sections.alertAdd.threshold.indexButtonLabel',
{
defaultMessage: 'index',
}
)}
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonIcon
iconType="cross"
color="danger"
aria-label={i18n.translate(
'xpack.triggersActionsUI.sections.alertAdd.threshold.closeIndexPopoverLabel',
{
defaultMessage: 'Close',
}
)}
onClick={() => {
setIndexPopoverOpen(false);
}}
/>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPopoverTitle>
{indexPopover}
</div>
</EuiPopover>
</EuiFlexItem>
</EuiFlexGroup>
<EuiFlexGroup>
<EuiFlexItem grow={false}>
<WhenExpression
aggType={aggType ?? DEFAULT_VALUES.AGGREGATION_TYPE}
onChangeSelectedAggType={(selectedAggType: string) =>
setAlertParams('aggType', selectedAggType)
}
/>
</EuiFlexItem>
{aggType && builtInAggregationTypes[aggType].fieldRequired ? (
<EuiFlexItem grow={false}>
<OfExpression
aggField={aggField}
fields={esFields}
aggType={aggType}
errors={errors}
onChangeSelectedAggField={(selectedAggField?: string) =>
setAlertParams('aggField', selectedAggField)
}
/>
</EuiFlexItem>
) : null}
</EuiFlexGroup>
<EuiFlexGroup>
<EuiFlexItem grow={false}>
<GroupByExpression
groupBy={groupBy || DEFAULT_VALUES.GROUP_BY}
termField={termField}
termSize={termSize}
errors={errors}
fields={esFields}
onChangeSelectedGroupBy={selectedGroupBy =>
setAlertParams('groupBy', selectedGroupBy)
}
onChangeSelectedTermField={selectedTermField =>
setAlertParams('termField', selectedTermField)
}
onChangeSelectedTermSize={selectedTermSize =>
setAlertParams('termSize', selectedTermSize)
}
/>
</EuiFlexItem>
</EuiFlexGroup>
</>
),
},
{
title: i18n.translate('xpack.triggersActionsUI.sections.alertAdd.conditionPrompt', {
defaultMessage: 'Define the condition.',
}),
children: (
<>
<EuiFlexGroup>
<EuiFlexItem grow={false}>
<ThresholdExpression
thresholdComparator={thresholdComparator ?? DEFAULT_VALUES.THRESHOLD_COMPARATOR}
threshold={threshold}
errors={errors}
popupPosition={'upLeft'}
onChangeSelectedThreshold={selectedThresholds =>
setAlertParams('threshold', selectedThresholds)
}
onChangeSelectedThresholdComparator={selectedThresholdComparator =>
setAlertParams('thresholdComparator', selectedThresholdComparator)
}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<ForLastExpression
popupPosition={'upLeft'}
timeWindowSize={timeWindowSize}
timeWindowUnit={timeWindowUnit}
errors={errors}
onChangeWindowSize={(selectedWindowSize: any) =>
setAlertParams('timeWindowSize', selectedWindowSize)
}
onChangeWindowUnit={(selectedWindowUnit: any) =>
setAlertParams('timeWindowUnit', selectedWindowUnit)
}
/>
</EuiFlexItem>
</EuiFlexGroup>
</>
),
},
];
return (
<Fragment>
{hasExpressionErrors ? (
@ -281,136 +441,7 @@ export const IndexThresholdAlertTypeExpression: React.FunctionComponent<IndexThr
</Fragment>
) : null}
<EuiSpacer size="l" />
<EuiFormLabel>
<FormattedMessage
defaultMessage="Select Index to query:"
id="xpack.triggersActionsUI.sections.alertAdd.selectIndex"
/>
</EuiFormLabel>
<EuiSpacer size="m" />
<EuiFlexGroup wrap>
<EuiFlexItem grow={false}>
<EuiPopover
id="indexPopover"
button={
<EuiExpression
data-test-subj="selectIndexExpression"
description={i18n.translate(
'xpack.triggersActionsUI.sections.alertAdd.threshold.indexLabel',
{
defaultMessage: 'index',
}
)}
value={index ? index.join(' ') : firstFieldOption.text}
isActive={indexPopoverOpen}
onClick={() => {
setIndexPopoverOpen(true);
}}
color={index ? 'secondary' : 'danger'}
/>
}
isOpen={indexPopoverOpen}
closePopover={() => {
setIndexPopoverOpen(false);
}}
ownFocus
withTitle
anchorPosition="downLeft"
zIndex={8000}
>
<div style={{ width: '450px' }}>
<EuiPopoverTitle>
{i18n.translate(
'xpack.triggersActionsUI.sections.alertAdd.threshold.indexButtonLabel',
{
defaultMessage: 'index',
}
)}
</EuiPopoverTitle>
{indexPopover}
</div>
</EuiPopover>
</EuiFlexItem>
</EuiFlexGroup>
<EuiFlexGroup>
<EuiFlexItem grow={false}>
<WhenExpression
aggType={aggType ?? DEFAULT_VALUES.AGGREGATION_TYPE}
onChangeSelectedAggType={(selectedAggType: string) =>
setAlertParams('aggType', selectedAggType)
}
/>
</EuiFlexItem>
{aggType && builtInAggregationTypes[aggType].fieldRequired ? (
<EuiFlexItem grow={false}>
<OfExpression
aggField={aggField}
fields={esFields}
aggType={aggType}
errors={errors}
onChangeSelectedAggField={(selectedAggField?: string) =>
setAlertParams('aggField', selectedAggField)
}
/>
</EuiFlexItem>
) : null}
</EuiFlexGroup>
<EuiFlexGroup>
<EuiFlexItem grow={false}>
<GroupByExpression
groupBy={groupBy || DEFAULT_VALUES.GROUP_BY}
termField={termField}
termSize={termSize}
errors={errors}
fields={esFields}
onChangeSelectedGroupBy={selectedGroupBy => setAlertParams('groupBy', selectedGroupBy)}
onChangeSelectedTermField={selectedTermField =>
setAlertParams('termField', selectedTermField)
}
onChangeSelectedTermSize={selectedTermSize =>
setAlertParams('termSize', selectedTermSize)
}
/>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size="xl" />
<EuiFormLabel>
<FormattedMessage
defaultMessage="Define the alert condition:"
id="xpack.triggersActionsUI.sections.alertAdd.conditionPrompt"
/>
</EuiFormLabel>
<EuiSpacer size="m" />
<EuiFlexGroup>
<EuiFlexItem grow={false}>
<ThresholdExpression
thresholdComparator={thresholdComparator ?? DEFAULT_VALUES.THRESHOLD_COMPARATOR}
threshold={threshold}
errors={errors}
popupPosition={'upLeft'}
onChangeSelectedThreshold={selectedThresholds =>
setAlertParams('threshold', selectedThresholds)
}
onChangeSelectedThresholdComparator={selectedThresholdComparator =>
setAlertParams('thresholdComparator', selectedThresholdComparator)
}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<ForLastExpression
popupPosition={'upLeft'}
timeWindowSize={timeWindowSize}
timeWindowUnit={timeWindowUnit}
errors={errors}
onChangeWindowSize={(selectedWindowSize: any) =>
setAlertParams('timeWindowSize', selectedWindowSize)
}
onChangeWindowUnit={(selectedWindowUnit: any) =>
setAlertParams('timeWindowUnit', selectedWindowUnit)
}
/>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSteps steps={firstSetOfSteps} />
<EuiSpacer size="l" />
<div className="actAlertVisualization__chart">
{canShowVizualization ? (
@ -422,7 +453,7 @@ export const IndexThresholdAlertTypeExpression: React.FunctionComponent<IndexThr
<EuiText color="subdued">
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertAdd.previewAlertVisualizationDescription"
defaultMessage="Complete the expression above to generate a preview"
defaultMessage="Complete the expression to generate a preview."
/>
</EuiText>
}

View file

@ -10,7 +10,7 @@ import { validateExpression } from './validation';
export function getAlertType(): AlertTypeModel {
return {
id: '.index-threshold',
name: 'Index Threshold',
name: 'Index threshold',
iconClass: 'alert',
alertParamsExpression: IndexThresholdAlertTypeExpression,
validate: validateExpression,

View file

@ -305,14 +305,14 @@ export const ThresholdVisualization: React.FunctionComponent<Props> = ({
title={
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertAdd.thresholdPreviewChart.noDataTitle"
defaultMessage="No data matches that query"
defaultMessage="No data matches this query"
/>
}
color="warning"
>
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertAdd.thresholdPreviewChart.dataDoesNotExistTextMessage"
defaultMessage="Check your time range and filters to make sure they are correct"
defaultMessage="Check that your time range and filters are correct."
/>
</EuiCallOut>
)}

View file

@ -17,6 +17,7 @@ import {
EuiTabs,
EuiTitle,
EuiBetaBadge,
EuiText,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
@ -28,6 +29,7 @@ import { hasShowActionsCapability, hasShowAlertsCapability } from './lib/capabil
import { ActionsConnectorsList } from './sections/actions_connectors_list/components/actions_connectors_list';
import { AlertsList } from './sections/alerts_list/components/alerts_list';
import { PLUGIN } from './constants/plugin';
interface MatchParams {
section: Section;
@ -100,12 +102,24 @@ export const TriggersActionsUIHome: React.FunctionComponent<RouteComponentProps<
'xpack.triggersActionsUI.home.betaBadgeTooltipContent',
{
defaultMessage:
'This module is not GA. Please help us by reporting any bugs.',
'{pluginName} is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.',
values: {
pluginName: PLUGIN.getI18nName(i18n),
},
}
)}
/>
</h1>
</EuiTitle>
<EuiSpacer size="s" />
<EuiText>
<p>
<FormattedMessage
id="xpack.triggersActionsUI.home.sectionDescription"
defaultMessage="Detect conditions using alerts, and take actions using connectors."
/>
</p>
</EuiText>
</EuiPageContentHeaderSection>
</EuiPageContentHeader>

View file

@ -43,11 +43,11 @@ test('returns isEnabled:false when action type is disabled by license', async ()
expect(checkActionTypeEnabled(actionType)).toMatchInlineSnapshot(`
Object {
"isEnabled": false,
"message": "This connector is disabled because it requires a basic license.",
"message": "This connector requires a Basic license.",
"messageCard": <EuiCard
className="actCheckActionTypeEnabled__disabledActionWarningCard"
description="To re-enable this action, please upgrade your license."
title="This feature requires a basic license."
title="This feature requires a Basic license."
titleSize="xs"
>
<ForwardRef

View file

@ -5,6 +5,7 @@
*/
import React from 'react';
import { capitalize } from 'lodash';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiCard, EuiLink } from '@elastic/eui';
@ -30,10 +31,9 @@ export function checkActionTypeEnabled(
message: i18n.translate(
'xpack.triggersActionsUI.checkActionTypeEnabled.actionTypeDisabledByLicenseMessage',
{
defaultMessage:
'This connector is disabled because it requires a {minimumLicenseRequired} license.',
defaultMessage: 'This connector requires a {minimumLicenseRequired} license.',
values: {
minimumLicenseRequired: actionType.minimumLicenseRequired,
minimumLicenseRequired: capitalize(actionType.minimumLicenseRequired),
},
}
),
@ -45,7 +45,7 @@ export function checkActionTypeEnabled(
{
defaultMessage: 'This feature requires a {minimumLicenseRequired} license.',
values: {
minimumLicenseRequired: actionType.minimumLicenseRequired,
minimumLicenseRequired: capitalize(actionType.minimumLicenseRequired),
},
}
)}

View file

@ -93,7 +93,9 @@ export const ActionForm = ({
(async () => {
try {
setIsLoadingActionTypes(true);
const registeredActionTypes = actionTypes ?? (await loadActionTypes({ http }));
const registeredActionTypes = (
actionTypes ?? (await loadActionTypes({ http }))
).sort((a, b) => a.name.localeCompare(b.name));
const index: ActionTypeIndex = {};
for (const actionTypeItem of registeredActionTypes) {
index[actionTypeItem.id] = actionTypeItem;
@ -188,7 +190,7 @@ export const ActionForm = ({
label={
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertForm.actionIdLabel"
defaultMessage="{connectorInstance} instance"
defaultMessage="{connectorInstance} connector"
values={{
connectorInstance: actionTypesIndex
? actionTypesIndex[actionConnector.actionTypeId].name
@ -259,7 +261,7 @@ export const ActionForm = ({
<EuiFlexGroup gutterSize="s">
<EuiFlexItem grow={false}>
<FormattedMessage
defaultMessage="Action: {actionConnectorName}"
defaultMessage="{actionConnectorName}"
id="xpack.triggersActionsUI.sections.alertForm.selectAlertActionTypeEditTitle"
values={{
actionConnectorName: actionConnector.name,
@ -340,7 +342,7 @@ export const ActionForm = ({
<EuiTitle size="s">
<h5>
<FormattedMessage
defaultMessage="Action: {actionConnectorName}"
defaultMessage="{actionConnectorName}"
id="xpack.triggersActionsUI.sections.alertForm.selectAlertActionTypeEditTitle"
values={{
actionConnectorName: actionTypeRegistered.actionTypeTitle,
@ -378,7 +380,7 @@ export const ActionForm = ({
title={
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertForm.emptyConnectorsLabel"
defaultMessage="There are no {actionTypeName} connectors"
defaultMessage="No {actionTypeName} connectors."
values={{
actionTypeName,
}}
@ -396,10 +398,7 @@ export const ActionForm = ({
>
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertForm.addConnectorButtonLabel"
defaultMessage="Add {actionTypeName} connector"
values={{
actionTypeName,
}}
defaultMessage="Create a connector"
/>
</EuiButton>,
]}

View file

@ -188,7 +188,7 @@ describe('connector_add_flyout', () => {
expect(element.exists()).toBeTruthy();
expect(element.first().prop('betaBadgeLabel')).toEqual('Upgrade');
expect(element.first().prop('betaBadgeTooltipContent')).toEqual(
'This connector is disabled because it requires a gold license.'
'This connector requires a Gold license.'
);
});
});

View file

@ -31,6 +31,7 @@ import { hasSaveActionsCapability } from '../../lib/capabilities';
import { createActionConnector } from '../../lib/action_connector_api';
import { useActionsConnectorsContext } from '../../context/actions_connectors_context';
import { VIEW_LICENSE_OPTIONS_LINK } from '../../../common/constants';
import { PLUGIN } from '../../constants/plugin';
export interface ConnectorAddFlyoutProps {
addFlyoutVisible: boolean;
@ -138,15 +139,11 @@ export const ConnectorAddFlyout = ({
})
.catch(errorRes => {
toastNotifications.addDanger(
i18n.translate(
'xpack.triggersActionsUI.sections.addConnectorForm.updateErrorNotificationText',
{
defaultMessage: 'Failed to create connector: {message}',
values: {
message: errorRes.body?.message ?? '',
},
}
)
errorRes.body?.message ??
i18n.translate(
'xpack.triggersActionsUI.sections.addConnectorForm.updateErrorNotificationText',
{ defaultMessage: 'Cannot create a connector.' }
)
);
return undefined;
});
@ -179,7 +176,10 @@ export const ConnectorAddFlyout = ({
'xpack.triggersActionsUI.sections.addConnectorForm.betaBadgeTooltipContent',
{
defaultMessage:
'This module is not GA. Please help us by reporting any bugs.',
'{pluginName} is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.',
values: {
pluginName: PLUGIN.getI18nName(i18n),
},
}
)}
/>
@ -203,7 +203,10 @@ export const ConnectorAddFlyout = ({
'xpack.triggersActionsUI.sections.addFlyout.betaBadgeTooltipContent',
{
defaultMessage:
'This module is not GA. Please help us by reporting any bugs.',
'{pluginName} is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.',
values: {
pluginName: PLUGIN.getI18nName(i18n),
},
}
)}
/>

View file

@ -24,6 +24,7 @@ import { connectorReducer } from './connector_reducer';
import { createActionConnector } from '../../lib/action_connector_api';
import { TypeRegistry } from '../../type_registry';
import './connector_add_modal.scss';
import { PLUGIN } from '../../constants/plugin';
interface ConnectorAddModalProps {
actionType: ActionType;
@ -133,7 +134,10 @@ export const ConnectorAddModal = ({
'xpack.triggersActionsUI.sections.addModalConnectorForm.betaBadgeTooltipContent',
{
defaultMessage:
'This module is not GA. Please help us by reporting any bugs.',
'{pluginName} is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.',
values: {
pluginName: PLUGIN.getI18nName(i18n),
},
}
)}
/>

View file

@ -25,6 +25,7 @@ import { connectorReducer } from './connector_reducer';
import { updateActionConnector } from '../../lib/action_connector_api';
import { hasSaveActionsCapability } from '../../lib/capabilities';
import { useActionsConnectorsContext } from '../../context/actions_connectors_context';
import { PLUGIN } from '../../constants/plugin';
export interface ConnectorEditProps {
initialConnector: ActionConnectorTableItem;
@ -66,32 +67,26 @@ export const ConnectorEditFlyout = ({
const onActionConnectorSave = async (): Promise<ActionConnector | undefined> =>
await updateActionConnector({ http, connector, id: connector.id })
.then(savedConnector => {
if (toastNotifications) {
toastNotifications.addSuccess(
i18n.translate(
'xpack.triggersActionsUI.sections.editConnectorForm.updateSuccessNotificationText',
{
defaultMessage: "Updated '{connectorName}'",
values: {
connectorName: savedConnector.name,
},
}
)
);
}
toastNotifications.addSuccess(
i18n.translate(
'xpack.triggersActionsUI.sections.editConnectorForm.updateSuccessNotificationText',
{
defaultMessage: "Updated '{connectorName}'",
values: {
connectorName: savedConnector.name,
},
}
)
);
return savedConnector;
})
.catch(errorRes => {
toastNotifications.addDanger(
i18n.translate(
'xpack.triggersActionsUI.sections.editConnectorForm.updateErrorNotificationText',
{
defaultMessage: 'Failed to update connector: {message}',
values: {
message: errorRes.body?.message ?? '',
},
}
)
errorRes.body?.message ??
i18n.translate(
'xpack.triggersActionsUI.sections.editConnectorForm.updateErrorNotificationText',
{ defaultMessage: 'Cannot update a connector.' }
)
);
return undefined;
});
@ -119,7 +114,10 @@ export const ConnectorEditFlyout = ({
'xpack.triggersActionsUI.sections.editConnectorForm.betaBadgeTooltipContent',
{
defaultMessage:
'This module is not GA. Please help us by reporting any bugs.',
'{pluginName} is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.',
values: {
pluginName: PLUGIN.getI18nName(i18n),
},
}
)}
/>

View file

@ -114,7 +114,7 @@ export const ActionsConnectorsList: React.FunctionComponent = () => {
title: i18n.translate(
'xpack.triggersActionsUI.sections.actionsConnectorsList.unableToLoadActionsMessage',
{
defaultMessage: 'Unable to load actions',
defaultMessage: 'Unable to load connectors',
}
),
});
@ -213,11 +213,11 @@ export const ActionsConnectorsList: React.FunctionComponent = () => {
description: canDelete
? i18n.translate(
'xpack.triggersActionsUI.sections.actionsConnectorsList.connectorsListTable.columns.actions.deleteActionDescription',
{ defaultMessage: 'Delete this action' }
{ defaultMessage: 'Delete this connector' }
)
: i18n.translate(
'xpack.triggersActionsUI.sections.actionsConnectorsList.connectorsListTable.columns.actions.deleteActionDisabledDescription',
{ defaultMessage: 'Unable to delete actions' }
{ defaultMessage: 'Unable to delete connectors' }
),
type: 'icon',
icon: 'trash',
@ -290,13 +290,13 @@ export const ActionsConnectorsList: React.FunctionComponent = () => {
? undefined
: i18n.translate(
'xpack.triggersActionsUI.sections.actionsConnectorsList.buttons.deleteDisabledTitle',
{ defaultMessage: 'Unable to delete actions' }
{ defaultMessage: 'Unable to delete connectors' }
)
}
>
<FormattedMessage
id="xpack.triggersActionsUI.sections.actionsConnectorsList.buttons.deleteLabel"
defaultMessage="Delete ({count})"
defaultMessage="Delete {count}"
values={{
count: selectedItems.length,
}}
@ -393,7 +393,7 @@ export const ActionsConnectorsList: React.FunctionComponent = () => {
toastNotifications.addDanger({
title: i18n.translate(
'xpack.triggersActionsUI.sections.actionsConnectorsList.failedToDeleteActionsMessage',
{ defaultMessage: 'Failed to delete action(s)' }
{ defaultMessage: 'Failed to delete connectors(s)' }
),
});
// Refresh the actions from the server, some actions may have beend deleted

View file

@ -12,6 +12,7 @@ import { EuiTitle, EuiBadge, EuiFlexItem, EuiSwitch, EuiBetaBadge } from '@elast
import { times, random } from 'lodash';
import { i18n } from '@kbn/i18n';
import { ViewInApp } from './view_in_app';
import { PLUGIN } from '../../../constants/plugin';
jest.mock('../../../app_context', () => ({
useAppDependencies: jest.fn(() => ({
@ -63,7 +64,11 @@ describe('alert_details', () => {
tooltipContent={i18n.translate(
'xpack.triggersActionsUI.sections.alertDetails.betaBadgeTooltipContent',
{
defaultMessage: 'This module is not GA. Please help us by reporting any bugs.',
defaultMessage:
'{pluginName} is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.',
values: {
pluginName: PLUGIN.getI18nName(i18n),
},
}
)}
/>

View file

@ -33,6 +33,7 @@ import {
} from '../../common/components/with_bulk_alert_api_operations';
import { AlertInstancesRouteWithApi } from './alert_instances_route';
import { ViewInApp } from './view_in_app';
import { PLUGIN } from '../../../constants/plugin';
type AlertDetailsProps = {
alert: Alert;
@ -77,7 +78,10 @@ export const AlertDetails: React.FunctionComponent<AlertDetailsProps> = ({
'xpack.triggersActionsUI.sections.alertDetails.betaBadgeTooltipContent',
{
defaultMessage:
'This module is not GA. Please help us by reporting any bugs.',
'{pluginName} is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.',
values: {
pluginName: PLUGIN.getI18nName(i18n),
},
}
)}
/>
@ -177,7 +181,7 @@ export const AlertDetails: React.FunctionComponent<AlertDetailsProps> = ({
<p>
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertDetails.alertInstances.disabledAlert"
defaultMessage="Disabled Alerts do not have an active state, hence Alert Instances cannot be displayed."
defaultMessage="This alert is disabled and cannot be displayed. Toggle Enable ↑ to activate it."
/>
</p>
</EuiCallOut>

View file

@ -24,6 +24,7 @@ import { Alert, AlertAction, IErrorObject } from '../../../types';
import { AlertForm, validateBaseProperties } from './alert_form';
import { alertReducer } from './alert_reducer';
import { createAlert } from '../../lib/alert_api';
import { PLUGIN } from '../../constants/plugin';
interface AlertAddProps {
consumer: string;
@ -109,12 +110,10 @@ export const AlertAdd = ({
return newAlert;
} catch (errorRes) {
toastNotifications.addDanger(
i18n.translate('xpack.triggersActionsUI.sections.alertAdd.saveErrorNotificationText', {
defaultMessage: 'Failed to save alert: {message}',
values: {
message: errorRes.body?.message ?? '',
},
})
errorRes.body?.message ??
i18n.translate('xpack.triggersActionsUI.sections.alertAdd.saveErrorNotificationText', {
defaultMessage: 'Cannot create alert.',
})
);
}
}
@ -132,7 +131,7 @@ export const AlertAdd = ({
<EuiTitle size="s" data-test-subj="addAlertFlyoutTitle">
<h3 id="flyoutTitle">
<FormattedMessage
defaultMessage="Create Alert"
defaultMessage="Create alert"
id="xpack.triggersActionsUI.sections.alertAdd.flyoutTitle"
/>
&emsp;
@ -141,7 +140,11 @@ export const AlertAdd = ({
tooltipContent={i18n.translate(
'xpack.triggersActionsUI.sections.alertAdd.betaBadgeTooltipContent',
{
defaultMessage: 'This module is not GA. Please help us by reporting any bugs.',
defaultMessage:
'{pluginName} is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.',
values: {
pluginName: PLUGIN.getI18nName(i18n),
},
}
)}
/>

View file

@ -147,8 +147,6 @@ describe('alert_edit', () => {
.first()
.simulate('click');
});
expect(mockedCoreSetup.notifications.toasts.addDanger).toHaveBeenCalledWith(
'Failed to save alert: Fail message'
);
expect(mockedCoreSetup.notifications.toasts.addDanger).toHaveBeenCalledWith('Fail message');
});
});

View file

@ -26,6 +26,7 @@ import { Alert, AlertAction, IErrorObject } from '../../../types';
import { AlertForm, validateBaseProperties } from './alert_form';
import { alertReducer } from './alert_reducer';
import { updateAlert } from '../../lib/alert_api';
import { PLUGIN } from '../../constants/plugin';
interface AlertEditProps {
initialAlert: Alert;
@ -82,28 +83,22 @@ export const AlertEdit = ({
async function onSaveAlert(): Promise<Alert | undefined> {
try {
const newAlert = await updateAlert({ http, alert, id: alert.id });
if (toastNotifications) {
toastNotifications.addSuccess(
i18n.translate('xpack.triggersActionsUI.sections.alertEdit.saveSuccessNotificationText', {
defaultMessage: "Updated '{alertName}'",
values: {
alertName: newAlert.name,
},
})
);
}
toastNotifications.addSuccess(
i18n.translate('xpack.triggersActionsUI.sections.alertEdit.saveSuccessNotificationText', {
defaultMessage: "Updated '{alertName}'",
values: {
alertName: newAlert.name,
},
})
);
return newAlert;
} catch (errorRes) {
if (toastNotifications) {
toastNotifications.addDanger(
toastNotifications.addDanger(
errorRes.body?.message ??
i18n.translate('xpack.triggersActionsUI.sections.alertEdit.saveErrorNotificationText', {
defaultMessage: 'Failed to save alert: {message}',
values: {
message: errorRes.body?.message ?? '',
},
defaultMessage: 'Cannot update alert.',
})
);
}
);
}
}
@ -120,7 +115,7 @@ export const AlertEdit = ({
<EuiTitle size="s" data-test-subj="editAlertFlyoutTitle">
<h3 id="flyoutTitle">
<FormattedMessage
defaultMessage="Edit Alert"
defaultMessage="Edit alert"
id="xpack.triggersActionsUI.sections.alertEdit.flyoutTitle"
/>
&emsp;
@ -129,7 +124,11 @@ export const AlertEdit = ({
tooltipContent={i18n.translate(
'xpack.triggersActionsUI.sections.alertEdit.betaBadgeTooltipContent',
{
defaultMessage: 'This module is not GA. Please help us by reporting any bugs.',
defaultMessage:
'{pluginName} is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.',
values: {
pluginName: PLUGIN.getI18nName(i18n),
},
}
)}
/>

View file

@ -260,7 +260,7 @@ export const AlertForm = ({
position="right"
type="questionInCircle"
content={i18n.translate('xpack.triggersActionsUI.sections.alertForm.checkWithTooltip', {
defaultMessage: 'This is some help text here for check alert.',
defaultMessage: 'Define how often to evaluate the condition.',
})}
/>
</>
@ -270,13 +270,13 @@ export const AlertForm = ({
<>
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertForm.renotifyFieldLabel"
defaultMessage="Re-notify every"
defaultMessage="Notify every"
/>{' '}
<EuiIconTip
position="right"
type="questionInCircle"
content={i18n.translate('xpack.triggersActionsUI.sections.alertForm.renotifyWithTooltip', {
defaultMessage: 'This is some help text here for re-notify alert.',
defaultMessage: 'Define how often to repeat the action while the alert is active.',
})}
/>
</>
@ -456,7 +456,7 @@ export const AlertForm = ({
<EuiTitle size="s">
<h5 id="alertTypeTitle">
<FormattedMessage
defaultMessage="Trigger: Select a trigger type"
defaultMessage="Select a trigger type"
id="xpack.triggersActionsUI.sections.alertForm.selectAlertTypeTitle"
/>
</h5>

View file

@ -120,7 +120,7 @@ export const AlertsList: React.FunctionComponent = () => {
(async () => {
try {
const result = await loadActionTypes({ http });
setActionTypes(result);
setActionTypes(result.filter(actionType => actionTypeRegistry.has(actionType.id)));
} catch (e) {
toastNotifications.addDanger({
title: i18n.translate(
@ -285,7 +285,7 @@ export const AlertsList: React.FunctionComponent = () => {
>
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertsList.addActionButtonLabel"
defaultMessage="Create"
defaultMessage="Create alert"
/>
</EuiButton>
);
@ -307,7 +307,7 @@ export const AlertsList: React.FunctionComponent = () => {
<p>
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertsList.emptyDesc"
defaultMessage="Recieve an alert through email, slack or other connectors when a certain trigger is hit"
defaultMessage="Receive an alert through email, Slack, or another connector when a trigger is hit."
/>
</p>
}