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

[Security solution] Guided onboarding, alerts & cases design updates #144249

Merged
merged 57 commits into from
Nov 9, 2022

Conversation

stephmilovic
Copy link
Contributor

@stephmilovic stephmilovic commented Oct 31, 2022

Summary

Makes updates to the guided onboarding design for the alerts and cases tour as requested here.

  1. Adds a "Next" button to all tour steps. Adds an onClick property to SecurityTourStep to accomplish this. When next is click, either incrementStep if no onClick provided or call the onClick. Therefore, any provided onClick should handle incrementing the tour step
  2. Focuses on Next buttons throughout tour (removes hideNextButton)
  3. Pre-populates a sample case
  4. Next button on create case step implements to a new step that scrolls down and calls attention to the create case button
  5. Implements a new last step that has user click through to case details, where the case tour ends
  6. Fixes bug with expanded rule name cell
  7. Fix a few places where the step number was still being used instead of AlertsCasesTourSteps

Here is what all of that looks like:

flow-wednesday2.mov

To test

  1. add feature flag to kibana.dev.yml: xpack.securitySolution.enableExperimental: ['guidedOnboarding']
  2. add cloud test feature flag: xpack.cloud.id: 'test'
  3. Run kibana with examples: yarn start --run-examples
  4. Ensure you have alerts
  5. Go to /app/guidedOnboardingExample
  6. Use the "Set guide state" section to set Guide to security and Step ID to alertsCases
  7. The Setup guide menu will automatically open to Security step 3. Hit the "Start" button
  8. You will be redirected to the alerts page and at this point, we will start on the Alerts and cases tour. Click through the steps to complete the tour and check the fixes mentioned above

Changes to the cases app

For the cases tour step, our designer requested that when the create case flyout opens, the form is pre-populated.

  • To achieve the pre-populated form, I added a new property to the CreateCaseFlyout of initialValue: Partial<Case>. This value is piped to the form context and spread with in the definition of the create form: defaultValue: { ...initialCaseValue, ...initialValue }
  • Added tour-step properties to Eui elements to use as references for anchors and focus() instead of data-test-subj

@stephmilovic stephmilovic added release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting Security Solution Threat Hunting Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting:Explore v8.6.0 labels Oct 31, 2022
Copy link
Contributor

@kellyemurphy kellyemurphy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One change and some questions.

Copy link
Contributor

@kellyemurphy kellyemurphy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, better suggestions this time.

@stephmilovic stephmilovic marked this pull request as ready for review November 2, 2022 14:56
@stephmilovic stephmilovic requested a review from a team as a code owner November 2, 2022 14:56

describe('Related Cases', () => {
beforeEach(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests needed improvement. Also, the async call in related_cases had side effects that the tests were yelling about, so I fixed the side effects. The last 2 tests in this file are what you should pay attention to

}
setRelatedCases(relatedCaseList);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unit tests were yelling about this being called when the component was unmounted. Therefore, I refactored the async call to avoid this side effect

document.querySelector(`[data-test-subj="create-case-submit"]`);

export const CasesTourSteps = () => {
const [activeStep, setActiveStep] = useState(AlertsCasesTourSteps.createCase);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this component is passed to Cases to render, it needs to manage its own activeStep state as the activeStep managed by security solution useTourContext is out of context

@@ -81,6 +82,7 @@ export const CreateCaseFlyout = React.memo<CreateCaseFlyoutProps>(
<GlobalStyle />
<StyledFlyout
onClose={onClose}
tour-step="create-case-flyout"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are labels for my tour step anchor. Previously I was using data-test-subj="create-case-flyout" but it makes me nervous to call on a test ref in production.

@@ -45,6 +45,7 @@ export const useResponderActionItem = (
if (isResponseActionsConsoleEnabled && !isAuthzLoading && canAccessResponseConsole && isAlert) {
actions.push(
<ResponderContextMenuItem
key="endpointResponseActions-action-item"
Copy link
Contributor Author

@stephmilovic stephmilovic Nov 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error in tests pointed out that all members of the context menu did not have keys

@@ -123,6 +131,7 @@ export const useAddToCaseActions = ({
<EuiContextMenuItem
aria-label={ariaLabel}
data-test-subj="add-to-existing-case-action"
key="add-to-existing-case-action"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error in tests pointed out that all members of the context menu did not have keys

Copy link
Contributor

@jonathan-buttner jonathan-buttner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cases changes look good 👍

Copy link
Contributor

@YulNaumenko YulNaumenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally and all the functionality work as expected.
Suggesting to improve the naming for the properties for GuidedOnboardingTourStep, incrementStep and remove "Allow me to explain some weirdness"


const afterCaseCreated = useCallback(async () => {
if (isTourShown(SecurityStepId.alertsCases)) {
endTourStep(SecurityStepId.alertsCases);
// user could be on step 5 or 6 at this point, increment to 7 no matter what
incrementStep(SecurityStepId.alertsCases, AlertsCasesTourSteps.viewCase);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could create a new setStep for this one, using incrementStep may seem we are incrementing by 7, but we are not incrementing, we are setting a specific step value. If we change the function name we won't need the comment explaining what it does.

Copy link
Contributor

@semd semd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
Thanks Steph this is awesome 🚀

@kibana-ci
Copy link
Collaborator

kibana-ci commented Nov 9, 2022

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 3224 3225 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
cases 344.2KB 344.4KB +151.0B
securitySolution 9.6MB 9.6MB -58.4KB
total -58.3KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
securitySolution 50.8KB 50.7KB -8.0B
Unknown metric groups

async chunk count

id before after diff
securitySolution 36 35 -1

ESLint disabled in files

id before after diff
osquery 1 2 +1

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
fleet 59 65 +6
osquery 108 113 +5
securitySolution 440 447 +7
total +20

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
fleet 67 73 +6
osquery 109 115 +6
securitySolution 517 524 +7
total +21

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@stephmilovic stephmilovic merged commit b721fdc into elastic:main Nov 9, 2022
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting ci:build-example-plugins ci:cloud-deploy Create or update a Cloud deployment release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting:Explore Team:Threat Hunting Security Solution Threat Hunting Team v8.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.