mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[SecuritySolution] Timeline http endpoints (#95036)
* add notes and pinned events routes * add api endpoints on client side * add apis * fix get all timelines * add decodeResponseFavoriteTimeline * rm apolloClient * fix unit tests * remove unused routes * update cypress task * fix integration tests * clean up type dependency * fix types * update snapshot * remove graphql types dependency * fix types * remove graphql queries * remove unused i18n * fix types * fix delete timelines * fix types and rewrite timeline integration tests * add readme * fix unit test * fix unit test * update package.json * rm x-pack/yarn.lock * fix tests * update yarn.lock * update yarn.lock * rm unused dependency * fix types * fix unit test * update query params for getAllTimelines * fix integration test * wrap JSON.stringify with try/catch * fix lint error * fix type * wrap JSON.stringify with try/catch * fix unit test * review * review * review Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
9cf66a78e9
commit
44eda0fa73
246 changed files with 4716 additions and 24787 deletions
21
package.json
21
package.json
|
@ -176,17 +176,6 @@
|
|||
"angular-sortable-view": "^0.0.17",
|
||||
"angular-ui-ace": "0.2.3",
|
||||
"antlr4ts": "^0.5.0-alpha.3",
|
||||
"apollo-cache-inmemory": "1.6.2",
|
||||
"apollo-client": "^2.3.8",
|
||||
"apollo-link": "^1.2.3",
|
||||
"apollo-link-error": "^1.1.7",
|
||||
"apollo-link-http": "^1.5.16",
|
||||
"apollo-link-http-common": "^0.2.15",
|
||||
"apollo-link-schema": "^1.1.0",
|
||||
"apollo-link-state": "^0.4.1",
|
||||
"apollo-server-core": "^1.3.6",
|
||||
"apollo-server-errors": "^2.0.2",
|
||||
"apollo-server-hapi": "^1.3.6",
|
||||
"archiver": "^5.2.0",
|
||||
"axios": "^0.21.1",
|
||||
"base64-js": "^1.3.1",
|
||||
|
@ -243,9 +232,7 @@
|
|||
"glob-all": "^3.2.1",
|
||||
"globby": "^11.0.3",
|
||||
"graphql": "^0.13.2",
|
||||
"graphql-fields": "^1.0.2",
|
||||
"graphql-tag": "^2.10.3",
|
||||
"graphql-tools": "^3.0.2",
|
||||
"handlebars": "4.7.7",
|
||||
"he": "^1.2.0",
|
||||
"history": "^4.9.0",
|
||||
|
@ -333,7 +320,6 @@
|
|||
"re2": "^1.15.4",
|
||||
"react": "^16.12.0",
|
||||
"react-ace": "^5.9.0",
|
||||
"react-apollo": "^2.1.4",
|
||||
"react-beautiful-dnd": "^13.0.0",
|
||||
"react-color": "^2.13.8",
|
||||
"react-datetime": "^2.14.0",
|
||||
|
@ -728,13 +714,6 @@
|
|||
"form-data": "^4.0.0",
|
||||
"geckodriver": "^1.22.2",
|
||||
"glob-watcher": "5.0.3",
|
||||
"graphql-code-generator": "^0.18.2",
|
||||
"graphql-codegen-add": "^0.18.2",
|
||||
"graphql-codegen-introspection": "^0.18.2",
|
||||
"graphql-codegen-typescript-client": "^0.18.2",
|
||||
"graphql-codegen-typescript-common": "^0.18.2",
|
||||
"graphql-codegen-typescript-resolvers": "^0.18.2",
|
||||
"graphql-codegen-typescript-server": "^0.18.2",
|
||||
"grunt": "1.3.0",
|
||||
"grunt-available-tasks": "^0.6.3",
|
||||
"grunt-peg": "^2.0.1",
|
||||
|
|
|
@ -136,11 +136,16 @@ export const DETECTION_ENGINE_RULES_STATUS_URL = `${DETECTION_ENGINE_RULES_URL}/
|
|||
export const DETECTION_ENGINE_PREPACKAGED_RULES_STATUS_URL = `${DETECTION_ENGINE_RULES_URL}/prepackaged/_status`;
|
||||
|
||||
export const TIMELINE_URL = '/api/timeline';
|
||||
export const TIMELINES_URL = '/api/timelines';
|
||||
export const TIMELINE_FAVORITE_URL = '/api/timeline/_favorite';
|
||||
export const TIMELINE_DRAFT_URL = `${TIMELINE_URL}/_draft`;
|
||||
export const TIMELINE_EXPORT_URL = `${TIMELINE_URL}/_export`;
|
||||
export const TIMELINE_IMPORT_URL = `${TIMELINE_URL}/_import`;
|
||||
export const TIMELINE_PREPACKAGED_URL = `${TIMELINE_URL}/_prepackaged`;
|
||||
|
||||
export const NOTE_URL = '/api/note';
|
||||
export const PINNED_EVENT_URL = '/api/pinned_event';
|
||||
|
||||
/**
|
||||
* Default signals index key for kibana.dev.yml
|
||||
*/
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
export const rootSchema = gql`
|
||||
schema {
|
||||
query: Query
|
||||
mutation: Mutation
|
||||
}
|
||||
|
||||
type Query
|
||||
|
||||
type Mutation
|
||||
`;
|
|
@ -1,92 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
export const sharedSchema = gql`
|
||||
input TimerangeInput {
|
||||
"The interval string to use for last bucket. The format is '{value}{unit}'. For example '5m' would return the metrics for the last 5 minutes of the timespan."
|
||||
interval: String!
|
||||
"The end of the timerange"
|
||||
to: String!
|
||||
"The beginning of the timerange"
|
||||
from: String!
|
||||
}
|
||||
|
||||
input docValueFieldsInput {
|
||||
field: String!
|
||||
format: String!
|
||||
}
|
||||
|
||||
type CursorType {
|
||||
value: String
|
||||
tiebreaker: String
|
||||
}
|
||||
|
||||
input PaginationInput {
|
||||
"The limit parameter allows you to configure the maximum amount of items to be returned"
|
||||
limit: Float!
|
||||
"The cursor parameter defines the next result you want to fetch"
|
||||
cursor: String
|
||||
"The tiebreaker parameter allow to be more precise to fetch the next item"
|
||||
tiebreaker: String
|
||||
}
|
||||
|
||||
input PaginationInputPaginated {
|
||||
"The activePage parameter defines the page of results you want to fetch"
|
||||
activePage: Float!
|
||||
"The cursorStart parameter defines the start of the results to be displayed"
|
||||
cursorStart: Float!
|
||||
"The fakePossibleCount parameter determines the total count in order to show 5 additional pages"
|
||||
fakePossibleCount: Float!
|
||||
"The querySize parameter is the number of items to be returned"
|
||||
querySize: Float!
|
||||
}
|
||||
|
||||
enum Direction {
|
||||
asc
|
||||
desc
|
||||
}
|
||||
|
||||
enum FlowTarget {
|
||||
client
|
||||
destination
|
||||
server
|
||||
source
|
||||
}
|
||||
|
||||
enum FlowTargetSourceDest {
|
||||
destination
|
||||
source
|
||||
}
|
||||
|
||||
enum FlowDirection {
|
||||
uniDirectional
|
||||
biDirectional
|
||||
}
|
||||
|
||||
input SortField {
|
||||
sortFieldId: String!
|
||||
direction: Direction!
|
||||
}
|
||||
|
||||
type PageInfo {
|
||||
endCursor: CursorType
|
||||
hasNextPage: Boolean
|
||||
}
|
||||
|
||||
type Inspect {
|
||||
dsl: [String!]!
|
||||
response: [String!]!
|
||||
}
|
||||
|
||||
type PageInfoPaginated {
|
||||
activePage: Float!
|
||||
fakeTotalCount: Float!
|
||||
showMorePagesIndicator: Boolean!
|
||||
}
|
||||
`;
|
|
@ -192,3 +192,9 @@ export type StrategyRequestType<T extends FactoryQueryTypes> = T extends HostsQu
|
|||
: T extends typeof MatrixHistogramQuery
|
||||
? MatrixHistogramRequestOptions
|
||||
: never;
|
||||
|
||||
export interface DocValueFieldsInput {
|
||||
field: string;
|
||||
|
||||
format: string;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,14 @@ import {
|
|||
TimelineEventsLastEventTimeStrategyResponse,
|
||||
TimelineKpiStrategyResponse,
|
||||
} from './events';
|
||||
import { DocValueFields, PaginationInputPaginated, TimerangeInput, SortField } from '../common';
|
||||
import {
|
||||
DocValueFields,
|
||||
PaginationInputPaginated,
|
||||
TimerangeInput,
|
||||
SortField,
|
||||
Maybe,
|
||||
} from '../common';
|
||||
import { DataProviderType, TimelineType, TimelineStatus } from '../../types/timeline';
|
||||
|
||||
export * from './events';
|
||||
|
||||
|
@ -64,3 +71,141 @@ export type TimelineStrategyRequestType<
|
|||
: T extends TimelineEventsQueries.lastEventTime
|
||||
? TimelineEventsLastEventTimeRequestOptions
|
||||
: never;
|
||||
|
||||
export interface ColumnHeaderInput {
|
||||
aggregatable?: Maybe<boolean>;
|
||||
category?: Maybe<string>;
|
||||
columnHeaderType?: Maybe<string>;
|
||||
description?: Maybe<string>;
|
||||
example?: Maybe<string>;
|
||||
indexes?: Maybe<string[]>;
|
||||
id?: Maybe<string>;
|
||||
name?: Maybe<string>;
|
||||
placeholder?: Maybe<string>;
|
||||
searchable?: Maybe<boolean>;
|
||||
type?: Maybe<string>;
|
||||
}
|
||||
|
||||
export interface QueryMatchInput {
|
||||
field?: Maybe<string>;
|
||||
|
||||
displayField?: Maybe<string>;
|
||||
|
||||
value?: Maybe<string>;
|
||||
|
||||
displayValue?: Maybe<string>;
|
||||
|
||||
operator?: Maybe<string>;
|
||||
}
|
||||
|
||||
export interface DataProviderInput {
|
||||
id?: Maybe<string>;
|
||||
name?: Maybe<string>;
|
||||
enabled?: Maybe<boolean>;
|
||||
excluded?: Maybe<boolean>;
|
||||
kqlQuery?: Maybe<string>;
|
||||
queryMatch?: Maybe<QueryMatchInput>;
|
||||
and?: Maybe<DataProviderInput[]>;
|
||||
type?: Maybe<DataProviderType>;
|
||||
}
|
||||
|
||||
export interface EqlOptionsInput {
|
||||
eventCategoryField?: Maybe<string>;
|
||||
tiebreakerField?: Maybe<string>;
|
||||
timestampField?: Maybe<string>;
|
||||
query?: Maybe<string>;
|
||||
size?: Maybe<number>;
|
||||
}
|
||||
|
||||
export interface FilterMetaTimelineInput {
|
||||
alias?: Maybe<string>;
|
||||
controlledBy?: Maybe<string>;
|
||||
disabled?: Maybe<boolean>;
|
||||
field?: Maybe<string>;
|
||||
formattedValue?: Maybe<string>;
|
||||
index?: Maybe<string>;
|
||||
key?: Maybe<string>;
|
||||
negate?: Maybe<boolean>;
|
||||
params?: Maybe<string>;
|
||||
type?: Maybe<string>;
|
||||
value?: Maybe<string>;
|
||||
}
|
||||
|
||||
export interface FilterTimelineInput {
|
||||
exists?: Maybe<string>;
|
||||
meta?: Maybe<FilterMetaTimelineInput>;
|
||||
match_all?: Maybe<string>;
|
||||
missing?: Maybe<string>;
|
||||
query?: Maybe<string>;
|
||||
range?: Maybe<string>;
|
||||
script?: Maybe<string>;
|
||||
}
|
||||
|
||||
export interface SerializedFilterQueryInput {
|
||||
filterQuery?: Maybe<SerializedKueryQueryInput>;
|
||||
}
|
||||
|
||||
export interface SerializedKueryQueryInput {
|
||||
kuery?: Maybe<KueryFilterQueryInput>;
|
||||
serializedQuery?: Maybe<string>;
|
||||
}
|
||||
|
||||
export interface KueryFilterQueryInput {
|
||||
kind?: Maybe<string>;
|
||||
expression?: Maybe<string>;
|
||||
}
|
||||
|
||||
export interface DateRangePickerInput {
|
||||
start?: Maybe<number>;
|
||||
end?: Maybe<number>;
|
||||
}
|
||||
|
||||
export interface SortTimelineInput {
|
||||
columnId?: Maybe<string>;
|
||||
sortDirection?: Maybe<string>;
|
||||
}
|
||||
|
||||
export enum RowRendererId {
|
||||
alerts = 'alerts',
|
||||
auditd = 'auditd',
|
||||
auditd_file = 'auditd_file',
|
||||
library = 'library',
|
||||
netflow = 'netflow',
|
||||
plain = 'plain',
|
||||
registry = 'registry',
|
||||
suricata = 'suricata',
|
||||
system = 'system',
|
||||
system_dns = 'system_dns',
|
||||
system_endgame_process = 'system_endgame_process',
|
||||
system_file = 'system_file',
|
||||
system_fim = 'system_fim',
|
||||
system_security_event = 'system_security_event',
|
||||
system_socket = 'system_socket',
|
||||
zeek = 'zeek',
|
||||
}
|
||||
|
||||
export interface TimelineInput {
|
||||
columns?: Maybe<ColumnHeaderInput[]>;
|
||||
dataProviders?: Maybe<DataProviderInput[]>;
|
||||
description?: Maybe<string>;
|
||||
eqlOptions?: Maybe<EqlOptionsInput>;
|
||||
eventType?: Maybe<string>;
|
||||
excludedRowRendererIds?: Maybe<RowRendererId[]>;
|
||||
filters?: Maybe<FilterTimelineInput[]>;
|
||||
kqlMode?: Maybe<string>;
|
||||
kqlQuery?: Maybe<SerializedFilterQueryInput>;
|
||||
indexNames?: Maybe<string[]>;
|
||||
title?: Maybe<string>;
|
||||
templateTimelineId?: Maybe<string>;
|
||||
templateTimelineVersion?: Maybe<number>;
|
||||
timelineType?: Maybe<TimelineType>;
|
||||
dateRange?: Maybe<DateRangePickerInput>;
|
||||
savedQueryId?: Maybe<string>;
|
||||
sort?: Maybe<SortTimelineInput[]>;
|
||||
status?: Maybe<TimelineStatus>;
|
||||
}
|
||||
|
||||
export enum FlowDirection {
|
||||
uniDirectional = 'uniDirectional',
|
||||
biDirectional = 'biDirectional',
|
||||
}
|
||||
|
|
|
@ -8,8 +8,12 @@
|
|||
import * as runtimeTypes from 'io-ts';
|
||||
|
||||
import { stringEnum, unionWithNullType } from '../../utility_types';
|
||||
import { NoteSavedObject, NoteSavedObjectToReturnRuntimeType } from './note';
|
||||
import { PinnedEventToReturnSavedObjectRuntimeType, PinnedEventSavedObject } from './pinned_event';
|
||||
import { NoteResult, NoteSavedObject, NoteSavedObjectToReturnRuntimeType } from './note';
|
||||
import {
|
||||
PinnedEventToReturnSavedObjectRuntimeType,
|
||||
PinnedEventSavedObject,
|
||||
PinnedEvent,
|
||||
} from './pinned_event';
|
||||
import {
|
||||
success,
|
||||
success_count as successCount,
|
||||
|
@ -17,6 +21,7 @@ import {
|
|||
import { FlowTarget } from '../../search_strategy/security_solution/network';
|
||||
import { PositiveInteger } from '../../detection_engine/schemas/types';
|
||||
import { errorSchema } from '../../detection_engine/schemas/response/error_schema';
|
||||
import { Direction, Maybe } from '../../search_strategy';
|
||||
|
||||
/*
|
||||
* ColumnHeader Types
|
||||
|
@ -167,6 +172,8 @@ const SavedSortRuntimeType = runtimeTypes.union([
|
|||
SavedSortObject,
|
||||
]);
|
||||
|
||||
export type Sort = runtimeTypes.TypeOf<typeof SavedSortRuntimeType>;
|
||||
|
||||
/*
|
||||
* Timeline Statuses
|
||||
*/
|
||||
|
@ -346,6 +353,14 @@ export type TimelineSavedObject = runtimeTypes.TypeOf<
|
|||
typeof TimelineSavedToReturnObjectRuntimeType
|
||||
>;
|
||||
|
||||
export const SingleTimelineResponseType = runtimeTypes.type({
|
||||
data: runtimeTypes.type({
|
||||
getOneTimeline: TimelineSavedToReturnObjectRuntimeType,
|
||||
}),
|
||||
});
|
||||
|
||||
export type SingleTimelineResponse = runtimeTypes.TypeOf<typeof SingleTimelineResponseType>;
|
||||
|
||||
/**
|
||||
* All Timeline Saved object type with metadata
|
||||
*/
|
||||
|
@ -476,3 +491,229 @@ export type TimelineExpandedDetailType =
|
|||
export type TimelineExpandedDetail = {
|
||||
[tab in TimelineTabs]?: TimelineExpandedDetailType;
|
||||
};
|
||||
|
||||
export const pageInfoTimeline = runtimeTypes.type({
|
||||
pageIndex: runtimeTypes.number,
|
||||
pageSize: runtimeTypes.number,
|
||||
});
|
||||
|
||||
export enum SortFieldTimeline {
|
||||
title = 'title',
|
||||
description = 'description',
|
||||
updated = 'updated',
|
||||
created = 'created',
|
||||
}
|
||||
|
||||
export const sortFieldTimeline = runtimeTypes.union([
|
||||
runtimeTypes.literal(SortFieldTimeline.title),
|
||||
runtimeTypes.literal(SortFieldTimeline.description),
|
||||
runtimeTypes.literal(SortFieldTimeline.updated),
|
||||
runtimeTypes.literal(SortFieldTimeline.created),
|
||||
]);
|
||||
|
||||
export const direction = runtimeTypes.union([
|
||||
runtimeTypes.literal(Direction.asc),
|
||||
runtimeTypes.literal(Direction.desc),
|
||||
]);
|
||||
|
||||
export const sortTimeline = runtimeTypes.type({
|
||||
sortField: sortFieldTimeline,
|
||||
sortOrder: direction,
|
||||
});
|
||||
|
||||
const favoriteTimelineResult = runtimeTypes.partial({
|
||||
fullName: unionWithNullType(runtimeTypes.string),
|
||||
userName: unionWithNullType(runtimeTypes.string),
|
||||
favoriteDate: unionWithNullType(runtimeTypes.number),
|
||||
});
|
||||
|
||||
export type FavoriteTimelineResult = runtimeTypes.TypeOf<typeof favoriteTimelineResult>;
|
||||
|
||||
export const responseFavoriteTimeline = runtimeTypes.partial({
|
||||
savedObjectId: runtimeTypes.string,
|
||||
version: runtimeTypes.string,
|
||||
code: unionWithNullType(runtimeTypes.number),
|
||||
message: unionWithNullType(runtimeTypes.string),
|
||||
templateTimelineId: unionWithNullType(runtimeTypes.string),
|
||||
templateTimelineVersion: unionWithNullType(runtimeTypes.number),
|
||||
timelineType: unionWithNullType(TimelineTypeLiteralRt),
|
||||
favorite: unionWithNullType(runtimeTypes.array(favoriteTimelineResult)),
|
||||
});
|
||||
|
||||
export type ResponseFavoriteTimeline = runtimeTypes.TypeOf<typeof responseFavoriteTimeline>;
|
||||
|
||||
export const getTimelinesArgs = runtimeTypes.partial({
|
||||
onlyUserFavorite: unionWithNullType(runtimeTypes.boolean),
|
||||
pageInfo: unionWithNullType(pageInfoTimeline),
|
||||
search: unionWithNullType(runtimeTypes.string),
|
||||
sort: unionWithNullType(sortTimeline),
|
||||
status: unionWithNullType(TimelineStatusLiteralRt),
|
||||
timelineType: unionWithNullType(TimelineTypeLiteralRt),
|
||||
});
|
||||
|
||||
export type GetTimelinesArgs = runtimeTypes.TypeOf<typeof getTimelinesArgs>;
|
||||
|
||||
const responseTimelines = runtimeTypes.type({
|
||||
timeline: runtimeTypes.array(TimelineSavedToReturnObjectRuntimeType),
|
||||
totalCount: runtimeTypes.number,
|
||||
});
|
||||
|
||||
export type ResponseTimelines = runtimeTypes.TypeOf<typeof responseTimelines>;
|
||||
|
||||
export const allTimelinesResponse = runtimeTypes.intersection([
|
||||
responseTimelines,
|
||||
runtimeTypes.type({
|
||||
defaultTimelineCount: runtimeTypes.number,
|
||||
templateTimelineCount: runtimeTypes.number,
|
||||
elasticTemplateTimelineCount: runtimeTypes.number,
|
||||
customTemplateTimelineCount: runtimeTypes.number,
|
||||
favoriteCount: runtimeTypes.number,
|
||||
}),
|
||||
]);
|
||||
|
||||
export type AllTimelinesResponse = runtimeTypes.TypeOf<typeof allTimelinesResponse>;
|
||||
|
||||
export interface PageInfoTimeline {
|
||||
pageIndex: number;
|
||||
|
||||
pageSize: number;
|
||||
}
|
||||
|
||||
export interface ColumnHeaderResult {
|
||||
aggregatable?: Maybe<boolean>;
|
||||
category?: Maybe<string>;
|
||||
columnHeaderType?: Maybe<string>;
|
||||
description?: Maybe<string>;
|
||||
example?: Maybe<string>;
|
||||
indexes?: Maybe<string[]>;
|
||||
id?: Maybe<string>;
|
||||
name?: Maybe<string>;
|
||||
placeholder?: Maybe<string>;
|
||||
searchable?: Maybe<boolean>;
|
||||
type?: Maybe<string>;
|
||||
}
|
||||
|
||||
export interface DataProviderResult {
|
||||
id?: Maybe<string>;
|
||||
name?: Maybe<string>;
|
||||
enabled?: Maybe<boolean>;
|
||||
excluded?: Maybe<boolean>;
|
||||
kqlQuery?: Maybe<string>;
|
||||
queryMatch?: Maybe<QueryMatchResult>;
|
||||
type?: Maybe<DataProviderType>;
|
||||
and?: Maybe<DataProviderResult[]>;
|
||||
}
|
||||
|
||||
export interface QueryMatchResult {
|
||||
field?: Maybe<string>;
|
||||
displayField?: Maybe<string>;
|
||||
value?: Maybe<string>;
|
||||
displayValue?: Maybe<string>;
|
||||
operator?: Maybe<string>;
|
||||
}
|
||||
|
||||
export interface DateRangePickerResult {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
start?: Maybe<any>;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
end?: Maybe<any>;
|
||||
}
|
||||
|
||||
export interface EqlOptionsResult {
|
||||
eventCategoryField?: Maybe<string>;
|
||||
tiebreakerField?: Maybe<string>;
|
||||
timestampField?: Maybe<string>;
|
||||
query?: Maybe<string>;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
size?: Maybe<any>;
|
||||
}
|
||||
|
||||
export interface FilterTimelineResult {
|
||||
exists?: Maybe<string>;
|
||||
meta?: Maybe<FilterMetaTimelineResult>;
|
||||
match_all?: Maybe<string>;
|
||||
missing?: Maybe<string>;
|
||||
query?: Maybe<string>;
|
||||
range?: Maybe<string>;
|
||||
script?: Maybe<string>;
|
||||
}
|
||||
|
||||
export interface FilterMetaTimelineResult {
|
||||
alias?: Maybe<string>;
|
||||
controlledBy?: Maybe<string>;
|
||||
disabled?: Maybe<boolean>;
|
||||
field?: Maybe<string>;
|
||||
formattedValue?: Maybe<string>;
|
||||
index?: Maybe<string>;
|
||||
key?: Maybe<string>;
|
||||
negate?: Maybe<boolean>;
|
||||
params?: Maybe<string>;
|
||||
type?: Maybe<string>;
|
||||
value?: Maybe<string>;
|
||||
}
|
||||
|
||||
export interface SerializedFilterQueryResult {
|
||||
filterQuery?: Maybe<SerializedKueryQueryResult>;
|
||||
}
|
||||
|
||||
export interface SerializedKueryQueryResult {
|
||||
kuery?: Maybe<KueryFilterQueryResult>;
|
||||
serializedQuery?: Maybe<string>;
|
||||
}
|
||||
|
||||
export interface KueryFilterQueryResult {
|
||||
kind?: Maybe<string>;
|
||||
expression?: Maybe<string>;
|
||||
}
|
||||
|
||||
export interface TimelineResult {
|
||||
columns?: Maybe<ColumnHeaderResult[]>;
|
||||
created?: Maybe<number>;
|
||||
createdBy?: Maybe<string>;
|
||||
dataProviders?: Maybe<DataProviderResult[]>;
|
||||
dateRange?: Maybe<DateRangePickerResult>;
|
||||
description?: Maybe<string>;
|
||||
eqlOptions?: Maybe<EqlOptionsResult>;
|
||||
eventIdToNoteIds?: Maybe<NoteResult[]>;
|
||||
eventType?: Maybe<string>;
|
||||
excludedRowRendererIds?: Maybe<RowRendererId[]>;
|
||||
favorite?: Maybe<FavoriteTimelineResult[]>;
|
||||
filters?: Maybe<FilterTimelineResult[]>;
|
||||
kqlMode?: Maybe<string>;
|
||||
kqlQuery?: Maybe<SerializedFilterQueryResult>;
|
||||
indexNames?: Maybe<string[]>;
|
||||
notes?: Maybe<NoteResult[]>;
|
||||
noteIds?: Maybe<string[]>;
|
||||
pinnedEventIds?: Maybe<string[]>;
|
||||
pinnedEventsSaveObject?: Maybe<PinnedEvent[]>;
|
||||
savedQueryId?: Maybe<string>;
|
||||
savedObjectId: string;
|
||||
sort?: Maybe<Sort>;
|
||||
status?: Maybe<TimelineStatus>;
|
||||
title?: Maybe<string>;
|
||||
templateTimelineId?: Maybe<string>;
|
||||
templateTimelineVersion?: Maybe<number>;
|
||||
timelineType?: Maybe<TimelineType>;
|
||||
updated?: Maybe<number>;
|
||||
updatedBy?: Maybe<string>;
|
||||
version: string;
|
||||
}
|
||||
|
||||
export interface ResponseTimeline {
|
||||
code?: Maybe<number>;
|
||||
message?: Maybe<string>;
|
||||
timeline: TimelineResult;
|
||||
}
|
||||
export interface SortTimeline {
|
||||
sortField: SortFieldTimeline;
|
||||
sortOrder: Direction;
|
||||
}
|
||||
|
||||
export interface GetAllTimelineVariables {
|
||||
pageInfo: PageInfoTimeline;
|
||||
search?: Maybe<string>;
|
||||
sort?: Maybe<SortTimeline>;
|
||||
onlyUserFavorite?: Maybe<boolean>;
|
||||
timelineType?: Maybe<TimelineType>;
|
||||
status?: Maybe<TimelineStatus>;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import * as runtimeTypes from 'io-ts';
|
||||
import { Direction, Maybe } from '../../../search_strategy/common';
|
||||
|
||||
import { unionWithNullType } from '../../../utility_types';
|
||||
|
||||
|
@ -63,3 +64,64 @@ export const NoteSavedObjectToReturnRuntimeType = runtimeTypes.intersection([
|
|||
|
||||
export interface NoteSavedObject
|
||||
extends runtimeTypes.TypeOf<typeof NoteSavedObjectToReturnRuntimeType> {}
|
||||
|
||||
export enum SortFieldNote {
|
||||
updatedBy = 'updatedBy',
|
||||
updated = 'updated',
|
||||
}
|
||||
|
||||
export const pageInfoNoteRt = runtimeTypes.type({
|
||||
pageIndex: runtimeTypes.number,
|
||||
pageSize: runtimeTypes.number,
|
||||
});
|
||||
|
||||
export type PageInfoNote = runtimeTypes.TypeOf<typeof pageInfoNoteRt>;
|
||||
|
||||
export const sortNoteRt = runtimeTypes.type({
|
||||
sortField: runtimeTypes.union([
|
||||
runtimeTypes.literal(SortFieldNote.updatedBy),
|
||||
runtimeTypes.literal(SortFieldNote.updated),
|
||||
]),
|
||||
sortOrder: runtimeTypes.union([
|
||||
runtimeTypes.literal(Direction.asc),
|
||||
runtimeTypes.literal(Direction.desc),
|
||||
]),
|
||||
});
|
||||
|
||||
export type SortNote = runtimeTypes.TypeOf<typeof sortNoteRt>;
|
||||
|
||||
export interface NoteResult {
|
||||
eventId?: Maybe<string>;
|
||||
|
||||
note?: Maybe<string>;
|
||||
|
||||
timelineId?: Maybe<string>;
|
||||
|
||||
noteId: string;
|
||||
|
||||
created?: Maybe<number>;
|
||||
|
||||
createdBy?: Maybe<string>;
|
||||
|
||||
timelineVersion?: Maybe<string>;
|
||||
|
||||
updated?: Maybe<number>;
|
||||
|
||||
updatedBy?: Maybe<string>;
|
||||
|
||||
version?: Maybe<string>;
|
||||
}
|
||||
|
||||
export interface ResponseNotes {
|
||||
notes: NoteResult[];
|
||||
|
||||
totalCount?: Maybe<number>;
|
||||
}
|
||||
|
||||
export interface ResponseNote {
|
||||
code?: Maybe<number>;
|
||||
|
||||
message?: Maybe<string>;
|
||||
|
||||
note: NoteResult;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import * as runtimeTypes from 'io-ts';
|
||||
import { Maybe } from '../../../search_strategy/common';
|
||||
|
||||
import { unionWithNullType } from '../../../utility_types';
|
||||
|
||||
|
@ -58,3 +59,27 @@ export const PinnedEventToReturnSavedObjectRuntimeType = runtimeTypes.intersecti
|
|||
|
||||
export interface PinnedEventSavedObject
|
||||
extends runtimeTypes.TypeOf<typeof PinnedEventToReturnSavedObjectRuntimeType> {}
|
||||
|
||||
export interface PinnedEvent {
|
||||
code?: Maybe<number>;
|
||||
|
||||
message?: Maybe<string>;
|
||||
|
||||
pinnedEventId: string;
|
||||
|
||||
eventId?: Maybe<string>;
|
||||
|
||||
timelineId?: Maybe<string>;
|
||||
|
||||
timelineVersion?: Maybe<string>;
|
||||
|
||||
created?: Maybe<number>;
|
||||
|
||||
createdBy?: Maybe<string>;
|
||||
|
||||
updated?: Maybe<number>;
|
||||
|
||||
updatedBy?: Maybe<string>;
|
||||
|
||||
version?: Maybe<string>;
|
||||
}
|
||||
|
|
|
@ -7,17 +7,12 @@
|
|||
|
||||
export const addNoteToTimeline = (note: string, timelineId: string) =>
|
||||
cy.request({
|
||||
method: 'POST',
|
||||
url: '/api/solutions/security/graphql',
|
||||
method: 'PATCH',
|
||||
url: '/api/note',
|
||||
body: {
|
||||
operationName: 'PersistTimelineNoteMutation',
|
||||
variables: {
|
||||
noteId: null,
|
||||
version: null,
|
||||
note: { note, timelineId },
|
||||
},
|
||||
query:
|
||||
'mutation PersistTimelineNoteMutation($noteId: ID, $version: String, $note: NoteInput!) {\n persistNote(noteId: $noteId, version: $version, note: $note) {\n code\n message\n note {\n eventId\n note\n timelineId\n timelineVersion\n noteId\n created\n createdBy\n updated\n updatedBy\n version\n __typename\n }\n __typename\n }\n}\n',
|
||||
noteId: null,
|
||||
version: null,
|
||||
note: { note, timelineId },
|
||||
},
|
||||
headers: { 'kbn-xsrf': 'cypress-creds' },
|
||||
});
|
||||
|
|
|
@ -98,13 +98,9 @@ export const createTimelineTemplate = (timeline: CompleteTimeline) =>
|
|||
export const deleteTimeline = (timelineId: string) => {
|
||||
cy.request({
|
||||
method: 'POST',
|
||||
url: 'api/solutions/security/graphql',
|
||||
url: 'api/timeline',
|
||||
body: {
|
||||
operationName: 'DeleteTimelineMutation',
|
||||
variables: {
|
||||
id: [timelineId],
|
||||
},
|
||||
query: 'mutation DeleteTimelineMutation($id: [ID!]!) {\n deleteTimeline(id: $id)\n}\n',
|
||||
id: [timelineId],
|
||||
},
|
||||
headers: { 'kbn-xsrf': 'delete-signals' },
|
||||
});
|
||||
|
@ -112,15 +108,7 @@ export const deleteTimeline = (timelineId: string) => {
|
|||
|
||||
export const getTimelineById = (timelineId: string) =>
|
||||
cy.request({
|
||||
method: 'POST',
|
||||
url: 'api/solutions/security/graphql',
|
||||
body: {
|
||||
operationName: 'GetOneTimeline',
|
||||
variables: {
|
||||
id: timelineId,
|
||||
},
|
||||
query:
|
||||
'query GetOneTimeline($id: ID!, $timelineType: TimelineType) {\n getOneTimeline(id: $id, timelineType: $timelineType) {\n savedObjectId\n columns {\n aggregatable\n category\n columnHeaderType\n description\n example\n indexes\n id\n name\n searchable\n type\n __typename\n }\n dataProviders {\n id\n name\n enabled\n excluded\n kqlQuery\n type\n queryMatch {\n field\n displayField\n value\n displayValue\n operator\n __typename\n }\n and {\n id\n name\n enabled\n excluded\n kqlQuery\n type\n queryMatch {\n field\n displayField\n value\n displayValue\n operator\n __typename\n }\n __typename\n }\n __typename\n }\n dateRange {\n start\n end\n __typename\n }\n description\n eventType\n eventIdToNoteIds {\n eventId\n note\n timelineId\n noteId\n created\n createdBy\n timelineVersion\n updated\n updatedBy\n version\n __typename\n }\n excludedRowRendererIds\n favorite {\n fullName\n userName\n favoriteDate\n __typename\n }\n filters {\n meta {\n alias\n controlledBy\n disabled\n field\n formattedValue\n index\n key\n negate\n params\n type\n value\n __typename\n }\n query\n exists\n match_all\n missing\n range\n script\n __typename\n }\n kqlMode\n kqlQuery {\n filterQuery {\n kuery {\n kind\n expression\n __typename\n }\n serializedQuery\n __typename\n }\n __typename\n }\n indexNames\n notes {\n eventId\n note\n timelineId\n timelineVersion\n noteId\n created\n createdBy\n updated\n updatedBy\n version\n __typename\n }\n noteIds\n pinnedEventIds\n pinnedEventsSaveObject {\n pinnedEventId\n eventId\n timelineId\n created\n createdBy\n updated\n updatedBy\n version\n __typename\n }\n status\n title\n timelineType\n templateTimelineId\n templateTimelineVersion\n savedQueryId\n sort\n created\n createdBy\n updated\n updatedBy\n version\n __typename\n }\n}\n',
|
||||
},
|
||||
method: 'GET',
|
||||
url: `api/timeline?id=${timelineId}`,
|
||||
headers: { 'kbn-xsrf': 'timeline-by-id' },
|
||||
});
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
import { History } from 'history';
|
||||
import React, { memo, FC } from 'react';
|
||||
import { ApolloProvider } from 'react-apollo';
|
||||
import { Store, Action } from 'redux';
|
||||
import { Provider as ReduxStoreProvider } from 'react-redux';
|
||||
|
||||
|
@ -19,30 +18,22 @@ import { DEFAULT_DARK_MODE, APP_NAME } from '../../common/constants';
|
|||
import { ErrorToastDispatcher } from '../common/components/error_toast_dispatcher';
|
||||
import { MlCapabilitiesProvider } from '../common/components/ml/permissions/ml_capabilities_provider';
|
||||
import { GlobalToaster, ManageGlobalToaster } from '../common/components/toasters';
|
||||
import { AppFrontendLibs } from '../common/lib/lib';
|
||||
import { KibanaContextProvider, useKibana, useUiSetting$ } from '../common/lib/kibana';
|
||||
import { State } from '../common/store';
|
||||
|
||||
import { ApolloClientContext } from '../common/utils/apollo_context';
|
||||
import { ManageGlobalTimeline } from '../timelines/components/manage_timeline';
|
||||
import { StartServices } from '../types';
|
||||
import { PageRouter } from './routes';
|
||||
import { EuiThemeProvider } from '../../../../../src/plugins/kibana_react/common';
|
||||
|
||||
interface StartAppComponent extends AppFrontendLibs {
|
||||
interface StartAppComponent {
|
||||
children: React.ReactNode;
|
||||
history: History;
|
||||
onAppLeave: (handler: AppLeaveHandler) => void;
|
||||
store: Store<State, Action>;
|
||||
}
|
||||
|
||||
const StartAppComponent: FC<StartAppComponent> = ({
|
||||
children,
|
||||
apolloClient,
|
||||
history,
|
||||
onAppLeave,
|
||||
store,
|
||||
}) => {
|
||||
const StartAppComponent: FC<StartAppComponent> = ({ children, history, onAppLeave, store }) => {
|
||||
const { i18n } = useKibana().services;
|
||||
const [darkMode] = useUiSetting$<boolean>(DEFAULT_DARK_MODE);
|
||||
|
||||
|
@ -52,21 +43,17 @@ const StartAppComponent: FC<StartAppComponent> = ({
|
|||
<ManageGlobalToaster>
|
||||
<ManageGlobalTimeline>
|
||||
<ReduxStoreProvider store={store}>
|
||||
<ApolloProvider client={apolloClient}>
|
||||
<ApolloClientContext.Provider value={apolloClient}>
|
||||
<EuiThemeProvider darkMode={darkMode}>
|
||||
<MlCapabilitiesProvider>
|
||||
<ManageUserInfo>
|
||||
<PageRouter history={history} onAppLeave={onAppLeave}>
|
||||
{children}
|
||||
</PageRouter>
|
||||
</ManageUserInfo>
|
||||
</MlCapabilitiesProvider>
|
||||
</EuiThemeProvider>
|
||||
<ErrorToastDispatcher />
|
||||
<GlobalToaster />
|
||||
</ApolloClientContext.Provider>
|
||||
</ApolloProvider>
|
||||
<EuiThemeProvider darkMode={darkMode}>
|
||||
<MlCapabilitiesProvider>
|
||||
<ManageUserInfo>
|
||||
<PageRouter history={history} onAppLeave={onAppLeave}>
|
||||
{children}
|
||||
</PageRouter>
|
||||
</ManageUserInfo>
|
||||
</MlCapabilitiesProvider>
|
||||
</EuiThemeProvider>
|
||||
<ErrorToastDispatcher />
|
||||
<GlobalToaster />
|
||||
</ReduxStoreProvider>
|
||||
</ManageGlobalTimeline>
|
||||
</ManageGlobalToaster>
|
||||
|
@ -77,7 +64,7 @@ const StartAppComponent: FC<StartAppComponent> = ({
|
|||
|
||||
const StartApp = memo(StartAppComponent);
|
||||
|
||||
interface SecurityAppComponentProps extends AppFrontendLibs {
|
||||
interface SecurityAppComponentProps {
|
||||
children: React.ReactNode;
|
||||
history: History;
|
||||
onAppLeave: (handler: AppLeaveHandler) => void;
|
||||
|
@ -87,7 +74,6 @@ interface SecurityAppComponentProps extends AppFrontendLibs {
|
|||
|
||||
const SecurityAppComponent: React.FC<SecurityAppComponentProps> = ({
|
||||
children,
|
||||
apolloClient,
|
||||
history,
|
||||
onAppLeave,
|
||||
services,
|
||||
|
@ -99,7 +85,7 @@ const SecurityAppComponent: React.FC<SecurityAppComponentProps> = ({
|
|||
...services,
|
||||
}}
|
||||
>
|
||||
<StartApp apolloClient={apolloClient} history={history} onAppLeave={onAppLeave} store={store}>
|
||||
<StartApp history={history} onAppLeave={onAppLeave} store={store}>
|
||||
{children}
|
||||
</StartApp>
|
||||
</KibanaContextProvider>
|
||||
|
|
|
@ -12,7 +12,6 @@ import { SecurityApp } from './app';
|
|||
import { RenderAppProps } from './types';
|
||||
|
||||
export const renderApp = ({
|
||||
apolloClient,
|
||||
element,
|
||||
history,
|
||||
onAppLeave,
|
||||
|
@ -21,13 +20,7 @@ export const renderApp = ({
|
|||
SubPluginRoutes,
|
||||
}: RenderAppProps): (() => void) => {
|
||||
render(
|
||||
<SecurityApp
|
||||
apolloClient={apolloClient}
|
||||
history={history}
|
||||
onAppLeave={onAppLeave}
|
||||
services={services}
|
||||
store={store}
|
||||
>
|
||||
<SecurityApp history={history} onAppLeave={onAppLeave} services={services} store={store}>
|
||||
<SubPluginRoutes />
|
||||
</SecurityApp>,
|
||||
element
|
||||
|
|
|
@ -19,12 +19,11 @@ import {
|
|||
|
||||
import { AppMountParameters, AppSearchDeepLink } from '../../../../../src/core/public';
|
||||
import { StartServices } from '../types';
|
||||
import { AppFrontendLibs } from '../common/lib/lib';
|
||||
|
||||
/**
|
||||
* The React properties used to render `SecurityApp` as well as the `element` to render it into.
|
||||
*/
|
||||
export interface RenderAppProps extends AppFrontendLibs, AppMountParameters {
|
||||
export interface RenderAppProps extends AppMountParameters {
|
||||
services: StartServices;
|
||||
store: Store<State, Action>;
|
||||
SubPluginRoutes: React.FC;
|
||||
|
|
|
@ -11,9 +11,6 @@ import { Router, mockHistory } from '../__mock__/router';
|
|||
import { UserActionMarkdown } from './user_action_markdown';
|
||||
import { TestProviders } from '../../../common/mock';
|
||||
import * as timelineHelpers from '../../../timelines/components/open_timeline/helpers';
|
||||
import { useApolloClient } from '../../../common/utils/apollo_context';
|
||||
const mockUseApolloClient = useApolloClient as jest.Mock;
|
||||
jest.mock('../../../common/utils/apollo_context');
|
||||
const onChangeEditable = jest.fn();
|
||||
const onSaveContent = jest.fn();
|
||||
|
||||
|
@ -30,7 +27,6 @@ const defaultProps = {
|
|||
describe('UserActionMarkdown ', () => {
|
||||
const queryTimelineByIdSpy = jest.spyOn(timelineHelpers, 'queryTimelineById');
|
||||
beforeEach(() => {
|
||||
mockUseApolloClient.mockClear();
|
||||
jest.resetAllMocks();
|
||||
});
|
||||
|
||||
|
@ -49,7 +45,6 @@ describe('UserActionMarkdown ', () => {
|
|||
.simulate('click');
|
||||
|
||||
expect(queryTimelineByIdSpy).toBeCalledWith({
|
||||
apolloClient: mockUseApolloClient(),
|
||||
graphEventId: '',
|
||||
timelineId,
|
||||
updateIsLoading: expect.any(Function),
|
||||
|
@ -79,7 +74,6 @@ describe('UserActionMarkdown ', () => {
|
|||
.first()
|
||||
.simulate('click');
|
||||
expect(queryTimelineByIdSpy).toBeCalledWith({
|
||||
apolloClient: mockUseApolloClient(),
|
||||
graphEventId: '',
|
||||
timelineId,
|
||||
updateIsLoading: expect.any(Function),
|
||||
|
|
|
@ -9,7 +9,6 @@ import { mount, shallow } from 'enzyme';
|
|||
import React from 'react';
|
||||
import { waitFor } from '@testing-library/react';
|
||||
import {
|
||||
apolloClientObservable,
|
||||
mockGlobalState,
|
||||
TestProviders,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
|
@ -37,23 +36,11 @@ jest.mock('../../lib/kibana', () => ({
|
|||
describe('AddFilterToGlobalSearchBar Component', () => {
|
||||
const state: State = mockGlobalState;
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
let store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
|
||||
beforeEach(() => {
|
||||
jest.useFakeTimers();
|
||||
store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
mockAddFilters.mockClear();
|
||||
});
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import React from 'react';
|
|||
import { Provider } from 'react-redux';
|
||||
|
||||
import {
|
||||
apolloClientObservable,
|
||||
mockGlobalState,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
kibanaObservable,
|
||||
|
@ -24,22 +23,10 @@ import { State } from '../../store/types';
|
|||
describe('Error Toast Dispatcher', () => {
|
||||
const state: State = mockGlobalState;
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
let store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
|
||||
beforeEach(() => {
|
||||
store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
});
|
||||
|
||||
describe('rendering', () => {
|
||||
|
|
|
@ -21,7 +21,6 @@ import styled from 'styled-components';
|
|||
|
||||
import { onFocusReFocusDraggable } from '../accessibility/helpers';
|
||||
import { BrowserFields } from '../../containers/source';
|
||||
import { ToStringArray } from '../../../graphql/types';
|
||||
import { ColumnHeaderOptions } from '../../../timelines/store/timeline/model';
|
||||
import { DragEffects } from '../drag_and_drop/draggable_wrapper';
|
||||
import { DroppableWrapper } from '../drag_and_drop/droppable_wrapper';
|
||||
|
@ -175,7 +174,7 @@ export const getColumns = ({
|
|||
name: i18n.VALUE,
|
||||
sortable: true,
|
||||
truncateText: false,
|
||||
render: (values: ToStringArray | null | undefined, data: EventFieldsData) => (
|
||||
render: (values: string[] | null | undefined, data: EventFieldsData) => (
|
||||
<FullWidthFlexGroup
|
||||
direction="column"
|
||||
alignItems="flexStart"
|
||||
|
|
|
@ -22,7 +22,6 @@ import {
|
|||
DEFAULT_DATE_COLUMN_MIN_WIDTH,
|
||||
DEFAULT_COLUMN_MIN_WIDTH,
|
||||
} from '../../../timelines/components/timeline/body/constants';
|
||||
import { ToStringArray } from '../../../graphql/types';
|
||||
|
||||
import * as i18n from './translations';
|
||||
|
||||
|
@ -50,7 +49,7 @@ export interface Item {
|
|||
field: JSX.Element;
|
||||
fieldId: string;
|
||||
type: string;
|
||||
values: ToStringArray;
|
||||
values: string[];
|
||||
}
|
||||
|
||||
export interface AlertSummaryRow {
|
||||
|
|
|
@ -12,6 +12,7 @@ import * as i18n from './translations';
|
|||
|
||||
import { ExportDocumentsProps } from '../../../detections/containers/detection_engine/rules';
|
||||
import { useStateToaster, errorToToaster } from '../toasters';
|
||||
import { TimelineErrorResponse } from '../../../../common/types/timeline';
|
||||
|
||||
const InvisibleAnchor = styled.a`
|
||||
display: none;
|
||||
|
@ -22,7 +23,7 @@ export type ExportSelectedData = ({
|
|||
filename,
|
||||
ids,
|
||||
signal,
|
||||
}: ExportDocumentsProps) => Promise<Blob>;
|
||||
}: ExportDocumentsProps) => Promise<Blob | TimelineErrorResponse>;
|
||||
|
||||
export interface GenericDownloaderProps {
|
||||
filename: string;
|
||||
|
|
|
@ -11,7 +11,6 @@ import React from 'react';
|
|||
import {
|
||||
TestProviders,
|
||||
mockGlobalState,
|
||||
apolloClientObservable,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
kibanaObservable,
|
||||
createSecuritySolutionStorageMock,
|
||||
|
@ -35,25 +34,13 @@ describe('Inspect Button', () => {
|
|||
state: state.inputs,
|
||||
};
|
||||
|
||||
let store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
|
||||
describe('Render', () => {
|
||||
beforeEach(() => {
|
||||
const myState = cloneDeep(state);
|
||||
myState.inputs = upsertQuery(newQuery);
|
||||
store = createStore(
|
||||
myState,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
store = createStore(myState, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
});
|
||||
test('Eui Empty Button', () => {
|
||||
const wrapper = mount(
|
||||
|
@ -157,13 +144,7 @@ describe('Inspect Button', () => {
|
|||
response: ['my response'],
|
||||
};
|
||||
myState.inputs = upsertQuery(myQuery);
|
||||
store = createStore(
|
||||
myState,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
store = createStore(myState, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
});
|
||||
test('Open Inspect Modal', () => {
|
||||
const wrapper = mount(
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { getCriteriaFromNetworkType } from './get_criteria_from_network_type';
|
||||
import { NetworkType } from '../../../../network/store/model';
|
||||
import { FlowTarget } from '../../../../graphql/types';
|
||||
import { FlowTarget } from '../../../../../common/search_strategy';
|
||||
|
||||
describe('get_criteria_from_network_type', () => {
|
||||
test('returns network names from criteria if the network type is details and it is source', () => {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { CriteriaFields } from '../types';
|
||||
import { NetworkType } from '../../../../network/store/model';
|
||||
import { FlowTarget } from '../../../../graphql/types';
|
||||
import { FlowTarget } from '../../../../../common/search_strategy';
|
||||
|
||||
export const getCriteriaFromNetworkType = (
|
||||
type: NetworkType,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { FlowTarget } from '../../../../graphql/types';
|
||||
import { FlowTarget } from '../../../../../common/search_strategy';
|
||||
import { CriteriaFields } from '../types';
|
||||
import { networkToCriteria } from './network_to_criteria';
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { FlowTarget } from '../../../../../common/search_strategy';
|
||||
import { CriteriaFields } from '../types';
|
||||
import { FlowTarget } from '../../../../graphql/types';
|
||||
|
||||
export const networkToCriteria = (ip: string, flowTarget: FlowTarget): CriteriaFields[] => {
|
||||
if (flowTarget === FlowTarget.source) {
|
||||
|
|
|
@ -24,7 +24,7 @@ import { ExplorerLink } from '../links/create_explorer_link';
|
|||
import { FormattedRelativePreferenceDate } from '../../formatted_date';
|
||||
import { NetworkType } from '../../../../network/store/model';
|
||||
import { escapeDataProviderId } from '../../drag_and_drop/helpers';
|
||||
import { FlowTarget } from '../../../../graphql/types';
|
||||
import { FlowTarget } from '../../../../../common/search_strategy';
|
||||
|
||||
export const getAnomaliesNetworkTableColumns = (
|
||||
startDate: string,
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import { networkEquality } from './network_equality';
|
||||
import { AnomaliesNetworkTableProps } from '../types';
|
||||
import { NetworkType } from '../../../../network/store/model';
|
||||
import { FlowTarget } from '../../../../graphql/types';
|
||||
import { FlowTarget } from '../../../../../common/search_strategy';
|
||||
|
||||
describe('network_equality', () => {
|
||||
test('it returns true if start and end date are equal', () => {
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
*/
|
||||
|
||||
import { Influencer } from '../../../../../ml/public';
|
||||
import { FlowTarget } from '../../../../common/search_strategy';
|
||||
|
||||
import { HostsType } from '../../../hosts/store/model';
|
||||
import { NetworkType } from '../../../network/store/model';
|
||||
import { FlowTarget } from '../../../graphql/types';
|
||||
|
||||
export interface Source {
|
||||
job_id: string;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { PaginationInputPaginated } from '../../../graphql/types';
|
||||
import { PaginationInputPaginated } from '../../../../common/search_strategy';
|
||||
|
||||
export const generateTablePaginationOptions = (
|
||||
activePage: number,
|
||||
|
|
|
@ -9,12 +9,12 @@ import { mount, shallow } from 'enzyme';
|
|||
import React from 'react';
|
||||
|
||||
import { DEFAULT_MAX_TABLE_QUERY_SIZE } from '../../../../common/constants';
|
||||
import { Direction } from '../../../graphql/types';
|
||||
|
||||
import { BasicTableProps, PaginatedTable } from './index';
|
||||
import { getHostsColumns, mockData, rowItems, sortedHosts } from './index.mock';
|
||||
import { ThemeProvider } from 'styled-components';
|
||||
import { getMockTheme } from '../../lib/kibana/kibana_react.mock';
|
||||
import { Direction } from '../../../../common/search_strategy';
|
||||
|
||||
jest.mock('react', () => {
|
||||
const r = jest.requireActual('react');
|
||||
|
|
|
@ -12,7 +12,6 @@ import { Sourcerer } from './index';
|
|||
import { DEFAULT_INDEX_PATTERN } from '../../../../common/constants';
|
||||
import { sourcererActions, sourcererModel } from '../../store/sourcerer';
|
||||
import {
|
||||
apolloClientObservable,
|
||||
createSecuritySolutionStorageMock,
|
||||
kibanaObservable,
|
||||
mockGlobalState,
|
||||
|
@ -53,22 +52,10 @@ describe('Sourcerer component', () => {
|
|||
});
|
||||
const state: State = mockGlobalState;
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
let store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
|
||||
beforeEach(() => {
|
||||
store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
});
|
||||
|
||||
// Using props callback instead of simulating clicks,
|
||||
|
@ -100,13 +87,7 @@ describe('Sourcerer component', () => {
|
|||
},
|
||||
};
|
||||
|
||||
store = createStore(
|
||||
state2,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
store = createStore(state2, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
const wrapper = mount(
|
||||
<TestProviders store={store}>
|
||||
<Sourcerer {...defaultProps} />
|
||||
|
@ -154,7 +135,6 @@ describe('Sourcerer component', () => {
|
|||
},
|
||||
},
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
|
@ -185,7 +165,6 @@ describe('Sourcerer component', () => {
|
|||
},
|
||||
},
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
|
@ -209,7 +188,6 @@ describe('Sourcerer component', () => {
|
|||
},
|
||||
},
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
|
@ -251,7 +229,6 @@ describe('Sourcerer component', () => {
|
|||
},
|
||||
},
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
|
|
|
@ -31,7 +31,6 @@ import {
|
|||
mockNarrowDateRange,
|
||||
} from '../../../network/components/kpi_network/mock';
|
||||
import {
|
||||
apolloClientObservable,
|
||||
createSecuritySolutionStorageMock,
|
||||
kibanaObservable,
|
||||
mockGlobalState,
|
||||
|
@ -60,13 +59,7 @@ describe('Stat Items Component', () => {
|
|||
const mockTheme = getMockTheme({ eui: { euiColorMediumShade: '#ece' } });
|
||||
const state: State = mockGlobalState;
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
const store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
const store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
|
||||
describe.each([
|
||||
[
|
||||
|
|
|
@ -12,7 +12,6 @@ import { Provider as ReduxStoreProvider } from 'react-redux';
|
|||
import { DEFAULT_TIMEPICKER_QUICK_RANGES } from '../../../../common/constants';
|
||||
import { useUiSetting$ } from '../../lib/kibana';
|
||||
import {
|
||||
apolloClientObservable,
|
||||
mockGlobalState,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
kibanaObservable,
|
||||
|
@ -83,23 +82,11 @@ describe('SIEM Super Date Picker', () => {
|
|||
describe('#SuperDatePicker', () => {
|
||||
const state: State = mockGlobalState;
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
let store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
mockUseUiSetting$.mockImplementation((key, defaultValue) => {
|
||||
const useUiSetting$Mock = createUseUiSetting$Mock();
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ import { waitFor } from '@testing-library/react';
|
|||
import '../../mock/match_media';
|
||||
import { mockBrowserFields } from '../../containers/source/mock';
|
||||
import {
|
||||
apolloClientObservable,
|
||||
mockGlobalState,
|
||||
TestProviders,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
|
@ -157,13 +156,7 @@ const state: State = {
|
|||
};
|
||||
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
const store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
const store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
|
||||
let testProps = {
|
||||
browserFields: mockBrowserFields,
|
||||
|
|
|
@ -29,7 +29,6 @@ import { SecurityPageName } from '../../../../common/constants';
|
|||
export const dispatchSetInitialStateFromUrl = (
|
||||
dispatch: Dispatch
|
||||
): DispatchSetInitialStateFromUrl => ({
|
||||
apolloClient,
|
||||
detailName,
|
||||
filterManager,
|
||||
indexPattern,
|
||||
|
@ -99,7 +98,6 @@ export const dispatchSetInitialStateFromUrl = (
|
|||
if (timeline != null && timeline.id !== '') {
|
||||
queryTimelineById({
|
||||
activeTimelineTab: timeline.activeTab,
|
||||
apolloClient,
|
||||
duplicate: false,
|
||||
graphEventId: timeline.graphEventId,
|
||||
timelineId: timeline.id,
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import ApolloClient from 'apollo-client';
|
||||
import * as H from 'history';
|
||||
import { ActionCreator } from 'typescript-fsa';
|
||||
import {
|
||||
|
@ -148,7 +147,6 @@ export interface UrlStateToRedux {
|
|||
}
|
||||
|
||||
export interface SetInitialStateFromUrl<TCache> {
|
||||
apolloClient: ApolloClient<TCache> | ApolloClient<{}> | undefined;
|
||||
detailName: string | undefined;
|
||||
filterManager: FilterManager;
|
||||
indexPattern: IIndexPattern | undefined;
|
||||
|
@ -160,7 +158,6 @@ export interface SetInitialStateFromUrl<TCache> {
|
|||
}
|
||||
|
||||
export type DispatchSetInitialStateFromUrl = <TCache>({
|
||||
apolloClient,
|
||||
detailName,
|
||||
indexPattern,
|
||||
pageName,
|
||||
|
|
|
@ -10,7 +10,6 @@ import { useEffect, useRef, useState } from 'react';
|
|||
import deepEqual from 'fast-deep-equal';
|
||||
|
||||
import { useKibana } from '../../lib/kibana';
|
||||
import { useApolloClient } from '../../utils/apollo_context';
|
||||
import { CONSTANTS, UrlStateType } from './constants';
|
||||
import {
|
||||
getQueryStringFromLocation,
|
||||
|
@ -70,7 +69,6 @@ export const useUrlStateHooks = ({
|
|||
urlState,
|
||||
}: UrlStateContainerPropTypes) => {
|
||||
const [isInitializing, setIsInitializing] = useState(true);
|
||||
const apolloClient = useApolloClient();
|
||||
const { filterManager, savedQueries } = useKibana().services.data.query;
|
||||
const prevProps = usePrevious({ pathName, pageName, urlState });
|
||||
|
||||
|
@ -161,7 +159,6 @@ export const useUrlStateHooks = ({
|
|||
});
|
||||
|
||||
setInitialStateFromUrl({
|
||||
apolloClient,
|
||||
detailName,
|
||||
filterManager,
|
||||
indexPattern,
|
||||
|
|
|
@ -9,9 +9,9 @@ import { ESTermQuery } from '../../../../../common/typed_json';
|
|||
import { NarrowDateRange } from '../../../components/ml/types';
|
||||
import { UpdateDateRange } from '../../../components/charts/common';
|
||||
import { GlobalTimeArgs } from '../../use_global_time';
|
||||
import { FlowTarget } from '../../../../graphql/types';
|
||||
import { HostsType } from '../../../../hosts/store/model';
|
||||
import { NetworkType } from '../../../../network/store//model';
|
||||
import { FlowTarget } from '../../../../../common/search_strategy';
|
||||
|
||||
interface QueryTabBodyProps {
|
||||
type: HostsType | NetworkType;
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
import deepmerge from 'deepmerge';
|
||||
|
||||
import { MlSummaryJob } from '../../../../../../ml/public';
|
||||
import { FlowTarget } from '../../../../../common/search_strategy';
|
||||
import { ESTermQuery } from '../../../../../common/typed_json';
|
||||
import { createFilter } from '../../helpers';
|
||||
import { FlowTarget } from '../../../../graphql/types';
|
||||
|
||||
export const getAnomaliesFilterQuery = (
|
||||
filterQuery: string | ESTermQuery | undefined,
|
||||
|
|
|
@ -1,108 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { reTryOneTimeOnErrorHandler, errorLinkHandler } from '.';
|
||||
import { ServerError } from 'apollo-link-http-common';
|
||||
import { Operation } from 'apollo-link';
|
||||
import { GraphQLError } from 'graphql';
|
||||
import * as store from '../../store';
|
||||
import { onError } from 'apollo-link-error';
|
||||
|
||||
const mockDispatch = jest.fn();
|
||||
jest.mock('apollo-link-error');
|
||||
jest.mock('../../store');
|
||||
(store.getStore as jest.Mock).mockReturnValue({ dispatch: mockDispatch });
|
||||
|
||||
describe('errorLinkHandler', () => {
|
||||
const mockGraphQLErrors: GraphQLError = {
|
||||
message: 'GraphQLError',
|
||||
} as GraphQLError;
|
||||
const mockNetworkError: ServerError = {
|
||||
result: {},
|
||||
statusCode: 503,
|
||||
name: '',
|
||||
message: 'error',
|
||||
response: {
|
||||
ok: false,
|
||||
} as Response,
|
||||
};
|
||||
const mockOperation: Operation = {} as Operation;
|
||||
const mockForward = jest.fn();
|
||||
|
||||
afterEach(() => {
|
||||
mockDispatch.mockClear();
|
||||
});
|
||||
|
||||
test('it should display error if graphQLErrors exist', () => {
|
||||
errorLinkHandler({
|
||||
graphQLErrors: [mockGraphQLErrors],
|
||||
operation: mockOperation,
|
||||
forward: mockForward,
|
||||
});
|
||||
|
||||
expect(store.getStore).toBeCalled();
|
||||
expect(mockDispatch.mock.calls.length).toBe(1);
|
||||
});
|
||||
|
||||
test('it should display error if networkError exist', () => {
|
||||
errorLinkHandler({
|
||||
networkError: mockNetworkError,
|
||||
operation: mockOperation,
|
||||
forward: mockForward,
|
||||
});
|
||||
|
||||
expect(store.getStore).toBeCalled();
|
||||
expect(mockDispatch.mock.calls.length).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('errorLink', () => {
|
||||
test('onError should be called with errorLinkHandler', () => {
|
||||
expect(onError).toHaveBeenCalledWith(errorLinkHandler);
|
||||
});
|
||||
});
|
||||
|
||||
describe('reTryOneTimeOnErrorHandler', () => {
|
||||
const mockNetworkError: ServerError = {
|
||||
result: {},
|
||||
statusCode: 503,
|
||||
name: '',
|
||||
message: 'error',
|
||||
response: {
|
||||
ok: false,
|
||||
} as Response,
|
||||
};
|
||||
const mockOperation: Operation = {} as Operation;
|
||||
const mockForward = jest.fn();
|
||||
|
||||
afterEach(() => {
|
||||
mockForward.mockClear();
|
||||
});
|
||||
test('it should retry only if network status code is 503', () => {
|
||||
reTryOneTimeOnErrorHandler({
|
||||
networkError: mockNetworkError,
|
||||
operation: mockOperation,
|
||||
forward: mockForward,
|
||||
});
|
||||
expect(mockForward).toBeCalledWith(mockOperation);
|
||||
});
|
||||
|
||||
test('it should not retry if other error happens', () => {
|
||||
reTryOneTimeOnErrorHandler({
|
||||
networkError: { ...mockNetworkError, statusCode: 500 },
|
||||
operation: mockOperation,
|
||||
forward: mockForward,
|
||||
});
|
||||
expect(mockForward).not.toBeCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('reTryOneTimeOnErrorLink', () => {
|
||||
test('onError should be called with reTryOneTimeOnErrorHandler', () => {
|
||||
expect(onError).toHaveBeenCalledWith(reTryOneTimeOnErrorHandler);
|
||||
});
|
||||
});
|
|
@ -1,57 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { onError, ErrorLink } from 'apollo-link-error';
|
||||
import { get, throttle, noop } from 'lodash/fp';
|
||||
|
||||
import uuid from 'uuid';
|
||||
|
||||
import * as i18n from './translations';
|
||||
|
||||
import { getStore } from '../../store';
|
||||
import { appActions } from '../../store/actions';
|
||||
|
||||
export const errorLinkHandler: ErrorLink.ErrorHandler = ({ graphQLErrors, networkError }) => {
|
||||
const store = getStore();
|
||||
const dispatch = throttle(50, store != null ? store.dispatch : noop);
|
||||
|
||||
if (graphQLErrors != null && store != null) {
|
||||
dispatch(
|
||||
appActions.addError({
|
||||
id: uuid.v4(),
|
||||
title: i18n.DATA_FETCH_FAILURE,
|
||||
message: graphQLErrors.map(({ message }) => message),
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (networkError != null && store != null) {
|
||||
dispatch(
|
||||
appActions.addError({
|
||||
id: uuid.v4(),
|
||||
title: i18n.NETWORK_FAILURE,
|
||||
message: [networkError.message],
|
||||
})
|
||||
);
|
||||
}
|
||||
};
|
||||
export const errorLink = onError(errorLinkHandler);
|
||||
|
||||
export const reTryOneTimeOnErrorHandler: ErrorLink.ErrorHandler = ({
|
||||
networkError,
|
||||
operation,
|
||||
forward,
|
||||
}) => {
|
||||
if (networkError != null) {
|
||||
const statusCode = get('statusCode', networkError);
|
||||
if (statusCode != null && statusCode === 503) {
|
||||
return forward(operation);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const reTryOneTimeOnErrorLink = onError(reTryOneTimeOnErrorHandler);
|
|
@ -1,22 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export const DATA_FETCH_FAILURE = i18n.translate(
|
||||
'xpack.securitySolution.containers.errors.dataFetchFailureTitle',
|
||||
{
|
||||
defaultMessage: 'Data Fetch Failure',
|
||||
}
|
||||
);
|
||||
|
||||
export const NETWORK_FAILURE = i18n.translate(
|
||||
'xpack.securitySolution.containers.errors.networkFailureTitle',
|
||||
{
|
||||
defaultMessage: 'Network Failure',
|
||||
}
|
||||
);
|
|
@ -5,12 +5,9 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { FetchPolicy } from 'apollo-client';
|
||||
import { isString } from 'lodash/fp';
|
||||
|
||||
import { ESQuery } from '../../../common/typed_json';
|
||||
|
||||
export const createFilter = (filterQuery: ESQuery | string | undefined) =>
|
||||
isString(filterQuery) ? filterQuery : JSON.stringify(filterQuery);
|
||||
|
||||
export const getDefaultFetchPolicy = (): FetchPolicy => 'cache-and-network';
|
||||
|
|
|
@ -1,87 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ApolloQueryResult } from 'apollo-client';
|
||||
import React from 'react';
|
||||
import { FetchMoreOptions, FetchMoreQueryOptions, OperationVariables } from 'react-apollo';
|
||||
|
||||
import { ESQuery } from '../../../common/typed_json';
|
||||
import { DocValueFields } from './source';
|
||||
|
||||
export { DocValueFields };
|
||||
|
||||
export interface QueryTemplateProps {
|
||||
indexNames: string[];
|
||||
docValueFields?: DocValueFields[];
|
||||
id?: string;
|
||||
endDate?: string;
|
||||
filterQuery?: ESQuery | string;
|
||||
skip?: boolean;
|
||||
sourceId: string;
|
||||
startDate?: string;
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export type FetchMoreOptionsArgs<TData, TVariables> = FetchMoreQueryOptions<any, any> &
|
||||
FetchMoreOptions<TData, TVariables>;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
type PromiseApolloQueryResult = Promise<ApolloQueryResult<any>>;
|
||||
|
||||
export class QueryTemplate<
|
||||
T extends QueryTemplateProps,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
TData = any,
|
||||
TVariables = OperationVariables
|
||||
> extends React.PureComponent<T, TData, TVariables> {
|
||||
private fetchMore!: (
|
||||
fetchMoreOptions: FetchMoreOptionsArgs<TData, TVariables>
|
||||
) => PromiseApolloQueryResult;
|
||||
|
||||
private fetchMoreOptions!: (
|
||||
newCursor: string,
|
||||
tiebreaker?: string
|
||||
) => FetchMoreOptionsArgs<TData, TVariables>;
|
||||
|
||||
private refetch!: (variables?: TVariables) => Promise<ApolloQueryResult<TData>>;
|
||||
|
||||
private executeBeforeFetchMore!: ({ id }: { id?: string }) => void;
|
||||
|
||||
private executeBeforeRefetch!: ({ id }: { id?: string }) => void;
|
||||
|
||||
public setExecuteBeforeFetchMore = (val: ({ id }: { id?: string }) => void) => {
|
||||
this.executeBeforeFetchMore = val;
|
||||
};
|
||||
public setExecuteBeforeRefetch = (val: ({ id }: { id?: string }) => void) => {
|
||||
this.executeBeforeRefetch = val;
|
||||
};
|
||||
|
||||
public setFetchMore = (
|
||||
val: (fetchMoreOptions: FetchMoreOptionsArgs<TData, TVariables>) => PromiseApolloQueryResult
|
||||
) => {
|
||||
this.fetchMore = val;
|
||||
};
|
||||
|
||||
public setFetchMoreOptions = (
|
||||
val: (newCursor: string, tiebreaker?: string) => FetchMoreOptionsArgs<TData, TVariables>
|
||||
) => {
|
||||
this.fetchMoreOptions = val;
|
||||
};
|
||||
|
||||
public setRefetch = (val: (variables?: TVariables) => Promise<ApolloQueryResult<TData>>) => {
|
||||
this.refetch = val;
|
||||
};
|
||||
|
||||
public wrappedLoadMore = (newCursor: string, tiebreaker?: string) => {
|
||||
this.executeBeforeFetchMore({ id: this.props.id });
|
||||
return this.fetchMore(this.fetchMoreOptions(newCursor, tiebreaker));
|
||||
};
|
||||
|
||||
public wrappedRefetch = (variables?: TVariables) => {
|
||||
this.executeBeforeRefetch({ id: this.props.id });
|
||||
return this.refetch(variables);
|
||||
};
|
||||
}
|
|
@ -1,103 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ApolloQueryResult, NetworkStatus } from 'apollo-client';
|
||||
import memoizeOne from 'memoize-one';
|
||||
import React from 'react';
|
||||
import { FetchMoreOptions, FetchMoreQueryOptions, OperationVariables } from 'react-apollo';
|
||||
import deepEqual from 'fast-deep-equal';
|
||||
|
||||
import { ESQuery } from '../../../common/typed_json';
|
||||
import { inputsModel } from '../store/model';
|
||||
import { generateTablePaginationOptions } from '../components/paginated_table/helpers';
|
||||
import { DocValueFields } from './source';
|
||||
|
||||
export { DocValueFields };
|
||||
|
||||
export interface QueryTemplatePaginatedProps {
|
||||
docValueFields?: DocValueFields[];
|
||||
id?: string;
|
||||
endDate?: string;
|
||||
filterQuery?: ESQuery | string;
|
||||
skip?: boolean;
|
||||
sourceId: string;
|
||||
startDate?: string;
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
type FetchMoreOptionsArgs<TData, TVariables> = FetchMoreQueryOptions<any, any> &
|
||||
FetchMoreOptions<TData, TVariables>;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
type PromiseApolloQueryResult = Promise<ApolloQueryResult<any>>;
|
||||
|
||||
export class QueryTemplatePaginated<
|
||||
T extends QueryTemplatePaginatedProps,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
TData = any,
|
||||
TVariables = OperationVariables
|
||||
> extends React.PureComponent<T, TData, TVariables> {
|
||||
private queryVariables: TVariables | null = null;
|
||||
private myLoading: boolean = false;
|
||||
private fetchMore!: (
|
||||
fetchMoreOptions: FetchMoreOptionsArgs<TData, TVariables>
|
||||
) => PromiseApolloQueryResult;
|
||||
|
||||
private fetchMoreOptions!: (newActivePage: number) => FetchMoreOptionsArgs<TData, TVariables>;
|
||||
|
||||
public memoizedRefetchQuery: (
|
||||
variables: TVariables,
|
||||
limit: number,
|
||||
refetch: (variables?: TVariables) => Promise<ApolloQueryResult<TData>>
|
||||
) => inputsModel.Refetch;
|
||||
|
||||
constructor(props: T) {
|
||||
super(props);
|
||||
this.memoizedRefetchQuery = memoizeOne(this.refetchQuery);
|
||||
}
|
||||
|
||||
public setFetchMore = (
|
||||
val: (fetchMoreOptions: FetchMoreOptionsArgs<TData, TVariables>) => PromiseApolloQueryResult
|
||||
) => {
|
||||
this.fetchMore = val;
|
||||
};
|
||||
|
||||
public setFetchMoreOptions = (
|
||||
val: (newActivePage: number) => FetchMoreOptionsArgs<TData, TVariables>
|
||||
) => {
|
||||
this.fetchMoreOptions = val;
|
||||
};
|
||||
|
||||
public wrappedLoadMore = (newActivePage: number) => {
|
||||
return this.fetchMore(this.fetchMoreOptions(newActivePage));
|
||||
};
|
||||
|
||||
public refetchQuery = (
|
||||
variables: TVariables,
|
||||
limit: number,
|
||||
refetch: (variables?: TVariables) => Promise<ApolloQueryResult<TData>>
|
||||
): inputsModel.Refetch => () => {
|
||||
refetch({ ...variables, pagination: generateTablePaginationOptions(0, limit) });
|
||||
};
|
||||
|
||||
public setPrevVariables(vars: TVariables) {
|
||||
this.queryVariables = vars;
|
||||
}
|
||||
|
||||
public isItAValidLoading(loading: boolean, variables: TVariables, networkStatus: NetworkStatus) {
|
||||
if (
|
||||
!this.myLoading &&
|
||||
(!deepEqual(variables, this.queryVariables) || networkStatus === NetworkStatus.refetch) &&
|
||||
loading
|
||||
) {
|
||||
this.myLoading = true;
|
||||
} else if (this.myLoading && !loading) {
|
||||
this.myLoading = false;
|
||||
}
|
||||
this.setPrevVariables(variables);
|
||||
return this.myLoading;
|
||||
}
|
||||
}
|
|
@ -12,7 +12,7 @@ import { act, renderHook } from '@testing-library/react-hooks';
|
|||
import { Provider } from 'react-redux';
|
||||
|
||||
import { useInitSourcerer } from '.';
|
||||
import { mockPatterns, mockSource } from './mocks';
|
||||
import { mockPatterns } from './mocks';
|
||||
// import { SourcererScopeName } from '../../store/sourcerer/model';
|
||||
import { RouteSpyState } from '../../utils/route/types';
|
||||
import { SecurityPageName } from '../../../../common/constants';
|
||||
|
@ -22,14 +22,12 @@ import {
|
|||
initialState as userInfoState,
|
||||
} from '../../../detections/components/user_info';
|
||||
import {
|
||||
apolloClientObservable,
|
||||
createSecuritySolutionStorageMock,
|
||||
kibanaObservable,
|
||||
mockGlobalState,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
} from '../../mock';
|
||||
import { SourcererScopeName } from '../../store/sourcerer/model';
|
||||
const mockSourceDefaults = mockSource;
|
||||
|
||||
const mockRouteSpy: RouteSpyState = {
|
||||
pageName: SecurityPageName.overview,
|
||||
|
@ -81,11 +79,6 @@ jest.mock('../../lib/kibana', () => ({
|
|||
}),
|
||||
useUiSetting$: jest.fn().mockImplementation(() => [mockPatterns]),
|
||||
}));
|
||||
jest.mock('../../utils/apollo_context', () => ({
|
||||
useApolloClient: jest.fn().mockReturnValue({
|
||||
query: jest.fn().mockImplementation(() => Promise.resolve(mockSourceDefaults)),
|
||||
}),
|
||||
}));
|
||||
|
||||
describe('Sourcerer Hooks', () => {
|
||||
const state: State = {
|
||||
|
@ -112,24 +105,12 @@ describe('Sourcerer Hooks', () => {
|
|||
},
|
||||
};
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
let store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
mockUseUserInfo.mockImplementation(() => userInfoState);
|
||||
});
|
||||
it('initializes loading default and timeline index patterns', async () => {
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { InMemoryCache, IntrospectionFragmentMatcher } from 'apollo-cache-inmemory';
|
||||
import { errorLink, reTryOneTimeOnErrorLink } from '../../containers/errors';
|
||||
import { getLinks } from './helpers';
|
||||
import { withClientState } from 'apollo-link-state';
|
||||
import * as apolloLinkHttp from 'apollo-link-http';
|
||||
import introspectionQueryResultData from '../../../graphql/introspection.json';
|
||||
|
||||
jest.mock('apollo-cache-inmemory');
|
||||
jest.mock('apollo-link-http');
|
||||
jest.mock('apollo-link-state');
|
||||
jest.mock('../../containers/errors');
|
||||
const mockWithClientState = 'mockWithClientState';
|
||||
const mockHttpLink = { mockHttpLink: 'mockHttpLink' };
|
||||
|
||||
(withClientState as jest.Mock).mockReturnValue(mockWithClientState);
|
||||
(apolloLinkHttp.createHttpLink as jest.Mock).mockImplementation(() => mockHttpLink);
|
||||
|
||||
describe('getLinks helper', () => {
|
||||
test('It should return links in correct order', () => {
|
||||
const mockCache = new InMemoryCache({
|
||||
dataIdFromObject: () => null,
|
||||
fragmentMatcher: new IntrospectionFragmentMatcher({
|
||||
// @ts-expect-error apollo-cache-inmemory types don't match actual introspection data
|
||||
introspectionQueryResultData,
|
||||
}),
|
||||
});
|
||||
const links = getLinks(mockCache, 'basePath');
|
||||
expect(links[0]).toEqual(errorLink);
|
||||
expect(links[1]).toEqual(reTryOneTimeOnErrorLink);
|
||||
expect(links[2]).toEqual(mockWithClientState);
|
||||
expect(links[3]).toEqual(mockHttpLink);
|
||||
});
|
||||
});
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { createHttpLink } from 'apollo-link-http';
|
||||
import { withClientState } from 'apollo-link-state';
|
||||
import { InMemoryCache } from 'apollo-cache-inmemory';
|
||||
|
||||
import { errorLink, reTryOneTimeOnErrorLink } from '../../containers/errors';
|
||||
|
||||
export const getLinks = (cache: InMemoryCache, basePath: string) => [
|
||||
errorLink,
|
||||
reTryOneTimeOnErrorLink,
|
||||
withClientState({
|
||||
cache,
|
||||
resolvers: {},
|
||||
}),
|
||||
createHttpLink({
|
||||
credentials: 'same-origin',
|
||||
headers: { 'kbn-xsrf': 'true' },
|
||||
uri: `${basePath}/api/solutions/security/graphql`,
|
||||
}),
|
||||
];
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { InMemoryCache, IntrospectionFragmentMatcher } from 'apollo-cache-inmemory';
|
||||
import ApolloClient from 'apollo-client';
|
||||
import { ApolloLink } from 'apollo-link';
|
||||
|
||||
import introspectionQueryResultData from '../../../graphql/introspection.json';
|
||||
import { AppFrontendLibs } from '../lib';
|
||||
import { getLinks } from './helpers';
|
||||
import { CoreStart } from '../../../../../../../src/core/public';
|
||||
|
||||
export function composeLibs(core: CoreStart): AppFrontendLibs {
|
||||
const cache = new InMemoryCache({
|
||||
dataIdFromObject: () => null,
|
||||
fragmentMatcher: new IntrospectionFragmentMatcher({
|
||||
// @ts-expect-error apollo-cache-inmemory types don't match actual introspection data
|
||||
introspectionQueryResultData,
|
||||
}),
|
||||
});
|
||||
const basePath = core.http.basePath.get();
|
||||
|
||||
const apolloClient = new ApolloClient({
|
||||
connectToDevTools: process.env.NODE_ENV !== 'production',
|
||||
cache,
|
||||
link: ApolloLink.from(getLinks(cache, basePath)),
|
||||
});
|
||||
|
||||
const libs: AppFrontendLibs = {
|
||||
apolloClient,
|
||||
};
|
||||
return libs;
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { NormalizedCacheObject } from 'apollo-cache-inmemory';
|
||||
import ApolloClient from 'apollo-client';
|
||||
|
||||
export interface AppFrontendLibs {
|
||||
apolloClient: AppApolloClient;
|
||||
}
|
||||
|
||||
export type AppTimezoneProvider = () => string;
|
||||
|
||||
export type AppApolloClient = ApolloClient<NormalizedCacheObject>;
|
||||
|
||||
export interface AppFrameworkAdapter {
|
||||
appState?: object;
|
||||
bytesFormat?: string;
|
||||
dateFormat?: string;
|
||||
dateFormatTz?: string;
|
||||
darkMode?: boolean;
|
||||
indexPattern?: string;
|
||||
anomalyScore?: number;
|
||||
scaledDateFormat?: string;
|
||||
timezone?: string;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
setUISettings(key: string, value: any): void;
|
||||
}
|
||||
|
||||
export interface AppKibanaUIConfig {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
get(key: string): any;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
set(key: string, value: any): Promise<boolean>;
|
||||
}
|
|
@ -14,7 +14,7 @@ import { coreMock } from '../../../../../../../src/core/public/mocks';
|
|||
import { StartPlugins } from '../../../types';
|
||||
import { depsStartMock } from './dependencies_start_mock';
|
||||
import { MiddlewareActionSpyHelper, createSpyMiddleware } from '../../store/test_utils';
|
||||
import { apolloClientObservable, kibanaObservable } from '../test_providers';
|
||||
import { kibanaObservable } from '../test_providers';
|
||||
import { createStore, State } from '../../store';
|
||||
import { AppRootProvider } from './app_root_provider';
|
||||
import { managementMiddlewareFactory } from '../../../management/store/middleware';
|
||||
|
@ -58,14 +58,10 @@ export const createAppRootMockRenderer = (): AppContextTestRender => {
|
|||
const middlewareSpy = createSpyMiddleware();
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
|
||||
const store = createStore(
|
||||
mockGlobalState,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage,
|
||||
[...managementMiddlewareFactory(coreStart, depsStart), middlewareSpy.actionSpyMiddleware]
|
||||
);
|
||||
const store = createStore(mockGlobalState, SUB_PLUGINS_REDUCER, kibanaObservable, storage, [
|
||||
...managementMiddlewareFactory(coreStart, depsStart),
|
||||
middlewareSpy.actionSpyMiddleware,
|
||||
]);
|
||||
|
||||
const MockKibanaContextProvider = createKibanaContextProviderMock();
|
||||
|
||||
|
|
|
@ -7,11 +7,8 @@
|
|||
|
||||
import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json';
|
||||
import { I18nProvider } from '@kbn/i18n/react';
|
||||
import { InMemoryCache as Cache } from 'apollo-cache-inmemory';
|
||||
import ApolloClient from 'apollo-client';
|
||||
import { ApolloLink } from 'apollo-link';
|
||||
|
||||
import React from 'react';
|
||||
import { ApolloProvider } from 'react-apollo';
|
||||
import { DragDropContext, DropResult, ResponderProvided } from 'react-beautiful-dnd';
|
||||
import { Provider as ReduxStoreProvider } from 'react-redux';
|
||||
import { Store } from 'redux';
|
||||
|
@ -36,12 +33,6 @@ interface Props {
|
|||
onDragEnd?: (result: DropResult, provided: ResponderProvided) => void;
|
||||
}
|
||||
|
||||
export const apolloClient = new ApolloClient({
|
||||
cache: new Cache(),
|
||||
link: new ApolloLink((o, f) => (f ? f(o) : null)),
|
||||
});
|
||||
|
||||
export const apolloClientObservable = new BehaviorSubject(apolloClient);
|
||||
export const kibanaObservable = new BehaviorSubject(createStartServicesMock());
|
||||
|
||||
Object.defineProperty(window, 'localStorage', {
|
||||
|
@ -54,24 +45,16 @@ const { storage } = createSecuritySolutionStorageMock();
|
|||
/** A utility for wrapping children in the providers required to run most tests */
|
||||
const TestProvidersComponent: React.FC<Props> = ({
|
||||
children,
|
||||
store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
),
|
||||
store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage),
|
||||
onDragEnd = jest.fn(),
|
||||
}) => (
|
||||
<I18nProvider>
|
||||
<MockKibanaContextProvider>
|
||||
<ApolloProvider client={apolloClient}>
|
||||
<ReduxStoreProvider store={store}>
|
||||
<ThemeProvider theme={() => ({ eui: euiDarkVars, darkMode: true })}>
|
||||
<DragDropContext onDragEnd={onDragEnd}>{children}</DragDropContext>
|
||||
</ThemeProvider>
|
||||
</ReduxStoreProvider>
|
||||
</ApolloProvider>
|
||||
<ReduxStoreProvider store={store}>
|
||||
<ThemeProvider theme={() => ({ eui: euiDarkVars, darkMode: true })}>
|
||||
<DragDropContext onDragEnd={onDragEnd}>{children}</DragDropContext>
|
||||
</ThemeProvider>
|
||||
</ReduxStoreProvider>
|
||||
</MockKibanaContextProvider>
|
||||
</I18nProvider>
|
||||
);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -26,7 +26,6 @@ import { timelineSelectors } from '../../timelines/store/timeline';
|
|||
import { inputsSelectors } from './inputs';
|
||||
import { SubPluginsInitReducer, createReducer } from './reducer';
|
||||
import { createRootEpic } from './epic';
|
||||
import { AppApolloClient } from '../lib/lib';
|
||||
import { AppAction } from './actions';
|
||||
import { Immutable } from '../../../common/endpoint/types';
|
||||
import { State } from './types';
|
||||
|
@ -52,7 +51,6 @@ let store: Store<State, Action> | null = null;
|
|||
export const createStore = (
|
||||
state: PreloadedState<State>,
|
||||
pluginsReducer: SubPluginsInitReducer,
|
||||
apolloClient: Observable<AppApolloClient>,
|
||||
kibana: Observable<CoreStart>,
|
||||
storage: Storage,
|
||||
additionalMiddleware?: Array<Middleware<{}, State, Dispatch<AppAction | Immutable<AppAction>>>>
|
||||
|
@ -60,7 +58,6 @@ export const createStore = (
|
|||
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
|
||||
|
||||
const middlewareDependencies: TimelineEpicDependencies<State> = {
|
||||
apolloClient$: apolloClient,
|
||||
kibana$: kibana,
|
||||
selectAllTimelineQuery: inputsSelectors.globalQueryByIdSelector,
|
||||
selectNotesByIdSelector: appSelectors.selectNotesByIdSelector,
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ApolloClient } from 'apollo-client';
|
||||
import { createContext, useContext } from 'react';
|
||||
|
||||
/**
|
||||
* This is a temporary provider and hook for use with hooks until react-apollo
|
||||
* has upgraded to the new-style `createContext` api.
|
||||
*/
|
||||
|
||||
export const ApolloClientContext = createContext<ApolloClient<{}> | undefined>(undefined);
|
||||
|
||||
export const useApolloClient = () => {
|
||||
return useContext(ApolloClientContext);
|
||||
};
|
|
@ -14,7 +14,7 @@ import { TimelineType } from '../../../../common/types/timeline';
|
|||
import { HostsTableType } from '../../../hosts/store/model';
|
||||
import { NetworkRouteType } from '../../../network/pages/navigation/types';
|
||||
import { AdministrationSubTab as AdministrationType } from '../../../management/types';
|
||||
import { FlowTarget } from '../../../graphql/types';
|
||||
import { FlowTarget } from '../../../../common/search_strategy';
|
||||
|
||||
export type SiemRouteType = HostsTableType | NetworkRouteType | TimelineType | AdministrationType;
|
||||
export interface RouteSpyState {
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
import { useCallback } from 'react';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { useApolloClient } from '../../../common/utils/apollo_context';
|
||||
import {
|
||||
dispatchUpdateTimeline,
|
||||
queryTimelineById,
|
||||
|
@ -16,12 +15,10 @@ import { updateIsLoading as dispatchUpdateIsLoading } from '../../../timelines/s
|
|||
|
||||
export const useTimelineClick = () => {
|
||||
const dispatch = useDispatch();
|
||||
const apolloClient = useApolloClient();
|
||||
|
||||
const handleTimelineClick = useCallback(
|
||||
(timelineId: string, graphEventId?: string) => {
|
||||
queryTimelineById({
|
||||
apolloClient,
|
||||
graphEventId,
|
||||
timelineId,
|
||||
updateIsLoading: ({
|
||||
|
@ -34,7 +31,7 @@ export const useTimelineClick = () => {
|
|||
updateTimeline: dispatchUpdateTimeline(dispatch),
|
||||
});
|
||||
},
|
||||
[apolloClient, dispatch]
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
return handleTimelineClick;
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { get } from 'lodash/fp';
|
||||
import sinon from 'sinon';
|
||||
import moment from 'moment';
|
||||
|
||||
|
@ -13,9 +12,7 @@ import { sendAlertToTimelineAction, determineToAndFrom } from './actions';
|
|||
import {
|
||||
mockEcsDataWithAlert,
|
||||
defaultTimelineProps,
|
||||
apolloClient,
|
||||
mockTimelineApolloResult,
|
||||
mockTimelineDetailsApollo,
|
||||
mockTimelineResult,
|
||||
mockTimelineDetails,
|
||||
} from '../../../common/mock/';
|
||||
import { CreateTimeline, UpdateTimelineLoading } from './types';
|
||||
|
@ -28,8 +25,11 @@ import {
|
|||
} from '../../../../common/types/timeline';
|
||||
import { ISearchStart } from '../../../../../../../src/plugins/data/public';
|
||||
import { dataPluginMock } from '../../../../../../../src/plugins/data/public/mocks';
|
||||
import { getTimelineTemplate } from '../../../timelines/containers/api';
|
||||
|
||||
jest.mock('apollo-client');
|
||||
jest.mock('../../../timelines/containers/api', () => ({
|
||||
getTimelineTemplate: jest.fn(),
|
||||
}));
|
||||
|
||||
describe('alert actions', () => {
|
||||
const anchor = '2020-03-01T17:59:46.349Z';
|
||||
|
@ -60,13 +60,7 @@ describe('alert actions', () => {
|
|||
searchSource: {} as ISearchStart['searchSource'],
|
||||
};
|
||||
|
||||
jest.spyOn(apolloClient, 'query').mockImplementation((obj) => {
|
||||
const id = get('variables.id', obj);
|
||||
if (id != null) {
|
||||
return Promise.resolve(mockTimelineApolloResult);
|
||||
}
|
||||
return Promise.resolve(mockTimelineDetailsApollo);
|
||||
});
|
||||
(getTimelineTemplate as jest.Mock).mockResolvedValue(mockTimelineResult);
|
||||
|
||||
clock = sinon.useFakeTimers(unix);
|
||||
});
|
||||
|
@ -79,7 +73,6 @@ describe('alert actions', () => {
|
|||
describe('timeline id is NOT empty string and apollo client exists', () => {
|
||||
test('it invokes updateTimelineIsLoading to set to true', async () => {
|
||||
await sendAlertToTimelineAction({
|
||||
apolloClient,
|
||||
createTimeline,
|
||||
ecsData: mockEcsDataWithAlert,
|
||||
nonEcsData: [],
|
||||
|
@ -96,7 +89,6 @@ describe('alert actions', () => {
|
|||
|
||||
test('it invokes createTimeline with designated timeline template if "timelineTemplate" exists', async () => {
|
||||
await sendAlertToTimelineAction({
|
||||
apolloClient,
|
||||
createTimeline,
|
||||
ecsData: mockEcsDataWithAlert,
|
||||
nonEcsData: [],
|
||||
|
@ -236,8 +228,8 @@ describe('alert actions', () => {
|
|||
});
|
||||
|
||||
test('it invokes createTimeline with kqlQuery.filterQuery.kuery.kind as "kuery" if not specified in returned timeline template', async () => {
|
||||
const mockTimelineApolloResultModified = {
|
||||
...mockTimelineApolloResult,
|
||||
const mockTimelineResultModified = {
|
||||
...mockTimelineResult,
|
||||
kqlQuery: {
|
||||
filterQuery: {
|
||||
kuery: {
|
||||
|
@ -246,10 +238,9 @@ describe('alert actions', () => {
|
|||
},
|
||||
},
|
||||
};
|
||||
jest.spyOn(apolloClient, 'query').mockResolvedValue(mockTimelineApolloResultModified);
|
||||
(getTimelineTemplate as jest.Mock).mockResolvedValue(mockTimelineResultModified);
|
||||
|
||||
await sendAlertToTimelineAction({
|
||||
apolloClient,
|
||||
createTimeline,
|
||||
ecsData: mockEcsDataWithAlert,
|
||||
nonEcsData: [],
|
||||
|
@ -263,12 +254,11 @@ describe('alert actions', () => {
|
|||
});
|
||||
|
||||
test('it invokes createTimeline with default timeline if apolloClient throws', async () => {
|
||||
jest.spyOn(apolloClient, 'query').mockImplementation(() => {
|
||||
(getTimelineTemplate as jest.Mock).mockImplementation(() => {
|
||||
throw new Error('Test error');
|
||||
});
|
||||
|
||||
await sendAlertToTimelineAction({
|
||||
apolloClient,
|
||||
createTimeline,
|
||||
ecsData: mockEcsDataWithAlert,
|
||||
nonEcsData: [],
|
||||
|
@ -303,7 +293,6 @@ describe('alert actions', () => {
|
|||
};
|
||||
|
||||
await sendAlertToTimelineAction({
|
||||
apolloClient,
|
||||
createTimeline,
|
||||
ecsData: ecsDataMock,
|
||||
nonEcsData: [],
|
||||
|
|
|
@ -13,7 +13,12 @@ import moment from 'moment';
|
|||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import type { Filter } from '../../../../../../../src/plugins/data/common/es_query/filters';
|
||||
import { TimelineId, TimelineStatus, TimelineType } from '../../../../common/types/timeline';
|
||||
import {
|
||||
TimelineId,
|
||||
TimelineResult,
|
||||
TimelineStatus,
|
||||
TimelineType,
|
||||
} from '../../../../common/types/timeline';
|
||||
import { updateAlertStatus } from '../../containers/detection_engine/alerts/api';
|
||||
import {
|
||||
SendAlertToTimelineActionProps,
|
||||
|
@ -21,7 +26,6 @@ import {
|
|||
UpdateAlertStatusActionProps,
|
||||
} from './types';
|
||||
import { Ecs } from '../../../../common/ecs';
|
||||
import { GetOneTimeline, TimelineResult } from '../../../graphql/types';
|
||||
import {
|
||||
TimelineNonEcsData,
|
||||
TimelineEventsDetailsItem,
|
||||
|
@ -29,7 +33,6 @@ import {
|
|||
TimelineEventsDetailsStrategyResponse,
|
||||
TimelineEventsQueries,
|
||||
} from '../../../../common/search_strategy/timeline';
|
||||
import { oneTimelineQuery } from '../../../timelines/containers/one/index.gql_query';
|
||||
import { timelineDefaults } from '../../../timelines/store/timeline/defaults';
|
||||
import {
|
||||
omitTypenameInTimeline,
|
||||
|
@ -47,6 +50,7 @@ import {
|
|||
QueryOperator,
|
||||
} from '../../../timelines/components/timeline/data_providers/data_provider';
|
||||
import { esFilters } from '../../../../../../../src/plugins/data/public';
|
||||
import { getTimelineTemplate } from '../../../timelines/containers/api';
|
||||
|
||||
export const getUpdateAlertsQuery = (eventIds: Readonly<string[]>) => {
|
||||
return {
|
||||
|
@ -362,7 +366,6 @@ export const buildEqlDataProviderOrFilter = (
|
|||
};
|
||||
|
||||
export const sendAlertToTimelineAction = async ({
|
||||
apolloClient,
|
||||
createTimeline,
|
||||
ecsData: ecs,
|
||||
nonEcsData,
|
||||
|
@ -381,18 +384,11 @@ export const sendAlertToTimelineAction = async ({
|
|||
const { to, from } = determineToAndFrom({ ecs });
|
||||
|
||||
// For now we do not want to populate the template timeline if we have alertIds
|
||||
if (!isEmpty(timelineId) && apolloClient != null && isEmpty(alertIds)) {
|
||||
if (!isEmpty(timelineId) && isEmpty(alertIds)) {
|
||||
try {
|
||||
updateTimelineIsLoading({ id: TimelineId.active, isLoading: true });
|
||||
const [responseTimeline, eventDataResp] = await Promise.all([
|
||||
apolloClient.query<GetOneTimeline.Query, GetOneTimeline.Variables>({
|
||||
query: oneTimelineQuery,
|
||||
fetchPolicy: 'no-cache',
|
||||
variables: {
|
||||
id: timelineId,
|
||||
timelineType: TimelineType.template,
|
||||
},
|
||||
}),
|
||||
getTimelineTemplate(timelineId),
|
||||
searchStrategyClient
|
||||
.search<TimelineEventsDetailsRequestOptions, TimelineEventsDetailsStrategyResponse>(
|
||||
{
|
||||
|
|
|
@ -18,7 +18,7 @@ import {
|
|||
DataProvidersAnd,
|
||||
} from '../../../timelines/components/timeline/data_providers/data_provider';
|
||||
import { TimelineEventsDetailsItem } from '../../../../common/search_strategy';
|
||||
import { TimelineType } from '../../../graphql/types';
|
||||
import { TimelineType } from '../../../../common/types/timeline';
|
||||
|
||||
interface FindValueToChangeInQuery {
|
||||
field: string;
|
||||
|
|
|
@ -13,7 +13,6 @@ import { TimelineId } from '../../../../../common/types/timeline';
|
|||
import { Ecs } from '../../../../../common/ecs';
|
||||
import { TimelineNonEcsData } from '../../../../../common/search_strategy/timeline';
|
||||
import { timelineActions } from '../../../../timelines/store/timeline';
|
||||
import { useApolloClient } from '../../../../common/utils/apollo_context';
|
||||
import { sendAlertToTimelineAction } from '../actions';
|
||||
import { dispatchUpdateTimeline } from '../../../../timelines/components/open_timeline/helpers';
|
||||
import { ActionIconItem } from '../../../../timelines/components/timeline/body/actions/action_icon_item';
|
||||
|
@ -42,7 +41,6 @@ const InvestigateInTimelineActionComponent: React.FC<InvestigateInTimelineAction
|
|||
data: { search: searchStrategyClient },
|
||||
} = useKibana().services;
|
||||
const dispatch = useDispatch();
|
||||
const apolloClient = useApolloClient();
|
||||
|
||||
const updateTimelineIsLoading = useCallback(
|
||||
(payload) => dispatch(timelineActions.updateIsLoading(payload)),
|
||||
|
@ -74,7 +72,6 @@ const InvestigateInTimelineActionComponent: React.FC<InvestigateInTimelineAction
|
|||
try {
|
||||
if (ecsRowData != null) {
|
||||
await sendAlertToTimelineAction({
|
||||
apolloClient,
|
||||
createTimeline,
|
||||
ecsData: ecsRowData,
|
||||
nonEcsData: nonEcsRowData,
|
||||
|
@ -85,7 +82,6 @@ const InvestigateInTimelineActionComponent: React.FC<InvestigateInTimelineAction
|
|||
if (ecsRowData == null && fetchEcsAlertsData) {
|
||||
const alertsEcsData = await fetchEcsAlertsData(alertIds);
|
||||
await sendAlertToTimelineAction({
|
||||
apolloClient,
|
||||
createTimeline,
|
||||
ecsData: alertsEcsData,
|
||||
nonEcsData: nonEcsRowData,
|
||||
|
@ -98,7 +94,6 @@ const InvestigateInTimelineActionComponent: React.FC<InvestigateInTimelineAction
|
|||
}
|
||||
}, [
|
||||
alertIds,
|
||||
apolloClient,
|
||||
createTimeline,
|
||||
ecsRowData,
|
||||
fetchEcsAlertsData,
|
||||
|
|
|
@ -5,14 +5,12 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import ApolloClient from 'apollo-client';
|
||||
|
||||
import { ISearchStart } from '../../../../../../../src/plugins/data/public';
|
||||
import { Status } from '../../../../common/detection_engine/schemas/common/schemas';
|
||||
import { Ecs } from '../../../../common/ecs';
|
||||
import { TimelineNonEcsData } from '../../../../common/search_strategy/timeline';
|
||||
import { NoteResult } from '../../../../common/types/timeline/note';
|
||||
import { DataProvider } from '../../../timelines/components/timeline/data_providers/data_provider';
|
||||
import { NoteResult } from '../../../graphql/types';
|
||||
import { TimelineModel } from '../../../timelines/store/timeline/model';
|
||||
import { inputsModel } from '../../../common/store';
|
||||
|
||||
|
@ -54,7 +52,6 @@ export interface UpdateAlertStatusActionProps {
|
|||
}
|
||||
|
||||
export interface SendAlertToTimelineActionProps {
|
||||
apolloClient?: ApolloClient<{}>;
|
||||
createTimeline: CreateTimeline;
|
||||
ecsData: Ecs | Ecs[];
|
||||
nonEcsData: TimelineNonEcsData[];
|
||||
|
|
|
@ -11,7 +11,6 @@ import { useParams } from 'react-router-dom';
|
|||
import { waitFor } from '@testing-library/react';
|
||||
import '../../../common/mock/match_media';
|
||||
import {
|
||||
apolloClientObservable,
|
||||
createSecuritySolutionStorageMock,
|
||||
kibanaObservable,
|
||||
mockGlobalState,
|
||||
|
@ -62,13 +61,7 @@ const state: State = {
|
|||
};
|
||||
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
const store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
const store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
|
||||
describe('DetectionEnginePageComponent', () => {
|
||||
beforeAll(() => {
|
||||
|
|
|
@ -11,7 +11,6 @@ import { waitFor } from '@testing-library/react';
|
|||
|
||||
import '../../../../../common/mock/match_media';
|
||||
import {
|
||||
apolloClientObservable,
|
||||
createSecuritySolutionStorageMock,
|
||||
kibanaObservable,
|
||||
mockGlobalState,
|
||||
|
@ -60,13 +59,7 @@ const state: State = {
|
|||
...mockGlobalState,
|
||||
};
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
const store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
const store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
|
||||
describe('RuleDetailsPageComponent', () => {
|
||||
beforeAll(() => {
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -12,7 +12,6 @@ import { Provider as ReduxStoreProvider } from 'react-redux';
|
|||
|
||||
import '../../../common/mock/match_media';
|
||||
import {
|
||||
apolloClientObservable,
|
||||
mockGlobalState,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
kibanaObservable,
|
||||
|
@ -29,22 +28,10 @@ describe('Authentication Table Component', () => {
|
|||
const state: State = mockGlobalState;
|
||||
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
let store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
|
||||
beforeEach(() => {
|
||||
store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
});
|
||||
|
||||
describe('rendering', () => {
|
||||
|
|
|
@ -7,11 +7,9 @@
|
|||
|
||||
import { shallow } from 'enzyme';
|
||||
import React from 'react';
|
||||
import { MockedProvider } from 'react-apollo/test-utils';
|
||||
|
||||
import '../../../common/mock/match_media';
|
||||
import {
|
||||
apolloClientObservable,
|
||||
mockGlobalState,
|
||||
TestProviders,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
|
@ -41,23 +39,11 @@ describe('Hosts Table', () => {
|
|||
const state: State = mockGlobalState;
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
|
||||
let store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
const mount = useMountAppended();
|
||||
|
||||
beforeEach(() => {
|
||||
store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
});
|
||||
|
||||
describe('rendering', () => {
|
||||
|
@ -86,21 +72,19 @@ describe('Hosts Table', () => {
|
|||
|
||||
beforeEach(() => {
|
||||
wrapper = mount(
|
||||
<MockedProvider>
|
||||
<TestProviders store={store}>
|
||||
<HostsTable
|
||||
id="hostsQuery"
|
||||
isInspect={false}
|
||||
loading={false}
|
||||
data={mockData}
|
||||
totalCount={0}
|
||||
fakeTotalCount={-1}
|
||||
showMorePagesIndicator={false}
|
||||
loadPage={loadPage}
|
||||
type={hostsModel.HostsType.page}
|
||||
/>
|
||||
</TestProviders>
|
||||
</MockedProvider>
|
||||
<TestProviders store={store}>
|
||||
<HostsTable
|
||||
id="hostsQuery"
|
||||
isInspect={false}
|
||||
loading={false}
|
||||
data={mockData}
|
||||
totalCount={0}
|
||||
fakeTotalCount={-1}
|
||||
showMorePagesIndicator={false}
|
||||
loadPage={loadPage}
|
||||
type={hostsModel.HostsType.page}
|
||||
/>
|
||||
</TestProviders>
|
||||
);
|
||||
});
|
||||
test('Initial value of the store', () => {
|
||||
|
|
|
@ -12,7 +12,6 @@ import { Router } from 'react-router-dom';
|
|||
import { Filter } from '../../../../../../src/plugins/data/common/es_query';
|
||||
import '../../common/mock/match_media';
|
||||
import {
|
||||
apolloClientObservable,
|
||||
TestProviders,
|
||||
mockGlobalState,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
|
@ -144,13 +143,7 @@ describe('Hosts - rendering', () => {
|
|||
});
|
||||
const myState: State = mockGlobalState;
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
const myStore = createStore(
|
||||
myState,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
const myStore = createStore(myState, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
const wrapper = mount(
|
||||
<TestProviders store={myStore}>
|
||||
<Router history={mockHistory}>
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { HostsFields } from '../../../common/search_strategy/security_solution/hosts';
|
||||
import { Direction } from '../../graphql/types';
|
||||
import { Direction } from '../../../common/search_strategy';
|
||||
import { HostsFields } from '../../../common/search_strategy/security_solution';
|
||||
|
||||
export enum HostsType {
|
||||
page = 'page',
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
*/
|
||||
|
||||
import { renderApp } from './app';
|
||||
import { composeLibs } from './common/lib/compose/kibana_compose';
|
||||
|
||||
import { createStore, createInitialState } from './common/store';
|
||||
|
||||
export { renderApp, composeLibs, createStore, createInitialState };
|
||||
export { renderApp, createStore, createInitialState };
|
||||
|
|
|
@ -9,10 +9,8 @@ import { shallow } from 'enzyme';
|
|||
import React from 'react';
|
||||
import { ActionCreator } from 'typescript-fsa';
|
||||
|
||||
import { FlowTarget } from '../../../graphql/types';
|
||||
import '../../../common/mock/match_media';
|
||||
import {
|
||||
apolloClientObservable,
|
||||
mockGlobalState,
|
||||
TestProviders,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
|
@ -26,27 +24,16 @@ import { IpOverview } from './index';
|
|||
import { mockData } from './mock';
|
||||
import { mockAnomalies } from '../../../common/components/ml/mock';
|
||||
import { NarrowDateRange } from '../../../common/components/ml/types';
|
||||
import { FlowTarget } from '../../../../common/search_strategy';
|
||||
|
||||
describe('IP Overview Component', () => {
|
||||
const state: State = mockGlobalState;
|
||||
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
let store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
|
||||
beforeEach(() => {
|
||||
store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
});
|
||||
|
||||
describe('rendering', () => {
|
||||
|
|
|
@ -13,11 +13,11 @@ import { getRenderedFieldValue, PointToolTipContentComponent } from './point_too
|
|||
import { TestProviders } from '../../../../common/mock';
|
||||
import { getEmptyStringTag } from '../../../../common/components/empty_value';
|
||||
import { HostDetailsLink, NetworkDetailsLink } from '../../../../common/components/links';
|
||||
import { FlowTarget } from '../../../../graphql/types';
|
||||
import {
|
||||
TooltipProperty,
|
||||
ITooltipProperty,
|
||||
} from '../../../../../../maps/public/classes/tooltips/tooltip_property';
|
||||
import { FlowTarget } from '../../../../../common/search_strategy';
|
||||
|
||||
describe('PointToolTipContent', () => {
|
||||
const mockFeatureProps: ITooltipProperty[] = [
|
||||
|
|
|
@ -14,9 +14,9 @@ import {
|
|||
import { DescriptionListStyled } from '../../../../common/components/page';
|
||||
import { HostDetailsLink, NetworkDetailsLink } from '../../../../common/components/links';
|
||||
import { DefaultFieldRenderer } from '../../../../timelines/components/field_renderers/field_renderers';
|
||||
import { FlowTarget } from '../../../../graphql/types';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { ITooltipProperty } from '../../../../../../maps/public/classes/tooltips/tooltip_property';
|
||||
import { FlowTarget } from '../../../../../common/search_strategy';
|
||||
|
||||
interface PointToolTipContentProps {
|
||||
contextId: string;
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
|
||||
import { mount, shallow } from 'enzyme';
|
||||
import React from 'react';
|
||||
|
||||
import { FlowDirection } from '../../../graphql/types';
|
||||
import { FlowDirection } from '../../../../common/search_strategy';
|
||||
|
||||
import { FlowDirectionSelect } from './flow_direction_select';
|
||||
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
|
||||
import { EuiFilterButton, EuiFilterGroup } from '@elastic/eui';
|
||||
import React from 'react';
|
||||
|
||||
import { FlowDirection } from '../../../graphql/types';
|
||||
import { FlowDirection } from '../../../../common/search_strategy';
|
||||
|
||||
import * as i18n from './translations';
|
||||
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
import { mount, shallow } from 'enzyme';
|
||||
import { clone } from 'lodash/fp';
|
||||
import React from 'react';
|
||||
|
||||
import { FlowDirection, FlowTarget } from '../../../graphql/types';
|
||||
import { FlowDirection, FlowTarget } from '../../../../common/search_strategy';
|
||||
|
||||
import { FlowTargetSelect } from './flow_target_select';
|
||||
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
|
||||
import { EuiSuperSelect } from '@elastic/eui';
|
||||
import React from 'react';
|
||||
|
||||
import { FlowDirection, FlowTarget } from '../../../graphql/types';
|
||||
import { FlowTarget, FlowDirection } from '../../../../common/search_strategy';
|
||||
|
||||
import * as i18n from './translations';
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import { MemoryRouter } from 'react-router-dom';
|
|||
import '../../../common/mock/match_media';
|
||||
import { TestProviders } from '../../../common/mock';
|
||||
import { FlowTargetSelectConnectedComponent } from './index';
|
||||
import { FlowTarget } from '../../../graphql/types';
|
||||
import { FlowTarget } from '../../../../common/search_strategy';
|
||||
|
||||
describe('Flow Target Select Connected', () => {
|
||||
test('renders correctly against snapshot flowTarget source', () => {
|
||||
|
|
|
@ -11,11 +11,11 @@ import React, { useCallback } from 'react';
|
|||
import { useHistory, useLocation } from 'react-router-dom';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { FlowDirection, FlowTarget } from '../../../graphql/types';
|
||||
import * as i18nIp from '../details/translations';
|
||||
|
||||
import { FlowTargetSelect } from '../flow_controls/flow_target_select';
|
||||
import { IpOverviewId } from '../../../timelines/components/field_renderers/field_renderers';
|
||||
import { FlowTarget, FlowDirection } from '../../../../common/search_strategy';
|
||||
|
||||
const SelectTypeItem = styled(EuiFlexItem)`
|
||||
min-width: 180px;
|
||||
|
|
|
@ -10,7 +10,6 @@ import React from 'react';
|
|||
import { Provider as ReduxStoreProvider } from 'react-redux';
|
||||
|
||||
import {
|
||||
apolloClientObservable,
|
||||
mockGlobalState,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
kibanaObservable,
|
||||
|
@ -33,22 +32,10 @@ describe('NetworkKpiComponent', () => {
|
|||
};
|
||||
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
let store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
|
||||
beforeEach(() => {
|
||||
store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
});
|
||||
|
||||
describe('rendering', () => {
|
||||
|
|
|
@ -8,12 +8,10 @@
|
|||
import { shallow } from 'enzyme';
|
||||
import { getOr } from 'lodash/fp';
|
||||
import React from 'react';
|
||||
import { MockedProvider } from 'react-apollo/test-utils';
|
||||
import { Provider as ReduxStoreProvider } from 'react-redux';
|
||||
|
||||
import '../../../common/mock/match_media';
|
||||
import {
|
||||
apolloClientObservable,
|
||||
mockGlobalState,
|
||||
TestProviders,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
|
@ -31,23 +29,11 @@ describe('NetworkTopNFlow Table Component', () => {
|
|||
const loadPage = jest.fn();
|
||||
const state: State = mockGlobalState;
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
let store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
const mount = useMountAppended();
|
||||
|
||||
beforeEach(() => {
|
||||
store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
});
|
||||
|
||||
describe('rendering', () => {
|
||||
|
@ -75,21 +61,19 @@ describe('NetworkTopNFlow Table Component', () => {
|
|||
describe('Sorting', () => {
|
||||
test('when you click on the column header, you should show the sorting icon', () => {
|
||||
const wrapper = mount(
|
||||
<MockedProvider>
|
||||
<TestProviders store={store}>
|
||||
<NetworkDnsTable
|
||||
data={mockData.edges}
|
||||
fakeTotalCount={getOr(50, 'fakeTotalCount', mockData.pageInfo)}
|
||||
id="dns"
|
||||
isInspect={false}
|
||||
loading={false}
|
||||
loadPage={loadPage}
|
||||
showMorePagesIndicator={getOr(false, 'showMorePagesIndicator', mockData.pageInfo)}
|
||||
totalCount={mockData.totalCount}
|
||||
type={networkModel.NetworkType.page}
|
||||
/>
|
||||
</TestProviders>
|
||||
</MockedProvider>
|
||||
<TestProviders store={store}>
|
||||
<NetworkDnsTable
|
||||
data={mockData.edges}
|
||||
fakeTotalCount={getOr(50, 'fakeTotalCount', mockData.pageInfo)}
|
||||
id="dns"
|
||||
isInspect={false}
|
||||
loading={false}
|
||||
loadPage={loadPage}
|
||||
showMorePagesIndicator={getOr(false, 'showMorePagesIndicator', mockData.pageInfo)}
|
||||
totalCount={mockData.totalCount}
|
||||
type={networkModel.NetworkType.page}
|
||||
/>
|
||||
</TestProviders>
|
||||
);
|
||||
|
||||
expect(store.getState().network.page.queries!.dns.sort).toEqual({
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
|
||||
import { mount, shallow } from 'enzyme';
|
||||
import React from 'react';
|
||||
|
||||
import { FlowDirection } from '../../../graphql/types';
|
||||
import { FlowDirection } from '../../../../common/search_strategy';
|
||||
|
||||
import { IsPtrIncluded } from './is_ptr_included';
|
||||
|
||||
|
|
|
@ -8,12 +8,10 @@
|
|||
import { shallow } from 'enzyme';
|
||||
import { getOr } from 'lodash/fp';
|
||||
import React from 'react';
|
||||
import { MockedProvider } from 'react-apollo/test-utils';
|
||||
import { Provider as ReduxStoreProvider } from 'react-redux';
|
||||
|
||||
import '../../../common/mock/match_media';
|
||||
import {
|
||||
apolloClientObservable,
|
||||
mockGlobalState,
|
||||
TestProviders,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
|
@ -34,23 +32,11 @@ describe('NetworkHttp Table Component', () => {
|
|||
const state: State = mockGlobalState;
|
||||
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
let store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
const mount = useMountAppended();
|
||||
|
||||
beforeEach(() => {
|
||||
store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
});
|
||||
|
||||
describe('rendering', () => {
|
||||
|
@ -78,21 +64,19 @@ describe('NetworkHttp Table Component', () => {
|
|||
describe('Sorting', () => {
|
||||
test('when you click on the column header, you should show the sorting icon', () => {
|
||||
const wrapper = mount(
|
||||
<MockedProvider>
|
||||
<TestProviders store={store}>
|
||||
<NetworkHttpTable
|
||||
data={mockData.edges}
|
||||
fakeTotalCount={getOr(50, 'fakeTotalCount', mockData.pageInfo)}
|
||||
id="http"
|
||||
isInspect={false}
|
||||
loading={false}
|
||||
loadPage={loadPage}
|
||||
showMorePagesIndicator={getOr(false, 'showMorePagesIndicator', mockData.pageInfo)}
|
||||
totalCount={mockData.totalCount}
|
||||
type={networkModel.NetworkType.page}
|
||||
/>
|
||||
</TestProviders>
|
||||
</MockedProvider>
|
||||
<TestProviders store={store}>
|
||||
<NetworkHttpTable
|
||||
data={mockData.edges}
|
||||
fakeTotalCount={getOr(50, 'fakeTotalCount', mockData.pageInfo)}
|
||||
id="http"
|
||||
isInspect={false}
|
||||
loading={false}
|
||||
loadPage={loadPage}
|
||||
showMorePagesIndicator={getOr(false, 'showMorePagesIndicator', mockData.pageInfo)}
|
||||
totalCount={mockData.totalCount}
|
||||
type={networkModel.NetworkType.page}
|
||||
/>
|
||||
</TestProviders>
|
||||
);
|
||||
|
||||
expect(store.getState().network.page.queries!.http.sort).toEqual({
|
||||
|
|
|
@ -8,13 +8,11 @@
|
|||
import { shallow } from 'enzyme';
|
||||
import { getOr } from 'lodash/fp';
|
||||
import React from 'react';
|
||||
import { MockedProvider } from 'react-apollo/test-utils';
|
||||
import { Provider as ReduxStoreProvider } from 'react-redux';
|
||||
|
||||
import '../../../common/mock/match_media';
|
||||
import { FlowTargetSourceDest } from '../../../../common/search_strategy/security_solution/network';
|
||||
import {
|
||||
apolloClientObservable,
|
||||
mockGlobalState,
|
||||
mockIndexPattern,
|
||||
TestProviders,
|
||||
|
@ -35,22 +33,10 @@ describe('NetworkTopCountries Table Component', () => {
|
|||
const mount = useMountAppended();
|
||||
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
let store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
|
||||
beforeEach(() => {
|
||||
store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
});
|
||||
|
||||
describe('rendering', () => {
|
||||
|
@ -109,27 +95,25 @@ describe('NetworkTopCountries Table Component', () => {
|
|||
describe('Sorting on Table', () => {
|
||||
test('when you click on the column header, you should show the sorting icon', () => {
|
||||
const wrapper = mount(
|
||||
<MockedProvider>
|
||||
<TestProviders store={store}>
|
||||
<NetworkTopCountriesTable
|
||||
data={mockData.NetworkTopCountries.edges}
|
||||
fakeTotalCount={getOr(50, 'fakeTotalCount', mockData.NetworkTopCountries.pageInfo)}
|
||||
flowTargeted={FlowTargetSourceDest.source}
|
||||
id="topCountriesSource"
|
||||
isInspect={false}
|
||||
indexPattern={mockIndexPattern}
|
||||
loading={false}
|
||||
loadPage={loadPage}
|
||||
showMorePagesIndicator={getOr(
|
||||
false,
|
||||
'showMorePagesIndicator',
|
||||
mockData.NetworkTopCountries.pageInfo
|
||||
)}
|
||||
totalCount={mockData.NetworkTopCountries.totalCount}
|
||||
type={networkModel.NetworkType.page}
|
||||
/>
|
||||
</TestProviders>
|
||||
</MockedProvider>
|
||||
<TestProviders store={store}>
|
||||
<NetworkTopCountriesTable
|
||||
data={mockData.NetworkTopCountries.edges}
|
||||
fakeTotalCount={getOr(50, 'fakeTotalCount', mockData.NetworkTopCountries.pageInfo)}
|
||||
flowTargeted={FlowTargetSourceDest.source}
|
||||
id="topCountriesSource"
|
||||
isInspect={false}
|
||||
indexPattern={mockIndexPattern}
|
||||
loading={false}
|
||||
loadPage={loadPage}
|
||||
showMorePagesIndicator={getOr(
|
||||
false,
|
||||
'showMorePagesIndicator',
|
||||
mockData.NetworkTopCountries.pageInfo
|
||||
)}
|
||||
totalCount={mockData.NetworkTopCountries.totalCount}
|
||||
type={networkModel.NetworkType.page}
|
||||
/>
|
||||
</TestProviders>
|
||||
);
|
||||
expect(store.getState().network.page.queries.topCountriesSource.sort).toEqual({
|
||||
direction: 'desc',
|
||||
|
|
|
@ -8,13 +8,10 @@
|
|||
import { shallow } from 'enzyme';
|
||||
import { getOr } from 'lodash/fp';
|
||||
import React from 'react';
|
||||
import { MockedProvider } from 'react-apollo/test-utils';
|
||||
import { Provider as ReduxStoreProvider } from 'react-redux';
|
||||
|
||||
import '../../../common/mock/match_media';
|
||||
import { FlowTargetSourceDest } from '../../../graphql/types';
|
||||
import {
|
||||
apolloClientObservable,
|
||||
mockGlobalState,
|
||||
TestProviders,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
|
@ -26,6 +23,7 @@ import { createStore, State } from '../../../common/store';
|
|||
import { networkModel } from '../../store';
|
||||
import { NetworkTopNFlowTable } from '.';
|
||||
import { mockData } from './mock';
|
||||
import { FlowTargetSourceDest } from '../../../../common/search_strategy';
|
||||
|
||||
jest.mock('../../../common/components/link_to');
|
||||
|
||||
|
@ -34,23 +32,11 @@ describe('NetworkTopNFlow Table Component', () => {
|
|||
const state: State = mockGlobalState;
|
||||
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
let store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
const mount = useMountAppended();
|
||||
|
||||
beforeEach(() => {
|
||||
store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
});
|
||||
|
||||
describe('rendering', () => {
|
||||
|
@ -100,22 +86,20 @@ describe('NetworkTopNFlow Table Component', () => {
|
|||
describe('Sorting on Table', () => {
|
||||
test('when you click on the column header, you should show the sorting icon', () => {
|
||||
const wrapper = mount(
|
||||
<MockedProvider>
|
||||
<TestProviders store={store}>
|
||||
<NetworkTopNFlowTable
|
||||
data={mockData.edges}
|
||||
fakeTotalCount={getOr(50, 'fakeTotalCount', mockData.pageInfo)}
|
||||
flowTargeted={FlowTargetSourceDest.source}
|
||||
id="topNFlowSource"
|
||||
isInspect={false}
|
||||
loading={false}
|
||||
loadPage={loadPage}
|
||||
showMorePagesIndicator={getOr(false, 'showMorePagesIndicator', mockData.pageInfo)}
|
||||
totalCount={mockData.totalCount}
|
||||
type={networkModel.NetworkType.page}
|
||||
/>
|
||||
</TestProviders>
|
||||
</MockedProvider>
|
||||
<TestProviders store={store}>
|
||||
<NetworkTopNFlowTable
|
||||
data={mockData.edges}
|
||||
fakeTotalCount={getOr(50, 'fakeTotalCount', mockData.pageInfo)}
|
||||
flowTargeted={FlowTargetSourceDest.source}
|
||||
id="topNFlowSource"
|
||||
isInspect={false}
|
||||
loading={false}
|
||||
loadPage={loadPage}
|
||||
showMorePagesIndicator={getOr(false, 'showMorePagesIndicator', mockData.pageInfo)}
|
||||
totalCount={mockData.totalCount}
|
||||
type={networkModel.NetworkType.page}
|
||||
/>
|
||||
</TestProviders>
|
||||
);
|
||||
expect(store.getState().network.page.queries.topNFlowSource.sort).toEqual({
|
||||
direction: 'desc',
|
||||
|
|
|
@ -8,12 +8,10 @@
|
|||
import { shallow } from 'enzyme';
|
||||
import { getOr } from 'lodash/fp';
|
||||
import React from 'react';
|
||||
import { MockedProvider } from 'react-apollo/test-utils';
|
||||
import { Provider as ReduxStoreProvider } from 'react-redux';
|
||||
|
||||
import '../../../common/mock/match_media';
|
||||
import {
|
||||
apolloClientObservable,
|
||||
mockGlobalState,
|
||||
TestProviders,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
|
@ -31,23 +29,11 @@ describe('Tls Table Component', () => {
|
|||
const state: State = mockGlobalState;
|
||||
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
let store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
const mount = useMountAppended();
|
||||
|
||||
beforeEach(() => {
|
||||
store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
});
|
||||
|
||||
describe('Rendering', () => {
|
||||
|
@ -75,21 +61,19 @@ describe('Tls Table Component', () => {
|
|||
describe('Sorting on Table', () => {
|
||||
test('when you click on the column header, you should show the sorting icon', () => {
|
||||
const wrapper = mount(
|
||||
<MockedProvider>
|
||||
<TestProviders store={store}>
|
||||
<TlsTable
|
||||
data={mockTlsData.edges}
|
||||
fakeTotalCount={getOr(50, 'fakeTotalCount', mockTlsData.pageInfo)}
|
||||
id="tls"
|
||||
isInspect={false}
|
||||
loading={false}
|
||||
loadPage={loadPage}
|
||||
showMorePagesIndicator={getOr(false, 'showMorePagesIndicator', mockTlsData.pageInfo)}
|
||||
totalCount={1}
|
||||
type={networkModel.NetworkType.details}
|
||||
/>
|
||||
</TestProviders>
|
||||
</MockedProvider>
|
||||
<TestProviders store={store}>
|
||||
<TlsTable
|
||||
data={mockTlsData.edges}
|
||||
fakeTotalCount={getOr(50, 'fakeTotalCount', mockTlsData.pageInfo)}
|
||||
id="tls"
|
||||
isInspect={false}
|
||||
loading={false}
|
||||
loadPage={loadPage}
|
||||
showMorePagesIndicator={getOr(false, 'showMorePagesIndicator', mockTlsData.pageInfo)}
|
||||
totalCount={1}
|
||||
type={networkModel.NetworkType.details}
|
||||
/>
|
||||
</TestProviders>
|
||||
);
|
||||
expect(store.getState().network.details.queries!.tls.sort).toEqual({
|
||||
direction: 'desc',
|
||||
|
|
|
@ -8,13 +8,10 @@
|
|||
import { shallow } from 'enzyme';
|
||||
import { getOr } from 'lodash/fp';
|
||||
import React from 'react';
|
||||
import { MockedProvider } from 'react-apollo/test-utils';
|
||||
import { Provider as ReduxStoreProvider } from 'react-redux';
|
||||
|
||||
import '../../../common/mock/match_media';
|
||||
import { FlowTarget } from '../../../graphql/types';
|
||||
import {
|
||||
apolloClientObservable,
|
||||
mockGlobalState,
|
||||
TestProviders,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
|
@ -27,29 +24,18 @@ import { networkModel } from '../../store';
|
|||
|
||||
import { UsersTable } from '.';
|
||||
import { mockUsersData } from './mock';
|
||||
import { FlowTarget } from '../../../../common/search_strategy';
|
||||
|
||||
describe('Users Table Component', () => {
|
||||
const loadPage = jest.fn();
|
||||
const state: State = mockGlobalState;
|
||||
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
let store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
const mount = useMountAppended();
|
||||
|
||||
beforeEach(() => {
|
||||
store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
});
|
||||
|
||||
describe('Rendering', () => {
|
||||
|
@ -78,26 +64,20 @@ describe('Users Table Component', () => {
|
|||
describe('Sorting on Table', () => {
|
||||
test('when you click on the column header, you should show the sorting icon', () => {
|
||||
const wrapper = mount(
|
||||
<MockedProvider>
|
||||
<TestProviders store={store}>
|
||||
<UsersTable
|
||||
data={mockUsersData.edges}
|
||||
flowTarget={FlowTarget.source}
|
||||
fakeTotalCount={getOr(50, 'fakeTotalCount', mockUsersData.pageInfo)}
|
||||
id="user"
|
||||
isInspect={false}
|
||||
loading={false}
|
||||
loadPage={loadPage}
|
||||
showMorePagesIndicator={getOr(
|
||||
false,
|
||||
'showMorePagesIndicator',
|
||||
mockUsersData.pageInfo
|
||||
)}
|
||||
totalCount={1}
|
||||
type={networkModel.NetworkType.details}
|
||||
/>
|
||||
</TestProviders>
|
||||
</MockedProvider>
|
||||
<TestProviders store={store}>
|
||||
<UsersTable
|
||||
data={mockUsersData.edges}
|
||||
flowTarget={FlowTarget.source}
|
||||
fakeTotalCount={getOr(50, 'fakeTotalCount', mockUsersData.pageInfo)}
|
||||
id="user"
|
||||
isInspect={false}
|
||||
loading={false}
|
||||
loadPage={loadPage}
|
||||
showMorePagesIndicator={getOr(false, 'showMorePagesIndicator', mockUsersData.pageInfo)}
|
||||
totalCount={1}
|
||||
type={networkModel.NetworkType.details}
|
||||
/>
|
||||
</TestProviders>
|
||||
);
|
||||
expect(store.getState().network.details.queries!.users.sort).toEqual({
|
||||
direction: 'asc',
|
||||
|
|
|
@ -15,7 +15,6 @@ import { inputsModel } from '../../../common/store';
|
|||
import { useDeepEqualSelector } from '../../../common/hooks/use_selector';
|
||||
import { useKibana } from '../../../common/lib/kibana';
|
||||
import { createFilter } from '../../../common/containers/helpers';
|
||||
import { PageInfoPaginated, FlowTargetSourceDest } from '../../../graphql/types';
|
||||
import { generateTablePaginationOptions } from '../../../common/components/paginated_table/helpers';
|
||||
import { networkModel, networkSelectors } from '../../store';
|
||||
import {
|
||||
|
@ -27,6 +26,7 @@ import { isCompleteResponse, isErrorResponse } from '../../../../../../../src/pl
|
|||
|
||||
import * as i18n from './translations';
|
||||
import { getInspectResponse } from '../../../helpers';
|
||||
import { FlowTargetSourceDest, PageInfoPaginated } from '../../../../common/search_strategy';
|
||||
|
||||
const ID = 'networkTlsQuery';
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ import { DEFAULT_INDEX_KEY } from '../../../../common/constants';
|
|||
import { inputsModel } from '../../../common/store';
|
||||
import { useKibana } from '../../../common/lib/kibana';
|
||||
import { createFilter } from '../../../common/containers/helpers';
|
||||
import { PageInfoPaginated } from '../../../graphql/types';
|
||||
import { generateTablePaginationOptions } from '../../../common/components/paginated_table/helpers';
|
||||
import { networkSelectors } from '../../store';
|
||||
import {
|
||||
|
@ -29,6 +28,7 @@ import { isCompleteResponse, isErrorResponse } from '../../../../../../../src/pl
|
|||
import * as i18n from './translations';
|
||||
import { getInspectResponse } from '../../../helpers';
|
||||
import { InspectResponse } from '../../../types';
|
||||
import { PageInfoPaginated } from '../../../../common/search_strategy';
|
||||
|
||||
const ID = 'networkUsersQuery';
|
||||
|
||||
|
|
|
@ -11,9 +11,7 @@ import { Router, useParams } from 'react-router-dom';
|
|||
import '../../../common/mock/match_media';
|
||||
|
||||
import { useSourcererScope } from '../../../common/containers/sourcerer';
|
||||
import { FlowTarget } from '../../../graphql/types';
|
||||
import {
|
||||
apolloClientObservable,
|
||||
mockGlobalState,
|
||||
TestProviders,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
|
@ -23,6 +21,7 @@ import {
|
|||
import { useMountAppended } from '../../../common/utils/use_mount_appended';
|
||||
import { createStore, State } from '../../../common/store';
|
||||
import { NetworkDetails } from './index';
|
||||
import { FlowTarget } from '../../../../common/search_strategy';
|
||||
|
||||
jest.mock('@elastic/eui', () => {
|
||||
const original = jest.requireActual('@elastic/eui');
|
||||
|
@ -109,22 +108,10 @@ describe('Network Details', () => {
|
|||
|
||||
const state: State = mockGlobalState;
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
let store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
|
||||
beforeEach(() => {
|
||||
store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
});
|
||||
|
||||
test('it renders', () => {
|
||||
|
|
|
@ -11,7 +11,11 @@ import { useDispatch } from 'react-redux';
|
|||
import { useParams } from 'react-router-dom';
|
||||
|
||||
import { useDeepEqualSelector } from '../../../common/hooks/use_selector';
|
||||
import { FlowTarget, LastEventIndexKey } from '../../../../common/search_strategy';
|
||||
import {
|
||||
FlowTarget,
|
||||
FlowTargetSourceDest,
|
||||
LastEventIndexKey,
|
||||
} from '../../../../common/search_strategy';
|
||||
import { useGlobalTime } from '../../../common/containers/use_global_time';
|
||||
import { FiltersGlobal } from '../../../common/components/filters_global';
|
||||
import { HeaderPage } from '../../../common/components/header_page';
|
||||
|
@ -26,7 +30,6 @@ import { IpOverview } from '../../components/details';
|
|||
import { SiemSearchBar } from '../../../common/components/search_bar';
|
||||
import { WrapperPage } from '../../../common/components/wrapper_page';
|
||||
import { useNetworkDetails } from '../../containers/details';
|
||||
import { FlowTargetSourceDest } from '../../../graphql/types';
|
||||
import { useKibana } from '../../../common/lib/kibana';
|
||||
import { decodeIpv6 } from '../../../common/lib/helpers';
|
||||
import { convertToBuildEsQuery } from '../../../common/lib/keury';
|
||||
|
|
|
@ -10,13 +10,13 @@ import { Route, Switch, RouteComponentProps, useHistory } from 'react-router-dom
|
|||
|
||||
import { useMlCapabilities } from '../../common/components/ml/hooks/use_ml_capabilities';
|
||||
import { hasMlUserPermissions } from '../../../common/machine_learning/has_ml_user_permissions';
|
||||
import { FlowTarget } from '../../graphql/types';
|
||||
|
||||
import { NetworkDetails } from './details';
|
||||
import { Network } from './network';
|
||||
import { getNetworkRoutePath } from './navigation';
|
||||
import { NetworkRouteType } from './navigation/types';
|
||||
import { MlNetworkConditionalContainer } from '../../common/components/ml/conditional_links/ml_network_conditional_container';
|
||||
import { FlowTarget } from '../../../common/search_strategy';
|
||||
|
||||
type Props = Partial<RouteComponentProps<{}>> & { url: string };
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ import { useSourcererScope } from '../../common/containers/sourcerer';
|
|||
import {
|
||||
TestProviders,
|
||||
mockGlobalState,
|
||||
apolloClientObservable,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
kibanaObservable,
|
||||
createSecuritySolutionStorageMock,
|
||||
|
@ -146,13 +145,7 @@ describe('Network page - rendering', () => {
|
|||
});
|
||||
const myState: State = mockGlobalState;
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
const myStore = createStore(
|
||||
myState,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
const myStore = createStore(myState, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
const wrapper = mount(
|
||||
<TestProviders store={myStore}>
|
||||
<Router history={mockHistory}>
|
||||
|
|
|
@ -11,7 +11,6 @@ import React from 'react';
|
|||
|
||||
import '../../../common/mock/match_media';
|
||||
import {
|
||||
apolloClientObservable,
|
||||
mockGlobalState,
|
||||
TestProviders,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
|
@ -63,23 +62,11 @@ describe('OverviewHost', () => {
|
|||
const state: State = mockGlobalState;
|
||||
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
let store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
|
||||
beforeEach(() => {
|
||||
const myState = cloneDeep(state);
|
||||
store = createStore(
|
||||
myState,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
store = createStore(myState, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
});
|
||||
|
||||
test('it renders the expected widget title', () => {
|
||||
|
|
|
@ -11,7 +11,6 @@ import React from 'react';
|
|||
|
||||
import '../../../common/mock/match_media';
|
||||
import {
|
||||
apolloClientObservable,
|
||||
mockGlobalState,
|
||||
TestProviders,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
|
@ -73,23 +72,11 @@ describe('OverviewNetwork', () => {
|
|||
const state: State = mockGlobalState;
|
||||
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
let store = createStore(
|
||||
state,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
|
||||
beforeEach(() => {
|
||||
const myState = cloneDeep(state);
|
||||
store = createStore(
|
||||
myState,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
store = createStore(myState, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
});
|
||||
|
||||
test('it renders the expected widget title', () => {
|
||||
|
|
|
@ -5,14 +5,12 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import ApolloClient from 'apollo-client';
|
||||
import { EuiHorizontalRule, EuiText } from '@elastic/eui';
|
||||
import React, { useCallback, useMemo, useEffect } from 'react';
|
||||
import { useDispatch } from 'react-redux';
|
||||
|
||||
import { TimelineType } from '../../../../common/types/timeline';
|
||||
import { SortFieldTimeline, TimelineType } from '../../../../common/types/timeline';
|
||||
import { useGetAllTimeline } from '../../../timelines/containers/all';
|
||||
import { SortFieldTimeline, Direction } from '../../../graphql/types';
|
||||
import {
|
||||
queryTimelineById,
|
||||
dispatchUpdateTimeline,
|
||||
|
@ -30,15 +28,15 @@ import { SecurityPageName } from '../../../app/types';
|
|||
import { APP_ID } from '../../../../common/constants';
|
||||
import { useFormatUrl } from '../../../common/components/link_to';
|
||||
import { LinkAnchor } from '../../../common/components/links';
|
||||
import { Direction } from '../../../../common/search_strategy';
|
||||
|
||||
interface Props {
|
||||
apolloClient: ApolloClient<{}>;
|
||||
filterBy: FilterMode;
|
||||
}
|
||||
|
||||
const PAGE_SIZE = 3;
|
||||
|
||||
const StatefulRecentTimelinesComponent: React.FC<Props> = ({ apolloClient, filterBy }) => {
|
||||
const StatefulRecentTimelinesComponent: React.FC<Props> = ({ filterBy }) => {
|
||||
const dispatch = useDispatch();
|
||||
const updateIsLoading = useCallback((payload) => dispatch(dispatchUpdateIsLoading(payload)), [
|
||||
dispatch,
|
||||
|
@ -50,14 +48,13 @@ const StatefulRecentTimelinesComponent: React.FC<Props> = ({ apolloClient, filte
|
|||
const onOpenTimeline: OnOpenTimeline = useCallback(
|
||||
({ duplicate, timelineId }) => {
|
||||
queryTimelineById({
|
||||
apolloClient,
|
||||
duplicate,
|
||||
timelineId,
|
||||
updateIsLoading,
|
||||
updateTimeline,
|
||||
});
|
||||
},
|
||||
[apolloClient, updateIsLoading, updateTimeline]
|
||||
[updateIsLoading, updateTimeline]
|
||||
);
|
||||
|
||||
const goToTimelines = useCallback(
|
||||
|
|
|
@ -20,7 +20,6 @@ import { FilterMode as RecentCasesFilterMode } from '../recent_cases/types';
|
|||
import { DEFAULT_FILTER_OPTIONS } from '../../../cases/containers/use_get_cases';
|
||||
import { SidebarHeader } from '../../../common/components/sidebar_header';
|
||||
import { useCurrentUser } from '../../../common/lib/kibana';
|
||||
import { useApolloClient } from '../../../common/utils/apollo_context';
|
||||
|
||||
import * as i18n from '../../pages/translations';
|
||||
|
||||
|
@ -50,7 +49,6 @@ export const Sidebar = React.memo<{
|
|||
setRecentTimelinesFilterBy,
|
||||
}) => {
|
||||
const currentUser = useCurrentUser();
|
||||
const apolloClient = useApolloClient();
|
||||
const recentCasesFilters = useMemo(
|
||||
() => (
|
||||
<RecentCasesFilters
|
||||
|
@ -98,10 +96,7 @@ export const Sidebar = React.memo<{
|
|||
|
||||
<EuiFlexItem grow={false}>
|
||||
<SidebarHeader title={i18n.RECENT_TIMELINES}>{recentTimelinesFilters}</SidebarHeader>
|
||||
<StatefulRecentTimelines
|
||||
apolloClient={apolloClient!}
|
||||
filterBy={recentTimelinesFilterBy}
|
||||
/>
|
||||
<StatefulRecentTimelines filterBy={recentTimelinesFilterBy} />
|
||||
</EuiFlexItem>
|
||||
|
||||
<Spacer />
|
||||
|
|
|
@ -177,10 +177,9 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S
|
|||
mount: async (params: AppMountParameters) => {
|
||||
const [coreStart, startPlugins] = await core.getStartServices();
|
||||
const { overview: subPlugin } = await this.subPlugins();
|
||||
const { renderApp, composeLibs } = await this.lazyApplicationDependencies();
|
||||
const { renderApp } = await this.lazyApplicationDependencies();
|
||||
|
||||
return renderApp({
|
||||
...composeLibs(coreStart),
|
||||
...params,
|
||||
services: await startServices,
|
||||
store: await this.store(coreStart, startPlugins),
|
||||
|
@ -200,10 +199,9 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S
|
|||
mount: async (params: AppMountParameters) => {
|
||||
const [coreStart, startPlugins] = await core.getStartServices();
|
||||
const { detections: subPlugin } = await this.subPlugins();
|
||||
const { renderApp, composeLibs } = await this.lazyApplicationDependencies();
|
||||
const { renderApp } = await this.lazyApplicationDependencies();
|
||||
|
||||
return renderApp({
|
||||
...composeLibs(coreStart),
|
||||
...params,
|
||||
services: await startServices,
|
||||
store: await this.store(coreStart, startPlugins),
|
||||
|
@ -223,9 +221,8 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S
|
|||
mount: async (params: AppMountParameters) => {
|
||||
const [coreStart, startPlugins] = await core.getStartServices();
|
||||
const { hosts: subPlugin } = await this.subPlugins();
|
||||
const { renderApp, composeLibs } = await this.lazyApplicationDependencies();
|
||||
const { renderApp } = await this.lazyApplicationDependencies();
|
||||
return renderApp({
|
||||
...composeLibs(coreStart),
|
||||
...params,
|
||||
services: await startServices,
|
||||
store: await this.store(coreStart, startPlugins),
|
||||
|
@ -245,9 +242,8 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S
|
|||
mount: async (params: AppMountParameters) => {
|
||||
const [coreStart, startPlugins] = await core.getStartServices();
|
||||
const { network: subPlugin } = await this.subPlugins();
|
||||
const { renderApp, composeLibs } = await this.lazyApplicationDependencies();
|
||||
const { renderApp } = await this.lazyApplicationDependencies();
|
||||
return renderApp({
|
||||
...composeLibs(coreStart),
|
||||
...params,
|
||||
services: await startServices,
|
||||
store: await this.store(coreStart, startPlugins),
|
||||
|
@ -267,9 +263,8 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S
|
|||
mount: async (params: AppMountParameters) => {
|
||||
const [coreStart, startPlugins] = await core.getStartServices();
|
||||
const { timelines: subPlugin } = await this.subPlugins();
|
||||
const { renderApp, composeLibs } = await this.lazyApplicationDependencies();
|
||||
const { renderApp } = await this.lazyApplicationDependencies();
|
||||
return renderApp({
|
||||
...composeLibs(coreStart),
|
||||
...params,
|
||||
services: await startServices,
|
||||
store: await this.store(coreStart, startPlugins),
|
||||
|
@ -289,9 +284,8 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S
|
|||
mount: async (params: AppMountParameters) => {
|
||||
const [coreStart, startPlugins] = await core.getStartServices();
|
||||
const { cases: subPlugin } = await this.subPlugins();
|
||||
const { renderApp, composeLibs } = await this.lazyApplicationDependencies();
|
||||
const { renderApp } = await this.lazyApplicationDependencies();
|
||||
return renderApp({
|
||||
...composeLibs(coreStart),
|
||||
...params,
|
||||
services: await startServices,
|
||||
store: await this.store(coreStart, startPlugins),
|
||||
|
@ -311,9 +305,8 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S
|
|||
mount: async (params: AppMountParameters) => {
|
||||
const [coreStart, startPlugins] = await core.getStartServices();
|
||||
const { management: managementSubPlugin } = await this.subPlugins();
|
||||
const { renderApp, composeLibs } = await this.lazyApplicationDependencies();
|
||||
const { renderApp } = await this.lazyApplicationDependencies();
|
||||
return renderApp({
|
||||
...composeLibs(coreStart),
|
||||
...params,
|
||||
services: await startServices,
|
||||
store: await this.store(coreStart, startPlugins),
|
||||
|
@ -458,7 +451,7 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S
|
|||
if (!this._store) {
|
||||
const defaultIndicesName = coreStart.uiSettings.get(DEFAULT_INDEX_KEY);
|
||||
const [
|
||||
{ composeLibs, createStore, createInitialState },
|
||||
{ createStore, createInitialState },
|
||||
kibanaIndexPatterns,
|
||||
{
|
||||
detections: detectionsSubPlugin,
|
||||
|
@ -491,8 +484,7 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S
|
|||
signal = { name: null };
|
||||
}
|
||||
|
||||
const { apolloClient } = composeLibs(coreStart);
|
||||
const appLibs: AppObservableLibs = { apolloClient, kibana: coreStart };
|
||||
const appLibs: AppObservableLibs = { kibana: coreStart };
|
||||
const libs$ = new BehaviorSubject(appLibs);
|
||||
|
||||
const detectionsStart = detectionsSubPlugin.start(this.storage);
|
||||
|
@ -534,7 +526,6 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S
|
|||
...timelinesStart.store.reducer,
|
||||
...managementSubPluginStart.store.reducer,
|
||||
},
|
||||
libs$.pipe(pluck('apolloClient')),
|
||||
libs$.pipe(pluck('kibana')),
|
||||
this.storage,
|
||||
[...(managementSubPluginStart.store.middleware ?? [])]
|
||||
|
|
|
@ -11,7 +11,6 @@ import React from 'react';
|
|||
import '../../../common/mock/react_beautiful_dnd';
|
||||
|
||||
import {
|
||||
apolloClientObservable,
|
||||
mockGlobalState,
|
||||
TestProviders,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
|
@ -78,7 +77,6 @@ describe('Flyout', () => {
|
|||
const storeShowIsTrue = createStore(
|
||||
stateShowIsTrue,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
apolloClientObservable,
|
||||
kibanaObservable,
|
||||
storage
|
||||
);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue