Skip to content

Commit

Permalink
fixes after cherry pick
Browse files Browse the repository at this point in the history
Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com>
  • Loading branch information
amsiglan committed Feb 26, 2025
1 parent 034c766 commit 2015af1
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import React, { useEffect, useState } from 'react';
import {
EuiBottomBar,
EuiSmallButton,
EuiCompressedCheckboxGroup,
EuiCompressedFieldText,
EuiCompressedFilePicker,
EuiCodeEditor,
EuiFlexGroup,
EuiFlexItem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -28,9 +28,9 @@ export const ThreatIntelSourceDetailsFileUploader: React.FC<ThreatIntelSourceDet
return (
<>
{isReadOnly && (
<EuiFormRow label="Uploaded file">
<EuiFieldText readOnly={isReadOnly} value={fileName} icon={'download'} />
</EuiFormRow>
<EuiCompressedFormRow label="Uploaded file">
<EuiCompressedFieldText readOnly={isReadOnly} value={fileName} icon={'download'} />
</EuiCompressedFormRow>
)}
{!isReadOnly && (
<ThreatIntelSourceFileUploader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { EuiFilePicker, EuiFilePickerProps, EuiFormRow, EuiSpacer, EuiText } from '@elastic/eui';
import {
EuiCompressedFilePicker,
EuiFilePickerProps,
EuiCompressedFormRow,
EuiSpacer,
EuiText,
} from '@elastic/eui';
import React from 'react';

export interface ThreatIntelSourceFileUploaderProps {
Expand Down Expand Up @@ -31,13 +37,13 @@ export const ThreatIntelSourceFileUploader: React.FC<ThreatIntelSourceFileUpload
<EuiSpacer />
</>
)}
<EuiFormRow
<EuiCompressedFormRow
label={formLabel}
helpText={formHelperText}
isInvalid={!!uploaderError}
error={uploaderError}
>
<EuiFilePicker
<EuiCompressedFilePicker
id={'filePickerId'}
fullWidth
initialPromptText="Select or drag and drop a file"
Expand All @@ -48,7 +54,7 @@ export const ThreatIntelSourceFileUploader: React.FC<ThreatIntelSourceFileUpload
isInvalid={!!uploaderError}
data-test-subj="import_ioc_file"
/>
</EuiFormRow>
</EuiCompressedFormRow>
<EuiSpacer />
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -353,7 +355,7 @@ export const AddThreatIntelSource: React.FC<AddThreatIntelSourceProps> = ({
};
if (useCustomSchemaByType.S3_CUSTOM) {
payload.ioc_schema = {
json_path_schema: JSON.parse(customSchema),
json_path_schema: parseCustomSchema(),
};
}
break;
Expand Down
6 changes: 3 additions & 3 deletions public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ export class SecurityAnalyticsPlugin
hash = `#/?dataSourceId=${dataSourceValue}`;
}
return {
defaultPath: hash
}
defaultPath: hash,
};
};

private appStateUpdater = new BehaviorSubject<AppUpdater>(
Expand Down Expand Up @@ -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 {};
Expand Down
10 changes: 7 additions & 3 deletions public/utils/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }));
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 2015af1

Please sign in to comment.