Skip to content

Commit

Permalink
[Cloud Posture]fix incorrect vuln_mgmt details in flyout (#157745)
Browse files Browse the repository at this point in the history
## Summary

Summarize your PR. If it involves visual changes include a screenshot or
gif.
Currently, after navigating any page after the first page and clicking
on vulnerability, the flyout displays incorrect details.

Currently, we use the `data.page`, which lists the maximum amount of
vulnerabilities(500 vulnerabilities). The `vulnerabilityIndex` is set
each time, a user clicks to expand vulnerability. We were currently only
selecting vulnerabilities from the first page.

Solution:

Use `slicedPage` to get the vulnerabilities on the current page and then
select vulnerability by `vulnerabilityIndex`


https://github.com/elastic/kibana/assets/17135495/df682ecf-d024-45e4-84ca-d7df22a60ec4
  • Loading branch information
Omolola-Akinleye authored and jasonrhodes committed May 17, 2023
1 parent 83379ec commit c0e6677
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ const VulnerabilitiesContent = ({ dataView }: { dataView: DataView }) => {
const slicedPage = usePageSlice(data?.page, pageIndex, pageSize);

const invalidIndex = -1;
const selectedVulnerability = data?.page[urlQuery.vulnerabilityIndex];

const selectedVulnerability = useMemo(() => {
return slicedPage[urlQuery.vulnerabilityIndex];
}, [slicedPage, urlQuery.vulnerabilityIndex]);

const onCloseFlyout = () => {
setUrlQuery({
Expand Down

0 comments on commit c0e6677

Please sign in to comment.