diff --git a/superset-frontend/src/addSlice/AddSliceContainer.test.tsx b/superset-frontend/src/pages/ChartCreation/ChartCreation.test.tsx similarity index 93% rename from superset-frontend/src/addSlice/AddSliceContainer.test.tsx rename to superset-frontend/src/pages/ChartCreation/ChartCreation.test.tsx index 1e26c849955d..2c3c7b5d639e 100644 --- a/superset-frontend/src/addSlice/AddSliceContainer.test.tsx +++ b/superset-frontend/src/pages/ChartCreation/ChartCreation.test.tsx @@ -22,10 +22,10 @@ import { styledMount as mount } from 'spec/helpers/theming'; import Button from 'src/components/Button'; import { AsyncSelect } from 'src/components'; import { - AddSliceContainer, - AddSliceContainerProps, - AddSliceContainerState, -} from 'src/addSlice/AddSliceContainer'; + ChartCreation, + ChartCreationProps, + ChartCreationState, +} from 'src/pages/ChartCreation'; import VizTypeGallery from 'src/explore/components/controls/VizTypeControl/VizTypeGallery'; import { act } from 'spec/helpers/testing-library'; import { UserWithPermissionsAndRoles } from 'src/types/bootstrapTypes'; @@ -70,15 +70,11 @@ const routeProps = { async function getWrapper(user = mockUser) { const wrapper = mount( - null} - {...routeProps} - />, + null} {...routeProps} />, ) as unknown as ReactWrapper< - AddSliceContainerProps, - AddSliceContainerState, - AddSliceContainer + ChartCreationProps, + ChartCreationState, + ChartCreation >; await act(() => new Promise(resolve => setTimeout(resolve, 0))); return wrapper; diff --git a/superset-frontend/src/addSlice/AddSliceContainer.tsx b/superset-frontend/src/pages/ChartCreation/index.tsx similarity index 97% rename from superset-frontend/src/addSlice/AddSliceContainer.tsx rename to superset-frontend/src/pages/ChartCreation/index.tsx index c50bcad9a2a5..4aeb7aeed4df 100644 --- a/superset-frontend/src/addSlice/AddSliceContainer.tsx +++ b/superset-frontend/src/pages/ChartCreation/index.tsx @@ -48,12 +48,12 @@ type Dataset = { datasource_type: string; }; -export interface AddSliceContainerProps extends RouteComponentProps { +export interface ChartCreationProps extends RouteComponentProps { user: UserWithPermissionsAndRoles; addSuccessToast: (arg: string) => void; } -export type AddSliceContainerState = { +export type ChartCreationState = { datasource?: { label: string; value: string }; datasetName?: string | string[] | null; vizType: string | null; @@ -215,11 +215,11 @@ const StyledStepDescription = styled.div` `} `; -export class AddSliceContainer extends React.PureComponent< - AddSliceContainerProps, - AddSliceContainerState +export class ChartCreation extends React.PureComponent< + ChartCreationProps, + ChartCreationState > { - constructor(props: AddSliceContainerProps) { + constructor(props: ChartCreationProps) { super(props); this.state = { vizType: null, @@ -428,4 +428,4 @@ export class AddSliceContainer extends React.PureComponent< } } -export default withRouter(withToasts(AddSliceContainer)); +export default withRouter(withToasts(ChartCreation)); diff --git a/superset-frontend/src/views/CRUD/chart/ChartCard.tsx b/superset-frontend/src/pages/ChartList/ChartCard.tsx similarity index 98% rename from superset-frontend/src/views/CRUD/chart/ChartCard.tsx rename to superset-frontend/src/pages/ChartList/ChartCard.tsx index 4b4f4569283e..df9b148567dd 100644 --- a/superset-frontend/src/views/CRUD/chart/ChartCard.tsx +++ b/superset-frontend/src/pages/ChartList/ChartCard.tsx @@ -30,7 +30,7 @@ import { AntdDropdown } from 'src/components'; import { Menu } from 'src/components/Menu'; import FaveStar from 'src/components/FaveStar'; import FacePile from 'src/components/FacePile'; -import { handleChartDelete, CardStyles } from '../utils'; +import { handleChartDelete, CardStyles } from 'src/views/CRUD/utils'; interface ChartCardProps { chart: Chart; diff --git a/superset-frontend/src/views/CRUD/chart/ChartList.test.jsx b/superset-frontend/src/pages/ChartList/ChartList.test.jsx similarity index 99% rename from superset-frontend/src/views/CRUD/chart/ChartList.test.jsx rename to superset-frontend/src/pages/ChartList/ChartList.test.jsx index 8bfe9951f776..fc216e617dd9 100644 --- a/superset-frontend/src/views/CRUD/chart/ChartList.test.jsx +++ b/superset-frontend/src/pages/ChartList/ChartList.test.jsx @@ -30,7 +30,7 @@ import userEvent from '@testing-library/user-event'; import { QueryParamProvider } from 'use-query-params'; import { act } from 'react-dom/test-utils'; -import ChartList from 'src/views/CRUD/chart/ChartList'; +import ChartList from 'src/pages/ChartList'; import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; import ListView from 'src/components/ListView'; import PropertiesModal from 'src/explore/components/PropertiesModal'; diff --git a/superset-frontend/src/views/CRUD/chart/ChartList.tsx b/superset-frontend/src/pages/ChartList/index.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/chart/ChartList.tsx rename to superset-frontend/src/pages/ChartList/index.tsx diff --git a/superset-frontend/src/views/CRUD/chart/types.ts b/superset-frontend/src/views/CRUD/chart/types.ts deleted file mode 100644 index e16b42a23f18..000000000000 --- a/superset-frontend/src/views/CRUD/chart/types.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -export type ChartObject = { - slice_name?: string; - description?: string; - viz_type?: string; - params?: string; - cache_timeout?: number; - datasource_id?: number; - datasource_type?: number; - is_managed_externally: boolean; -}; diff --git a/superset-frontend/src/views/CRUD/welcome/ChartTable.tsx b/superset-frontend/src/views/CRUD/welcome/ChartTable.tsx index b5d016d42140..52548e30b0c0 100644 --- a/superset-frontend/src/views/CRUD/welcome/ChartTable.tsx +++ b/superset-frontend/src/views/CRUD/welcome/ChartTable.tsx @@ -40,7 +40,7 @@ import { PAGE_SIZE, } from 'src/views/CRUD/utils'; import { LoadingCards } from 'src/views/CRUD/welcome/Welcome'; -import ChartCard from 'src/views/CRUD/chart/ChartCard'; +import ChartCard from 'src/pages/ChartList/ChartCard'; import Chart from 'src/types/Chart'; import handleResourceExport from 'src/utils/export'; import Loading from 'src/components/Loading'; diff --git a/superset-frontend/src/views/routes.tsx b/superset-frontend/src/views/routes.tsx index 0898ea74df9a..da4b8312c9b8 100644 --- a/superset-frontend/src/views/routes.tsx +++ b/superset-frontend/src/views/routes.tsx @@ -21,11 +21,9 @@ import React, { lazy } from 'react'; // not lazy loaded since this is the home page. import Welcome from 'src/views/CRUD/welcome/Welcome'; -const AddSliceContainer = lazy( +const ChartCreation = lazy( () => - import( - /* webpackChunkName: "AddSliceContainer" */ 'src/addSlice/AddSliceContainer' - ), + import(/* webpackChunkName: "ChartCreation" */ 'src/pages/ChartCreation'), ); const AnnotationLayersList = lazy( () => @@ -46,10 +44,7 @@ const AnnotationList = lazy( ), ); const ChartList = lazy( - () => - import( - /* webpackChunkName: "ChartList" */ 'src/views/CRUD/chart/ChartList' - ), + () => import(/* webpackChunkName: "ChartList" */ 'src/pages/ChartList'), ); const CssTemplatesList = lazy( () => @@ -139,7 +134,7 @@ export const routes: Routes = [ }, { path: '/chart/add', - Component: AddSliceContainer, + Component: ChartCreation, }, { path: '/chart/list/',