Skip to content

Commit

Permalink
pr comments + replaced reason column with status
Browse files Browse the repository at this point in the history
  • Loading branch information
animehart committed Nov 14, 2024
1 parent 8cff4f7 commit 410cadc
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@ 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 {
id: string;
index: string;
ruleUuid: string;
ruleName: string;
reason: string;
severity: AlertSeverity;
status: string;
}

interface AlertsDetailsFields {
Expand Down Expand Up @@ -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],
};
}
);
Expand Down Expand Up @@ -178,7 +178,7 @@ export const AlertsDetailsTable = memo(
defaultMessage: 'Rule',
}
),
width: '35%',
width: '55%',
},
{
field: 'severity',
Expand All @@ -196,15 +196,15 @@ export const AlertsDetailsTable = memo(
width: '20%',
},
{
field: 'reason',
render: (reason: string) => <EuiText size="s">{reason}</EuiText>,
field: 'status',
render: (status: string) => <EuiText size="s">{capitalize(status)}</EuiText>,
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%',
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -155,7 +154,6 @@ export const InsightsTabCsp = memo(
) : activeInsightsId === CspInsightLeftPanelSubTab.VULNERABILITIES ? (
<VulnerabilitiesFindingsDetailsTable queryName={name} />
) : (
// <div>{'ALERTS HERE'}</div> //AlertsDetailsTable
<AlertsDetailsTable fieldName={fieldName} queryName={name} />
)}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 410cadc

Please sign in to comment.