Skip to content

Commit

Permalink
[SIEM] Add TLS to Newtowrk overview page (#48062)
Browse files Browse the repository at this point in the history
* add TLS table to network overview page

* isolate TLS parser

* add unit test

* add integration test

* fix types

* revert not necessary change

* remove variables for domains table

* fix for review

* fix tlsSelector

* update tls selector

* apply updateTlsLimit

* update selected property for tls selector

* add networkType as the 2nd param of updateTlsSort

* correcting pagetype

* check the page type for updateTableActivePage

* hard coded the targeting table name

* remove tls table param as property

* fix types
  • Loading branch information
angorayc authored Oct 16, 2019
1 parent 76e1398 commit cb091e8
Show file tree
Hide file tree
Showing 40 changed files with 1,936 additions and 870 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { RedirectToNetworkPage } from './redirect_to_network';
import { RedirectToOverviewPage } from './redirect_to_overview';
import { RedirectToTimelinesPage } from './redirect_to_timelines';
import { HostsTableType } from '../../store/hosts/model';

interface LinkToPageProps {
match: RouteMatch<{}>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@ interface TlsTableReduxProps {
}

interface TlsTableDispatchProps {
updateTableActivePage: ActionCreator<{
updateIpDetailsTableActivePage: ActionCreator<{
activePage: number;
tableType: networkModel.IpDetailsTableType;
}>;
updateNetworkPageTableActivePage: ActionCreator<{
activePage: number;
tableType: networkModel.NetworkTableType;
}>;
updateTlsLimit: ActionCreator<{
limit: number;
networkType: networkModel.NetworkType;
Expand Down Expand Up @@ -80,9 +84,18 @@ class TlsTableComponent extends React.PureComponent<TlsTableProps> {
tlsSortField,
totalCount,
type,
updateTableActivePage,
updateIpDetailsTableActivePage,
updateNetworkPageTableActivePage,
updateTlsLimit,
} = this.props;

const updateTableActivePage: ActionCreator<{
activePage: number;
tableType: networkModel.NetworkTableType | networkModel.IpDetailsTableType;
}> =
type === networkModel.NetworkType.page
? updateNetworkPageTableActivePage
: updateIpDetailsTableActivePage;
return (
<PaginatedTable
activePage={activePage}
Expand Down Expand Up @@ -130,17 +143,14 @@ class TlsTableComponent extends React.PureComponent<TlsTableProps> {
};
}

const makeMapStateToProps = () => {
const getTlsSelector = networkSelectors.tlsSelector();
return (state: State) => ({
...getTlsSelector(state),
});
};
const makeMapStateToProps = (state: State, ownProps: OwnProps) =>
networkSelectors.tlsSelector(ownProps.type);

export const TlsTable = connect(
makeMapStateToProps,
{
updateTableActivePage: networkActions.updateIpDetailsTableActivePage,
updateNetworkPageTableActivePage: networkActions.updateNetworkPageTableActivePage,
updateIpDetailsTableActivePage: networkActions.updateIpDetailsTableActivePage,
updateTlsLimit: networkActions.updateTlsLimit,
updateTlsSort: networkActions.updateTlsSort,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const tlsQuery = gql`
query GetTlsQuery(
$sourceId: ID!
$filterQuery: String
$flowTarget: FlowTarget!
$flowTarget: FlowTargetSourceDest!
$ip: String!
$pagination: PaginationInputPaginated!
$sort: TlsSortField!
Expand Down
23 changes: 10 additions & 13 deletions x-pack/legacy/plugins/siem/public/containers/tls/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import { connect } from 'react-redux';
import chrome from 'ui/chrome';
import { DEFAULT_INDEX_KEY } from '../../../common/constants';
import {
FlowTarget,
PageInfoPaginated,
TlsEdges,
TlsSortField,
GetTlsQuery,
FlowTargetSourceDest,
} from '../../graphql/types';
import { inputsModel, networkModel, networkSelectors, State, inputsSelectors } from '../../store';
import { createFilter, getDefaultFetchPolicy } from '../helpers';
Expand All @@ -40,7 +40,7 @@ export interface TlsArgs {

export interface OwnProps extends QueryTemplatePaginatedProps {
children: (args: TlsArgs) => React.ReactNode;
flowTarget: FlowTarget;
flowTarget: FlowTargetSourceDest;
ip: string;
type: networkModel.NetworkType;
}
Expand Down Expand Up @@ -139,18 +139,15 @@ class TlsComponentQuery extends QueryTemplatePaginated<
}
}

const makeMapStateToProps = () => {
const getTlsSelector = networkSelectors.tlsSelector();
const mapStateToProps = (state: State, { id = ID, type }: OwnProps) => {
const getTlsSelector = networkSelectors.tlsSelector(type);
const getQuery = inputsSelectors.globalQueryByIdSelector();
const mapStateToProps = (state: State, { id = ID }: OwnProps) => {
const { isInspected } = getQuery(state, id);
return {
...getTlsSelector(state),
isInspected,
};
};
const { isInspected } = getQuery(state, id);

return mapStateToProps;
return {
...getTlsSelector(state),
isInspected,
};
};

export const TlsQuery = connect(makeMapStateToProps)(TlsComponentQuery);
export const TlsQuery = connect(mapStateToProps)(TlsComponentQuery);
Loading

0 comments on commit cb091e8

Please sign in to comment.