From ccfd82d57be214133f599fa128e52e228ae0b581 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Mon, 11 Dec 2023 10:29:49 -0500 Subject: [PATCH] [8.12] [Cloud Security] fix accounts evaluation count issue (#173035) (#173065) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Backport This will backport the following commits from `main` to `8.12`: - [[Cloud Security] fix accounts evaluation count issue (#173035)](https://github.com/elastic/kibana/pull/173035) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Lola --- .../public/components/accounts_evaluated_widget.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/cloud_security_posture/public/components/accounts_evaluated_widget.tsx b/x-pack/plugins/cloud_security_posture/public/components/accounts_evaluated_widget.tsx index 4feee3a5e2287..c4e2028381ed6 100644 --- a/x-pack/plugins/cloud_security_posture/public/components/accounts_evaluated_widget.tsx +++ b/x-pack/plugins/cloud_security_posture/public/components/accounts_evaluated_widget.tsx @@ -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(); @@ -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 && (