From abf69d48f207ed89c88a45d86fe722da2f15e434 Mon Sep 17 00:00:00 2001 From: Brent Kimmel Date: Tue, 23 Jun 2020 16:13:34 -0400 Subject: [PATCH] Draft: Separate limit information --- .../security_solution/public/resolver/store/data/action.ts | 6 +++--- .../security_solution/public/resolver/store/data/reducer.ts | 3 ++- .../security_solution/public/resolver/store/middleware.ts | 5 +++-- x-pack/plugins/security_solution/public/resolver/types.ts | 3 ++- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/security_solution/public/resolver/store/data/action.ts b/x-pack/plugins/security_solution/public/resolver/store/data/action.ts index 37b2a30ebeac7..3de6f08f5e015 100644 --- a/x-pack/plugins/security_solution/public/resolver/store/data/action.ts +++ b/x-pack/plugins/security_solution/public/resolver/store/data/action.ts @@ -13,9 +13,9 @@ import { interface ServerReturnedResolverData { readonly type: 'serverReturnedResolverData'; readonly payload: { - readonly events: ResolverEvent[]; - readonly stats: Map; - readonly limitReached: boolean; + readonly events: Readonly; + readonly stats: Readonly>; + readonly lineageLimits: { readonly children: string | null; readonly ancestors: string | null }; }; } diff --git a/x-pack/plugins/security_solution/public/resolver/store/data/reducer.ts b/x-pack/plugins/security_solution/public/resolver/store/data/reducer.ts index b13654acc4d2a..a36d43b70b87d 100644 --- a/x-pack/plugins/security_solution/public/resolver/store/data/reducer.ts +++ b/x-pack/plugins/security_solution/public/resolver/store/data/reducer.ts @@ -13,6 +13,7 @@ function initialState(): DataState { relatedEventsStats: new Map(), relatedEvents: new Map(), relatedEventsReady: new Map(), + lineageLimits: { children: null, ancestors: null }, isLoading: false, hasError: false, }; @@ -24,7 +25,7 @@ export const dataReducer: Reducer = (state = initialS ...state, results: action.payload.events, relatedEventsStats: action.payload.stats, - limitReached: action.payload.limitReached, + lineageLimits: action.payload.lineageLimits, isLoading: false, hasError: false, }; diff --git a/x-pack/plugins/security_solution/public/resolver/store/middleware.ts b/x-pack/plugins/security_solution/public/resolver/store/middleware.ts index e97e79bf1b740..a352a076e5a97 100644 --- a/x-pack/plugins/security_solution/public/resolver/store/middleware.ts +++ b/x-pack/plugins/security_solution/public/resolver/store/middleware.ts @@ -77,7 +77,8 @@ export const resolverMiddlewareFactory: MiddlewareFactory = (context) => { } const nodeStats: Map = new Map(); nodeStats.set(entityId, stats); - const limitReached = children.nextChild !== null || ancestry.nextAncestor !== null; + const lineageLimits = { children: children.nextChild, ancestors: ancestry.nextAncestor }; + const events = [ ...lifecycle, ...getLifecycleEventsAndStats(children.childNodes, nodeStats), @@ -88,7 +89,7 @@ export const resolverMiddlewareFactory: MiddlewareFactory = (context) => { payload: { events, stats: nodeStats, - limitReached, + lineageLimits, }, }); } catch (error) { diff --git a/x-pack/plugins/security_solution/public/resolver/types.ts b/x-pack/plugins/security_solution/public/resolver/types.ts index a48f3b59b0f6d..f0e401dd2e893 100644 --- a/x-pack/plugins/security_solution/public/resolver/types.ts +++ b/x-pack/plugins/security_solution/public/resolver/types.ts @@ -147,9 +147,10 @@ export type CameraState = { */ export interface DataState { readonly results: readonly ResolverEvent[]; - readonly relatedEventsStats: Map; + readonly relatedEventsStats: Readonly>; readonly relatedEvents: Map; readonly relatedEventsReady: Map; + readonly lineageLimits: Readonly<{ children: string | null; ancestors: string | null }>; isLoading: boolean; hasError: boolean; }