From 90c9a23675280cbe85fb51335d65fee5377ca275 Mon Sep 17 00:00:00 2001 From: Omolola Akinleye Date: Thu, 7 Dec 2023 10:48:27 -0500 Subject: [PATCH 1/2] address pr nit comments --- x-pack/plugins/cloud_security_posture/common/constants.ts | 2 ++ .../compliance_charts/compliance_score_chart.tsx | 4 ++-- .../server/routes/compliance_dashboard/get_trends.ts | 6 ++++-- .../server/tasks/findings_stats_task.ts | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/cloud_security_posture/common/constants.ts b/x-pack/plugins/cloud_security_posture/common/constants.ts index d2fffa9d26a2b..0be8c799b8286 100644 --- a/x-pack/plugins/cloud_security_posture/common/constants.ts +++ b/x-pack/plugins/cloud_security_posture/common/constants.ts @@ -78,6 +78,8 @@ export const RULE_FAILED = `failed`; export const POSTURE_TYPE_ALL = 'all'; +export const CSPM_FINDINGS_STATS_INTERVAL = 5; + // A mapping of in-development features to their status. These features should be hidden from users but can be easily // activated via a simple code change in a single location. export const INTERNAL_FEATURE_FLAGS = { diff --git a/x-pack/plugins/cloud_security_posture/public/pages/compliance_dashboard/compliance_charts/compliance_score_chart.tsx b/x-pack/plugins/cloud_security_posture/public/pages/compliance_dashboard/compliance_charts/compliance_score_chart.tsx index 2067a9c98fd23..29a0ca93a4884 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/compliance_dashboard/compliance_charts/compliance_score_chart.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/compliance_dashboard/compliance_charts/compliance_score_chart.tsx @@ -132,7 +132,7 @@ const CompactPercentageLabels = ({ ); -const NonCompactPercentageLabels = ({ +const PercentageLabels = ({ onEvalCounterClick, stats, }: { @@ -301,7 +301,7 @@ export const ComplianceScoreChart = ({ onEvalCounterClick={onEvalCounterClick} /> ) : ( - diff --git a/x-pack/plugins/cloud_security_posture/server/routes/compliance_dashboard/get_trends.ts b/x-pack/plugins/cloud_security_posture/server/routes/compliance_dashboard/get_trends.ts index 00acd14d960fa..c2bb35fa6086c 100644 --- a/x-pack/plugins/cloud_security_posture/server/routes/compliance_dashboard/get_trends.ts +++ b/x-pack/plugins/cloud_security_posture/server/routes/compliance_dashboard/get_trends.ts @@ -7,10 +7,12 @@ import { ElasticsearchClient, Logger } from '@kbn/core/server'; import { calculatePostureScore } from '../../../common/utils/helpers'; -import { BENCHMARK_SCORE_INDEX_DEFAULT_NS } from '../../../common/constants'; +import { + BENCHMARK_SCORE_INDEX_DEFAULT_NS, + CSPM_FINDINGS_STATS_INTERVAL, +} from '../../../common/constants'; import type { PosturePolicyTemplate, Stats } from '../../../common/types'; import { toBenchmarkDocFieldKey } from '../../lib/mapping_field_util'; -import { CSPM_FINDINGS_STATS_INTERVAL } from '../../tasks/findings_stats_task'; interface FindingsDetails { total_findings: number; diff --git a/x-pack/plugins/cloud_security_posture/server/tasks/findings_stats_task.ts b/x-pack/plugins/cloud_security_posture/server/tasks/findings_stats_task.ts index c157e8081546a..93886c8f8acca 100644 --- a/x-pack/plugins/cloud_security_posture/server/tasks/findings_stats_task.ts +++ b/x-pack/plugins/cloud_security_posture/server/tasks/findings_stats_task.ts @@ -19,6 +19,7 @@ import { getIdentifierRuntimeMapping } from '../../common/runtime_mappings/get_i import { FindingsStatsTaskResult, ScoreByPolicyTemplateBucket, VulnSeverityAggs } from './types'; import { BENCHMARK_SCORE_INDEX_DEFAULT_NS, + CSPM_FINDINGS_STATS_INTERVAL, LATEST_FINDINGS_INDEX_DEFAULT_NS, LATEST_VULNERABILITIES_INDEX_DEFAULT_NS, VULNERABILITIES_SEVERITY, @@ -36,7 +37,6 @@ import { toBenchmarkMappingFieldKey } from '../lib/mapping_field_util'; const CSPM_FINDINGS_STATS_TASK_ID = 'cloud_security_posture-findings_stats'; const CSPM_FINDINGS_STATS_TASK_TYPE = 'cloud_security_posture-stats_task'; -export const CSPM_FINDINGS_STATS_INTERVAL = 5; export async function scheduleFindingsStatsTask( taskManager: TaskManagerStartContract, From b688f85f2628a936a80b2aaee61ce4c2e9ef0753 Mon Sep 17 00:00:00 2001 From: Omolola Akinleye Date: Mon, 11 Dec 2023 06:42:15 -0500 Subject: [PATCH 2/2] fix module export to use types old --- .../server/routes/compliance_dashboard/get_trends.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/cloud_security_posture/server/routes/compliance_dashboard/get_trends.ts b/x-pack/plugins/cloud_security_posture/server/routes/compliance_dashboard/get_trends.ts index c2bb35fa6086c..f0369dd3a562a 100644 --- a/x-pack/plugins/cloud_security_posture/server/routes/compliance_dashboard/get_trends.ts +++ b/x-pack/plugins/cloud_security_posture/server/routes/compliance_dashboard/get_trends.ts @@ -11,7 +11,7 @@ import { BENCHMARK_SCORE_INDEX_DEFAULT_NS, CSPM_FINDINGS_STATS_INTERVAL, } from '../../../common/constants'; -import type { PosturePolicyTemplate, Stats } from '../../../common/types'; +import type { PosturePolicyTemplate, Stats } from '../../../common/types_old'; import { toBenchmarkDocFieldKey } from '../../lib/mapping_field_util'; interface FindingsDetails {