forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Rules migration] Implement workflow tour - Setup Guide (elastic#11384)…
… (elastic#207242) ## Summary [Internal link](elastic/security-team#10820) to the feature details This PR adds the SIEM Migration setup tour guide on the main landing page. [Figma link](https://www.figma.com/design/BD9GZZz6y8pfSbubAt5H2W/%5B8.18%5D-GenAI-Powered-SIEM-Migration%3A-Rule-translation?node-id=2652-244526&t=WmkBy29xrzl5mN7G-4) https://github.com/user-attachments/assets/680e3bb6-a0af-43dc-99f8-30e32badf367 Delete `securitySolution.siemMigrations.setupGuide.v8.18` in the local storage to reset the tour. > [!NOTE] > This feature needs `siemMigrationsEnabled` experimental flag enabled to work.
- Loading branch information
Showing
4 changed files
with
132 additions
and
2 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
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
79 changes: 79 additions & 0 deletions
79
...ins/security_solution/public/siem_migrations/rules/components/tours/setup_guide/index.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,79 @@ | ||
/* | ||
* 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 React, { useCallback, useEffect, useMemo, useState } from 'react'; | ||
import { EuiButtonEmpty, EuiTourStep } from '@elastic/eui'; | ||
import { NEW_FEATURES_TOUR_STORAGE_KEYS } from '../../../../../../common/constants'; | ||
import { useKibana } from '../../../../../common/lib/kibana'; | ||
import * as i18n from './translations'; | ||
|
||
const tourConfig = { | ||
currentTourStep: 1, | ||
isTourActive: true, | ||
tourPopoverWidth: 360, | ||
}; | ||
|
||
export interface SetupTourProps { | ||
children: React.ReactElement; | ||
} | ||
|
||
export const SiemMigrationSetupTour: React.FC<SetupTourProps> = React.memo(({ children }) => { | ||
const { siemMigrations, storage } = useKibana().services; | ||
|
||
const [tourState, setTourState] = useState(() => { | ||
const restoredTourState = storage.get(NEW_FEATURES_TOUR_STORAGE_KEYS.SIEM_MAIN_LANDING_PAGE); | ||
if (restoredTourState != null) { | ||
return restoredTourState; | ||
} | ||
return tourConfig; | ||
}); | ||
|
||
const onTourFinished = useCallback(() => { | ||
setTourState({ | ||
...tourState, | ||
isTourActive: false, | ||
}); | ||
}, [tourState]); | ||
|
||
useEffect(() => { | ||
storage.set(NEW_FEATURES_TOUR_STORAGE_KEYS.SIEM_MAIN_LANDING_PAGE, tourState); | ||
}, [tourState, storage]); | ||
|
||
const [tourDelayElapsed, setTourDelayElapsed] = useState(false); | ||
|
||
useEffect(() => { | ||
// visible EuiTourStep anchors don't follow the button when the layout changes | ||
const timeout = setTimeout(() => setTourDelayElapsed(true), 1000); | ||
return () => clearTimeout(timeout); | ||
}, []); | ||
|
||
const showTour = useMemo(() => { | ||
return siemMigrations.rules.isAvailable() && tourState.isTourActive && tourDelayElapsed; | ||
}, [siemMigrations.rules, tourDelayElapsed, tourState.isTourActive]); | ||
|
||
return ( | ||
<EuiTourStep | ||
anchorPosition="downCenter" | ||
content={i18n.SETUP_SIEM_MIGRATION_TOUR_CONTENT} | ||
isStepOpen={showTour} | ||
maxWidth={tourState.tourPopoverWidth} | ||
onFinish={onTourFinished} | ||
step={1} | ||
stepsTotal={1} | ||
subtitle={i18n.SETUP_SIEM_MIGRATION_TOUR_SUBTITLE} | ||
title={i18n.SETUP_SIEM_MIGRATION_TOUR_TITLE} | ||
footerAction={ | ||
<EuiButtonEmpty size="xs" color="text" flush="right" onClick={onTourFinished}> | ||
{i18n.FINISH_TOUR_BUTTON} | ||
</EuiButtonEmpty> | ||
} | ||
> | ||
{children} | ||
</EuiTourStep> | ||
); | ||
}); | ||
SiemMigrationSetupTour.displayName = 'SiemMigrationSetupTour'; |
37 changes: 37 additions & 0 deletions
37
...curity_solution/public/siem_migrations/rules/components/tours/setup_guide/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,37 @@ | ||
/* | ||
* 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 SETUP_SIEM_MIGRATION_TOUR_TITLE = i18n.translate( | ||
'xpack.securitySolution.siemMigrations.rules.tour.setupSiemMigrationTourTitle', | ||
{ | ||
defaultMessage: 'Streamlined SIEM migration', | ||
} | ||
); | ||
|
||
export const SETUP_SIEM_MIGRATION_TOUR_SUBTITLE = i18n.translate( | ||
'xpack.securitySolution.siemMigrations.rules.tour.setupSiemMigrationTourTitle', | ||
{ | ||
defaultMessage: 'New onboarding guide!', | ||
} | ||
); | ||
|
||
export const SETUP_SIEM_MIGRATION_TOUR_CONTENT = i18n.translate( | ||
'xpack.securitySolution.siemMigrations.rules.tour.setupSiemMigrationTourContent', | ||
{ | ||
defaultMessage: | ||
'This is a step-by-step guide to quickly import your SIEM rules, assets, and data to Elastic Security. Powered by AI.', | ||
} | ||
); | ||
|
||
export const FINISH_TOUR_BUTTON = i18n.translate( | ||
'xpack.securitySolution.siemMigrations.rules.tour.finishButton', | ||
{ | ||
defaultMessage: 'OK', | ||
} | ||
); |