Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
patrykkopycinski committed Aug 31, 2020
1 parent 04da5a0 commit b2101f5
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,91 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { IEsSearchResponse } from '../../../../../../../src/plugins/data/common';

import { CursorType, Inspect, Maybe, PageInfoPaginated, RequestOptionsPaginated } from '..';
export * from './tls';

export enum NetworkQueries {
tls = 'tls',
}

export interface TlsBuckets {
key: string;
timestamp?: {
value: number;
value_as_string: string;
};

subjects: {
buckets: Readonly<Array<{ key: string; doc_count: number }>>;
};

ja3: {
buckets: Readonly<Array<{ key: string; doc_count: number }>>;
};

issuers: {
buckets: Readonly<Array<{ key: string; doc_count: number }>>;
};

not_after: {
buckets: Readonly<Array<{ key: number; key_as_string: string; doc_count: number }>>;
};
}

export interface TlsNode {
_id?: Maybe<string>;

timestamp?: Maybe<string>;

notAfter?: Maybe<string[]>;

subjects?: Maybe<string[]>;

ja3?: Maybe<string[]>;

issuers?: Maybe<string[]>;
}

export enum FlowTargetSourceDest {
destination = 'destination',
source = 'source',
}

export enum TlsFields {
_id = '_id',
}

export interface TlsEdges {
node: TlsNode;

cursor: CursorType;
}

export enum Direction {
asc = 'asc',
desc = 'desc',
}

export interface TlsSortField {
field: TlsFields;

direction: Direction;
}

export interface NetworkTlsRequestOptions extends RequestOptionsPaginated {
ip: string;
flowTarget: FlowTargetSourceDest;
sort: TlsSortField;
defaultIndex: string[];
}

export interface NetworkTlsStrategyResponse extends IEsSearchResponse {
edges: TlsEdges[];

totalCount: number;

pageInfo: PageInfoPaginated;

inspect?: Maybe<Inspect>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { IEsSearchResponse } from '../../../../../../../src/plugins/data/common';
import { CursorType, Inspect, Maybe, PageInfoPaginated, RequestOptionsPaginated } from '..';

export interface TlsBuckets {
key: string;
timestamp?: {
value: number;
value_as_string: string;
};
subjects: {
buckets: Readonly<Array<{ key: string; doc_count: number }>>;
};
ja3: {
buckets: Readonly<Array<{ key: string; doc_count: number }>>;
};
issuers: {
buckets: Readonly<Array<{ key: string; doc_count: number }>>;
};
not_after: {
buckets: Readonly<Array<{ key: number; key_as_string: string; doc_count: number }>>;
};
}

export interface TlsNode {
_id?: Maybe<string>;
timestamp?: Maybe<string>;
notAfter?: Maybe<string[]>;
subjects?: Maybe<string[]>;
ja3?: Maybe<string[]>;
issuers?: Maybe<string[]>;
}

export enum FlowTargetSourceDest {
destination = 'destination',
source = 'source',
}

export enum TlsFields {
_id = '_id',
}

export interface TlsEdges {
node: TlsNode;
cursor: CursorType;
}

export enum Direction {
asc = 'asc',
desc = 'desc',
}

export interface TlsSortField {
field: TlsFields;
direction: Direction;
}

export interface NetworkTlsRequestOptions extends RequestOptionsPaginated {
ip: string;
flowTarget: FlowTargetSourceDest;
sort: TlsSortField;
defaultIndex: string[];
}

export interface NetworkTlsStrategyResponse extends IEsSearchResponse {
edges: TlsEdges[];
totalCount: number;
pageInfo: PageInfoPaginated;
inspect?: Maybe<Inspect>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ export const useNetworkTls = ({
startDate,
type,
}: UseNetworkTls): [boolean, NetworkTlsArgs] => {
// const getQuery = inputsSelectors.globalQueryByIdSelector();
// const { isInspected } = useSelector((state: State) => getQuery(state, id), shallowEqual);
const getTlsSelector = networkSelectors.tlsSelector();
const { activePage, limit, sort } = useSelector(
(state: State) => getTlsSelector(state, type, flowTarget),
Expand All @@ -77,7 +75,6 @@ export const useNetworkTls = ({
factoryQueryType: NetworkQueries.tls,
filterQuery: createFilter(filterQuery),
flowTarget,
// inspect: isInspected,
ip,
pagination: generateTablePaginationOptions(activePage, limit),
sort,
Expand All @@ -90,12 +87,10 @@ export const useNetworkTls = ({

const wrappedLoadMore = useCallback(
(newActivePage: number) => {
setHostRequest((prevRequest) => {
return {
...prevRequest,
pagination: generateTablePaginationOptions(newActivePage, limit),
};
});
setHostRequest((prevRequest) => ({
...prevRequest,
pagination: generateTablePaginationOptions(newActivePage, limit),
}));
},
[limit]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { TlsQueryTabBodyProps } from './types';

const TlsTableManage = manageQuery(TlsTable);

export const TlsQueryTabBody = ({
const TlsQueryTabBodyComponent: React.FC<TlsQueryTabBodyProps> = ({
endDate,
filterQuery,
flowTarget,
Expand All @@ -21,7 +21,7 @@ export const TlsQueryTabBody = ({
skip,
startDate,
type,
}: TlsQueryTabBodyProps) => {
}) => {
const [
loading,
{ id, inspect, isInspected, tls, totalCount, pageInfo, loadPage, refetch },
Expand Down Expand Up @@ -52,3 +52,7 @@ export const TlsQueryTabBody = ({
/>
);
};

TlsQueryTabBodyComponent.displayName = 'TlsQueryTabBodyComponent';

export const TlsQueryTabBody = React.memo(TlsQueryTabBodyComponent);

0 comments on commit b2101f5

Please sign in to comment.