Skip to content

Commit

Permalink
[Security Solution][Resolver] Show origin node details in panel on lo…
Browse files Browse the repository at this point in the history
…ad (elastic#73313)

* show origin node details in panel on load

* added comment

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
michaelolo24 and elasticmachine committed Jul 28, 2020
1 parent dd6bc18 commit 4cb99dd
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions x-pack/plugins/security_solution/public/resolver/view/map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

/* eslint-disable react/display-name */

import React, { useContext } from 'react';
import React, { useContext, useEffect } from 'react';
import { useSelector } from 'react-redux';
import { useEffectOnce } from 'react-use';
import { EuiLoadingSpinner } from '@elastic/eui';
Expand Down Expand Up @@ -68,11 +68,25 @@ export const ResolverMap = React.memo(function ({
const hasError = useSelector(selectors.hasError);
const activeDescendantId = useSelector(selectors.ariaActiveDescendant);
const { colorMap } = useResolverTheme();
const { cleanUpQueryParams } = useResolverQueryParams();
const {
cleanUpQueryParams,
queryParams: { crumbId },
pushToQueryParams,
} = useResolverQueryParams();

useEffectOnce(() => {
return () => cleanUpQueryParams();
});

useEffect(() => {
// When you refresh the page after selecting a process in the table view (not the timeline view)
// The old crumbId still exists in the query string even though a resolver is no longer visible
// This just makes sure the activeDescendant and crumbId are in sync on load for that view as well as the timeline
if (activeDescendantId && crumbId !== activeDescendantId) {
pushToQueryParams({ crumbId: activeDescendantId, crumbEvent: '' });
}
}, [crumbId, activeDescendantId, pushToQueryParams]);

return (
<StyledMapContainer className={className} backgroundColor={colorMap.resolverBackground}>
{isLoading ? (
Expand Down

0 comments on commit 4cb99dd

Please sign in to comment.