Skip to content

Commit

Permalink
Bug fixes for threat intel, duplicate findings, and breadcrumbs path (#…
Browse files Browse the repository at this point in the history
…1176)

* fix spacing for threat intel

Signed-off-by: Joanne Wang <[email protected]>

* fix alienvault source details page crash

Signed-off-by: Joanne Wang <[email protected]>

* fix threat intel findings widget view view all url crash

Signed-off-by: Joanne Wang <[email protected]>

* fix security analtyics breadcrumbs link path crash

Signed-off-by: Joanne Wang <[email protected]>

* fix duplicate findings

Signed-off-by: Joanne Wang <[email protected]>

---------

Signed-off-by: Joanne Wang <[email protected]>
  • Loading branch information
jowg-amazon authored Oct 2, 2024
1 parent fbea553 commit 0ce91fb
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 17 deletions.
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

0 comments on commit 0ce91fb

Please sign in to comment.