Skip to content

[Cloud Posture] onboarding prompts for vul_mgmt#154118

Merged
Omolola-Akinleye merged 22 commits intoelastic:mainfrom
Omolola-Akinleye:onboarding-prompts-vul-mngt
Apr 12, 2023
Merged

[Cloud Posture] onboarding prompts for vul_mgmt#154118
Omolola-Akinleye merged 22 commits intoelastic:mainfrom
Omolola-Akinleye:onboarding-prompts-vul-mngt

Conversation

@Omolola-Akinleye
Copy link
Copy Markdown
Contributor

@Omolola-Akinleye Omolola-Akinleye commented Mar 31, 2023

Summary

This PR adds onboarding prompts for when vulnerability management integration is not installed and when vulnerability management is installed then show scanning empty prompt.

A <NoVulnerabilitesState/> component checks for vuln_mgmt status. If the status is not-deployed or indexing then show

The packageNoInstalledRender component will listen for the current tab and renders on useLocation().pathname. If currentTab is 'vulnerabilities' then we show <VulnerabilitiesFindingsInstalledEmptyPrompt/>. If currentTab is configurations then show <ConfigurationFindingsInstalledEmptyPrompt/>

Installed Prompt
Screen Shot 2023-03-30 at 3 45 35 PM
Scanning Envioronment
Screen Shot 2023-03-30 at 3 45 20 PM

@Omolola-Akinleye Omolola-Akinleye added release_note:skip Skip the PR/issue when compiling release notes Team:Cloud Security Cloud Security team related v8.8.0 labels Mar 31, 2023
@Omolola-Akinleye Omolola-Akinleye self-assigned this Mar 31, 2023
@Omolola-Akinleye Omolola-Akinleye linked an issue Mar 31, 2023 that may be closed by this pull request
7 tasks
@Omolola-Akinleye Omolola-Akinleye added the backport:skip This PR does not require backporting label Mar 31, 2023
@Omolola-Akinleye Omolola-Akinleye marked this pull request as ready for review March 31, 2023 12:03
@Omolola-Akinleye Omolola-Akinleye requested a review from a team as a code owner March 31, 2023 12:03
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-cloud-security-posture (Team:Cloud Security)

expect(screen.queryByTestId(ERROR_STATE_TEST_SUBJECT)).not.toBeInTheDocument();
});

// Todo: fix this test once we have a way to mock the useLocation hook
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

consider the following snippet as an example for mocking useLocation

jest.mock('react-router-dom', () => ({
  ...jest.requireActual('react-router-dom'),
  useLocation: jest.fn().mockReturnValue({ search: '' }),
  useHistory: jest.fn().mockReturnValue({
    push: jest.fn(),
    location: {
      search: '',
    },
  }),
}));

import { VULNERABILITIES_CONTAINER_TEST_SUBJ } from '../../components/test_subjects';

export const Vulnerabilities = () => {
const dataViewQuery = useLatestFindingsDataView(LATEST_VULNERABILITIES_INDEX_DEFAULT_NS);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's use the useFilteredDataView hook instead, so we don't need to create a data view for vulnerability, available once this PR is merged

@Omolola-Akinleye
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@Omolola-Akinleye Omolola-Akinleye force-pushed the onboarding-prompts-vul-mngt branch from b2c6da5 to b8e52c3 Compare April 11, 2023 16:00
- return indexing when there are findings in the datastream but not in the latest index
- return index when latest index contains findings
- delete existing documents instead of deleting the entire index.
- added refresh: true when adding/deleting findings docs in order to force indexing before moving on with the tests
import { VULNERABILITIES_CONTAINER_TEST_SUBJ } from '../../components/test_subjects';

export const Vulnerabilities = () => {
const dataViewQuery = useLatestFindingsDataView(LATEST_VULNERABILITIES_INDEX_DEFAULT_NS);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it's ready to switch for useFilteredDataView now


export const CLOUD_SECURITY_POSTURE_PACKAGE_NAME = 'cloud_security_posture';

// TODO: REMOVE CSP_LATEST_FINDINGS_DATA_VIEW and replace it with LATEST_FINDINGS_INDEX_PATTERN
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can remove that now

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

CSP_LATEST_FINDINGS_DATA_VIEW is used in multiple places. We added a todo comment for now. I can create a follow PR to remove the instances where it's being used

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Got it, we can address it in follow-up tickets

@kibana-ci
Copy link
Copy Markdown

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
cloudSecurityPosture 174.4KB 178.3KB +3.9KB

Page load bundle

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

id before after diff
cloudSecurityPosture 11.5KB 11.6KB +84.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
securitySolution 433 436 +3

Total ESLint disabled count

id before after diff
securitySolution 512 515 +3

History

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

cc @Omolola-Akinleye

Copy link
Copy Markdown
Contributor

@opauloh opauloh left a comment

Choose a reason for hiding this comment

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

LGTM

@Omolola-Akinleye Omolola-Akinleye merged commit b07743b into elastic:main Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Cloud Security Cloud Security team related v8.8.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Cloud Security] [Findings] [Vulnerabilities] Onboarding prompts UI

5 participants