Skip to content

Commit

Permalink
Fix API
Browse files Browse the repository at this point in the history
  • Loading branch information
patrykkopycinski committed Jul 17, 2020
1 parent 1d03ac7 commit 4605896
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
5 changes: 0 additions & 5 deletions x-pack/plugins/security_solution/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,3 @@ export const showAllOthersBucket: string[] = [
'destination.ip',
'user.name',
];

/*
* This should be set to true after https://github.com/elastic/kibana/pull/67496 is merged
*/
export const enableElasticFilter = false;
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ export const getTimelineTitle = (
duplicate: boolean,
timelineType?: TimelineType
) => {
const isCreateFromAction = timeline.timelineType !== timelineType;
if (isCreateFromAction) return '';
const isCreateTimelineFromAction = timelineType && timeline.timelineType !== timelineType;
if (isCreateTimelineFromAction) return '';

return duplicate ? `${timeline.title} - Duplicate` : timeline.title || '';
};
Expand All @@ -228,7 +228,7 @@ export const getTimelineStatus = (
duplicate: boolean,
timelineType?: TimelineType
) => {
const isCreateTimelineFromAction = timeline.timelineType !== timelineType;
const isCreateTimelineFromAction = timelineType && timeline.timelineType !== timelineType;
if (isCreateTimelineFromAction) return TimelineStatus.draft;

return duplicate ? TimelineStatus.active : timeline.status;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { getOr } from 'lodash/fp';

import { SavedObjectsFindOptions } from '../../../../../../src/core/server';
import { UNAUTHENTICATED_USER, enableElasticFilter } from '../../../common/constants';
import { UNAUTHENTICATED_USER } from '../../../common/constants';
import { NoteSavedObject } from '../../../common/types/timeline/note';
import { PinnedEventSavedObject } from '../../../common/types/timeline/pinned_event';
import {
Expand Down Expand Up @@ -125,7 +125,9 @@ const getTimelineTypeFilter = (
status: TimelineStatusLiteralWithNull
) => {
const typeFilter =
timelineType === TimelineType.template
timelineType == null
? null
: timelineType === TimelineType.template
? `siem-ui-timeline.attributes.timelineType: ${TimelineType.template}` /** Show only whose timelineType exists and equals to "template" */
: /** Show me every timeline whose timelineType is not "template".
* which includes timelineType === 'default' and
Expand All @@ -151,12 +153,10 @@ const getTimelineTypeFilter = (
templateTimelineType == null
? null
: templateTimelineType === TemplateTimelineType.elastic
? `siem-ui-timeline.attributes.createdBy: "Elsatic"`
? `siem-ui-timeline.attributes.createdBy: "Elastic"`
: `not siem-ui-timeline.attributes.createdBy: "Elastic"`;

const filters = enableElasticFilter
? [typeFilter, draftFilter, immutableFilter, templateTimelineTypeFilter]
: [typeFilter, draftFilter, immutableFilter];
const filters = [typeFilter, draftFilter, immutableFilter, templateTimelineTypeFilter];
return filters.filter((f) => f != null).join(' and ');
};

Expand Down

0 comments on commit 4605896

Please sign in to comment.