Skip to content

Commit 848c2f7

Browse files
authored
[SECURITY] Bugs css/inspect (#74711) (#74760)
* Fix inspection button when using topN * css left over
1 parent 2dd1b0f commit 848c2f7

File tree

5 files changed

+33
-7
lines changed

5 files changed

+33
-7
lines changed

x-pack/plugins/security_solution/public/cases/components/configure_cases/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ const FormWrapper = styled.div`
4242
4343
padding-top: ${theme.eui.paddingSizes.xl};
4444
padding-bottom: ${theme.eui.paddingSizes.xl};
45+
.euiFlyout {
46+
z-index: ${theme.eui.euiZNavigation + 1};
47+
}
4548
`}
4649
`;
4750

x-pack/plugins/security_solution/public/common/components/header_global/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,15 @@ const FlexItem = styled(EuiFlexItem)`
4141
`;
4242
FlexItem.displayName = 'FlexItem';
4343

44-
const FlexGroup = styled(EuiFlexGroup)<{ $globalFullScreen: boolean }>`
45-
${({ $globalFullScreen, theme }) => `
44+
const FlexGroup = styled(EuiFlexGroup)<{ $globalFullScreen: boolean; $hasSibling: boolean }>`
45+
${({ $globalFullScreen, $hasSibling, theme }) => `
4646
border-bottom: ${theme.eui.euiBorderThin};
4747
margin-bottom: 1px;
4848
padding-bottom: 4px;
4949
padding-left: ${theme.eui.paddingSizes.l};
5050
padding-right: ${gutterTimeline};
5151
${$globalFullScreen ? 'display: none;' : ''}
52+
${$hasSibling ? `border-bottom: ${theme.eui.euiBorderThin};` : 'border-bottom-width: 0px;'}
5253
`}
5354
`;
5455
FlexGroup.displayName = 'FlexGroup';
@@ -75,6 +76,7 @@ export const HeaderGlobal = React.memo<HeaderGlobalProps>(({ hideDetectionEngine
7576
<FlexGroup
7677
alignItems="center"
7778
$globalFullScreen={globalFullScreen}
79+
$hasSibling={globalHeaderPortalNode.hasChildNodes()}
7880
justifyContent="spaceBetween"
7981
wrap
8082
>

x-pack/plugins/security_solution/public/common/components/top_n/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const StatefulTopNComponent: React.FC<Props> = ({
104104
value,
105105
}) => {
106106
const kibana = useKibana();
107-
const { from, deleteQuery, setQuery, to } = useGlobalTime();
107+
const { from, deleteQuery, setQuery, to } = useGlobalTime(false);
108108

109109
const options = getOptions(
110110
timelineId === TimelineId.active ? activeTimelineEventType : undefined

x-pack/plugins/security_solution/public/common/containers/use_global_time/index.test.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,22 @@ import { act, renderHook } from '@testing-library/react-hooks';
88

99
import { useGlobalTime } from '.';
1010

11+
const mockDispatch = jest.fn();
12+
1113
jest.mock('react-redux', () => {
1214
const originalModule = jest.requireActual('react-redux');
1315

1416
return {
1517
...originalModule,
16-
useDispatch: jest.fn().mockReturnValue(jest.fn()),
18+
useDispatch: () => mockDispatch,
1719
useSelector: jest.fn().mockReturnValue({ from: 0, to: 0 }),
1820
};
1921
});
2022

2123
describe('useGlobalTime', () => {
24+
beforeEach(() => {
25+
mockDispatch.mockReset();
26+
});
2227
test('returns memoized value', () => {
2328
const { result, rerender } = renderHook(() => useGlobalTime());
2429

@@ -30,4 +35,18 @@ describe('useGlobalTime', () => {
3035
expect(result1.from).toBe(0);
3136
expect(result1.to).toBe(0);
3237
});
38+
39+
test('clear all queries at unmount', () => {
40+
const { rerender } = renderHook(() => useGlobalTime());
41+
act(() => rerender());
42+
expect(mockDispatch.mock.calls[0][0].type).toEqual(
43+
'x-pack/security_solution/local/inputs/DELETE_ALL_QUERY'
44+
);
45+
});
46+
47+
test('do NOT clear all queries at unmount', () => {
48+
const { rerender } = renderHook(() => useGlobalTime(false));
49+
act(() => rerender());
50+
expect(mockDispatch.mock.calls.length).toBe(0);
51+
});
3352
});

x-pack/plugins/security_solution/public/common/containers/use_global_time/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { inputsSelectors } from '../../store';
1111
import { inputsActions } from '../../store/actions';
1212
import { SetQuery, DeleteQuery } from './types';
1313

14-
export const useGlobalTime = () => {
14+
export const useGlobalTime = (clearAllQuery: boolean = true) => {
1515
const dispatch = useDispatch();
1616
const { from, to } = useSelector(inputsSelectors.globalTimeRangeSelector);
1717
const [isInitializing, setIsInitializing] = useState(true);
@@ -32,9 +32,11 @@ export const useGlobalTime = () => {
3232
setIsInitializing(false);
3333
}
3434
return () => {
35-
dispatch(inputsActions.deleteAllQuery({ id: 'global' }));
35+
if (clearAllQuery) {
36+
dispatch(inputsActions.deleteAllQuery({ id: 'global' }));
37+
}
3638
};
37-
}, [dispatch, isInitializing]);
39+
}, [clearAllQuery, dispatch, isInitializing]);
3840

3941
const memoizedReturn = useMemo(
4042
() => ({

0 commit comments

Comments
 (0)