From a4ba3f8cf52216f3b9ee3c7e2472dd8ca3cd1926 Mon Sep 17 00:00:00 2001 From: Michael Olorunnisola Date: Fri, 16 Sep 2022 10:08:50 -0400 Subject: [PATCH] [Bug][Security Solution][Investigations] - Remove DataProvider from bottom bar (#140727) * remove dataproviders from bottom bar * remove unused dataprovider tests * cleanup code * fix tests * rename boolean --- .../flyout/__snapshots__/index.test.tsx.snap | 283 +----------------- .../flyout/bottom_bar/index.test.tsx | 61 +--- .../components/flyout/bottom_bar/index.tsx | 25 +- .../timelines/components/flyout/index.tsx | 3 +- 4 files changed, 8 insertions(+), 364 deletions(-) diff --git a/x-pack/plugins/security_solution/public/timelines/components/flyout/__snapshots__/index.test.tsx.snap b/x-pack/plugins/security_solution/public/timelines/components/flyout/__snapshots__/index.test.tsx.snap index a6a846110f72c9..df6539a20c74e1 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/flyout/__snapshots__/index.test.tsx.snap +++ b/x-pack/plugins/security_solution/public/timelines/components/flyout/__snapshots__/index.test.tsx.snap @@ -18,171 +18,7 @@ exports[`Flyout rendering it renders correctly against snapshot 1`] = ` - .c7 { - -webkit-transition: background-color 0.7s ease; - transition: background-color 0.7s ease; - width: 100%; - height: 100%; -} - -.c7 .flyout-overlay .euiPanel { - background-color: #16171c; -} - -.c7 > div.timeline-drop-area .drop-and-provider-timeline { - display: none; -} - -.c7 > div.timeline-drop-area + div { - display: none !important; -} - -.c13 { - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - border-radius: 100%; - display: -webkit-inline-box; - display: -webkit-inline-flex; - display: -ms-inline-flexbox; - display: inline-flex; - font-size: 9px; - height: 34px; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; - justify-content: center; - margin: 0 5px 0 5px; - padding: 7px 6px 4px 6px; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - width: 34px; -} - -.c13 .euiBadge__content { - position: relative; - top: -1px; -} - -.c13 .euiBadge__text { - text-overflow: clip; -} - -.c10 { - overflow: hidden; - margin: 5px 0 5px 0; - padding: 3px; - white-space: nowrap; -} - -.c12 { - height: 20px; - margin: 0 5px 0 5px; - maxwidth: 85px; - minwidth: 85px; -} - -.c11 { - background-color: #343741; -} - -.c8 { - width: auto; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-flex-direction: column; - -ms-flex-direction: column; - flex-direction: column; - -webkit-flex-wrap: wrap; - -ms-flex-wrap: wrap; - flex-wrap: wrap; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; - justify-content: center; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - -webkit-align-content: center; - -ms-flex-line-pack: center; - align-content: center; - min-height: 100px; -} - -.c8 + div { - display: none !important; -} - -.c9 { - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-flex-direction: row; - -ms-flex-direction: row; - flex-direction: row; - -webkit-flex-wrap: no-wrap; - -ms-flex-wrap: no-wrap; - flex-wrap: no-wrap; -} - -.c5 { - padding: 2px 0 4px 0; -} - -.is-dragging .c5 .drop-target-data-providers { - background: rgba(125,222,216,0.1); - border: 0.2rem dashed #7dded8; -} - -.is-dragging .c5 .drop-target-data-providers .timeline-drop-area-empty__text { - color: #7dded8; -} - -.is-dragging .c5 .drop-target-data-providers .euiFormHelpText { - color: #7dded8; -} - -.c6 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-flex-direction: column; - -ms-flex-direction: column; - flex-direction: column; - -webkit-box-pack: start; - -webkit-justify-content: flex-start; - -ms-flex-pack: start; - justify-content: flex-start; - padding-bottom: 2px; - position: relative; - border: 0.2rem dashed #535966; - border-radius: 5px; - padding: 4px 0; - margin: 2px 0 2px 0; - max-height: 33vh; - min-height: 100px; - overflow: auto; - resize: vertical; - background-color: #16171c; -} - -.c2 { + .c2 { display: block; } @@ -200,16 +36,6 @@ exports[`Flyout rendering it renders correctly against snapshot 1`] = ` overflow: hidden; } -.c4 { - border-radius: 0; - padding: 0 4px 0 4px; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - z-index: 9000; -} -
-
-
-
-
-
-
-
- Drop anything -
- - - - - highlighted - - - - -
- here to build an -
- - - - OR - - - -
- query -
-
-
-
- -
-
-
-
-
-
-
`; diff --git a/x-pack/plugins/security_solution/public/timelines/components/flyout/bottom_bar/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/flyout/bottom_bar/index.test.tsx index 366b8d36fc7d4a..6c97e250a8e79b 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/flyout/bottom_bar/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/flyout/bottom_bar/index.test.tsx @@ -9,91 +9,36 @@ import React from 'react'; import { render, screen } from '@testing-library/react'; import { TestProviders } from '../../../../common/mock/test_providers'; -import { TimelineTabs } from '../../../../../common/types/timeline'; import { FlyoutBottomBar } from '.'; describe('FlyoutBottomBar', () => { test('it renders the expected bottom bar', () => { render( - + ); expect(screen.getByTestId('flyoutBottomBar')).toBeInTheDocument(); }); - test('it renders the data providers drop target area', () => { - render( - - - - ); - - expect(screen.getByTestId('dataProviders')).toBeInTheDocument(); - }); - test('it renders the flyout header panel', () => { render( - + ); expect(screen.getByTestId('timeline-flyout-header-panel')).toBeInTheDocument(); }); - test('it hides the data providers drop target area', () => { - render( - - - - ); - - expect(screen.queryByTestId('dataProviders')).not.toBeInTheDocument(); - }); - test('it hides the flyout header panel', () => { render( - + ); expect(screen.queryByTestId('timeline-flyout-header-panel')).not.toBeInTheDocument(); }); - - test('it renders the data providers drop target area when showDataproviders=false and tab is not query', () => { - render( - - - - ); - - expect(screen.getByTestId('dataProviders')).toBeInTheDocument(); - }); }); diff --git a/x-pack/plugins/security_solution/public/timelines/components/flyout/bottom_bar/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/flyout/bottom_bar/index.tsx index 3bb2d4d7530c98..0b5286f1fedb30 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/flyout/bottom_bar/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/flyout/bottom_bar/index.tsx @@ -4,39 +4,20 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - -import { EuiPanel } from '@elastic/eui'; import React from 'react'; -import styled from 'styled-components'; - -import { DataProviders } from '../../timeline/data_providers'; import { FLYOUT_BUTTON_BAR_CLASS_NAME } from '../../timeline/helpers'; import { FlyoutHeaderPanel } from '../header'; -import { TimelineTabs } from '../../../../../common/types/timeline'; - -const DataProvidersPanel = styled(EuiPanel)` - border-radius: 0; - padding: 0 4px 0 4px; - user-select: none; - z-index: ${({ theme }) => theme.eui.euiZLevel9}; -`; interface FlyoutBottomBarProps { - activeTab: TimelineTabs; - showDataproviders: boolean; + showTimelineHeaderPanel: boolean; timelineId: string; } export const FlyoutBottomBar = React.memo( - ({ activeTab, showDataproviders, timelineId }) => { + ({ showTimelineHeaderPanel, timelineId }) => { return (
- {showDataproviders && } - {(showDataproviders || (!showDataproviders && activeTab !== TimelineTabs.query)) && ( - - - - )} + {showTimelineHeaderPanel && }
); } diff --git a/x-pack/plugins/security_solution/public/timelines/components/flyout/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/flyout/index.tsx index 2b77901b4f1022..dfb2fd0cdd9279 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/flyout/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/flyout/index.tsx @@ -29,7 +29,6 @@ const FlyoutComponent: React.FC = ({ timelineId, onAppLeave }) => { const dispatch = useDispatch(); const getTimelineShowStatus = useMemo(() => getTimelineShowStatusByIdSelector(), []); const { - activeTab, show, status: timelineStatus, updated, @@ -122,7 +121,7 @@ const FlyoutComponent: React.FC = ({ timelineId, onAppLeave }) => { - + );