Skip to content

Commit

Permalink
refactor: Organizes the pages in their own folder (#23241)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-s-molina authored Mar 1, 2023
1 parent 6076457 commit d16eda6
Show file tree
Hide file tree
Showing 36 changed files with 118 additions and 121 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint';
import { Switch } from 'src/components/Switch';
import ListView from 'src/components/ListView';
import SubMenu from 'src/views/components/SubMenu';
import AlertList from 'src/views/CRUD/alert/AlertList';
import AlertList from 'src/pages/AlertReportList';
import IndeterminateCheckbox from 'src/components/IndeterminateCheckbox';
import { act } from 'react-dom/test-utils';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ import {
import { createErrorHandler, createFetchRelated } from 'src/views/CRUD/utils';
import { isUserAdmin } from 'src/dashboard/util/permissionUtils';
import Owner from 'src/types/Owner';
import AlertReportModal from './AlertReportModal';
import { AlertObject, AlertState } from './types';
import AlertReportModal from 'src/views/CRUD/alert/AlertReportModal';
import { AlertObject, AlertState } from 'src/views/CRUD/alert/types';

const extensionsRegistry = getExtensionsRegistry();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import AsyncSelect from 'src/components/Select/AsyncSelect';
import { SelectValue } from 'antd/lib/select';
import { loadTags } from 'src/components/Tags/utils';
import { getValue } from 'src/components/Select/utils';
import AllEntitiesTable from './AllEntitiesTable';
import AllEntitiesTable from 'src/views/CRUD/allentities/AllEntitiesTable';

const AllEntitiesContainer = styled.div`
${({ theme }) => `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import fetchMock from 'fetch-mock';
import { Provider } from 'react-redux';
import { styledMount as mount } from 'spec/helpers/theming';

import AnnotationLayersList from 'src/views/CRUD/annotationlayers/AnnotationLayersList';
import AnnotationLayersList from 'src/pages/AnnotationLayerList';
import AnnotationLayerModal from 'src/views/CRUD/annotationlayers/AnnotationLayerModal';
import SubMenu from 'src/views/components/SubMenu';
import ListView from 'src/components/ListView';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import ListView, {
} from 'src/components/ListView';
import DeleteModal from 'src/components/DeleteModal';
import ConfirmStatusChange from 'src/components/ConfirmStatusChange';
import AnnotationLayerModal from './AnnotationLayerModal';
import { AnnotationLayerObject } from './types';
import AnnotationLayerModal from 'src/views/CRUD/annotationlayers/AnnotationLayerModal';
import { AnnotationLayerObject } from 'src/views/CRUD/annotationlayers/types';

const PAGE_SIZE = 25;
const MOMENT_FORMAT = 'MMM DD, YYYY';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import fetchMock from 'fetch-mock';
import { Provider } from 'react-redux';
import { styledMount as mount } from 'spec/helpers/theming';

import AnnotationList from 'src/views/CRUD/annotation/AnnotationList';
import AnnotationList from 'src/pages/AnnotationList';
import DeleteModal from 'src/components/DeleteModal';
import IndeterminateCheckbox from 'src/components/IndeterminateCheckbox';
import ListView from 'src/components/ListView';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import withToasts from 'src/components/MessageToasts/withToasts';
import { useListViewResource } from 'src/views/CRUD/hooks';
import { createErrorHandler } from 'src/views/CRUD/utils';

import { AnnotationObject } from './types';
import AnnotationModal from './AnnotationModal';
import { AnnotationObject } from 'src/views/CRUD/annotation/types';
import AnnotationModal from 'src/views/CRUD/annotation/AnnotationModal';

const PAGE_SIZE = 25;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ import { URL_PARAMS } from 'src/constants';
import { getClientErrorObject } from 'src/utils/getClientErrorObject';
import getFormDataWithExtraFilters from 'src/dashboard/util/charts/getFormDataWithExtraFilters';
import { getAppliedFilterValues } from 'src/dashboard/util/activeDashboardFilters';
import { getParsedExploreURLParams } from './exploreUtils/getParsedExploreURLParams';
import { hydrateExplore } from './actions/hydrateExplore';
import ExploreViewContainer from './components/ExploreViewContainer';
import { ExploreResponsePayload, SaveActionType } from './types';
import { fallbackExploreInitialData } from './fixtures';
import { getItem, LocalStorageKeys } from '../utils/localStorageHelpers';
import { getFormDataWithDashboardContext } from './controlUtils/getFormDataWithDashboardContext';
import { getParsedExploreURLParams } from 'src/explore/exploreUtils/getParsedExploreURLParams';
import { hydrateExplore } from 'src/explore/actions/hydrateExplore';
import ExploreViewContainer from 'src/explore/components/ExploreViewContainer';
import { ExploreResponsePayload, SaveActionType } from 'src/explore/types';
import { fallbackExploreInitialData } from 'src/explore/fixtures';
import { getItem, LocalStorageKeys } from 'src/utils/localStorageHelpers';
import { getFormDataWithDashboardContext } from 'src/explore/controlUtils/getFormDataWithDashboardContext';

const isValidResult = (rv: JsonObject): boolean =>
rv?.result?.form_data && isDefined(rv?.result?.dataset?.id);
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/pages/ChartList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ import { GenericLink } from 'src/components/GenericLink/GenericLink';
import getBootstrapData from 'src/utils/getBootstrapData';
import Owner from 'src/types/Owner';
import { loadTags } from 'src/components/Tags/utils';
import ChartCard from './ChartCard';
import ChartCard from 'src/views/CRUD/chart/ChartCard';

const FlexRowContainer = styled.div`
align-items: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { Provider } from 'react-redux';
import fetchMock from 'fetch-mock';
import { styledMount as mount } from 'spec/helpers/theming';

import CssTemplatesList from 'src/views/CRUD/csstemplates/CssTemplatesList';
import CssTemplatesList from 'src/pages/CssTemplateList';
import SubMenu from 'src/views/components/SubMenu';
import ListView from 'src/components/ListView';
import Filters from 'src/components/ListView/Filters';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ import ListView, {
Filters,
FilterOperator,
} from 'src/components/ListView';
import CssTemplateModal from './CssTemplateModal';
import { TemplateObject } from './types';
import CssTemplateModal from 'src/views/CRUD/csstemplates/CssTemplateModal';
import { TemplateObject } from 'src/views/CRUD/csstemplates/types';

const PAGE_SIZE = 25;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
import React, { FC } from 'react';
import { useParams } from 'react-router-dom';
import { DashboardPage } from './DashboardPage';
import { DashboardPage } from 'src/dashboard/containers/DashboardPage';

const DashboardRoute: FC = () => {
const { idOrSlug } = useParams<{ idOrSlug: string }>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { QueryParamProvider } from 'use-query-params';
import { act } from 'react-dom/test-utils';

import ConfirmStatusChange from 'src/components/ConfirmStatusChange';
import DashboardList from 'src/views/CRUD/dashboard/DashboardList';
import DashboardList from 'src/pages/DashboardList';
import ListView from 'src/components/ListView';
import ListViewCard from 'src/components/ListViewCard';
import PropertiesModal from 'src/dashboard/components/PropertiesModal';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ import { Dashboard as CRUDDashboard } from 'src/views/CRUD/types';
import CertifiedBadge from 'src/components/CertifiedBadge';
import { loadTags } from 'src/components/Tags/utils';
import getBootstrapData from 'src/utils/getBootstrapData';
import DashboardCard from './DashboardCard';
import { DashboardStatus } from './types';
import DashboardCard from 'src/views/CRUD/dashboard/DashboardCard';
import { DashboardStatus } from 'src/views/CRUD/dashboard/types';

const PAGE_SIZE = 25;
const PASSWORDS_NEEDED_MESSAGE = t(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import fetchMock from 'fetch-mock';
import { Provider } from 'react-redux';
import { styledMount as mount } from 'spec/helpers/theming';

import DatabaseList from 'src/views/CRUD/data/database/DatabaseList';
import DatabaseList from 'src/pages/DatabaseList';
import DatabaseModal from 'src/views/CRUD/data/database/DatabaseModal';
import DeleteModal from 'src/components/DeleteModal';
import SubMenu from 'src/views/components/SubMenu';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ import handleResourceExport from 'src/utils/export';
import { ExtensionConfigs } from 'src/views/components/types';
import { UserWithPermissionsAndRoles } from 'src/types/bootstrapTypes';
import type { MenuObjectProps } from 'src/types/bootstrapTypes';
import DatabaseModal from './DatabaseModal';

import { DatabaseObject } from './types';
import DatabaseModal from 'src/views/CRUD/data/database/DatabaseModal';
import { DatabaseObject } from 'src/views/CRUD/data/database/types';

const PAGE_SIZE = 25;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
import React from 'react';
import { render, screen } from 'spec/helpers/testing-library';
import AddDataset from 'src/views/CRUD/data/dataset/AddDataset';
import AddDataset from 'src/pages/DatasetCreation';

const mockHistoryPush = jest.fn();
jest.mock('react-router-dom', () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@
import React, { useReducer, Reducer, useEffect, useState } from 'react';
import { useParams } from 'react-router-dom';
import { useDatasetsList } from 'src/views/CRUD/data/hooks';
import Header from './Header';
import EditPage from './EditDataset';
import DatasetPanel from './DatasetPanel';
import LeftPanel from './LeftPanel';
import Footer from './Footer';
import { DatasetActionType, DatasetObject, DSReducerActionType } from './types';
import DatasetLayout from '../DatasetLayout';
import Header from 'src/views/CRUD/data/dataset/AddDataset/Header';
import EditPage from 'src/views/CRUD/data/dataset/AddDataset/EditDataset';
import DatasetPanel from 'src/views/CRUD/data/dataset/AddDataset/DatasetPanel';
import LeftPanel from 'src/views/CRUD/data/dataset/AddDataset/LeftPanel';
import Footer from 'src/views/CRUD/data/dataset/AddDataset/Footer';
import {
DatasetActionType,
DatasetObject,
DSReducerActionType,
} from 'src/views/CRUD/data/dataset/AddDataset/types';
import DatasetLayout from 'src/views/CRUD/data/dataset/DatasetLayout';

type Schema = {
schema: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import userEvent from '@testing-library/user-event';
import { QueryParamProvider } from 'use-query-params';
import * as featureFlags from 'src/featureFlags';

import DatasetList from 'src/views/CRUD/data/dataset/DatasetList';
import DatasetList from 'src/pages/DatasetList';
import ListView from 'src/components/ListView';
import Button from 'src/components/Button';
import IndeterminateCheckbox from 'src/components/IndeterminateCheckbox';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ import {
SORT_BY,
PASSWORDS_NEEDED_MESSAGE,
CONFIRM_OVERWRITE_MESSAGE,
} from './constants';
import DuplicateDatasetModal from './DuplicateDatasetModal';
} from 'src/views/CRUD/data/dataset/constants';
import DuplicateDatasetModal from 'src/views/CRUD/data/dataset/DuplicateDatasetModal';

const FlexRowContainer = styled.div`
align-items: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import thunk from 'redux-thunk';
import { styledMount as mount } from 'spec/helpers/theming';
import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint';
import ListView from 'src/components/ListView';
import ExecutionLog from 'src/views/CRUD/alert/ExecutionLog';
import ExecutionLog from 'src/pages/ExecutionLogList';

// store needed for withToasts(ExecutionLog)
const mockStore = configureStore([thunk]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
useListViewResource,
useSingleViewResource,
} from 'src/views/CRUD/hooks';
import { AlertObject, LogObject } from './types';
import { AlertObject, LogObject } from 'src/views/CRUD/alert/types';

const PAGE_SIZE = 25;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import fetchMock from 'fetch-mock';
import { act } from 'react-dom/test-utils';
import configureStore from 'redux-mock-store';
import * as featureFlags from 'src/featureFlags';
import Welcome from 'src/views/CRUD/welcome/Welcome';
import Welcome from 'src/pages/Home';
import { ReactWrapper } from 'enzyme';
import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint';
import { render, screen } from 'spec/helpers/testing-library';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ import { AntdSwitch } from 'src/components';
import getBootstrapData from 'src/utils/getBootstrapData';
import { TableTab } from 'src/views/CRUD/types';
import { canUserAccessSqlLab } from 'src/dashboard/util/permissionUtils';
import { WelcomePageLastTab } from './types';
import ActivityTable from './ActivityTable';
import ChartTable from './ChartTable';
import SavedQueries from './SavedQueries';
import DashboardTable from './DashboardTable';
import { WelcomePageLastTab } from 'src/views/CRUD/welcome/types';
import ActivityTable from 'src/views/CRUD/welcome/ActivityTable';
import ChartTable from 'src/views/CRUD/welcome/ChartTable';
import SavedQueries from 'src/views/CRUD/welcome/SavedQueries';
import DashboardTable from 'src/views/CRUD/welcome/DashboardTable';

const extensionsRegistry = getExtensionsRegistry();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { act } from 'react-dom/test-utils';
import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint';
import { styledMount as mount } from 'spec/helpers/theming';

import QueryList from 'src/views/CRUD/data/query/QueryList';
import QueryList from 'src/pages/QueryHistoryList';
import QueryPreviewModal from 'src/views/CRUD/data/query/QueryPreviewModal';
import { QueryObject } from 'src/views/CRUD/types';
import ListView from 'src/components/ListView';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import { DATETIME_WITH_TIME_ZONE, TIME_WITH_MS } from 'src/constants';
import { QueryObject, QueryObjectColumns } from 'src/views/CRUD/types';

import Icons from 'src/components/Icons';
import QueryPreviewModal from './QueryPreviewModal';
import QueryPreviewModal from 'src/views/CRUD/data/query/QueryPreviewModal';

const PAGE_SIZE = 25;
const SQL_PREVIEW_MAX_LINES = 4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import userEvent from '@testing-library/user-event';
import { QueryParamProvider } from 'use-query-params';
import { act } from 'react-dom/test-utils';
import * as featureFlags from 'src/featureFlags';
import SavedQueryList from 'src/views/CRUD/data/savedquery/SavedQueryList';
import SavedQueryList from 'src/pages/SavedQueryList';
import SubMenu from 'src/views/components/SubMenu';
import ListView from 'src/components/ListView';
import Filters from 'src/components/ListView/Filters';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
import ImportModelsModal from 'src/components/ImportModal/index';
import Icons from 'src/components/Icons';
import { BootstrapUser } from 'src/types/bootstrapTypes';
import SavedQueryPreviewModal from './SavedQueryPreviewModal';
import SavedQueryPreviewModal from 'src/views/CRUD/data/savedquery/SavedQueryPreviewModal';

const PAGE_SIZE = 25;
const PASSWORDS_NEEDED_MESSAGE = t(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import FacePile from 'src/components/FacePile';
import { Link } from 'react-router-dom';
import { deleteTags } from 'src/tags';
import { Tag as AntdTag } from 'antd';
import { Tag } from '../types';
import TagCard from './TagCard';
import { Tag } from 'src/views/CRUD/types';
import TagCard from 'src/views/CRUD/tags/TagCard';

const PAGE_SIZE = 25;

Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/views/CRUD/welcome/ActivityTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { Link } from 'react-router-dom';
import ListViewCard from 'src/components/ListViewCard';
import SubMenu from 'src/views/components/SubMenu';
import { Dashboard, SavedQueryObject, TableTab } from 'src/views/CRUD/types';
import { ActivityData, LoadingCards } from 'src/views/CRUD/welcome/Welcome';
import { ActivityData, LoadingCards } from 'src/pages/Home';
import {
CardContainer,
CardStyles,
Expand Down
4 changes: 2 additions & 2 deletions superset-frontend/src/views/CRUD/welcome/ChartTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ import {
getFilterValues,
PAGE_SIZE,
} from 'src/views/CRUD/utils';
import { LoadingCards } from 'src/views/CRUD/welcome/Welcome';
import ChartCard from 'src/pages/ChartList/ChartCard';
import { LoadingCards } from 'src/pages/Home';
import ChartCard from 'src/views/CRUD/chart/ChartCard';
import Chart from 'src/types/Chart';
import handleResourceExport from 'src/utils/export';
import Loading from 'src/components/Loading';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
LocalStorageKeys,
setItem,
} from 'src/utils/localStorageHelpers';
import { LoadingCards } from 'src/views/CRUD/welcome/Welcome';
import { LoadingCards } from 'src/pages/Home';
import {
CardContainer,
createErrorHandler,
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/views/CRUD/welcome/SavedQueries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { styled, SupersetClient, t, useTheme } from '@superset-ui/core';
import SyntaxHighlighter from 'react-syntax-highlighter/dist/cjs/light';
import sql from 'react-syntax-highlighter/dist/cjs/languages/hljs/sql';
import github from 'react-syntax-highlighter/dist/cjs/styles/hljs/github';
import { LoadingCards } from 'src/views/CRUD/welcome/Welcome';
import { LoadingCards } from 'src/pages/Home';
import { TableTab } from 'src/views/CRUD/types';
import withToasts from 'src/components/MessageToasts/withToasts';
import { AntdDropdown } from 'src/components';
Expand Down
4 changes: 1 addition & 3 deletions superset-frontend/src/views/routes.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ jest.mock('src/featureFlags', () => ({
...jest.requireActual<object>('src/featureFlags'),
isFeatureEnabled: jest.fn().mockReturnValue(true),
}));
jest.mock('src/views/CRUD/welcome/Welcome', () => () => (
<div data-test="mock-welcome" />
));
jest.mock('src/pages/Home', () => () => <div data-test="mock-home" />);

describe('isFrontendRoute', () => {
it('returns true if a route matches', () => {
Expand Down
Loading

0 comments on commit d16eda6

Please sign in to comment.