-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SIEM] Fix anomaly table #5
Changes from all commits
9bbebed
ecfe07a
18179d5
728e938
1d0f417
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,9 +22,7 @@ const HostDetailsBodyComponent = React.memo<HostDetailsBodyComponentProps>( | |
filterQueryExpression, | ||
from, | ||
isInitializing, | ||
match: { | ||
params: { detailName, tabName }, | ||
}, | ||
detailName, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: In these cases we have to remove |
||
setAbsoluteRangeDatePicker, | ||
setQuery, | ||
to, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,6 @@ import { StickyContainer } from 'react-sticky'; | |
import { FiltersGlobal } from '../../../components/filters_global'; | ||
import { HeaderPage } from '../../../components/header_page'; | ||
import { LastEventTime } from '../../../components/last_event_time'; | ||
import { HostComponentProps } from '../../../components/link_to/redirect_to_hosts'; | ||
|
||
import { HostOverviewByNameQuery } from '../../../containers/hosts/overview'; | ||
import { indicesExistOrDataTemporarilyUnavailable, WithSource } from '../../../containers/source'; | ||
|
@@ -47,9 +46,7 @@ const HostDetailsComponent = React.memo<HostDetailsComponentProps>( | |
isInitializing, | ||
filterQueryExpression, | ||
from, | ||
match: { | ||
params: { detailName, tabName }, | ||
}, | ||
detailName, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: In these cases we have to remove |
||
setQuery, | ||
setAbsoluteRangeDatePicker, | ||
to, | ||
|
@@ -168,7 +165,7 @@ const HostDetailsComponent = React.memo<HostDetailsComponentProps>( | |
|
||
HostDetailsComponent.displayName = 'HostDetailsComponent'; | ||
|
||
export const HostDetails = compose<React.ComponentClass<HostsQueryProps & HostComponentProps>>( | ||
export const HostDetails = compose<React.ComponentClass<HostsQueryProps & { detailName: string }>>( | ||
connect( | ||
makeMapStateToProps, | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,7 @@ | |
*/ | ||
|
||
import React from 'react'; | ||
import { Redirect, Route, Switch } from 'react-router-dom'; | ||
import { pure } from 'recompose'; | ||
|
||
import { HostComponentProps } from '../../components/link_to/redirect_to_hosts'; | ||
import { Redirect, Route, Switch, RouteComponentProps } from 'react-router-dom'; | ||
|
||
import { HostDetailsBody, HostDetails } from './details'; | ||
import { | ||
|
@@ -40,15 +37,17 @@ const getHostDetailsTabPath = (pagePath: string) => | |
`${HostsTableType.anomalies}|` + | ||
`${HostsTableType.events})`; | ||
|
||
export const HostsContainer = pure<HostComponentProps>(({ match }) => ( | ||
type Props = Partial<RouteComponentProps<{}>> & { url: string }; | ||
|
||
export const HostsContainer = React.memo<Props>(({ url }) => ( | ||
<GlobalTime> | ||
{({ to, from, setQuery, isInitializing }) => ( | ||
<Switch> | ||
<Route | ||
strict | ||
exact | ||
path={hostsPagePath} | ||
render={props => ( | ||
render={() => ( | ||
<Route | ||
path={hostsPagePath} | ||
render={() => ( | ||
|
@@ -59,7 +58,6 @@ export const HostsContainer = pure<HostComponentProps>(({ match }) => ( | |
to={to} | ||
setQuery={setQuery} | ||
isInitializing={isInitializing} | ||
{...props} | ||
children={HostsQueryTabBody} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: I removed props spreading as that was causing additional properties such as a Props spreading is interesting in that TypeScript does not alert us to the additional un-needed attributes being pushed down. Any extra values being pushed down can cause additional rendering such as in our case where |
||
/> | ||
</> | ||
|
@@ -71,7 +69,7 @@ export const HostsContainer = pure<HostComponentProps>(({ match }) => ( | |
strict | ||
exact | ||
path={getHostsTabPath(hostsPagePath)} | ||
render={props => ( | ||
render={() => ( | ||
<> | ||
<Hosts from={from} to={to} setQuery={setQuery} isInitializing={isInitializing} /> | ||
<Route | ||
|
@@ -82,7 +80,6 @@ export const HostsContainer = pure<HostComponentProps>(({ match }) => ( | |
to={to} | ||
setQuery={setQuery} | ||
isInitializing={isInitializing} | ||
{...props} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: I removed props spreading as that was causing additional properties such as a Props spreading is interesting in that TypeScript does not alert us to the additional un-needed attributes being pushed down. Any extra values being pushed down can cause additional rendering such as in our case where |
||
children={HostsQueryTabBody} | ||
/> | ||
)} | ||
|
@@ -95,7 +92,6 @@ export const HostsContainer = pure<HostComponentProps>(({ match }) => ( | |
to={to} | ||
setQuery={setQuery} | ||
isInitializing={isInitializing} | ||
{...props} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: I removed props spreading as that was causing additional properties such as a Props spreading is interesting in that TypeScript does not alert us to the additional un-needed attributes being pushed down. Any extra values being pushed down can cause additional rendering such as in our case where |
||
children={AuthenticationsQueryTabBody} | ||
/> | ||
)} | ||
|
@@ -108,7 +104,6 @@ export const HostsContainer = pure<HostComponentProps>(({ match }) => ( | |
to={to} | ||
setQuery={setQuery} | ||
isInitializing={isInitializing} | ||
{...props} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: I removed props spreading as that was causing additional properties such as a Props spreading is interesting in that TypeScript does not alert us to the additional un-needed attributes being pushed down. Any extra values being pushed down can cause additional rendering such as in our case where |
||
children={UncommonProcessTabBody} | ||
/> | ||
)} | ||
|
@@ -121,7 +116,6 @@ export const HostsContainer = pure<HostComponentProps>(({ match }) => ( | |
to={to} | ||
setQuery={setQuery} | ||
isInitializing={isInitializing} | ||
{...props} | ||
children={AnomaliesTabBody} | ||
/> | ||
)} | ||
|
@@ -134,7 +128,6 @@ export const HostsContainer = pure<HostComponentProps>(({ match }) => ( | |
to={to} | ||
setQuery={setQuery} | ||
isInitializing={isInitializing} | ||
{...props} | ||
children={EventsTabBody} | ||
/> | ||
)} | ||
|
@@ -153,7 +146,7 @@ export const HostsContainer = pure<HostComponentProps>(({ match }) => ( | |
to={to} | ||
setQuery={setQuery} | ||
isInitializing={isInitializing} | ||
{...props} | ||
detailName={props.match.params.detailName} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: Changed out the props spreading which includes the |
||
/> | ||
<Route | ||
path={`${hostsPagePath}/:detailName/:tabName(${HostsTableType.hosts})`} | ||
|
@@ -163,8 +156,8 @@ export const HostsContainer = pure<HostComponentProps>(({ match }) => ( | |
to={to} | ||
setQuery={setQuery} | ||
isInitializing={isInitializing} | ||
{...props} | ||
children={HostsQueryTabBody} | ||
detailName={props.match.params.detailName} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: Changed out the props spreading which includes the |
||
/> | ||
)} | ||
/> | ||
|
@@ -176,7 +169,7 @@ export const HostsContainer = pure<HostComponentProps>(({ match }) => ( | |
to={to} | ||
setQuery={setQuery} | ||
isInitializing={isInitializing} | ||
{...props} | ||
detailName={props.match.params.detailName} | ||
children={AuthenticationsQueryTabBody} | ||
/> | ||
)} | ||
|
@@ -189,7 +182,7 @@ export const HostsContainer = pure<HostComponentProps>(({ match }) => ( | |
to={to} | ||
setQuery={setQuery} | ||
isInitializing={isInitializing} | ||
{...props} | ||
detailName={props.match.params.detailName} | ||
children={UncommonProcessTabBody} | ||
/> | ||
)} | ||
|
@@ -202,7 +195,7 @@ export const HostsContainer = pure<HostComponentProps>(({ match }) => ( | |
to={to} | ||
setQuery={setQuery} | ||
isInitializing={isInitializing} | ||
{...props} | ||
detailName={props.match.params.detailName} | ||
children={AnomaliesTabBody} | ||
/> | ||
)} | ||
|
@@ -215,7 +208,7 @@ export const HostsContainer = pure<HostComponentProps>(({ match }) => ( | |
to={to} | ||
setQuery={setQuery} | ||
isInitializing={isInitializing} | ||
{...props} | ||
detailName={props.match.params.detailName} | ||
children={EventsTabBody} | ||
/> | ||
)} | ||
|
@@ -224,8 +217,8 @@ export const HostsContainer = pure<HostComponentProps>(({ match }) => ( | |
)} | ||
/> | ||
<Redirect | ||
from={`${match.url}/:detailName`} | ||
to={`${match.url}/:detailName/${HostsTableType.authentications}`} | ||
from={`${url}/:detailName`} | ||
to={`${url}/:detailName/${HostsTableType.authentications}`} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replaced the |
||
/> | ||
<Redirect from="/hosts/" to={`/hosts/${HostsTableType.hosts}`} /> | ||
</Switch> | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,24 +5,28 @@ | |
*/ | ||
|
||
import React from 'react'; | ||
import { Redirect, Route, Switch } from 'react-router-dom'; | ||
|
||
import { pure } from 'recompose'; | ||
|
||
import { NetworkComponentProps } from '../../components/link_to/redirect_to_network'; | ||
import { Redirect, Route, Switch, RouteComponentProps } from 'react-router-dom'; | ||
|
||
import { IPDetails } from './ip_details'; | ||
import { Network } from './network'; | ||
|
||
const networkPath = `/:pageName(network)`; | ||
export const NetworkContainer = pure<NetworkComponentProps>(({ match }) => ( | ||
<> | ||
<Switch> | ||
<Route strict exact path={networkPath} render={props => <Network {...props} />} /> | ||
<Route path={`${networkPath}/ip/:detailName`} render={props => <IPDetails {...props} />} /> | ||
<Redirect from="/network/" to="/network" /> | ||
</Switch> | ||
</> | ||
|
||
type Props = Partial<RouteComponentProps<{}>> & { url: string }; | ||
|
||
export const NetworkContainer = React.memo<Props>(() => ( | ||
<Switch> | ||
<Route strict exact path={networkPath} render={() => <Network />} /> | ||
<Route | ||
path={`${networkPath}/ip/:detailName`} | ||
render={({ | ||
match: { | ||
params: { detailName }, | ||
}, | ||
}) => <IPDetails detailName={detailName} />} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: Removed the By removing the additional props spreading and just pushing down the string of |
||
/> | ||
<Redirect from="/network/" to="/network" /> | ||
</Switch> | ||
)); | ||
|
||
NetworkContainer.displayName = 'NetworkContainer'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: Both of these MUST be
render
in order to avoid passing down thematch
as it is a newly created object every single time Route decides to render (which can be a lot).Also even though the downstream React.memo component doesn't need
location
, adding thelocation
causes it to update correctly and re-render when we switch tabs (which is what we want)