forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Cloud Posture] CSPM support - dashboard onboarding per policy templa…
…te (elastic#148158)
- Loading branch information
1 parent
82969d6
commit 92f6d9d
Showing
35 changed files
with
948 additions
and
295 deletions.
There are no files selected for viewing
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
2 changes: 1 addition & 1 deletion
2
x-pack/plugins/cloud_security_posture/public/assets/icons/cis_eks_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
...ins/cloud_security_posture/public/assets/illustrations/no_data_illustration.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
* 2.0. | ||
*/ | ||
|
||
export * from './use_compliance_dashboard_data_api'; | ||
export * from './use_stats_api'; |
20 changes: 0 additions & 20 deletions
20
x-pack/plugins/cloud_security_posture/public/common/api/use_compliance_dashboard_data_api.ts
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
x-pack/plugins/cloud_security_posture/public/common/api/use_stats_api.ts
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,43 @@ | ||
/* | ||
* 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 { useQuery, UseQueryOptions } from '@tanstack/react-query'; | ||
import { useKibana } from '../hooks/use_kibana'; | ||
import { PosturePolicyTemplate, ComplianceDashboardData } from '../../../common/types'; | ||
import { STATS_ROUTE_PATH } from '../../../common/constants'; | ||
|
||
// TODO: consolidate both hooks into one hook with a dynamic key | ||
const getCspmStatsKey = ['csp_cspm_dashboard_stats']; | ||
const getKspmStatsKey = ['csp_kspm_dashboard_stats']; | ||
|
||
export const getStatsRoute = (policyTemplate: PosturePolicyTemplate) => { | ||
return STATS_ROUTE_PATH.replace('{policy_template}', policyTemplate); | ||
}; | ||
|
||
export const useCspmStatsApi = ( | ||
options: UseQueryOptions<unknown, unknown, ComplianceDashboardData, string[]> | ||
) => { | ||
const { http } = useKibana().services; | ||
return useQuery( | ||
getCspmStatsKey, | ||
// TODO: CIS AWS - remove casting and use actual policy template instead of benchmark_id | ||
() => http.get<ComplianceDashboardData>(getStatsRoute('cis_aws' as PosturePolicyTemplate)), | ||
options | ||
); | ||
}; | ||
|
||
export const useKspmStatsApi = ( | ||
options: UseQueryOptions<unknown, unknown, ComplianceDashboardData, string[]> | ||
) => { | ||
const { http } = useKibana().services; | ||
return useQuery( | ||
getKspmStatsKey, | ||
// TODO: CIS AWS - remove casting and use actual policy template | ||
() => http.get<ComplianceDashboardData>(getStatsRoute('cis_k8s' as PosturePolicyTemplate)), | ||
options | ||
); | ||
}; |
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
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.