Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.8] [Security Solution] Fix rule snooze description on the rule editing page (#155850) #156889

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/kbn-doc-links/src/get_doc_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => {
value_lists: `${SECURITY_SOLUTION_DOCS}value-lists-exceptions.html`,
},
privileges: `${SECURITY_SOLUTION_DOCS}endpoint-management-req.html`,
manageDetectionRules: `${SECURITY_SOLUTION_DOCS}rules-ui-management.html`,
},
query: {
eql: `${ELASTICSEARCH_DOCS}eql.html`,
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-doc-links/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ export interface DocLinks {
value_lists: string;
};
readonly privileges: string;
readonly manageDetectionRules: string;
};
readonly query: {
readonly eql: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
*/

import React from 'react';
import { css } from '@emotion/react';
import { EuiFlexGroup, EuiFlexItem, EuiText, useEuiTheme } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui';
import type { RuleObjectId } from '../../../../../common/detection_engine/rule_schema';
import { RuleSnoozeBadge } from '../../../../detection_engine/rule_management/components/rule_snooze_badge';
import * as i18n from './translations';
Expand All @@ -17,26 +16,14 @@ interface RuleSnoozeSectionProps {
}

export function RuleSnoozeSection({ ruleId }: RuleSnoozeSectionProps): JSX.Element {
const { euiTheme } = useEuiTheme();

return (
<section>
<EuiText size="s">{i18n.RULE_SNOOZE_DESCRIPTION}</EuiText>
<EuiFlexGroup
alignItems="center"
css={css`
margin-top: ${euiTheme.size.s};
`}
>
<EuiFlexItem grow={false}>
<RuleSnoozeBadge ruleId={ruleId} showTooltipInline />
</EuiFlexItem>
<EuiFlexItem>
<EuiText size="s">
<strong>{i18n.SNOOZED_ACTIONS_WARNING}</strong>
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
</section>
<EuiFlexGroup direction="column" gutterSize="s">
<EuiFlexItem>
<EuiText size="s">{i18n.RULE_SNOOZE_DESCRIPTION}</EuiText>
</EuiFlexItem>
<EuiFlexItem>
<RuleSnoozeBadge ruleId={ruleId} showTooltipInline />
</EuiFlexItem>
</EuiFlexGroup>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
* 2.0.
*/

import React from 'react';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import { EuiLink } from '@elastic/eui';
import { useKibana } from '../../../../common/lib/kibana';

export const COMPLETE_WITHOUT_ENABLING = i18n.translate(
'xpack.securitySolution.detectionEngine.createRule.stepScheduleRule.completeWithoutEnablingTitle',
Expand All @@ -29,17 +33,36 @@ export const NO_ACTIONS_READ_PERMISSIONS = i18n.translate(
}
);

export const RULE_SNOOZE_DESCRIPTION = i18n.translate(
'xpack.securitySolution.detectionEngine.createRule.stepRuleActions.snoozeDescription',
const RULE_SNOOZE_DOCS_LINK_TEXT = i18n.translate(
'xpack.securitySolution.detectionEngine.createRule.stepRuleActions.docsLinkText',
{
defaultMessage:
'Select when automated actions should be performed if a rule evaluates as true.',
defaultMessage: 'Learn more',
}
);

export const SNOOZED_ACTIONS_WARNING = i18n.translate(
'xpack.securitySolution.detectionEngine.createRule.stepRuleActions.snoozedActionsWarning',
{
defaultMessage: 'Actions will not be performed until it is unsnoozed.',
}
);
function RuleSnoozeDescription(): JSX.Element {
const {
docLinks: {
links: {
securitySolution: { manageDetectionRules },
},
},
} = useKibana().services;
const manageDetectionRulesSnoozeSection = `${manageDetectionRules}#edit-rules-settings`;

return (
<FormattedMessage
id="xpack.securitySolution.detectionEngine.createRule.stepRuleActions.snoozeDescription"
defaultMessage="Choose when to perform actions or snooze them. Notifications are not created for snoozed actions. {docs}."
values={{
docs: (
<EuiLink href={manageDetectionRulesSnoozeSection} target="_blank">
{RULE_SNOOZE_DOCS_LINK_TEXT}
</EuiLink>
),
}}
/>
);
}

export const RULE_SNOOZE_DESCRIPTION = <RuleSnoozeDescription />;