-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution][Alerts] Add tour to rule management page for supp…
…ression and new terms multi fields (#145775) ## Summary Adds new tour highlighting new rule capabilities in 8.6 - new terms multi fields (#143943) and alert suppression (#142686). I tried using the generic `RulesFeatureTour` again (main...marshallmain:kibana:failed-tour) but it still crashes the page. I also looked at integrating this tour with the Guided onboarding tour for rules management (#145223), but concluded that they should be separate since guided onboarding is experimental and this tour should be displayed to users even if they are not new users. This PR is essentially a copy of the new terms tour in 8.4 (#138469).
- Loading branch information
1 parent
c5f2072
commit 13c1b0b
Showing
4 changed files
with
106 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
...blic/detection_engine/rule_management_ui/components/rules_table/alternative_tour/tour.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> | ||
); | ||
}; |
22 changes: 22 additions & 0 deletions
22
...tection_engine/rule_management_ui/components/rules_table/alternative_tour/translations.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`, | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters