From 410cadc508b4d1a4a482fc986f8546cf682b31cd Mon Sep 17 00:00:00 2001 From: animehart Date: Thu, 14 Nov 2024 09:06:04 -0800 Subject: [PATCH] pr comments + replaced reason column with status --- .../common/utils/helpers.test.ts | 2 +- .../common/utils/helpers.ts | 2 +- .../alerts_findings_details_table.tsx | 18 +++++++++--------- .../csp_details/insights_tab_csp.tsx | 2 -- .../flyout/entity_details/host_right/index.tsx | 9 ++------- .../flyout/entity_details/user_right/index.tsx | 9 ++------- 6 files changed, 15 insertions(+), 27 deletions(-) diff --git a/x-pack/packages/kbn-cloud-security-posture/common/utils/helpers.test.ts b/x-pack/packages/kbn-cloud-security-posture/common/utils/helpers.test.ts index 01a5b2b244006..04cb76f4441c5 100644 --- a/x-pack/packages/kbn-cloud-security-posture/common/utils/helpers.test.ts +++ b/x-pack/packages/kbn-cloud-security-posture/common/utils/helpers.test.ts @@ -193,9 +193,9 @@ describe('test helper methods', () => { '_id', '_index', 'kibana.alert.rule.uuid', - 'kibana.alert.reason', 'kibana.alert.severity', 'kibana.alert.rule.name', + 'kibana.alert.workflow_status', ], query: { bool: { diff --git a/x-pack/packages/kbn-cloud-security-posture/common/utils/helpers.ts b/x-pack/packages/kbn-cloud-security-posture/common/utils/helpers.ts index d9b43642000e9..bd531fa63804f 100644 --- a/x-pack/packages/kbn-cloud-security-posture/common/utils/helpers.ts +++ b/x-pack/packages/kbn-cloud-security-posture/common/utils/helpers.ts @@ -78,9 +78,9 @@ export const buildEntityAlertsQuery = ( '_id', '_index', 'kibana.alert.rule.uuid', - 'kibana.alert.reason', 'kibana.alert.severity', 'kibana.alert.rule.name', + 'kibana.alert.workflow_status', ], query: { bool: { diff --git a/x-pack/plugins/security_solution/public/cloud_security_posture/components/csp_details/alerts_findings_details_table.tsx b/x-pack/plugins/security_solution/public/cloud_security_posture/components/csp_details/alerts_findings_details_table.tsx index b376b2c7e4f3b..966de68e3497f 100644 --- a/x-pack/plugins/security_solution/public/cloud_security_posture/components/csp_details/alerts_findings_details_table.tsx +++ b/x-pack/plugins/security_solution/public/cloud_security_posture/components/csp_details/alerts_findings_details_table.tsx @@ -41,9 +41,9 @@ interface ResultAlertsField { _id: string[]; _index: string[]; 'kibana.alert.rule.uuid': string[]; - 'kibana.alert.reason': string[]; 'kibana.alert.severity': AlertSeverity[]; 'kibana.alert.rule.name': string[]; + 'kibana.alert.workflow_status': string[]; } interface ContextualFlyoutAlertsField { @@ -51,8 +51,8 @@ interface ContextualFlyoutAlertsField { index: string; ruleUuid: string; ruleName: string; - reason: string; severity: AlertSeverity; + status: string; } interface AlertsDetailsFields { @@ -100,10 +100,10 @@ export const AlertsDetailsTable = memo( return { id: item.fields?._id?.[0], index: item.fields?._index?.[0], - reason: item.fields?.['kibana.alert.reason']?.[0], ruleName: item.fields?.['kibana.alert.rule.name']?.[0], ruleUuid: item.fields?.['kibana.alert.rule.uuid']?.[0], severity: item.fields?.['kibana.alert.severity']?.[0], + status: item.fields?.['kibana.alert.workflow_status']?.[0], }; } ); @@ -178,7 +178,7 @@ export const AlertsDetailsTable = memo( defaultMessage: 'Rule', } ), - width: '35%', + width: '55%', }, { field: 'severity', @@ -196,15 +196,15 @@ export const AlertsDetailsTable = memo( width: '20%', }, { - field: 'reason', - render: (reason: string) => {reason}, + field: 'status', + render: (status: string) => {capitalize(status)}, name: i18n.translate( - 'xpack.securitySolution.flyout.left.insights.alerts.table.reasonColumnName', + 'xpack.securitySolution.flyout.left.insights.alerts.table.statusColumnName', { - defaultMessage: 'Reason', + defaultMessage: 'Status', } ), - width: '40%', + width: '20%', }, ]; diff --git a/x-pack/plugins/security_solution/public/cloud_security_posture/components/csp_details/insights_tab_csp.tsx b/x-pack/plugins/security_solution/public/cloud_security_posture/components/csp_details/insights_tab_csp.tsx index 17e75a7ca88fa..2e7b4171fd023 100644 --- a/x-pack/plugins/security_solution/public/cloud_security_posture/components/csp_details/insights_tab_csp.tsx +++ b/x-pack/plugins/security_solution/public/cloud_security_posture/components/csp_details/insights_tab_csp.tsx @@ -12,7 +12,6 @@ import { FormattedMessage } from '@kbn/i18n-react'; import type { FlyoutPanelProps, PanelPath } from '@kbn/expandable-flyout'; import { useExpandableFlyoutState } from '@kbn/expandable-flyout'; import { i18n } from '@kbn/i18n'; -// import type { FlyoutPanels } from '@kbn/expandable-flyout/src/store/state'; import { CspInsightLeftPanelSubTab } from '../../../flyout/entity_details/shared/components/left_panel/left_panel_header'; import { MisconfigurationFindingsDetailsTable } from './misconfiguration_findings_details_table'; import { VulnerabilitiesFindingsDetailsTable } from './vulnerabilities_findings_details_table'; @@ -155,7 +154,6 @@ export const InsightsTabCsp = memo( ) : activeInsightsId === CspInsightLeftPanelSubTab.VULNERABILITIES ? ( ) : ( - //
{'ALERTS HERE'}
//AlertsDetailsTable )} diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/host_right/index.tsx b/x-pack/plugins/security_solution/public/flyout/entity_details/host_right/index.tsx index e178cda2c90d5..a7e99898606f8 100644 --- a/x-pack/plugins/security_solution/public/flyout/entity_details/host_right/index.tsx +++ b/x-pack/plugins/security_solution/public/flyout/entity_details/host_right/index.tsx @@ -135,13 +135,8 @@ export const HostPanel = ({ from, }); - const alertsOpenCount = alertsData?.open?.total || 0; - - const alertsAcknowledgedCount = alertsData?.acknowledged?.total || 0; - - const alertsCount = alertsOpenCount + alertsAcknowledgedCount; - - const hasNonClosedAlerts = alertsCount; + const hasNonClosedAlerts = + (alertsData?.acknowledged?.total || 0) + (alertsData?.open?.total || 0) > 0; useQueryInspector({ deleteQuery, diff --git a/x-pack/plugins/security_solution/public/flyout/entity_details/user_right/index.tsx b/x-pack/plugins/security_solution/public/flyout/entity_details/user_right/index.tsx index 7fade9677b777..07762ed9aea0c 100644 --- a/x-pack/plugins/security_solution/public/flyout/entity_details/user_right/index.tsx +++ b/x-pack/plugins/security_solution/public/flyout/entity_details/user_right/index.tsx @@ -127,13 +127,8 @@ export const UserPanel = ({ from, }); - const alertsOpenCount = alertsData?.open?.total || 0; - - const alertsAcknowledgedCount = alertsData?.acknowledged?.total || 0; - - const alertsCount = alertsOpenCount + alertsAcknowledgedCount; - - const hasNonClosedAlerts = alertsCount > 0; + const hasNonClosedAlerts = + (alertsData?.acknowledged?.total || 0) + (alertsData?.open?.total || 0) > 0; useQueryInspector({ deleteQuery,