Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes for threat intel, duplicate findings, and breadcrumbs path #1176

Merged
merged 5 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { TableWidget } from './TableWidget';
import { WidgetContainer } from './WidgetContainer';
import { renderTime } from '../../../../utils/helpers';
import { ThreatIntelFinding } from '../../../../../types';
import { getApplication } from '../../../../services/utils/constants';
import { getApplication, getUseUpdatedUx } from '../../../../services/utils/constants';
import { IocLabel, ThreatIntelIocType } from '../../../../../common/constants';

const columns: EuiBasicTableColumn<ThreatIntelFinding>[] = [
Expand Down Expand Up @@ -78,17 +78,16 @@ export const RecentThreatIntelFindingsWidget: React.FC<RecentThreatIntelFindings
);
}, [items]);

const threatIntelFindingsUrl = `${getApplication().getUrlForApp(FINDINGS_NAV_ID, {
path: `#${ROUTES.FINDINGS}`,
})}?detectionType=${FindingTabId.ThreatIntel}`;
const actions = React.useMemo(
() => [
<EuiSmallButton onClick={() => getApplication().navigateToUrl(threatIntelFindingsUrl)}>
const actions = React.useMemo(() => {
const baseUrl = getUseUpdatedUx() ? getApplication().getUrlForApp(FINDINGS_NAV_ID) : '';
return [
<EuiSmallButton
href={`${baseUrl}#${ROUTES.FINDINGS}?detectionType=${FindingTabId.ThreatIntel}`}
>
View all
</EuiSmallButton>,
],
[]
);
];
}, []);

return (
<WidgetContainer title={'Recent threat intel findings'} actions={actions}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,12 @@ export const ThreatIntelSourceDetails: React.FC<ThreatIntelSourceDetailsProps> =
</>
)}
{type === 'URL_DOWNLOAD' && (
<EuiFormRow label="Source URL">
<EuiFieldText
<EuiCompressedFormRow label="Source URL">
<EuiCompressedFieldText
readOnly={isReadOnly}
value={(sourceItem.source as URLDownloadSource).url_download?.url}
/>
</EuiFormRow>
</EuiCompressedFormRow>
)}
<EuiCompressedFormRow label="Types of malicious indicators">
<>
Expand Down Expand Up @@ -374,7 +374,12 @@ export const ThreatIntelSourceDetails: React.FC<ThreatIntelSourceDetailsProps> =
<EuiSmallButton onClick={onDiscard}>Discard</EuiSmallButton>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiSmallButton isLoading={saveInProgress} fill onClick={onSave} disabled={saveDisabled}>
<EuiSmallButton
isLoading={saveInProgress}
fill
onClick={onSave}
disabled={saveDisabled}
>
Save
</EuiSmallButton>
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export const ThreatIntelSourcesList: React.FC<ThreatIntelSourcesListProps> = ({
}) => {
return (
<EuiPanel>
<EuiSpacer size="m" />
<EuiFlexGroup>
<EuiFlexItem>
<EuiTitle size="s">
Expand Down Expand Up @@ -97,7 +96,11 @@ export const ThreatIntelSourcesList: React.FC<ThreatIntelSourcesListProps> = ({
</EuiFlexGroup>
{threatIntelSources.length === 0 && (
<EuiEmptyPrompt
title={<EuiText size="s"><h2>No threat intel source present</h2></EuiText>}
title={
<EuiText size="s">
<h2>No threat intel source present</h2>
</EuiText>
}
actions={[
<EuiSmallButton
fill
Expand Down
4 changes: 4 additions & 0 deletions public/store/FindingsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ export class FindingsStore implements IFindingsStore {

const firstGetFindingsRes = await this.service.getFindings(getFindingsQueryParams);

if (signal.aborted) {
return allFindings;
}

if (firstGetFindingsRes.ok) {
const extendedFindings = this.extendFindings(firstGetFindingsRes.response.findings, detector);
onPartialFindingsFetched?.(extendedFindings);
Expand Down
2 changes: 1 addition & 1 deletion public/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const getNotificationDetailsHref = (channelId: string) =>
`notifications-dashboards#/channels-details/${channelId}`;

export const BREADCRUMBS = Object.freeze({
SECURITY_ANALYTICS: { text: 'Security Analytics', href: '#/' },
SECURITY_ANALYTICS: { text: 'Security Analytics', href: `#${ROUTES.OVERVIEW}` },
OVERVIEW: { text: 'Overview', href: `#${ROUTES.OVERVIEW}` },
GETTING_STARTED: { text: 'Getting started', href: `#${ROUTES.GETTING_STARTED}` },
FINDINGS: { text: 'Findings', href: `#${ROUTES.FINDINGS}` },
Expand Down
Loading