Skip to content

Commit

Permalink
- pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-goldstein committed May 24, 2022
1 parent ee5e524 commit ce0c17d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import React from 'react';

import { TestProviders, mockTimelineModel, mockTimelineData } from '../../../../../common/mock';
import { Actions, isAlert } from '.';
import { Ecs } from '../../../../../../common/ecs';
import { mockTimelines } from '../../../../../common/mock/mock_timelines_plugin';
import { useIsExperimentalFeatureEnabled } from '../../../../../common/hooks/use_experimental_features';
import { mockCasesContract } from '@kbn/cases-plugin/public/mocks';
Expand Down Expand Up @@ -224,28 +223,12 @@ describe('Actions', () => {
});

describe('isAlert', () => {
test('it returns true when the ecsData is an alert', () => {
const ecsData: Ecs = {
...mockTimelineData[0].ecs,
kibana: {
alert: {
rule: {
parameters: {},
uuid: ['CBDCAB79-BEDC-4A08-8AC2-29D7500063B9'],
},
},
},
};

expect(isAlert(ecsData)).toBe(true);
test('it returns true when the eventType is an alert', () => {
expect(isAlert('signal')).toBe(true);
});

test('it returns false when ecsData is NOT an alert', () => {
const ecsData: Ecs = {
...mockTimelineData[0].ecs,
};

expect(isAlert(ecsData)).toBe(false);
test('it returns false when the eventType is NOT an alert', () => {
expect(isAlert('raw')).toBe(false);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,19 @@ import {
useGlobalFullScreen,
useTimelineFullScreen,
} from '../../../../../common/containers/use_full_screen';
import { Ecs } from '../../../../../../common/ecs';
import {
TimelineId,
ActionProps,
OnPinEvent,
TimelineTabs,
TimelineEventsType,
} from '../../../../../../common/types/timeline';
import { timelineActions, timelineSelectors } from '../../../../store/timeline';
import { timelineDefaults } from '../../../../store/timeline/defaults';
import { isInvestigateInResolverActionEnabled } from '../../../../../detections/components/alerts_table/timeline_actions/investigate_in_resolver';

export const isAlert = (ecsData: Ecs): boolean => getEventType(ecsData) === 'signal';
export const isAlert = (eventType: TimelineEventsType | Omit<TimelineEventsType, 'all'>): boolean =>
eventType === 'signal';

const ActionsContainer = styled.div`
align-items: center;
Expand Down Expand Up @@ -224,7 +225,7 @@ const ActionsComponent: React.FC<ActionProps> = ({
/>
<PinEventAction
ariaLabel={i18n.PIN_EVENT_FOR_ROW({ ariaRowindex, columnValues, isEventPinned })}
isAlert={isAlert(ecsData)}
isAlert={isAlert(eventType)}
key="pin-event"
onPinClicked={handlePinClicked}
noteIds={eventIdToNoteIds ? eventIdToNoteIds[eventId] || emptyNotes : emptyNotes}
Expand Down

0 comments on commit ce0c17d

Please sign in to comment.