From 6ab03feed82e7e5c34106d29c16a43092ea86205 Mon Sep 17 00:00:00 2001 From: Jesse Yang Date: Sun, 8 Nov 2020 21:09:27 -0800 Subject: [PATCH] chore: clean up mountedTab (#11569) --- .../components/DashboardBuilder_spec.jsx | 1 - .../components/gridComponents/Chart_spec.jsx | 2 +- .../components/gridComponents/Tabs_spec.jsx | 1 - superset-frontend/src/chart/Chart.jsx | 2 -- .../src/common/components/Tabs/Tabs.tsx | 7 +++-- .../src/components/Menu/Menu.tsx | 2 +- .../src/dashboard/actions/dashboardState.js | 8 ------ .../dashboard/components/DashboardBuilder.jsx | 6 ----- .../components/gridComponents/Chart.jsx | 27 +------------------ .../components/gridComponents/Tabs.jsx | 8 +----- .../dashboard/containers/DashboardBuilder.jsx | 2 -- .../containers/DashboardComponent.jsx | 3 +-- .../src/dashboard/reducers/dashboardState.js | 15 +---------- 13 files changed, 9 insertions(+), 75 deletions(-) diff --git a/superset-frontend/spec/javascripts/dashboard/components/DashboardBuilder_spec.jsx b/superset-frontend/spec/javascripts/dashboard/components/DashboardBuilder_spec.jsx index eb90589644..b6cd7b9a32 100644 --- a/superset-frontend/spec/javascripts/dashboard/components/DashboardBuilder_spec.jsx +++ b/superset-frontend/spec/javascripts/dashboard/components/DashboardBuilder_spec.jsx @@ -67,7 +67,6 @@ describe('DashboardBuilder', () => { colorScheme: undefined, handleComponentDrop() {}, setDirectPathToChild: sinon.spy(), - setMountedTab() {}, }; function setup(overrideProps, useProvider = false, store = mockStore) { diff --git a/superset-frontend/spec/javascripts/dashboard/components/gridComponents/Chart_spec.jsx b/superset-frontend/spec/javascripts/dashboard/components/gridComponents/Chart_spec.jsx index ff4421977b..198e2d6264 100644 --- a/superset-frontend/spec/javascripts/dashboard/components/gridComponents/Chart_spec.jsx +++ b/superset-frontend/spec/javascripts/dashboard/components/gridComponents/Chart_spec.jsx @@ -20,7 +20,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import sinon from 'sinon'; -import { ChartUnconnected as Chart } from 'src/dashboard/components/gridComponents/Chart'; +import Chart from 'src/dashboard/components/gridComponents/Chart'; import SliceHeader from 'src/dashboard/components/SliceHeader'; import ChartContainer from 'src/chart/ChartContainer'; diff --git a/superset-frontend/spec/javascripts/dashboard/components/gridComponents/Tabs_spec.jsx b/superset-frontend/spec/javascripts/dashboard/components/gridComponents/Tabs_spec.jsx index 63dc8000c4..777837cccd 100644 --- a/superset-frontend/spec/javascripts/dashboard/components/gridComponents/Tabs_spec.jsx +++ b/superset-frontend/spec/javascripts/dashboard/components/gridComponents/Tabs_spec.jsx @@ -55,7 +55,6 @@ describe('Tabs', () => { deleteComponent() {}, updateComponents() {}, logEvent() {}, - setMountedTab() {}, }; function setup(overrideProps) { diff --git a/superset-frontend/src/chart/Chart.jsx b/superset-frontend/src/chart/Chart.jsx index 1d386ecf6e..2636751fd6 100644 --- a/superset-frontend/src/chart/Chart.jsx +++ b/superset-frontend/src/chart/Chart.jsx @@ -65,8 +65,6 @@ const propTypes = { onQuery: PropTypes.func, onFilterMenuOpen: PropTypes.func, onFilterMenuClose: PropTypes.func, - // id of the last mounted parent tab - mountedParent: PropTypes.string, }; const BLANK = {}; diff --git a/superset-frontend/src/common/components/Tabs/Tabs.tsx b/superset-frontend/src/common/components/Tabs/Tabs.tsx index de2fabe376..743ea6a533 100644 --- a/superset-frontend/src/common/components/Tabs/Tabs.tsx +++ b/superset-frontend/src/common/components/Tabs/Tabs.tsx @@ -127,7 +127,7 @@ const StyledEditableTabs = styled(StyledTabs)` `} `; -const EditableTabs = Object.assign(StyledEditableTabs, { +export const EditableTabs = Object.assign(StyledEditableTabs, { TabPane: StyledTabPane, }); @@ -142,7 +142,7 @@ EditableTabs.TabPane.defaultProps = { ), }; -const StyledLineEditableTabs = styled(EditableTabs)` +export const StyledLineEditableTabs = styled(EditableTabs)` &.ant-tabs-card > .ant-tabs-nav .ant-tabs-tab { margin: 0 ${({ theme }) => theme.gridUnit * 4}px; padding: ${({ theme }) => `${theme.gridUnit * 3}px ${theme.gridUnit}px`}; @@ -170,9 +170,8 @@ const StyledLineEditableTabs = styled(EditableTabs)` } `; -const LineEditableTabs = Object.assign(StyledLineEditableTabs, { +export const LineEditableTabs = Object.assign(StyledLineEditableTabs, { TabPane: StyledTabPane, }); export default Tabs; -export { EditableTabs, LineEditableTabs }; diff --git a/superset-frontend/src/components/Menu/Menu.tsx b/superset-frontend/src/components/Menu/Menu.tsx index a193b08515..1efb44b52c 100644 --- a/superset-frontend/src/components/Menu/Menu.tsx +++ b/superset-frontend/src/components/Menu/Menu.tsx @@ -191,7 +191,7 @@ export function Menu({ , ]} {(navbarRight.version_string || navbarRight.version_sha) && [ - , + , { - // Entering current tab, DOM is visible and has dimension - this.props.setMountedTab(id); - }} >