Skip to content

Commit

Permalink
Update entity route schema, use more indices on detections page (#91718
Browse files Browse the repository at this point in the history
…) (#91764)
  • Loading branch information
kqualters-elastic authored Feb 18, 2021
1 parent 562ebb1 commit 701cf53
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,6 @@ export const validateEntities = {
/**
* Indices to search in.
*/
indices: schema.arrayOf(schema.string()),
indices: schema.oneOf([schema.arrayOf(schema.string()), schema.string()]),
}),
};
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ import { TimelineId } from '../../../../common/types/timeline';
import { timelineSelectors } from '../../store/timeline';
import { timelineDefaults } from '../../store/timeline/defaults';
import { isFullScreen } from '../timeline/body/column_headers';
import { useSourcererScope } from '../../../common/containers/sourcerer';
import { SourcererScopeName } from '../../../common/store/sourcerer/model';
import { sourcererSelectors } from '../../../common/store';
import { updateTimelineGraphEventId } from '../../../timelines/store/timeline/actions';
import { Resolver } from '../../../resolver/view';
import {
Expand Down Expand Up @@ -169,14 +168,12 @@ const GraphOverlayComponent: React.FC<OwnProps> = ({ isEventViewer, timelineId }
globalFullScreen,
]);

let sourcereScope = SourcererScopeName.default;
if ([TimelineId.detectionsRulesDetailsPage, TimelineId.detectionsPage].includes(timelineId)) {
sourcereScope = SourcererScopeName.detections;
} else if (timelineId === TimelineId.active) {
sourcereScope = SourcererScopeName.timeline;
}
const existingIndexNamesSelector = useMemo(
() => sourcererSelectors.getAllExistingIndexNamesSelector(),
[]
);
const existingIndexNames = useDeepEqualSelector<string[]>(existingIndexNamesSelector);

const { selectedPatterns } = useSourcererScope(sourcereScope);
return (
<OverlayContainer
data-test-subj="overlayContainer"
Expand All @@ -200,7 +197,7 @@ const GraphOverlayComponent: React.FC<OwnProps> = ({ isEventViewer, timelineId }
<StyledResolver
databaseDocumentID={graphEventId}
resolverComponentInstanceID={timelineId}
indices={selectedPatterns}
indices={existingIndexNames}
shouldUpdate={shouldUpdate}
filters={{ from, to }}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const InvestigateInResolverActionComponent: React.FC<InvestigateInResolverAction
const isDisabled = useMemo(() => !isInvestigateInResolverActionEnabled(ecsData), [ecsData]);
const handleClick = useCallback(() => {
dispatch(updateTimelineGraphEventId({ id: timelineId, graphEventId: ecsData._id }));
if (TimelineId.active) {
if (timelineId === TimelineId.active) {
dispatch(setActiveTabTimeline({ id: timelineId, activeTab: TimelineTabs.graph }));
}
}, [dispatch, ecsData._id, timelineId]);
Expand Down

0 comments on commit 701cf53

Please sign in to comment.