/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ import React from 'react'; import { EuiPanel, EuiFlexGroup, EuiFlexItem, EuiText, EuiButtonIcon, EuiSpacer, EuiBadge, EuiHorizontalRule, EuiToolTip, EuiDescriptionList, } from '@elastic/eui'; import { getSeverityLabel, getSeverityColor, getLabelFromLogType } from '../utils/constants'; import { DataStore } from '../../../store/DataStore'; import { CorrelationFinding } from '../../../../types'; export interface FindingCardProps { id: string; logType: string; timestamp: string; detectionRule: { name: string; severity: string }; correlationData?: { score: string; onInspect: (findingId: string, logType: string) => void; }; finding: CorrelationFinding; findings: CorrelationFinding[]; } export const FindingCard: React.FC = ({ correlationData, id, logType, timestamp, detectionRule, finding, findings, }) => { const correlationHeader = correlationData ? ( <> {correlationData.score} DataStore.findings.openFlyout(finding, findings, false)} /> correlationData.onInspect(id, logType)} /> Correlation score ) : null; const list = [ { title: 'Generated', description: timestamp, }, { title: 'Detection rule', description: detectionRule.name, }, ]; return ( {correlationHeader}
{getSeverityLabel(detectionRule.severity)} {getLabelFromLogType(logType)}
{!correlationData && ( DataStore.findings.openFlyout(finding, findings, false)} /> )}
{correlationHeader ? : null}
); };