diff --git a/public/pages/Correlations/containers/CorrelationsContainer.tsx b/public/pages/Correlations/containers/CorrelationsContainer.tsx index 081973f42..554de6f9d 100644 --- a/public/pages/Correlations/containers/CorrelationsContainer.tsx +++ b/public/pages/Correlations/containers/CorrelationsContainer.tsx @@ -391,17 +391,20 @@ export class Correlations extends React.Component {findingCardsData.correlatedFindings.map((finding, index) => { return ( - + <> + + + ); })} diff --git a/public/pages/Findings/components/CorrelationsTable/CorrelationsTable.tsx b/public/pages/Findings/components/CorrelationsTable/CorrelationsTable.tsx index 6183d958a..b5bb8bf80 100644 --- a/public/pages/Findings/components/CorrelationsTable/CorrelationsTable.tsx +++ b/public/pages/Findings/components/CorrelationsTable/CorrelationsTable.tsx @@ -95,8 +95,7 @@ export const CorrelationsTable: React.FC = ({ { name: 'Correlated rule', truncateText: true, - render: (item: CorrelationFinding) => - item?.correlationRule?._source?.name || DEFAULT_EMPTY_DATA, + render: (item: CorrelationFinding) => item?.correlationRule.name || DEFAULT_EMPTY_DATA, }, { field: 'logType', diff --git a/public/pages/Findings/components/FindingDetailsFlyout.tsx b/public/pages/Findings/components/FindingDetailsFlyout.tsx index 8b980c787..c3237abb9 100644 --- a/public/pages/Findings/components/FindingDetailsFlyout.tsx +++ b/public/pages/Findings/components/FindingDetailsFlyout.tsx @@ -106,7 +106,7 @@ export default class FindingDetailsFlyout extends Component< correlatedFindings.push({ ...finding, correlationRule: correlationRules.find( - (rule) => finding.rules?.indexOf(rule._id) !== -1 + (rule) => finding.rules?.indexOf(rule.id) !== -1 ), }); } @@ -390,11 +390,7 @@ export default class FindingDetailsFlyout extends Component< } } - private getTabContent( - tabId: FindingFlyoutTabId, - isDocumentLoading = false, - areCorrelationsLoading = false - ) { + private getTabContent(tabId: FindingFlyoutTabId, isDocumentLoading = false) { switch (tabId) { case FindingFlyoutTabId.CORRELATIONS: return ( @@ -441,7 +437,7 @@ export default class FindingDetailsFlyout extends Component< timestamp, }, } = this.props; - const { isDocumentLoading, areCorrelationsLoading } = this.state; + const { isDocumentLoading } = this.state; return ( { + return (this.cache[cacheKey] = response.response.hits.hits.map((hit) => { const queries: CorrelationRuleQuery[] = hit._source.correlate.map((queryData) => { return { index: queryData.index, @@ -105,12 +106,12 @@ export class CorrelationsStore implements ICorrelationsStore { }; }); - return (this.cache[cacheKey] = { + return { id: hit._id, name: hit._source.name, queries, - }); - }); + }; + })); } return []; diff --git a/public/store/DataStore.ts b/public/store/DataStore.ts index c9f55094c..4f085d1e7 100644 --- a/public/store/DataStore.ts +++ b/public/store/DataStore.ts @@ -7,15 +7,14 @@ import { RulesStore } from './RulesStore'; import { BrowserServices } from '../models/interfaces'; import { NotificationsStart } from 'opensearch-dashboards/public'; import { DetectorsStore } from './DetectorsStore'; -import { ICorrelationsStore } from '../../types'; import { CorrelationsStore } from './CorrelationsStore'; -import { FindingsStore, IFindingsStore } from './FindingsStore'; +import { FindingsStore } from './FindingsStore'; export class DataStore { public static rules: RulesStore; public static detectors: DetectorsStore; - public static correlations: ICorrelationsStore; - public static findings: IFindingsStore; + public static correlations: CorrelationsStore; + public static findings: FindingsStore; public static init = (services: BrowserServices, notifications: NotificationsStart) => { const rulesStore = new RulesStore(services.ruleService, notifications); diff --git a/types/Correlations.ts b/types/Correlations.ts index 8d07be196..4db43c44e 100644 --- a/types/Correlations.ts +++ b/types/Correlations.ts @@ -46,15 +46,15 @@ export interface CorrelationFieldCondition { condition: 'AND' | 'OR'; } -export interface CorrelationRule extends CorrelationRuleModel { - id: string; -} - export interface CorrelationRuleModel { name: string; queries: CorrelationRuleQuery[]; } +export interface CorrelationRule extends CorrelationRuleModel { + id: string; +} + export interface CorrelationRuleSourceQueries { index: string; query: string;