Skip to content

Commit

Permalink
[8.12] [Cloud Security] fix accounts evaluation count issue (#173035) (
Browse files Browse the repository at this point in the history
…#173065)

# Backport

This will backport the following commits from `main` to `8.12`:
- [[Cloud Security] fix accounts evaluation count issue
(#173035)](#173035)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"Lola","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-12-11T14:02:54Z","message":"[Cloud
Security] fix accounts evaluation count issue (#173035)\n\n##
Summary\r\n\r\nSummarize your PR. If it involves visual changes include
a screenshot or\r\ngif.\r\n\r\nThe Account Evaluation counter only
counts the type of benchmark. For\r\ninstance, the `cis_azure` benchmark
counter shows 1 because we count the\r\nbenchmark type which is always
1. We need to display the\r\n`benchmark.meta.assetCount` will accurately
display the number of\r\naccounts per benchmark ID.\r\n<img
width=\"1205\" alt=\"Screenshot 2023-12-11 at 6 09
41 AM\"\r\nsrc=\"https://github.com/elastic/kibana/assets/17135495/978fcca3-fbc8-44d0-b6cf-8f3e07a42505\">","sha":"305b6da3617980bd856e8efd33ed1a020c03ba98","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:Cloud
Security","v8.12.0","v8.13.0"],"number":173035,"url":"https://github.com/elastic/kibana/pull/173035","mergeCommit":{"message":"[Cloud
Security] fix accounts evaluation count issue (#173035)\n\n##
Summary\r\n\r\nSummarize your PR. If it involves visual changes include
a screenshot or\r\ngif.\r\n\r\nThe Account Evaluation counter only
counts the type of benchmark. For\r\ninstance, the `cis_azure` benchmark
counter shows 1 because we count the\r\nbenchmark type which is always
1. We need to display the\r\n`benchmark.meta.assetCount` will accurately
display the number of\r\naccounts per benchmark ID.\r\n<img
width=\"1205\" alt=\"Screenshot 2023-12-11 at 6 09
41 AM\"\r\nsrc=\"https://github.com/elastic/kibana/assets/17135495/978fcca3-fbc8-44d0-b6cf-8f3e07a42505\">","sha":"305b6da3617980bd856e8efd33ed1a020c03ba98"}},"sourceBranch":"main","suggestedTargetBranches":["8.12"],"targetPullRequestStates":[{"branch":"8.12","label":"v8.12.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","labelRegex":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/173035","number":173035,"mergeCommit":{"message":"[Cloud
Security] fix accounts evaluation count issue (#173035)\n\n##
Summary\r\n\r\nSummarize your PR. If it involves visual changes include
a screenshot or\r\ngif.\r\n\r\nThe Account Evaluation counter only
counts the type of benchmark. For\r\ninstance, the `cis_azure` benchmark
counter shows 1 because we count the\r\nbenchmark type which is always
1. We need to display the\r\n`benchmark.meta.assetCount` will accurately
display the number of\r\naccounts per benchmark ID.\r\n<img
width=\"1205\" alt=\"Screenshot 2023-12-11 at 6 09
41 AM\"\r\nsrc=\"https://github.com/elastic/kibana/assets/17135495/978fcca3-fbc8-44d0-b6cf-8f3e07a42505\">","sha":"305b6da3617980bd856e8efd33ed1a020c03ba98"}}]}]
BACKPORT-->

Co-authored-by: Lola <[email protected]>
  • Loading branch information
kibanamachine and Omolola-Akinleye authored Dec 11, 2023
1 parent fb4efd5 commit ccfd82d
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 ccfd82d

Please sign in to comment.