mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
# Backport This will backport the following commits from `main` to `8.8`: - [[RAM] Add link and add validations (#157028)](https://github.com/elastic/kibana/pull/157028) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Julia","email":"iuliia.guskova@elastic.co"},"sourceCommit":{"committedDate":"2023-05-09T07:07:36Z","message":"[RAM] Add link and add validations (#157028)\n\nIn this PR:\r\n1. I add a link to Slack Web API docs in UI\r\n2. Add some limitations to parameters schema for Slack Web API\r\nconnector.\r\n\r\n---------\r\n\r\nCo-authored-by: Lisa Cawley <lcawley@elastic.co>","sha":"12162a0b3f85f5594e8f54ca9c14d014e926720d","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:ResponseOps","backport:prev-minor","v8.9.0"],"number":157028,"url":"https://github.com/elastic/kibana/pull/157028","mergeCommit":{"message":"[RAM] Add link and add validations (#157028)\n\nIn this PR:\r\n1. I add a link to Slack Web API docs in UI\r\n2. Add some limitations to parameters schema for Slack Web API\r\nconnector.\r\n\r\n---------\r\n\r\nCo-authored-by: Lisa Cawley <lcawley@elastic.co>","sha":"12162a0b3f85f5594e8f54ca9c14d014e926720d"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/157028","number":157028,"mergeCommit":{"message":"[RAM] Add link and add validations (#157028)\n\nIn this PR:\r\n1. I add a link to Slack Web API docs in UI\r\n2. Add some limitations to parameters schema for Slack Web API\r\nconnector.\r\n\r\n---------\r\n\r\nCo-authored-by: Lisa Cawley <lcawley@elastic.co>","sha":"12162a0b3f85f5594e8f54ca9c14d014e926720d"}}]}] BACKPORT--> Co-authored-by: Julia <iuliia.guskova@elastic.co>
This commit is contained in:
parent
857c81adda
commit
1401b1a2b8
5 changed files with 28 additions and 11 deletions
|
@ -507,7 +507,8 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => {
|
|||
serviceNowAction: `${KIBANA_DOCS}servicenow-action-type.html#configuring-servicenow`,
|
||||
serviceNowSIRAction: `${KIBANA_DOCS}servicenow-sir-action-type.html`,
|
||||
setupPrerequisites: `${KIBANA_DOCS}alerting-setup.html#alerting-prerequisites`,
|
||||
slackAction: `${KIBANA_DOCS}slack-action-type.html#configuring-slack`,
|
||||
slackAction: `${KIBANA_DOCS}slack-action-type.html#configuring-slack-webhook`,
|
||||
slackApiAction: `${KIBANA_DOCS}slack-action-type.html#configuring-slack-web-api`,
|
||||
teamsAction: `${KIBANA_DOCS}teams-action-type.html#configuring-teams`,
|
||||
connectors: `${KIBANA_DOCS}action-types.html`,
|
||||
},
|
||||
|
|
|
@ -388,6 +388,7 @@ export interface DocLinks {
|
|||
serviceNowSIRAction: string;
|
||||
setupPrerequisites: string;
|
||||
slackAction: string;
|
||||
slackApiAction: string;
|
||||
teamsAction: string;
|
||||
connectors: string;
|
||||
}>;
|
||||
|
|
|
@ -16,9 +16,10 @@ export const GetChannelsParamsSchema = schema.object({
|
|||
});
|
||||
|
||||
export const PostMessageSubActionParamsSchema = schema.object({
|
||||
channels: schema.arrayOf(schema.string()),
|
||||
text: schema.string(),
|
||||
channels: schema.arrayOf(schema.string(), { maxSize: 1 }),
|
||||
text: schema.string({ minLength: 1 }),
|
||||
});
|
||||
|
||||
export const PostMessageParamsSchema = schema.object({
|
||||
subAction: schema.literal('postMessage'),
|
||||
subActionParams: PostMessageSubActionParamsSchema,
|
||||
|
|
|
@ -10,24 +10,38 @@ import {
|
|||
ActionConnectorFieldsProps,
|
||||
SecretsFieldSchema,
|
||||
SimpleConnectorForm,
|
||||
useKibana,
|
||||
} from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { EuiLink } from '@elastic/eui';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import { DocLinksStart } from '@kbn/core/public';
|
||||
import * as i18n from './translations';
|
||||
|
||||
const secretsFormSchema: SecretsFieldSchema[] = [
|
||||
const getSecretsFormSchema = (docLinks: DocLinksStart): SecretsFieldSchema[] => [
|
||||
{
|
||||
id: 'token',
|
||||
label: i18n.TOKEN_LABEL,
|
||||
isPasswordField: true,
|
||||
helpText: (
|
||||
<EuiLink href={docLinks.links.alerting.slackApiAction} target="_blank">
|
||||
<FormattedMessage
|
||||
id="xpack.stackConnectors.components.slack_api.apiKeyDocumentation"
|
||||
defaultMessage="Create a Slack Web API token"
|
||||
/>
|
||||
</EuiLink>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
const SlackActionFields: React.FC<ActionConnectorFieldsProps> = ({ readOnly, isEdit }) => {
|
||||
const { docLinks } = useKibana().services;
|
||||
|
||||
return (
|
||||
<SimpleConnectorForm
|
||||
isEdit={isEdit}
|
||||
readOnly={readOnly}
|
||||
configFormSchema={[]}
|
||||
secretsFormSchema={secretsFormSchema}
|
||||
secretsFormSchema={getSecretsFormSchema(docLinks)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -8,34 +8,34 @@
|
|||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export const MESSAGE_REQUIRED = i18n.translate(
|
||||
'xpack.stackConnectors.components.slack.error.requiredSlackMessageText',
|
||||
'xpack.stackConnectors.components.slack_api.error.requiredSlackMessageText',
|
||||
{
|
||||
defaultMessage: 'Message is required.',
|
||||
}
|
||||
);
|
||||
export const CHANNEL_REQUIRED = i18n.translate(
|
||||
'xpack.stackConnectors.components.slack.error.requiredSlackChannel',
|
||||
'xpack.stackConnectors.components.slack_api.error.requiredSlackChannel',
|
||||
{
|
||||
defaultMessage: 'Channel is required.',
|
||||
}
|
||||
);
|
||||
export const TOKEN_LABEL = i18n.translate(
|
||||
'xpack.stackConnectors.components.slack.tokenTextFieldLabel',
|
||||
'xpack.stackConnectors.components.slack_api.tokenTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'API Token',
|
||||
}
|
||||
);
|
||||
export const WEB_API = i18n.translate('xpack.stackConnectors.components.slack.webApi', {
|
||||
export const WEB_API = i18n.translate('xpack.stackConnectors.components.slack_api.webApi', {
|
||||
defaultMessage: 'Web API',
|
||||
});
|
||||
export const SELECT_MESSAGE = i18n.translate(
|
||||
'xpack.stackConnectors.components.slack.selectMessageText',
|
||||
'xpack.stackConnectors.components.slack_api.selectMessageText',
|
||||
{
|
||||
defaultMessage: 'Send messages to Slack channels.',
|
||||
}
|
||||
);
|
||||
export const ACTION_TYPE_TITLE = i18n.translate(
|
||||
'xpack.stackConnectors.components.slack.connectorTypeTitle',
|
||||
'xpack.stackConnectors.components.slack_api.connectorTypeTitle',
|
||||
{
|
||||
defaultMessage: 'Send to Slack',
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue