From 06ea75fe311a80bc16242da3ce03f64bd33bb54f Mon Sep 17 00:00:00 2001 From: Eric Wei Date: Thu, 13 Jul 2023 14:13:24 -0700 Subject: [PATCH] Remove unused files (#662) * remove unused files Signed-off-by: Eric Wei * missing snapshots Signed-off-by: Eric Wei --------- Signed-off-by: Eric Wei --- .../shared_components.test.tsx.snap | 117 ------------------ .../__tests__/shared_components.test.tsx | 31 ----- .../visualizations/shared_components/index.ts | 1 - .../shared_components/toolbar_button.scss | 65 ---------- .../shared_components/toolbar_button.tsx | 72 ----------- public/components/event_analytics/index.scss | 1 - 6 files changed, 287 deletions(-) delete mode 100644 public/components/event_analytics/explorer/visualizations/shared_components/__tests__/__snapshots__/shared_components.test.tsx.snap delete mode 100644 public/components/event_analytics/explorer/visualizations/shared_components/__tests__/shared_components.test.tsx delete mode 100644 public/components/event_analytics/explorer/visualizations/shared_components/toolbar_button.scss delete mode 100644 public/components/event_analytics/explorer/visualizations/shared_components/toolbar_button.tsx diff --git a/public/components/event_analytics/explorer/visualizations/shared_components/__tests__/__snapshots__/shared_components.test.tsx.snap b/public/components/event_analytics/explorer/visualizations/shared_components/__tests__/__snapshots__/shared_components.test.tsx.snap deleted file mode 100644 index 29dcef545..000000000 --- a/public/components/event_analytics/explorer/visualizations/shared_components/__tests__/__snapshots__/shared_components.test.tsx.snap +++ /dev/null @@ -1,117 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Shared components Renders tool bar button component 1`] = ` - - - - - - - -`; diff --git a/public/components/event_analytics/explorer/visualizations/shared_components/__tests__/shared_components.test.tsx b/public/components/event_analytics/explorer/visualizations/shared_components/__tests__/shared_components.test.tsx deleted file mode 100644 index 8b5405906..000000000 --- a/public/components/event_analytics/explorer/visualizations/shared_components/__tests__/shared_components.test.tsx +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -import { configure, mount } from 'enzyme'; -import Adapter from 'enzyme-adapter-react-16'; -import React from 'react'; -import { waitFor } from '@testing-library/react'; -import { ToolbarButton } from '../toolbar_button'; - -describe('Shared components', () => { - configure({ adapter: new Adapter() }); - - it('Renders tool bar button component', async () => { - const handleClick = jest.fn(); - const WrappedComponent = () =>
testing
; - - const wrapper = mount( - - - - ); - - wrapper.update(); - - await waitFor(() => { - expect(wrapper).toMatchSnapshot(); - }); - }); -}); diff --git a/public/components/event_analytics/explorer/visualizations/shared_components/index.ts b/public/components/event_analytics/explorer/visualizations/shared_components/index.ts index cd308b785..24e655513 100644 --- a/public/components/event_analytics/explorer/visualizations/shared_components/index.ts +++ b/public/components/event_analytics/explorer/visualizations/shared_components/index.ts @@ -4,5 +4,4 @@ */ export * from './empty_placeholder'; -export { ToolbarButtonProps, ToolbarButton } from './toolbar_button'; export { VisWorkspaceDefault } from './vis_canvass_placeholder'; diff --git a/public/components/event_analytics/explorer/visualizations/shared_components/toolbar_button.scss b/public/components/event_analytics/explorer/visualizations/shared_components/toolbar_button.scss deleted file mode 100644 index 621cb9293..000000000 --- a/public/components/event_analytics/explorer/visualizations/shared_components/toolbar_button.scss +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -.lnsToolbarButton { - line-height: $euiButtonHeight; // Keeps alignment of text and chart icon - background-color: $euiColorEmptyShade; - - // Some toolbar buttons are just icons, but EuiButton comes with margin and min-width that need to be removed - min-width: 0; - - &[class*='--text'] { - // Lighten the border color for all states - border-color: $euiBorderColor !important; // sass-lint:disable-line no-important - } - - &[class*='isDisabled'] { - // There is a popover `pointer-events: none` that messes with the not-allowed cursor - pointer-events: initial; - } - - .lnsToolbarButton__text > svg { - margin-top: -1px; // Just some weird alignment issue when icon is the child not the `iconType` - } - - .lnsToolbarButton__text:empty { - margin: 0; - } - - // Toolbar buttons don't look good with centered text when fullWidth - &[class*='fullWidth'] { - text-align: left; - - .lnsToolbarButton__content { - justify-content: space-between; - } - } - -} - -.lnsToolbarButton--groupLeft { - border-top-right-radius: 0; - border-bottom-right-radius: 0; -} - -.lnsToolbarButton--groupCenter { - border-radius: 0; - border-left: none; -} - -.lnsToolbarButton--groupRight { - border-top-left-radius: 0; - border-bottom-left-radius: 0; - border-left: none; -} - -.lnsToolbarButton--bold { - font-weight: $euiFontWeightBold; -} - -.lnsToolbarButton--s { - box-shadow: none !important; // sass-lint:disable-line no-important - font-size: $euiFontSizeS; -} diff --git a/public/components/event_analytics/explorer/visualizations/shared_components/toolbar_button.tsx b/public/components/event_analytics/explorer/visualizations/shared_components/toolbar_button.tsx deleted file mode 100644 index 12e889474..000000000 --- a/public/components/event_analytics/explorer/visualizations/shared_components/toolbar_button.tsx +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -import React from 'react'; -import classNames from 'classnames'; -import { EuiButton, PropsOf, EuiButtonProps } from '@elastic/eui'; - -const groupPositionToClassMap = { - none: null, - left: 'lnsToolbarButton--groupLeft', - center: 'lnsToolbarButton--groupCenter', - right: 'lnsToolbarButton--groupRight', -}; - -export type ToolbarButtonProps = PropsOf & { - /** - * Determines prominence - */ - fontWeight?: 'normal' | 'bold'; - /** - * Smaller buttons also remove extra shadow for less prominence - */ - size?: EuiButtonProps['size']; - /** - * Determines if the button will have a down arrow or not - */ - hasArrow?: boolean; - /** - * Adjusts the borders for groupings - */ - groupPosition?: 'none' | 'left' | 'center' | 'right'; - dataTestSubj?: string; -}; - -export const ToolbarButton: React.FunctionComponent = ({ - children, - className, - fontWeight = 'normal', - size = 's', - hasArrow = true, - groupPosition = 'none', - dataTestSubj = '', - ...rest -}) => { - const classes = classNames( - 'lnsToolbarButton', - groupPositionToClassMap[groupPosition], - [`lnsToolbarButton--${fontWeight}`, `lnsToolbarButton--${size}`], - className - ); - return ( - - {children} - - ); -}; diff --git a/public/components/event_analytics/index.scss b/public/components/event_analytics/index.scss index 00accf3bf..ac34f9ab8 100644 --- a/public/components/event_analytics/index.scss +++ b/public/components/event_analytics/index.scss @@ -13,7 +13,6 @@ @import 'explorer/visualizations/config_panel/config_panes/config_controls/data_configurations_panel'; @import 'explorer/visualizations/visualizations'; @import 'explorer/visualizations/shared_components/empty_placeholder'; -@import 'explorer/visualizations/shared_components/toolbar_button'; @import 'explorer/visualizations/shared_components/plotly_viz_editor/plotly_editor'; @import 'explorer/visualizations/shared_components/plotly_viz_editor/plotly_vis'; @import 'explorer/visualizations/workspace_panel/workspace_panel'; \ No newline at end of file