Skip to content

Commit

Permalink
Draft: Separate limit information
Browse files Browse the repository at this point in the history
  • Loading branch information
Brent Kimmel committed Jun 23, 2020
1 parent a46560e commit abf69d4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import {
interface ServerReturnedResolverData {
readonly type: 'serverReturnedResolverData';
readonly payload: {
readonly events: ResolverEvent[];
readonly stats: Map<string, ResolverNodeStats>;
readonly limitReached: boolean;
readonly events: Readonly<ResolverEvent[]>;
readonly stats: Readonly<Map<string, ResolverNodeStats>>;
readonly lineageLimits: { readonly children: string | null; readonly ancestors: string | null };
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand All @@ -24,7 +25,7 @@ export const dataReducer: Reducer<DataState, ResolverAction> = (state = initialS
...state,
results: action.payload.events,
relatedEventsStats: action.payload.stats,
limitReached: action.payload.limitReached,
lineageLimits: action.payload.lineageLimits,
isLoading: false,
hasError: false,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ export const resolverMiddlewareFactory: MiddlewareFactory = (context) => {
}
const nodeStats: Map<string, ResolverNodeStats> = 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),
Expand All @@ -88,7 +89,7 @@ export const resolverMiddlewareFactory: MiddlewareFactory = (context) => {
payload: {
events,
stats: nodeStats,
limitReached,
lineageLimits,
},
});
} catch (error) {
Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/security_solution/public/resolver/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,10 @@ export type CameraState = {
*/
export interface DataState {
readonly results: readonly ResolverEvent[];
readonly relatedEventsStats: Map<string, ResolverNodeStats>;
readonly relatedEventsStats: Readonly<Map<string, ResolverNodeStats>>;
readonly relatedEvents: Map<string, ResolverRelatedEvents>;
readonly relatedEventsReady: Map<string, boolean>;
readonly lineageLimits: Readonly<{ children: string | null; ancestors: string | null }>;
isLoading: boolean;
hasError: boolean;
}
Expand Down

0 comments on commit abf69d4

Please sign in to comment.