-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Cloud Security][BugFix] Fix for loading issue when loading Dashboard (…
…#153908) ## Summary This is a fix for issue where: - the dashboard is stuck on loading state after user installed either KSPM or CSPM - Installation Prompt for integration thats not been installed yet is not rendered - Regression on Findings page caused by Status PR Added a test to cover rendering test for CSPM or KSPM installation prompt on Dashboard page (depending on which one is not installed yet) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
dfbf21f
commit 107f4d8
Showing
13 changed files
with
247 additions
and
111 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
x-pack/plugins/cloud_security_posture/public/common/utils/get_cpm_status.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { CspSetupStatus } from '../../../common/types'; | ||
|
||
// Cloud Posture Management Status | ||
export const getCpmStatus = (cpmStatusData: CspSetupStatus | undefined) => { | ||
// if has findings in any of the integrations. | ||
const hasFindings = | ||
cpmStatusData?.indicesDetails[0].status === 'not-empty' || | ||
cpmStatusData?.kspm.status === 'indexed' || | ||
cpmStatusData?.cspm.status === 'indexed'; | ||
|
||
// kspm | ||
const hasKspmFindings = | ||
cpmStatusData?.kspm?.status === 'indexed' || | ||
cpmStatusData?.indicesDetails[0].status === 'not-empty'; | ||
|
||
// cspm | ||
const hasCspmFindings = | ||
cpmStatusData?.cspm?.status === 'indexed' || | ||
cpmStatusData?.indicesDetails[0].status === 'not-empty'; | ||
|
||
const isKspmInstalled = cpmStatusData?.kspm?.status !== 'not-installed'; | ||
const isCspmInstalled = cpmStatusData?.cspm?.status !== 'not-installed'; | ||
const isKspmPrivileged = cpmStatusData?.kspm?.status !== 'unprivileged'; | ||
const isCspmPrivileged = cpmStatusData?.cspm?.status !== 'unprivileged'; | ||
|
||
const isCspmIntegrationInstalled = isCspmInstalled && isCspmPrivileged; | ||
const isKspmIntegrationInstalled = isKspmInstalled && isKspmPrivileged; | ||
|
||
const isEmptyData = | ||
cpmStatusData?.kspm?.status === 'not-installed' && | ||
cpmStatusData?.cspm?.status === 'not-installed' && | ||
cpmStatusData?.indicesDetails[0].status === 'empty'; | ||
|
||
return { | ||
hasFindings, | ||
hasKspmFindings, | ||
hasCspmFindings, | ||
isCspmInstalled, | ||
isKspmInstalled, | ||
isKspmPrivileged, | ||
isCspmPrivileged, | ||
isCspmIntegrationInstalled, | ||
isKspmIntegrationInstalled, | ||
isEmptyData, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.