mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[8.6] [Security Solution][Alerts] Add tour to rule management page for suppression and new terms multi fields (#145775) (#146479)
# Backport This will backport the following commits from `main` to `8.6`: - [[Security Solution][Alerts] Add tour to rule management page for suppression and new terms multi fields (#145775)](https://github.com/elastic/kibana/pull/145775) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Marshall Main","email":"55718608+marshallmain@users.noreply.github.com"},"sourceCommit":{"committedDate":"2022-11-28T21:35:02Z","message":"[Security Solution][Alerts] Add tour to rule management page for suppression and new terms multi fields (#145775)\n\n## Summary\r\n\r\nAdds new tour highlighting new rule capabilities in 8.6 - new terms\r\nmulti fields (https://github.com/elastic/kibana/pull/143943) and alert\r\nsuppression (https://github.com/elastic/kibana/pull/142686).\r\n\r\nI tried using the generic `RulesFeatureTour` again\r\n(https://github.com/elastic/kibana/compare/main...marshallmain:kibana:failed-tour)\r\nbut it still crashes the page.\r\n\r\nI also looked at integrating this tour with the Guided onboarding tour\r\nfor rules management (https://github.com/elastic/kibana/pull/145223),\r\nbut concluded that they should be separate since guided onboarding is\r\nexperimental and this tour should be displayed to users even if they are\r\nnot new users.\r\n\r\nThis PR is essentially a copy of the new terms tour in 8.4\r\n(https://github.com/elastic/kibana/pull/138469).","sha":"13c1b0b863b7d8b324d33f2aaf45d90d5c8c108e","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team: SecuritySolution","Team:Detection Alerts","v8.6.0","v8.7.0"],"number":145775,"url":"https://github.com/elastic/kibana/pull/145775","mergeCommit":{"message":"[Security Solution][Alerts] Add tour to rule management page for suppression and new terms multi fields (#145775)\n\n## Summary\r\n\r\nAdds new tour highlighting new rule capabilities in 8.6 - new terms\r\nmulti fields (https://github.com/elastic/kibana/pull/143943) and alert\r\nsuppression (https://github.com/elastic/kibana/pull/142686).\r\n\r\nI tried using the generic `RulesFeatureTour` again\r\n(https://github.com/elastic/kibana/compare/main...marshallmain:kibana:failed-tour)\r\nbut it still crashes the page.\r\n\r\nI also looked at integrating this tour with the Guided onboarding tour\r\nfor rules management (https://github.com/elastic/kibana/pull/145223),\r\nbut concluded that they should be separate since guided onboarding is\r\nexperimental and this tour should be displayed to users even if they are\r\nnot new users.\r\n\r\nThis PR is essentially a copy of the new terms tour in 8.4\r\n(https://github.com/elastic/kibana/pull/138469).","sha":"13c1b0b863b7d8b324d33f2aaf45d90d5c8c108e"}},"sourceBranch":"main","suggestedTargetBranches":["8.6"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/145775","number":145775,"mergeCommit":{"message":"[Security Solution][Alerts] Add tour to rule management page for suppression and new terms multi fields (#145775)\n\n## Summary\r\n\r\nAdds new tour highlighting new rule capabilities in 8.6 - new terms\r\nmulti fields (https://github.com/elastic/kibana/pull/143943) and alert\r\nsuppression (https://github.com/elastic/kibana/pull/142686).\r\n\r\nI tried using the generic `RulesFeatureTour` again\r\n(https://github.com/elastic/kibana/compare/main...marshallmain:kibana:failed-tour)\r\nbut it still crashes the page.\r\n\r\nI also looked at integrating this tour with the Guided onboarding tour\r\nfor rules management (https://github.com/elastic/kibana/pull/145223),\r\nbut concluded that they should be separate since guided onboarding is\r\nexperimental and this tour should be displayed to users even if they are\r\nnot new users.\r\n\r\nThis PR is essentially a copy of the new terms tour in 8.4\r\n(https://github.com/elastic/kibana/pull/138469).","sha":"13c1b0b863b7d8b324d33f2aaf45d90d5c8c108e"}}]}] BACKPORT--> Co-authored-by: Marshall Main <55718608+marshallmain@users.noreply.github.com>
This commit is contained in:
parent
c4de26f9e0
commit
5f8b171ee3
4 changed files with 106 additions and 12 deletions
|
@ -449,7 +449,7 @@ export const RULES_TABLE_PAGE_SIZE_OPTIONS = [5, 10, 20, 50, RULES_TABLE_MAX_PAG
|
|||
* we will need to update these constants with the corresponding version.
|
||||
*/
|
||||
export const NEW_FEATURES_TOUR_STORAGE_KEYS = {
|
||||
RULE_MANAGEMENT_PAGE: 'securitySolution.rulesManagementPage.newFeaturesTour.v8.4',
|
||||
RULE_MANAGEMENT_PAGE: 'securitySolution.rulesManagementPage.newFeaturesTour.v8.6',
|
||||
};
|
||||
|
||||
export const RULE_DETAILS_EXECUTION_LOG_TABLE_SHOW_METRIC_COLUMNS_STORAGE_KEY =
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { EuiText, EuiTourStep } from '@elastic/eui';
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { NEW_FEATURES_TOUR_STORAGE_KEYS } from '../../../../../../common/constants';
|
||||
import { useKibana } from '../../../../../common/lib/kibana';
|
||||
import * as i18n from './translations';
|
||||
|
||||
export interface Props {
|
||||
children: React.ReactElement;
|
||||
}
|
||||
|
||||
export const RulesPageTourComponent: React.FC<Props> = ({ children }) => {
|
||||
const tourConfig = {
|
||||
currentTourStep: 1,
|
||||
isTourActive: true,
|
||||
tourPopoverWidth: 300,
|
||||
};
|
||||
|
||||
const { storage } = useKibana().services;
|
||||
|
||||
const [tourState, setTourState] = useState(() => {
|
||||
const restoredTourState = storage.get(NEW_FEATURES_TOUR_STORAGE_KEYS.RULE_MANAGEMENT_PAGE);
|
||||
|
||||
if (restoredTourState != null) {
|
||||
return restoredTourState;
|
||||
}
|
||||
return tourConfig;
|
||||
});
|
||||
|
||||
const demoTourSteps = [
|
||||
{
|
||||
step: 1,
|
||||
title: i18n.CREATE_RULE_TOUR_TITLE,
|
||||
content: <EuiText>{i18n.CREATE_RULE_TOUR_CONTENT}</EuiText>,
|
||||
},
|
||||
];
|
||||
const finishTour = useCallback(() => {
|
||||
setTourState({
|
||||
...tourState,
|
||||
isTourActive: false,
|
||||
});
|
||||
}, [tourState]);
|
||||
|
||||
useEffect(() => {
|
||||
storage.set(NEW_FEATURES_TOUR_STORAGE_KEYS.RULE_MANAGEMENT_PAGE, tourState);
|
||||
}, [tourState, storage]);
|
||||
|
||||
return (
|
||||
<EuiTourStep
|
||||
content={demoTourSteps[0].content}
|
||||
isStepOpen={tourState.currentTourStep === 1 && tourState.isTourActive}
|
||||
minWidth={tourState.tourPopoverWidth}
|
||||
onFinish={finishTour}
|
||||
step={1}
|
||||
stepsTotal={demoTourSteps.length}
|
||||
subtitle={tourState.tourSubtitle}
|
||||
title={demoTourSteps[0].title}
|
||||
anchorPosition="rightUp"
|
||||
>
|
||||
{children}
|
||||
</EuiTourStep>
|
||||
);
|
||||
};
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export const CREATE_RULE_TOUR_TITLE = i18n.translate(
|
||||
'xpack.securitySolution.detectionEngine.rules.tour.createRuleTourTitle',
|
||||
{
|
||||
defaultMessage: 'New security rule features are available',
|
||||
}
|
||||
);
|
||||
|
||||
export const CREATE_RULE_TOUR_CONTENT = i18n.translate(
|
||||
'xpack.securitySolution.detectionEngine.rules.tour.createRuleTourContent',
|
||||
{
|
||||
defaultMessage: `Alert suppression options are now available for Custom Query rules and multiple fields can be selected in New Terms rules`,
|
||||
}
|
||||
);
|
|
@ -41,6 +41,7 @@ import { AllRules } from '../../components/rules_table';
|
|||
import { RulesTableContextProvider } from '../../components/rules_table/rules_table/rules_table_context';
|
||||
|
||||
import * as i18n from '../../../../detections/pages/detection_engine/rules/translations';
|
||||
import { RulesPageTourComponent } from '../../components/rules_table/alternative_tour/tour';
|
||||
|
||||
const RulesPageComponent: React.FC = () => {
|
||||
const [isImportModalVisible, showImportModal, hideImportModal] = useBoolState();
|
||||
|
@ -140,17 +141,19 @@ const RulesPageComponent: React.FC = () => {
|
|||
{i18n.IMPORT_RULE}
|
||||
</EuiButton>
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem grow={false}>
|
||||
<SecuritySolutionLinkButton
|
||||
data-test-subj="create-new-rule"
|
||||
fill
|
||||
iconType="plusInCircle"
|
||||
isDisabled={!hasUserCRUDPermission(canUserCRUD) || loading}
|
||||
deepLinkId={SecurityPageName.rulesCreate}
|
||||
>
|
||||
{i18n.ADD_NEW_RULE}
|
||||
</SecuritySolutionLinkButton>
|
||||
</EuiFlexItem>
|
||||
<RulesPageTourComponent>
|
||||
<EuiFlexItem grow={false}>
|
||||
<SecuritySolutionLinkButton
|
||||
data-test-subj="create-new-rule"
|
||||
fill
|
||||
iconType="plusInCircle"
|
||||
isDisabled={!hasUserCRUDPermission(canUserCRUD) || loading}
|
||||
deepLinkId={SecurityPageName.rulesCreate}
|
||||
>
|
||||
{i18n.ADD_NEW_RULE}
|
||||
</SecuritySolutionLinkButton>
|
||||
</EuiFlexItem>
|
||||
</RulesPageTourComponent>
|
||||
</EuiFlexGroup>
|
||||
</HeaderPage>
|
||||
{(prePackagedRuleStatus === 'ruleNeedUpdate' ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue