Skip to content

Commit

Permalink
[Cloud Security] fix accounts evaluation count issue (#173035)
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.

The Account Evaluation counter only counts the type of benchmark. For
instance, the `cis_azure` benchmark counter shows 1 because we count the
benchmark type which is always 1. We need to display the
`benchmark.meta.assetCount` will accurately display the number of
accounts per benchmark ID.
<img width="1205" alt="Screenshot 2023-12-11 at 6 09 41 AM"
src="https://github.com/elastic/kibana/assets/17135495/978fcca3-fbc8-44d0-b6cf-8f3e07a42505">

(cherry picked from commit 305b6da)
  • Loading branch information
Omolola-Akinleye committed Dec 11, 2023
1 parent 6333a72 commit 7350b83
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ export const AccountsEvaluatedWidget = ({
}) => {
const { euiTheme } = useEuiTheme();

const filterBenchmarksById = (benchmarkId: string) => {
return benchmarkAssets?.filter((obj) => obj?.meta.benchmarkId === benchmarkId) || [];
const getBenchmarkById = (benchmarkId: string) => {
return benchmarkAssets?.find((obj) => obj?.meta.benchmarkId === benchmarkId);
};

const navToFindings = useNavigateFindings();
Expand All @@ -67,7 +67,7 @@ export const AccountsEvaluatedWidget = ({
};

const benchmarkElements = benchmarks.map((benchmark) => {
const cloudAssetAmount = filterBenchmarksById(benchmark.type).length;
const cloudAssetAmount = getBenchmarkById(benchmark.type)?.meta?.assetCount || 0;

return (
cloudAssetAmount > 0 && (
Expand Down

0 comments on commit 7350b83

Please sign in to comment.