-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Security solution] Guided onboarding unhappy path fixes #144178
[Security solution] Guided onboarding unhappy path fixes #144178
Conversation
const StyledTourStep = styled(EuiTourStep)<EuiTourStepProps & { stepId: SecurityStepId }>` | ||
&.euiPopover__panel[data-popover-open] { | ||
z-index: ${({ step, stepId }) => | ||
isStepExternallyMounted(stepId, step) ? '9000 !important' : '1000 !important'}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export const SecurityTourStep = ({ children, step, stepId }: SecurityTourStep) => { | ||
const { activeStep, incrementStep, isTourShown } = useTourContext(); | ||
const tourStep = useMemo( | ||
() => securityTourConfig[stepId].find((config) => config.step === step), | ||
[step, stepId] | ||
); | ||
|
||
const getTimeline = useMemo(() => timelineSelectors.getTimelineByIdSelector(), []); | ||
const showTimeline = useShallowEqualSelector( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -217,11 +217,12 @@ const ActionsComponent: React.FC<ActionProps> = ({ | |||
); | |||
|
|||
const onExpandEvent = useCallback(() => { | |||
if (isTourAnchor) { | |||
const isStep2Active = activeStep === 2 && isTourShown(SecurityStepId.alertsCases); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use the enum here instead of 2 and maybe isExpandEventStepActive
?
@@ -80,7 +80,9 @@ export const useAddToCaseActions = ({ | |||
onMenuItemClick(); | |||
createCaseFlyout.open({ | |||
attachments: caseAttachments, | |||
...(isTourShown(SecurityStepId.alertsCases) && activeStep === 4 | |||
// activeStep will be 4 on first render because not yet incremented | |||
// if the user closes the flyout without completing the form and comes back, we will be at step 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -19,7 +19,7 @@ import { securityTourConfig, SecurityStepId } from './tour_config'; | |||
export interface TourContextValue { | |||
activeStep: number; | |||
endTourStep: (stepId: SecurityStepId) => void; | |||
incrementStep: (stepId: SecurityStepId, step?: number) => void; | |||
incrementStep: (stepId: SecurityStepId) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
never used/implemented
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it going to be used in the future or should we just remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh ignore me
@@ -9,6 +9,12 @@ import { render } from '@testing-library/react'; | |||
import { GuidedOnboardingTourStep, SecurityTourStep } from './tour_step'; | |||
import { SecurityStepId } from './tour_config'; | |||
import { useTourContext } from './tour'; | |||
import { mockGlobalState, SUB_PLUGINS_REDUCER, TestProviders } from '../../mock'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need this now since we have timeline state in the component
Pinging @elastic/security-threat-hunting (Team:Threat Hunting) |
Pinging @elastic/security-solution (Team: SecuritySolution) |
@@ -89,11 +117,13 @@ export const SecurityTourStep = ({ children, step, stepId }: SecurityTourStep) = | |||
// see type EuiTourStepAnchorProps | |||
return anchor != null ? ( | |||
<> | |||
<EuiTourStep {...commonProps} anchor={anchor} /> | |||
<StyledTourStep stepId={stepId} {...commonProps} anchor={anchor} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: In this case where we have the anchor
, do we need to render the TourStep if we don't have children
?
I am asking because if we don't have to render anything if children
is not passed, then we could create an exit case (if !children return null
) much earlier in the component, and avoid checking it on every return, and this double ternary condition as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, step 5 is only the tour step, no children passed
x-pack/plugins/security_solution/public/timelines/components/timeline/body/actions/index.tsx
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, All the problems mentioned are solved.
The only change I would do is to use constants in the components for the steps, instead of the sequence number, as discussed. But besides that, it LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, just one UX change for the flyout header, but everything else looks good...just some nits. Thanks for doing this work!
@michaelolo24 I have a PR with design fixes coming up next so I will clear this problem up there. thanks! |
💚 Build Succeeded
Metrics [docs]Async chunks
Unknown metric groupsESLint disabled in files
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
Summary
Follow up to #143598
Fixes unhappy path behavior on the
SecurityStepId.alertsCases
tour. Details on the fixes are in the code!To test
Add to your dev yml:
xpack.cloud.id: test
(this is new since the original PR)Follow instructions from original PR #143598
Known issues left unresolved
If you have a flyout guide step open, close the flyout, open the Setup guide menu, and click "Continue", the user needs to manually open the flyout to get back to the step. Here is an issue to add a callback that will allow us to automate this click. FWIW, this only happens if the user is on the alerts page. If they go to an unrelated page (non-detections), open the Setup guide menu, and click "Continue", they are redirected to the Alerts page and reset to step 1.