Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Move charts to src/pages folder #22230

Merged
merged 7 commits into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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/ChartCreation';
import VizTypeGallery from 'src/explore/components/controls/VizTypeControl/VizTypeGallery';
import { act } from 'spec/helpers/testing-library';
import { UserWithPermissionsAndRoles } from 'src/types/bootstrapTypes';
Expand Down Expand Up @@ -70,15 +70,11 @@ const routeProps = {

async function getWrapper(user = mockUser) {
const wrapper = mount(
<AddSliceContainer
user={user}
addSuccessToast={() => null}
{...routeProps}
/>,
<ChartCreation user={user} addSuccessToast={() => null} {...routeProps} />,
) as unknown as ReactWrapper<
AddSliceContainerProps,
AddSliceContainerState,
AddSliceContainer
ChartCreationProps,
ChartCreationState,
ChartCreation
>;
await act(() => new Promise(resolve => setTimeout(resolve, 0)));
return wrapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -428,4 +428,4 @@ export class AddSliceContainer extends React.PureComponent<
}
}

export default withRouter(withToasts(AddSliceContainer));
export default withRouter(withToasts(ChartCreation));
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/ChartList';
import ConfirmStatusChange from 'src/components/ConfirmStatusChange';
import ListView from 'src/components/ListView';
import PropertiesModal from 'src/explore/components/PropertiesModal';
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/views/CRUD/welcome/ChartTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
10 changes: 4 additions & 6 deletions superset-frontend/src/views/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ 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'
/* webpackChunkName: "ChartCreation" */ 'src/pages/ChartCreation/ChartCreation'
),
);
const AnnotationLayersList = lazy(
Expand All @@ -47,9 +47,7 @@ const AnnotationList = lazy(
);
const ChartList = lazy(
() =>
import(
/* webpackChunkName: "ChartList" */ 'src/views/CRUD/chart/ChartList'
),
import(/* webpackChunkName: "ChartList" */ 'src/pages/ChartList/ChartList'),
);
const CssTemplatesList = lazy(
() =>
Expand Down Expand Up @@ -139,7 +137,7 @@ export const routes: Routes = [
},
{
path: '/chart/add',
Component: AddSliceContainer,
Component: ChartCreation,
},
{
path: '/chart/list/',
Expand Down