Skip to content

Commit

Permalink
UI changes due to the text review (#61019) (#61121)
Browse files Browse the repository at this point in the history
* Fixed UI due to text review

* Fixed due to comments

* Fixed due to review comments
  • Loading branch information
YulNaumenko authored Mar 24, 2020
1 parent 94b2da5 commit 4faeebb
Show file tree
Hide file tree
Showing 25 changed files with 344 additions and 249 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -396,7 +396,7 @@ const EmailParamsFields: React.FunctionComponent<ActionParamsProps<EmailActionPa
label={i18n.translate(
'xpack.triggersActionsUI.sections.builtinActionTypes.emailAction.recipientTextFieldLabel',
{
defaultMessage: 'To:',
defaultMessage: 'To',
}
)}
labelAppend={
Expand All @@ -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>
Expand All @@ -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}
Expand Down Expand Up @@ -459,7 +459,7 @@ const EmailParamsFields: React.FunctionComponent<ActionParamsProps<EmailActionPa
label={i18n.translate(
'xpack.triggersActionsUI.sections.builtinActionTypes.emailAction.recipientCopyTextFieldLabel',
{
defaultMessage: 'Cc:',
defaultMessage: 'Cc',
}
)}
>
Expand Down Expand Up @@ -500,7 +500,7 @@ const EmailParamsFields: React.FunctionComponent<ActionParamsProps<EmailActionPa
label={i18n.translate(
'xpack.triggersActionsUI.sections.builtinActionTypes.emailAction.recipientBccTextFieldLabel',
{
defaultMessage: 'Bcc:',
defaultMessage: 'Bcc',
}
)}
>
Expand Down Expand Up @@ -540,7 +540,7 @@ const EmailParamsFields: React.FunctionComponent<ActionParamsProps<EmailActionPa
label={i18n.translate(
'xpack.triggersActionsUI.sections.builtinActionTypes.emailAction.subjectTextFieldLabel',
{
defaultMessage: 'Subject:',
defaultMessage: 'Subject',
}
)}
>
Expand All @@ -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);
}}
Expand All @@ -568,7 +567,7 @@ const EmailParamsFields: React.FunctionComponent<ActionParamsProps<EmailActionPa
label={i18n.translate(
'xpack.triggersActionsUI.sections.builtinActionTypes.emailAction.messageTextAreaFieldLabel',
{
defaultMessage: 'Message:',
defaultMessage: 'Message',
}
)}
labelAppend={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
}
Expand Down Expand Up @@ -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 })
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
}
Expand All @@ -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 => {
Expand Down Expand Up @@ -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',
}
)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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.',
}
)
);
Expand All @@ -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.',
}
)
);
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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',
{
Expand Down
Loading

0 comments on commit 4faeebb

Please sign in to comment.