From 2015af18ecfb4b1cec4e8e27d7bdd473c8f80dff Mon Sep 17 00:00:00 2001 From: Amardeepsingh Siglani Date: Tue, 25 Feb 2025 22:49:39 -0800 Subject: [PATCH] fixes after cherry pick Signed-off-by: Amardeepsingh Siglani --- .../ThreatIntelSourceDetails.tsx | 2 -- .../ThreatIntelSourceDetailsFileUploader.tsx | 8 ++++---- .../ThreatIntelSourceFileUploader.tsx | 14 ++++++++++---- .../AddThreatIntelSource/AddThreatIntelSource.tsx | 4 +++- public/plugin.ts | 6 +++--- public/utils/helpers.tsx | 10 +++++++--- 6 files changed, 27 insertions(+), 17 deletions(-) diff --git a/public/pages/ThreatIntel/components/ThreatIntelSourceDetails/ThreatIntelSourceDetails.tsx b/public/pages/ThreatIntel/components/ThreatIntelSourceDetails/ThreatIntelSourceDetails.tsx index 66dca614..84117c2f 100644 --- a/public/pages/ThreatIntel/components/ThreatIntelSourceDetails/ThreatIntelSourceDetails.tsx +++ b/public/pages/ThreatIntel/components/ThreatIntelSourceDetails/ThreatIntelSourceDetails.tsx @@ -7,9 +7,7 @@ import React, { useEffect, useState } from 'react'; import { EuiBottomBar, EuiSmallButton, - EuiCompressedCheckboxGroup, EuiCompressedFieldText, - EuiCompressedFilePicker, EuiCodeEditor, EuiFlexGroup, EuiFlexItem, diff --git a/public/pages/ThreatIntel/components/ThreatIntelSourceDetails/ThreatIntelSourceDetailsFileUploader.tsx b/public/pages/ThreatIntel/components/ThreatIntelSourceDetails/ThreatIntelSourceDetailsFileUploader.tsx index 87e03834..8adfbcc4 100644 --- a/public/pages/ThreatIntel/components/ThreatIntelSourceDetails/ThreatIntelSourceDetailsFileUploader.tsx +++ b/public/pages/ThreatIntel/components/ThreatIntelSourceDetails/ThreatIntelSourceDetailsFileUploader.tsx @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { EuiFieldText, EuiFormRow } from '@elastic/eui'; +import { EuiCompressedFieldText, EuiCompressedFormRow } from '@elastic/eui'; import React from 'react'; import { ThreatIntelSourceFileUploader, @@ -28,9 +28,9 @@ export const ThreatIntelSourceDetailsFileUploader: React.FC {isReadOnly && ( - - - + + + )} {!isReadOnly && ( )} - - - + ); diff --git a/public/pages/ThreatIntel/containers/AddThreatIntelSource/AddThreatIntelSource.tsx b/public/pages/ThreatIntel/containers/AddThreatIntelSource/AddThreatIntelSource.tsx index 6ccfdcf1..86593940 100644 --- a/public/pages/ThreatIntel/containers/AddThreatIntelSource/AddThreatIntelSource.tsx +++ b/public/pages/ThreatIntel/containers/AddThreatIntelSource/AddThreatIntelSource.tsx @@ -56,6 +56,8 @@ import { IOC_UPLOAD_MAX_FILE_SIZE, } from '../../utils/constants'; import { ThreatIntelSourceFileUploader } from '../../components/ThreatIntelSourceFileUploader/ThreatIntelSourceFileUploader'; +import { setBreadcrumbs } from '../../../../utils/helpers'; +import { PageHeader } from '../../../../components/PageHeader/PageHeader'; export interface AddThreatIntelSourceProps extends RouteComponentProps { threatIntelService: ThreatIntelService; @@ -353,7 +355,7 @@ export const AddThreatIntelSource: React.FC = ({ }; if (useCustomSchemaByType.S3_CUSTOM) { payload.ioc_schema = { - json_path_schema: JSON.parse(customSchema), + json_path_schema: parseCustomSchema(), }; } break; diff --git a/public/plugin.ts b/public/plugin.ts index c31db826..9ac2559d 100644 --- a/public/plugin.ts +++ b/public/plugin.ts @@ -86,8 +86,8 @@ export class SecurityAnalyticsPlugin hash = `#/?dataSourceId=${dataSourceValue}`; } return { - defaultPath: hash - } + defaultPath: hash, + }; }; private appStateUpdater = new BehaviorSubject( @@ -281,7 +281,7 @@ export class SecurityAnalyticsPlugin setContentManagement(contentManagement); setNotifications(core.notifications); setSavedObjectsClient(core.savedObjects.client); - initializeServices(core, data.indexPatterns); + initializeServices(core, data.indexPatterns, data.search); registerThreatAlertsCard(); return {}; diff --git a/public/utils/helpers.tsx b/public/utils/helpers.tsx index a7e500a1..eed5c5ad 100644 --- a/public/utils/helpers.tsx +++ b/public/utils/helpers.tsx @@ -84,7 +84,7 @@ import semver from 'semver'; import * as pluginManifest from '../../opensearch_dashboards.json'; import { DataSourceThreatAlertsCard } from '../components/DataSourceThreatAlertsCard/DataSourceThreatAlertsCard'; import { DataSourceAttributes } from '../../../../src/plugins/data_source/common/data_sources'; -import { RouteComponentProps } from 'react-router-dom'; +import { ISearchStart } from '../../../../src/plugins/data/public'; export const parseStringsToOptions = (strings: string[]) => { return strings.map((str) => ({ id: str, label: str })); @@ -735,14 +735,18 @@ export function getEuiEmptyPrompt(message: string) { ); } -export function initializeServices(coreStart: CoreStart, indexPattern: CoreIndexPatternsService) { +export function initializeServices( + coreStart: CoreStart, + indexPattern: CoreIndexPatternsService, + search: ISearchStart +) { const { http, savedObjects } = coreStart; const detectorsService = new DetectorsService(http); const correlationsService = new CorrelationService(http); const indexService = new IndexService(http); const findingsService = new FindingsService(http, coreStart.notifications); - const opensearchService = new OpenSearchService(http, savedObjects.client); + const opensearchService = new OpenSearchService(http, savedObjects.client, search); const fieldMappingService = new FieldMappingService(http); const alertsService = new AlertsService(http, coreStart.notifications); const ruleService = new RuleService(http);