From adcb8cf0ac39d2402b4243fac5c03203eb7ee8c2 Mon Sep 17 00:00:00 2001 From: "Michael S. Molina" <70410625+michael-s-molina@users.noreply.github.com> Date: Thu, 6 Apr 2023 09:23:32 -0300 Subject: [PATCH] refactor: Moves CRUD features to src/features (#23482) --- .../Datasource/ChangeDatasourceModal.tsx | 2 +- .../HeaderReportDropdown/index.tsx | 2 +- .../components/PropertiesModal/index.tsx | 7 +- .../components/PropertiesModal/index.tsx | 7 +- .../alerts}/AlertReportModal.test.jsx | 2 +- .../alerts}/AlertReportModal.test.tsx | 2 +- .../alerts}/AlertReportModal.tsx | 6 +- .../AlertReportCronScheduler.test.tsx | 0 .../components/AlertReportCronScheduler.tsx | 2 +- .../alerts}/components/AlertStatusIcon.tsx | 0 .../alerts}/components/NotificationMethod.tsx | 2 +- .../alerts}/components/RecipientIcon.tsx | 0 .../CRUD/alert => features/alerts}/types.ts | 0 .../allEntities}/AllEntitiesTable.tsx | 4 +- .../AnnotationLayerModal.test.jsx | 2 +- .../AnnotationLayerModal.tsx | 0 .../annotationLayers}/types.ts | 0 .../annotations}/AnnotationModal.test.jsx | 2 +- .../annotations}/AnnotationModal.tsx | 0 .../annotations}/types.ts | 0 .../chart => features/charts}/ChartCard.tsx | 0 .../cssTemplates}/CssTemplateModal.test.jsx | 2 +- .../cssTemplates}/CssTemplateModal.tsx | 0 .../cssTemplates}/types.ts | 0 .../dashboards}/DashboardCard.tsx | 0 .../dashboards}/types.ts | 0 .../CommonParameters.tsx | 0 .../DatabaseConnectionForm/EncryptedField.tsx | 0 .../DatabaseConnectionForm/TableCatalog.tsx | 0 .../ValidatedInputField.tsx | 0 .../DatabaseConnectionForm/index.tsx | 0 .../databases}/DatabaseModal/ExtraOptions.tsx | 0 .../databases}/DatabaseModal/ModalHeader.tsx | 0 .../DatabaseModal/SSHTunnelForm.tsx | 1 - .../DatabaseModal/SSHTunnelSwitch.tsx | 0 .../DatabaseModal/SqlAlchemyForm.tsx | 1 - .../databases}/DatabaseModal/index.test.tsx | 5 +- .../databases}/DatabaseModal/index.tsx | 8 +- .../databases}/DatabaseModal/styles.ts | 0 .../database => features/databases}/state.ts | 0 .../database => features/databases}/types.ts | 0 .../DatasetPanel/DatasetPanel.stories.tsx | 0 .../DatasetPanel/DatasetPanel.test.tsx | 2 +- .../AddDataset/DatasetPanel/DatasetPanel.tsx | 2 +- .../DatasetPanel/MessageContent.tsx | 0 .../AddDataset/DatasetPanel/fixtures.ts | 2 +- .../AddDataset/DatasetPanel/index.tsx | 2 +- .../AddDataset/DatasetPanel/types.ts | 0 .../EditDataset/EditDataset.test.tsx | 0 .../EditDataset/UsageTab/UsageTab.test.tsx | 0 .../AddDataset/EditDataset/UsageTab/index.tsx | 0 .../AddDataset/EditDataset/index.tsx | 2 +- .../AddDataset/Footer/Footer.test.tsx | 2 +- .../datasets}/AddDataset/Footer/index.tsx | 0 .../AddDataset/Header/Header.test.tsx | 4 +- .../datasets}/AddDataset/Header/index.tsx | 10 +- .../AddDataset/LeftPanel/LeftPanel.test.tsx | 4 +- .../datasets}/AddDataset/LeftPanel/index.tsx | 2 +- .../AddDataset/RightPanel/RightPanel.test.tsx | 2 +- .../datasets}/AddDataset/RightPanel/index.tsx | 0 .../datasets}/AddDataset/types.tsx | 0 .../DatasetLayout/DatasetLayout.test.tsx | 12 +-- .../datasets}/DatasetLayout/index.tsx | 2 +- .../datasets}/DuplicateDatasetModal.tsx | 0 .../datasets}/constants.ts | 0 .../datasets/hooks/useDatasetLists.ts} | 93 +------------------ .../hooks/useGetDatasetRelatedCounts.ts | 55 +++++++++++ .../dataset => features/datasets}/styles.ts | 0 .../dataset => features/datasets}/types.ts | 0 .../home}/ActivityTable.test.tsx | 2 +- .../home}/ActivityTable.tsx | 4 +- .../home}/ChartTable.test.tsx | 3 +- .../welcome => features/home}/ChartTable.tsx | 4 +- .../home}/DashboardTable.test.tsx | 4 +- .../home}/DashboardTable.tsx | 4 +- .../home}/EmptyState.test.tsx | 2 +- .../welcome => features/home}/EmptyState.tsx | 0 .../home}/LanguagePicker.test.tsx | 0 .../home}/LanguagePicker.tsx | 0 .../home}/Menu.test.tsx | 0 .../components => features/home}/Menu.tsx | 0 .../home}/RightMenu.test.tsx | 2 +- .../home}/RightMenu.tsx | 11 +-- .../home}/SavedQueries.test.tsx | 5 +- .../home}/SavedQueries.tsx | 6 +- .../home}/SubMenu.test.tsx | 0 .../components => features/home}/SubMenu.tsx | 7 +- .../home/commonMenuData.ts} | 0 .../components => features/home}/types.ts | 10 ++ .../queries}/QueryPreviewModal.test.tsx | 2 +- .../queries}/QueryPreviewModal.tsx | 4 +- .../queries}/SavedQueryPreviewModal.test.jsx | 2 +- .../queries}/SavedQueryPreviewModal.tsx | 4 +- .../queries/SyntaxHighlighterCopy.tsx} | 0 .../queries/hooks/useQueryPreviewState.ts | 76 +++++++++++++++ .../{views/CRUD => features}/tags/TagCard.tsx | 2 +- .../src/{ => features/tags}/tags.ts | 0 .../AlertReportList/AlertReportList.test.jsx | 2 +- .../src/pages/AlertReportList/index.tsx | 11 +-- .../src/pages/AllEntities/index.tsx | 2 +- .../AnnotationLayerList.test.jsx | 4 +- .../src/pages/AnnotationLayerList/index.tsx | 6 +- .../AnnotationList/AnnotationList.test.jsx | 2 +- .../src/pages/AnnotationList/index.tsx | 6 +- .../src/pages/ChartList/index.tsx | 4 +- .../CssTemplateList/CssTemplateList.test.jsx | 2 +- .../src/pages/CssTemplateList/index.tsx | 6 +- .../src/pages/DashboardList/index.tsx | 6 +- .../pages/DatabaseList/DatabaseList.test.jsx | 4 +- .../src/pages/DatabaseList/index.tsx | 8 +- .../src/pages/DatasetCreation/index.tsx | 16 ++-- .../pages/DatasetList/DatasetList.test.tsx | 2 +- .../src/pages/DatasetList/index.tsx | 11 +-- .../src/pages/ExecutionLogList/index.tsx | 6 +- superset-frontend/src/pages/Home/index.tsx | 12 +-- .../QueryHistoryList.test.tsx | 4 +- .../src/pages/QueryHistoryList/index.tsx | 6 +- .../SavedQueryList/SavedQueryList.test.jsx | 2 +- .../src/pages/SavedQueryList/index.tsx | 9 +- superset-frontend/src/pages/Tags/index.tsx | 6 +- superset-frontend/src/types/bootstrapTypes.ts | 2 +- superset-frontend/src/views/App.tsx | 2 +- .../src/views/CRUD/utils.test.tsx | 2 +- superset-frontend/src/views/CRUD/utils.tsx | 2 +- .../src/views/CRUD/welcome/types.ts | 29 ------ superset-frontend/src/views/menu.tsx | 2 +- superset-frontend/src/views/types.ts | 2 +- 127 files changed, 300 insertions(+), 285 deletions(-) rename superset-frontend/src/{views/CRUD/alert => features/alerts}/AlertReportModal.test.jsx (99%) rename superset-frontend/src/{views/CRUD/alert => features/alerts}/AlertReportModal.test.tsx (97%) rename superset-frontend/src/{views/CRUD/alert => features/alerts}/AlertReportModal.tsx (99%) rename superset-frontend/src/{views/CRUD/alert => features/alerts}/components/AlertReportCronScheduler.test.tsx (100%) rename superset-frontend/src/{views/CRUD/alert => features/alerts}/components/AlertReportCronScheduler.tsx (97%) rename superset-frontend/src/{views/CRUD/alert => features/alerts}/components/AlertStatusIcon.tsx (100%) rename superset-frontend/src/{views/CRUD/alert => features/alerts}/components/NotificationMethod.tsx (98%) rename superset-frontend/src/{views/CRUD/alert => features/alerts}/components/RecipientIcon.tsx (100%) rename superset-frontend/src/{views/CRUD/alert => features/alerts}/types.ts (100%) rename superset-frontend/src/{views/CRUD/allentities => features/allEntities}/AllEntitiesTable.tsx (97%) rename superset-frontend/src/{views/CRUD/annotationlayers => features/annotationLayers}/AnnotationLayerModal.test.jsx (97%) rename superset-frontend/src/{views/CRUD/annotationlayers => features/annotationLayers}/AnnotationLayerModal.tsx (100%) rename superset-frontend/src/{views/CRUD/annotationlayers => features/annotationLayers}/types.ts (100%) rename superset-frontend/src/{views/CRUD/annotation => features/annotations}/AnnotationModal.test.jsx (97%) rename superset-frontend/src/{views/CRUD/annotation => features/annotations}/AnnotationModal.tsx (100%) rename superset-frontend/src/{views/CRUD/annotation => features/annotations}/types.ts (100%) rename superset-frontend/src/{views/CRUD/chart => features/charts}/ChartCard.tsx (100%) rename superset-frontend/src/{views/CRUD/csstemplates => features/cssTemplates}/CssTemplateModal.test.jsx (97%) rename superset-frontend/src/{views/CRUD/csstemplates => features/cssTemplates}/CssTemplateModal.tsx (100%) rename superset-frontend/src/{views/CRUD/csstemplates => features/cssTemplates}/types.ts (100%) rename superset-frontend/src/{views/CRUD/dashboard => features/dashboards}/DashboardCard.tsx (100%) rename superset-frontend/src/{views/CRUD/dashboard => features/dashboards}/types.ts (100%) rename superset-frontend/src/{views/CRUD/data/database => features/databases}/DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx (100%) rename superset-frontend/src/{views/CRUD/data/database => features/databases}/DatabaseModal/DatabaseConnectionForm/EncryptedField.tsx (100%) rename superset-frontend/src/{views/CRUD/data/database => features/databases}/DatabaseModal/DatabaseConnectionForm/TableCatalog.tsx (100%) rename superset-frontend/src/{views/CRUD/data/database => features/databases}/DatabaseModal/DatabaseConnectionForm/ValidatedInputField.tsx (100%) rename superset-frontend/src/{views/CRUD/data/database => features/databases}/DatabaseModal/DatabaseConnectionForm/index.tsx (100%) rename superset-frontend/src/{views/CRUD/data/database => features/databases}/DatabaseModal/ExtraOptions.tsx (100%) rename superset-frontend/src/{views/CRUD/data/database => features/databases}/DatabaseModal/ModalHeader.tsx (100%) rename superset-frontend/src/{views/CRUD/data/database => features/databases}/DatabaseModal/SSHTunnelForm.tsx (99%) rename superset-frontend/src/{views/CRUD/data/database => features/databases}/DatabaseModal/SSHTunnelSwitch.tsx (100%) rename superset-frontend/src/{views/CRUD/data/database => features/databases}/DatabaseModal/SqlAlchemyForm.tsx (99%) rename superset-frontend/src/{views/CRUD/data/database => features/databases}/DatabaseModal/index.test.tsx (99%) rename superset-frontend/src/{views/CRUD/data/database => features/databases}/DatabaseModal/index.tsx (99%) rename superset-frontend/src/{views/CRUD/data/database => features/databases}/DatabaseModal/styles.ts (100%) rename superset-frontend/src/{views/CRUD/data/database => features/databases}/state.ts (100%) rename superset-frontend/src/{views/CRUD/data/database => features/databases}/types.ts (100%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/AddDataset/DatasetPanel/DatasetPanel.stories.tsx (100%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/AddDataset/DatasetPanel/DatasetPanel.test.tsx (98%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/AddDataset/DatasetPanel/DatasetPanel.tsx (99%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/AddDataset/DatasetPanel/MessageContent.tsx (100%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/AddDataset/DatasetPanel/fixtures.ts (94%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/AddDataset/DatasetPanel/index.tsx (98%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/AddDataset/DatasetPanel/types.ts (100%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/AddDataset/EditDataset/EditDataset.test.tsx (100%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/AddDataset/EditDataset/UsageTab/UsageTab.test.tsx (100%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/AddDataset/EditDataset/UsageTab/index.tsx (100%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/AddDataset/EditDataset/index.tsx (95%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/AddDataset/Footer/Footer.test.tsx (97%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/AddDataset/Footer/index.tsx (100%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/AddDataset/Header/Header.test.tsx (95%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/AddDataset/Header/index.tsx (96%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/AddDataset/LeftPanel/LeftPanel.test.tsx (98%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/AddDataset/LeftPanel/index.tsx (99%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/AddDataset/RightPanel/RightPanel.test.tsx (93%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/AddDataset/RightPanel/index.tsx (100%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/AddDataset/types.tsx (100%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/DatasetLayout/DatasetLayout.test.tsx (85%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/DatasetLayout/index.tsx (98%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/DuplicateDatasetModal.tsx (100%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/constants.ts (100%) rename superset-frontend/src/{views/CRUD/data/hooks.ts => features/datasets/hooks/useDatasetLists.ts} (54%) create mode 100644 superset-frontend/src/features/datasets/hooks/useGetDatasetRelatedCounts.ts rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/styles.ts (100%) rename superset-frontend/src/{views/CRUD/data/dataset => features/datasets}/types.ts (100%) rename superset-frontend/src/{views/CRUD/welcome => features/home}/ActivityTable.test.tsx (98%) rename superset-frontend/src/{views/CRUD/welcome => features/home}/ActivityTable.tsx (99%) rename superset-frontend/src/{views/CRUD/welcome => features/home}/ChartTable.test.tsx (98%) rename superset-frontend/src/{views/CRUD/welcome => features/home}/ChartTable.tsx (98%) rename superset-frontend/src/{views/CRUD/welcome => features/home}/DashboardTable.test.tsx (95%) rename superset-frontend/src/{views/CRUD/welcome => features/home}/DashboardTable.tsx (98%) rename superset-frontend/src/{views/CRUD/welcome => features/home}/EmptyState.test.tsx (97%) rename superset-frontend/src/{views/CRUD/welcome => features/home}/EmptyState.tsx (100%) rename superset-frontend/src/{views/components => features/home}/LanguagePicker.test.tsx (100%) rename superset-frontend/src/{views/components => features/home}/LanguagePicker.tsx (100%) rename superset-frontend/src/{views/components => features/home}/Menu.test.tsx (100%) rename superset-frontend/src/{views/components => features/home}/Menu.tsx (100%) rename superset-frontend/src/{views/components => features/home}/RightMenu.test.tsx (99%) rename superset-frontend/src/{views/components => features/home}/RightMenu.tsx (98%) rename superset-frontend/src/{views/CRUD/welcome => features/home}/SavedQueries.test.tsx (96%) rename superset-frontend/src/{views/CRUD/welcome => features/home}/SavedQueries.tsx (99%) rename superset-frontend/src/{views/components => features/home}/SubMenu.test.tsx (100%) rename superset-frontend/src/{views/components => features/home}/SubMenu.tsx (98%) rename superset-frontend/src/{views/CRUD/data/common.ts => features/home/commonMenuData.ts} (100%) rename superset-frontend/src/{views/components => features/home}/types.ts (85%) rename superset-frontend/src/{views/CRUD/data/query => features/queries}/QueryPreviewModal.test.tsx (98%) rename superset-frontend/src/{views/CRUD/data/query => features/queries}/QueryPreviewModal.tsx (97%) rename superset-frontend/src/{views/CRUD/data/savedquery => features/queries}/SavedQueryPreviewModal.test.jsx (97%) rename superset-frontend/src/{views/CRUD/data/savedquery => features/queries}/SavedQueryPreviewModal.tsx (96%) rename superset-frontend/src/{views/CRUD/data/components/SyntaxHighlighterCopy/index.tsx => features/queries/SyntaxHighlighterCopy.tsx} (100%) create mode 100644 superset-frontend/src/features/queries/hooks/useQueryPreviewState.ts rename superset-frontend/src/{views/CRUD => features}/tags/TagCard.tsx (98%) rename superset-frontend/src/{ => features/tags}/tags.ts (100%) delete mode 100644 superset-frontend/src/views/CRUD/welcome/types.ts diff --git a/superset-frontend/src/components/Datasource/ChangeDatasourceModal.tsx b/superset-frontend/src/components/Datasource/ChangeDatasourceModal.tsx index 5ec592680..b5b99e108 100644 --- a/superset-frontend/src/components/Datasource/ChangeDatasourceModal.tsx +++ b/superset-frontend/src/components/Datasource/ChangeDatasourceModal.tsx @@ -40,7 +40,7 @@ import { Input } from 'src/components/Input'; import { PAGE_SIZE as DATASET_PAGE_SIZE, SORT_BY as DATASET_SORT_BY, -} from 'src/views/CRUD/data/dataset/constants'; +} from 'src/features/datasets/constants'; import withToasts from 'src/components/MessageToasts/withToasts'; import FacePile from '../FacePile'; diff --git a/superset-frontend/src/components/ReportModal/HeaderReportDropdown/index.tsx b/superset-frontend/src/components/ReportModal/HeaderReportDropdown/index.tsx index e8426641d..6d141f941 100644 --- a/superset-frontend/src/components/ReportModal/HeaderReportDropdown/index.tsx +++ b/superset-frontend/src/components/ReportModal/HeaderReportDropdown/index.tsx @@ -31,7 +31,7 @@ import { } from '@superset-ui/core'; import Icons from 'src/components/Icons'; import { Switch } from 'src/components/Switch'; -import { AlertObject } from 'src/views/CRUD/alert/types'; +import { AlertObject } from 'src/features/alerts/types'; import { Menu } from 'src/components/Menu'; import Checkbox from 'src/components/Checkbox'; import { noOp } from 'src/utils/common'; diff --git a/superset-frontend/src/dashboard/components/PropertiesModal/index.tsx b/superset-frontend/src/dashboard/components/PropertiesModal/index.tsx index 22b273476..9b044519d 100644 --- a/superset-frontend/src/dashboard/components/PropertiesModal/index.tsx +++ b/superset-frontend/src/dashboard/components/PropertiesModal/index.tsx @@ -43,7 +43,12 @@ import { getClientErrorObject } from 'src/utils/getClientErrorObject'; import withToasts from 'src/components/MessageToasts/withToasts'; import { isFeatureEnabled } from 'src/featureFlags'; import TagType from 'src/types/TagType'; -import { addTag, deleteTaggedObjects, fetchTags, OBJECT_TYPES } from 'src/tags'; +import { + addTag, + deleteTaggedObjects, + fetchTags, + OBJECT_TYPES, +} from 'src/features/tags/tags'; import { loadTags } from 'src/components/Tags/utils'; const StyledFormItem = styled(FormItem)` diff --git a/superset-frontend/src/explore/components/PropertiesModal/index.tsx b/superset-frontend/src/explore/components/PropertiesModal/index.tsx index 4cfd4b600..f7763f1ff 100644 --- a/superset-frontend/src/explore/components/PropertiesModal/index.tsx +++ b/superset-frontend/src/explore/components/PropertiesModal/index.tsx @@ -34,7 +34,12 @@ import Chart, { Slice } from 'src/types/Chart'; import { getClientErrorObject } from 'src/utils/getClientErrorObject'; import withToasts from 'src/components/MessageToasts/withToasts'; import { loadTags } from 'src/components/Tags/utils'; -import { addTag, deleteTaggedObjects, fetchTags, OBJECT_TYPES } from 'src/tags'; +import { + addTag, + deleteTaggedObjects, + fetchTags, + OBJECT_TYPES, +} from 'src/features/tags/tags'; import TagType from 'src/types/TagType'; export type PropertiesModalProps = { diff --git a/superset-frontend/src/views/CRUD/alert/AlertReportModal.test.jsx b/superset-frontend/src/features/alerts/AlertReportModal.test.jsx similarity index 99% rename from superset-frontend/src/views/CRUD/alert/AlertReportModal.test.jsx rename to superset-frontend/src/features/alerts/AlertReportModal.test.jsx index a383c8be2..e7fb99797 100644 --- a/superset-frontend/src/views/CRUD/alert/AlertReportModal.test.jsx +++ b/superset-frontend/src/features/alerts/AlertReportModal.test.jsx @@ -22,7 +22,6 @@ import thunk from 'redux-thunk'; import configureStore from 'redux-mock-store'; import fetchMock from 'fetch-mock'; import { act } from 'react-dom/test-utils'; -import AlertReportModal from 'src/views/CRUD/alert/AlertReportModal'; import Modal from 'src/components/Modal'; import { Select, AsyncSelect } from 'src/components'; import { Switch } from 'src/components/Switch'; @@ -30,6 +29,7 @@ import { Radio } from 'src/components/Radio'; import TextAreaControl from 'src/explore/components/controls/TextAreaControl'; import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint'; import { styledMount as mount } from 'spec/helpers/theming'; +import AlertReportModal from './AlertReportModal'; const mockData = { active: true, diff --git a/superset-frontend/src/views/CRUD/alert/AlertReportModal.test.tsx b/superset-frontend/src/features/alerts/AlertReportModal.test.tsx similarity index 97% rename from superset-frontend/src/views/CRUD/alert/AlertReportModal.test.tsx rename to superset-frontend/src/features/alerts/AlertReportModal.test.tsx index 928b2e956..163b8e801 100644 --- a/superset-frontend/src/views/CRUD/alert/AlertReportModal.test.tsx +++ b/superset-frontend/src/features/alerts/AlertReportModal.test.tsx @@ -19,7 +19,7 @@ import React from 'react'; import { render, screen, waitFor } from 'spec/helpers/testing-library'; import userEvent from '@testing-library/user-event'; -import AlertReportModal from 'src/views/CRUD/alert/AlertReportModal'; +import AlertReportModal from './AlertReportModal'; test('allows change to None in log retention', async () => { render(, { useRedux: true }); diff --git a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx b/superset-frontend/src/features/alerts/AlertReportModal.tsx similarity index 99% rename from superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx rename to superset-frontend/src/features/alerts/AlertReportModal.tsx index b9d6223e6..ab78895a1 100644 --- a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx +++ b/superset-frontend/src/features/alerts/AlertReportModal.tsx @@ -45,7 +45,8 @@ import withToasts from 'src/components/MessageToasts/withToasts'; import Owner from 'src/types/Owner'; import { AntdCheckbox, AsyncSelect, Select } from 'src/components'; import TextAreaControl from 'src/explore/components/controls/TextAreaControl'; -import { useCommonConf } from 'src/views/CRUD/data/database/state'; +import { useCommonConf } from 'src/features/databases/state'; +import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls'; import { NotificationMethodOption, AlertObject, @@ -56,8 +57,7 @@ import { Operator, Recipient, AlertsReportsConfig, -} from 'src/views/CRUD/alert/types'; -import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls'; +} from 'src/features/alerts/types'; import { useSelector } from 'react-redux'; import { AlertReportCronScheduler } from './components/AlertReportCronScheduler'; import { NotificationMethod } from './components/NotificationMethod'; diff --git a/superset-frontend/src/views/CRUD/alert/components/AlertReportCronScheduler.test.tsx b/superset-frontend/src/features/alerts/components/AlertReportCronScheduler.test.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/alert/components/AlertReportCronScheduler.test.tsx rename to superset-frontend/src/features/alerts/components/AlertReportCronScheduler.test.tsx diff --git a/superset-frontend/src/views/CRUD/alert/components/AlertReportCronScheduler.tsx b/superset-frontend/src/features/alerts/components/AlertReportCronScheduler.tsx similarity index 97% rename from superset-frontend/src/views/CRUD/alert/components/AlertReportCronScheduler.tsx rename to superset-frontend/src/features/alerts/components/AlertReportCronScheduler.tsx index 9a7fa6214..143d1e1fb 100644 --- a/superset-frontend/src/views/CRUD/alert/components/AlertReportCronScheduler.tsx +++ b/superset-frontend/src/features/alerts/components/AlertReportCronScheduler.tsx @@ -23,7 +23,7 @@ import { AntdInput, RadioChangeEvent } from 'src/components'; import { Input } from 'src/components/Input'; import { Radio } from 'src/components/Radio'; import { CronPicker, CronError } from 'src/components/CronPicker'; -import { StyledInputContainer } from 'src/views/CRUD/alert/AlertReportModal'; +import { StyledInputContainer } from '../AlertReportModal'; export interface AlertReportCronSchedulerProps { value: string; diff --git a/superset-frontend/src/views/CRUD/alert/components/AlertStatusIcon.tsx b/superset-frontend/src/features/alerts/components/AlertStatusIcon.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/alert/components/AlertStatusIcon.tsx rename to superset-frontend/src/features/alerts/components/AlertStatusIcon.tsx diff --git a/superset-frontend/src/views/CRUD/alert/components/NotificationMethod.tsx b/superset-frontend/src/features/alerts/components/NotificationMethod.tsx similarity index 98% rename from superset-frontend/src/views/CRUD/alert/components/NotificationMethod.tsx rename to superset-frontend/src/features/alerts/components/NotificationMethod.tsx index 12b59a7af..528c7011d 100644 --- a/superset-frontend/src/views/CRUD/alert/components/NotificationMethod.tsx +++ b/superset-frontend/src/features/alerts/components/NotificationMethod.tsx @@ -20,7 +20,7 @@ import React, { FunctionComponent, useState } from 'react'; import { styled, t, useTheme } from '@superset-ui/core'; import { Select } from 'src/components'; import Icons from 'src/components/Icons'; -import { NotificationMethodOption } from 'src/views/CRUD/alert/types'; +import { NotificationMethodOption } from '../types'; import { StyledInputContainer } from '../AlertReportModal'; const StyledNotificationMethod = styled.div` diff --git a/superset-frontend/src/views/CRUD/alert/components/RecipientIcon.tsx b/superset-frontend/src/features/alerts/components/RecipientIcon.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/alert/components/RecipientIcon.tsx rename to superset-frontend/src/features/alerts/components/RecipientIcon.tsx diff --git a/superset-frontend/src/views/CRUD/alert/types.ts b/superset-frontend/src/features/alerts/types.ts similarity index 100% rename from superset-frontend/src/views/CRUD/alert/types.ts rename to superset-frontend/src/features/alerts/types.ts diff --git a/superset-frontend/src/views/CRUD/allentities/AllEntitiesTable.tsx b/superset-frontend/src/features/allEntities/AllEntitiesTable.tsx similarity index 97% rename from superset-frontend/src/views/CRUD/allentities/AllEntitiesTable.tsx rename to superset-frontend/src/features/allEntities/AllEntitiesTable.tsx index 648644ba1..79e1c11ec 100644 --- a/superset-frontend/src/views/CRUD/allentities/AllEntitiesTable.tsx +++ b/superset-frontend/src/features/allEntities/AllEntitiesTable.tsx @@ -21,8 +21,8 @@ import moment from 'moment'; import { t, styled, logging } from '@superset-ui/core'; import TableView, { EmptyWrapperType } from 'src/components/TableView'; import { addDangerToast } from 'src/components/MessageToasts/actions'; -import { fetchObjects } from '../../../tags'; -import Loading from '../../../components/Loading'; +import Loading from 'src/components/Loading'; +import { fetchObjects } from '../tags/tags'; const AllEntitiesTableContainer = styled.div` text-align: left; diff --git a/superset-frontend/src/views/CRUD/annotationlayers/AnnotationLayerModal.test.jsx b/superset-frontend/src/features/annotationLayers/AnnotationLayerModal.test.jsx similarity index 97% rename from superset-frontend/src/views/CRUD/annotationlayers/AnnotationLayerModal.test.jsx rename to superset-frontend/src/features/annotationLayers/AnnotationLayerModal.test.jsx index 878346fd6..f92220948 100644 --- a/superset-frontend/src/views/CRUD/annotationlayers/AnnotationLayerModal.test.jsx +++ b/superset-frontend/src/features/annotationLayers/AnnotationLayerModal.test.jsx @@ -21,10 +21,10 @@ import thunk from 'redux-thunk'; import configureStore from 'redux-mock-store'; import { Provider } from 'react-redux'; import fetchMock from 'fetch-mock'; -import AnnotationLayerModal from 'src/views/CRUD/annotationlayers/AnnotationLayerModal'; import Modal from 'src/components/Modal'; import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint'; import { styledMount as mount } from 'spec/helpers/theming'; +import AnnotationLayerModal from './AnnotationLayerModal'; const mockData = { id: 1, name: 'test', descr: 'test description' }; const FETCH_ANNOTATION_LAYER_ENDPOINT = 'glob:*/api/v1/annotation_layer/*'; diff --git a/superset-frontend/src/views/CRUD/annotationlayers/AnnotationLayerModal.tsx b/superset-frontend/src/features/annotationLayers/AnnotationLayerModal.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/annotationlayers/AnnotationLayerModal.tsx rename to superset-frontend/src/features/annotationLayers/AnnotationLayerModal.tsx diff --git a/superset-frontend/src/views/CRUD/annotationlayers/types.ts b/superset-frontend/src/features/annotationLayers/types.ts similarity index 100% rename from superset-frontend/src/views/CRUD/annotationlayers/types.ts rename to superset-frontend/src/features/annotationLayers/types.ts diff --git a/superset-frontend/src/views/CRUD/annotation/AnnotationModal.test.jsx b/superset-frontend/src/features/annotations/AnnotationModal.test.jsx similarity index 97% rename from superset-frontend/src/views/CRUD/annotation/AnnotationModal.test.jsx rename to superset-frontend/src/features/annotations/AnnotationModal.test.jsx index 4ba95fe3b..93183c7e6 100644 --- a/superset-frontend/src/views/CRUD/annotation/AnnotationModal.test.jsx +++ b/superset-frontend/src/features/annotations/AnnotationModal.test.jsx @@ -21,11 +21,11 @@ import thunk from 'redux-thunk'; import configureStore from 'redux-mock-store'; import { Provider } from 'react-redux'; import fetchMock from 'fetch-mock'; -import AnnotationModal from 'src/views/CRUD/annotation/AnnotationModal'; import Modal from 'src/components/Modal'; import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint'; import { JsonEditor } from 'src/components/AsyncAceEditor'; import { styledMount as mount } from 'spec/helpers/theming'; +import AnnotationModal from './AnnotationModal'; const mockData = { id: 1, diff --git a/superset-frontend/src/views/CRUD/annotation/AnnotationModal.tsx b/superset-frontend/src/features/annotations/AnnotationModal.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/annotation/AnnotationModal.tsx rename to superset-frontend/src/features/annotations/AnnotationModal.tsx diff --git a/superset-frontend/src/views/CRUD/annotation/types.ts b/superset-frontend/src/features/annotations/types.ts similarity index 100% rename from superset-frontend/src/views/CRUD/annotation/types.ts rename to superset-frontend/src/features/annotations/types.ts diff --git a/superset-frontend/src/views/CRUD/chart/ChartCard.tsx b/superset-frontend/src/features/charts/ChartCard.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/chart/ChartCard.tsx rename to superset-frontend/src/features/charts/ChartCard.tsx diff --git a/superset-frontend/src/views/CRUD/csstemplates/CssTemplateModal.test.jsx b/superset-frontend/src/features/cssTemplates/CssTemplateModal.test.jsx similarity index 97% rename from superset-frontend/src/views/CRUD/csstemplates/CssTemplateModal.test.jsx rename to superset-frontend/src/features/cssTemplates/CssTemplateModal.test.jsx index c503c709d..712e71321 100644 --- a/superset-frontend/src/views/CRUD/csstemplates/CssTemplateModal.test.jsx +++ b/superset-frontend/src/features/cssTemplates/CssTemplateModal.test.jsx @@ -21,11 +21,11 @@ import thunk from 'redux-thunk'; import { Provider } from 'react-redux'; import configureStore from 'redux-mock-store'; import fetchMock from 'fetch-mock'; -import CssTemplateModal from 'src/views/CRUD/csstemplates/CssTemplateModal'; import Modal from 'src/components/Modal'; import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint'; import { CssEditor } from 'src/components/AsyncAceEditor'; import { styledMount as mount } from 'spec/helpers/theming'; +import CssTemplateModal from './CssTemplateModal'; const mockData = { id: 1, template_name: 'test' }; const FETCH_CSS_TEMPLATE_ENDPOINT = 'glob:*/api/v1/css_template/*'; diff --git a/superset-frontend/src/views/CRUD/csstemplates/CssTemplateModal.tsx b/superset-frontend/src/features/cssTemplates/CssTemplateModal.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/csstemplates/CssTemplateModal.tsx rename to superset-frontend/src/features/cssTemplates/CssTemplateModal.tsx diff --git a/superset-frontend/src/views/CRUD/csstemplates/types.ts b/superset-frontend/src/features/cssTemplates/types.ts similarity index 100% rename from superset-frontend/src/views/CRUD/csstemplates/types.ts rename to superset-frontend/src/features/cssTemplates/types.ts diff --git a/superset-frontend/src/views/CRUD/dashboard/DashboardCard.tsx b/superset-frontend/src/features/dashboards/DashboardCard.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/dashboard/DashboardCard.tsx rename to superset-frontend/src/features/dashboards/DashboardCard.tsx diff --git a/superset-frontend/src/views/CRUD/dashboard/types.ts b/superset-frontend/src/features/dashboards/types.ts similarity index 100% rename from superset-frontend/src/views/CRUD/dashboard/types.ts rename to superset-frontend/src/features/dashboards/types.ts diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx b/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx rename to superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm/EncryptedField.tsx b/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/EncryptedField.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm/EncryptedField.tsx rename to superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/EncryptedField.tsx diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm/TableCatalog.tsx b/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/TableCatalog.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm/TableCatalog.tsx rename to superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/TableCatalog.tsx diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm/ValidatedInputField.tsx b/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/ValidatedInputField.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm/ValidatedInputField.tsx rename to superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/ValidatedInputField.tsx diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm/index.tsx b/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/index.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm/index.tsx rename to superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/index.tsx diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/ExtraOptions.tsx b/superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/data/database/DatabaseModal/ExtraOptions.tsx rename to superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.tsx diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/ModalHeader.tsx b/superset-frontend/src/features/databases/DatabaseModal/ModalHeader.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/data/database/DatabaseModal/ModalHeader.tsx rename to superset-frontend/src/features/databases/DatabaseModal/ModalHeader.tsx diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/SSHTunnelForm.tsx b/superset-frontend/src/features/databases/DatabaseModal/SSHTunnelForm.tsx similarity index 99% rename from superset-frontend/src/views/CRUD/data/database/DatabaseModal/SSHTunnelForm.tsx rename to superset-frontend/src/features/databases/DatabaseModal/SSHTunnelForm.tsx index 6cc0312b5..f708761a2 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/SSHTunnelForm.tsx +++ b/superset-frontend/src/features/databases/DatabaseModal/SSHTunnelForm.tsx @@ -24,7 +24,6 @@ import { Radio } from 'src/components/Radio'; import { Input, TextArea } from 'src/components/Input'; import { Input as AntdInput, Tooltip } from 'antd'; import { EyeInvisibleOutlined, EyeOutlined } from '@ant-design/icons'; - import { DatabaseObject } from '../types'; import { AuthType } from '.'; diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/SSHTunnelSwitch.tsx b/superset-frontend/src/features/databases/DatabaseModal/SSHTunnelSwitch.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/data/database/DatabaseModal/SSHTunnelSwitch.tsx rename to superset-frontend/src/features/databases/DatabaseModal/SSHTunnelSwitch.tsx diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/SqlAlchemyForm.tsx b/superset-frontend/src/features/databases/DatabaseModal/SqlAlchemyForm.tsx similarity index 99% rename from superset-frontend/src/views/CRUD/data/database/DatabaseModal/SqlAlchemyForm.tsx rename to superset-frontend/src/features/databases/DatabaseModal/SqlAlchemyForm.tsx index 003a26c9a..5d50625cd 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/SqlAlchemyForm.tsx +++ b/superset-frontend/src/features/databases/DatabaseModal/SqlAlchemyForm.tsx @@ -21,7 +21,6 @@ import { t, SupersetTheme } from '@superset-ui/core'; import SupersetText from 'src/utils/textUtils'; import Button from 'src/components/Button'; import { StyledInputContainer, wideButton } from './styles'; - import { DatabaseObject } from '../types'; const SqlAlchemyTab = ({ diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.test.tsx b/superset-frontend/src/features/databases/DatabaseModal/index.test.tsx similarity index 99% rename from superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.test.tsx rename to superset-frontend/src/features/databases/DatabaseModal/index.test.tsx index 32cc16b04..bcff047be 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.test.tsx +++ b/superset-frontend/src/features/databases/DatabaseModal/index.test.tsx @@ -27,13 +27,10 @@ import { act, waitFor, } from 'spec/helpers/testing-library'; -import { - DatabaseObject, - CONFIGURATION_METHOD, -} from 'src/views/CRUD/data/database/types'; import { getExtensionsRegistry } from '@superset-ui/core'; import setupExtensions from 'src/setup/setupExtensions'; import * as hooks from 'src/views/CRUD/hooks'; +import { DatabaseObject, CONFIGURATION_METHOD } from '../types'; import DatabaseModal, { dbReducer, DBReducerActionType, diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx b/superset-frontend/src/features/databases/DatabaseModal/index.tsx similarity index 99% rename from superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx rename to superset-frontend/src/features/databases/DatabaseModal/index.tsx index b90fc56d0..a14a851b6 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx +++ b/superset-frontend/src/features/databases/DatabaseModal/index.tsx @@ -54,7 +54,9 @@ import { getConnectionAlert, useImportResource, } from 'src/views/CRUD/hooks'; -import { useCommonConf } from 'src/views/CRUD/data/database/state'; +import { useCommonConf } from 'src/features/databases/state'; +import Loading from 'src/components/Loading'; +import { isEmpty, pick } from 'lodash'; import { DatabaseObject, DatabaseForm, @@ -62,9 +64,7 @@ import { CatalogObject, Engines, ExtraJson, -} from 'src/views/CRUD/data/database/types'; -import Loading from 'src/components/Loading'; -import { isEmpty, pick } from 'lodash'; +} from '../types'; import ExtraOptions from './ExtraOptions'; import SqlAlchemyForm from './SqlAlchemyForm'; import DatabaseConnectionForm from './DatabaseConnectionForm'; diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/styles.ts b/superset-frontend/src/features/databases/DatabaseModal/styles.ts similarity index 100% rename from superset-frontend/src/views/CRUD/data/database/DatabaseModal/styles.ts rename to superset-frontend/src/features/databases/DatabaseModal/styles.ts diff --git a/superset-frontend/src/views/CRUD/data/database/state.ts b/superset-frontend/src/features/databases/state.ts similarity index 100% rename from superset-frontend/src/views/CRUD/data/database/state.ts rename to superset-frontend/src/features/databases/state.ts diff --git a/superset-frontend/src/views/CRUD/data/database/types.ts b/superset-frontend/src/features/databases/types.ts similarity index 100% rename from superset-frontend/src/views/CRUD/data/database/types.ts rename to superset-frontend/src/features/databases/types.ts diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/DatasetPanel.stories.tsx b/superset-frontend/src/features/datasets/AddDataset/DatasetPanel/DatasetPanel.stories.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/DatasetPanel.stories.tsx rename to superset-frontend/src/features/datasets/AddDataset/DatasetPanel/DatasetPanel.stories.tsx diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/DatasetPanel.test.tsx b/superset-frontend/src/features/datasets/AddDataset/DatasetPanel/DatasetPanel.test.tsx similarity index 98% rename from superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/DatasetPanel.test.tsx rename to superset-frontend/src/features/datasets/AddDataset/DatasetPanel/DatasetPanel.test.tsx index b5a29638c..19262c91b 100644 --- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/DatasetPanel.test.tsx +++ b/superset-frontend/src/features/datasets/AddDataset/DatasetPanel/DatasetPanel.test.tsx @@ -23,7 +23,7 @@ import DatasetPanel, { ALT_LOADING, tableColumnDefinition, COLUMN_TITLE, -} from 'src/views/CRUD/data/dataset/AddDataset/DatasetPanel/DatasetPanel'; +} from 'src/features/datasets/AddDataset/DatasetPanel/DatasetPanel'; import { exampleColumns, exampleDataset } from './fixtures'; import { SELECT_MESSAGE, diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/DatasetPanel.tsx b/superset-frontend/src/features/datasets/AddDataset/DatasetPanel/DatasetPanel.tsx similarity index 99% rename from superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/DatasetPanel.tsx rename to superset-frontend/src/features/datasets/AddDataset/DatasetPanel/DatasetPanel.tsx index 8d579b79b..c49e48d3f 100644 --- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/DatasetPanel.tsx +++ b/superset-frontend/src/features/datasets/AddDataset/DatasetPanel/DatasetPanel.tsx @@ -24,7 +24,7 @@ import Table, { ColumnsType, TableSize } from 'src/components/Table'; import { alphabeticalSort } from 'src/components/Table/sorters'; // @ts-ignore import LOADING_GIF from 'src/assets/images/loading.gif'; -import { DatasetObject } from 'src/views/CRUD/data/dataset/AddDataset/types'; +import { DatasetObject } from 'src/features/datasets/AddDataset/types'; import { ITableColumn } from './types'; import MessageContent from './MessageContent'; diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/MessageContent.tsx b/superset-frontend/src/features/datasets/AddDataset/DatasetPanel/MessageContent.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/MessageContent.tsx rename to superset-frontend/src/features/datasets/AddDataset/DatasetPanel/MessageContent.tsx diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/fixtures.ts b/superset-frontend/src/features/datasets/AddDataset/DatasetPanel/fixtures.ts similarity index 94% rename from superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/fixtures.ts rename to superset-frontend/src/features/datasets/AddDataset/DatasetPanel/fixtures.ts index 5c09188c6..d3cecdd0d 100644 --- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/fixtures.ts +++ b/superset-frontend/src/features/datasets/AddDataset/DatasetPanel/fixtures.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { DatasetObject } from 'src/views/CRUD/data/dataset/AddDataset/types'; +import { DatasetObject } from 'src/features/datasets/AddDataset/types'; import { ITableColumn } from './types'; export const exampleColumns: ITableColumn[] = [ diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/index.tsx b/superset-frontend/src/features/datasets/AddDataset/DatasetPanel/index.tsx similarity index 98% rename from superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/index.tsx rename to superset-frontend/src/features/datasets/AddDataset/DatasetPanel/index.tsx index 73bea70b4..ef5797fb3 100644 --- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/index.tsx +++ b/superset-frontend/src/features/datasets/AddDataset/DatasetPanel/index.tsx @@ -18,7 +18,7 @@ */ import React, { useEffect, useState, useRef } from 'react'; import { SupersetClient, logging, t } from '@superset-ui/core'; -import { DatasetObject } from 'src/views/CRUD/data/dataset/AddDataset/types'; +import { DatasetObject } from 'src/features/datasets/AddDataset/types'; import { addDangerToast } from 'src/components/MessageToasts/actions'; import DatasetPanel from './DatasetPanel'; import { ITableColumn, IDatabaseTable, isIDatabaseTable } from './types'; diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/types.ts b/superset-frontend/src/features/datasets/AddDataset/DatasetPanel/types.ts similarity index 100% rename from superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/types.ts rename to superset-frontend/src/features/datasets/AddDataset/DatasetPanel/types.ts diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/EditDataset/EditDataset.test.tsx b/superset-frontend/src/features/datasets/AddDataset/EditDataset/EditDataset.test.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/data/dataset/AddDataset/EditDataset/EditDataset.test.tsx rename to superset-frontend/src/features/datasets/AddDataset/EditDataset/EditDataset.test.tsx diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/EditDataset/UsageTab/UsageTab.test.tsx b/superset-frontend/src/features/datasets/AddDataset/EditDataset/UsageTab/UsageTab.test.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/data/dataset/AddDataset/EditDataset/UsageTab/UsageTab.test.tsx rename to superset-frontend/src/features/datasets/AddDataset/EditDataset/UsageTab/UsageTab.test.tsx diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/EditDataset/UsageTab/index.tsx b/superset-frontend/src/features/datasets/AddDataset/EditDataset/UsageTab/index.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/data/dataset/AddDataset/EditDataset/UsageTab/index.tsx rename to superset-frontend/src/features/datasets/AddDataset/EditDataset/UsageTab/index.tsx diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/EditDataset/index.tsx b/superset-frontend/src/features/datasets/AddDataset/EditDataset/index.tsx similarity index 95% rename from superset-frontend/src/views/CRUD/data/dataset/AddDataset/EditDataset/index.tsx rename to superset-frontend/src/features/datasets/AddDataset/EditDataset/index.tsx index e8853cf04..81710c787 100644 --- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/EditDataset/index.tsx +++ b/superset-frontend/src/features/datasets/AddDataset/EditDataset/index.tsx @@ -18,7 +18,7 @@ */ import { styled, t } from '@superset-ui/core'; import React from 'react'; -import { useGetDatasetRelatedCounts } from 'src/views/CRUD/data/hooks'; +import useGetDatasetRelatedCounts from 'src/features/datasets/hooks/useGetDatasetRelatedCounts'; import Badge from 'src/components/Badge'; import Tabs from 'src/components/Tabs'; import UsageTab from './UsageTab'; diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/Footer.test.tsx b/superset-frontend/src/features/datasets/AddDataset/Footer/Footer.test.tsx similarity index 97% rename from superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/Footer.test.tsx rename to superset-frontend/src/features/datasets/AddDataset/Footer/Footer.test.tsx index a1818cdf2..2e577fea9 100644 --- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/Footer.test.tsx +++ b/superset-frontend/src/features/datasets/AddDataset/Footer/Footer.test.tsx @@ -18,7 +18,7 @@ */ import React from 'react'; import { render, screen } from 'spec/helpers/testing-library'; -import Footer from 'src/views/CRUD/data/dataset/AddDataset/Footer'; +import Footer from 'src/features/datasets/AddDataset/Footer'; const mockHistoryPush = jest.fn(); jest.mock('react-router-dom', () => ({ diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx b/superset-frontend/src/features/datasets/AddDataset/Footer/index.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx rename to superset-frontend/src/features/datasets/AddDataset/Footer/index.tsx diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Header/Header.test.tsx b/superset-frontend/src/features/datasets/AddDataset/Header/Header.test.tsx similarity index 95% rename from superset-frontend/src/views/CRUD/data/dataset/AddDataset/Header/Header.test.tsx rename to superset-frontend/src/features/datasets/AddDataset/Header/Header.test.tsx index 539181208..f2310ca4a 100644 --- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Header/Header.test.tsx +++ b/superset-frontend/src/features/datasets/AddDataset/Header/Header.test.tsx @@ -18,9 +18,7 @@ */ import React from 'react'; import { render, screen, waitFor } from 'spec/helpers/testing-library'; -import Header, { - DEFAULT_TITLE, -} from 'src/views/CRUD/data/dataset/AddDataset/Header'; +import Header, { DEFAULT_TITLE } from 'src/features/datasets/AddDataset/Header'; describe('Header', () => { const mockSetDataset = jest.fn(); diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Header/index.tsx b/superset-frontend/src/features/datasets/AddDataset/Header/index.tsx similarity index 96% rename from superset-frontend/src/views/CRUD/data/dataset/AddDataset/Header/index.tsx rename to superset-frontend/src/features/datasets/AddDataset/Header/index.tsx index 044221c3f..78669b2df 100644 --- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Header/index.tsx +++ b/superset-frontend/src/features/datasets/AddDataset/Header/index.tsx @@ -23,15 +23,15 @@ import Button from 'src/components/Button'; import Icons from 'src/components/Icons'; import { Menu } from 'src/components/Menu'; import { TooltipPlacement } from 'src/components/Tooltip'; +import { + DatasetActionType, + DSReducerActionType, +} from 'src/features/datasets/AddDataset/types'; import { HeaderComponentStyles, disabledSaveBtnStyles, StyledCreateDatasetTitle, -} from 'src/views/CRUD/data/dataset/styles'; -import { - DatasetActionType, - DSReducerActionType, -} from 'src/views/CRUD/data/dataset/AddDataset/types'; +} from '../../styles'; export const DEFAULT_TITLE = t('New dataset'); diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/LeftPanel.test.tsx b/superset-frontend/src/features/datasets/AddDataset/LeftPanel/LeftPanel.test.tsx similarity index 98% rename from superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/LeftPanel.test.tsx rename to superset-frontend/src/features/datasets/AddDataset/LeftPanel/LeftPanel.test.tsx index f9174e199..604e3e9d9 100644 --- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/LeftPanel.test.tsx +++ b/superset-frontend/src/features/datasets/AddDataset/LeftPanel/LeftPanel.test.tsx @@ -20,8 +20,8 @@ import React from 'react'; import fetchMock from 'fetch-mock'; import userEvent from '@testing-library/user-event'; import { render, screen, waitFor } from 'spec/helpers/testing-library'; -import LeftPanel from 'src/views/CRUD/data/dataset/AddDataset/LeftPanel'; -import { exampleDataset } from 'src/views/CRUD/data/dataset/AddDataset/DatasetPanel/fixtures'; +import LeftPanel from 'src/features/datasets/AddDataset/LeftPanel'; +import { exampleDataset } from 'src/features/datasets/AddDataset/DatasetPanel/fixtures'; const databasesEndpoint = 'glob:*/api/v1/database/?q*'; const schemasEndpoint = 'glob:*/api/v1/database/*/schemas*'; diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx b/superset-frontend/src/features/datasets/AddDataset/LeftPanel/index.tsx similarity index 99% rename from superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx rename to superset-frontend/src/features/datasets/AddDataset/LeftPanel/index.tsx index 1d1d3847a..90ec55583 100644 --- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx +++ b/superset-frontend/src/features/datasets/AddDataset/LeftPanel/index.tsx @@ -51,7 +51,7 @@ import { LocalStorageKeys, getItem } from 'src/utils/localStorageHelpers'; import { DatasetActionType, DatasetObject, -} from 'src/views/CRUD/data/dataset/AddDataset/types'; +} from 'src/features/datasets/AddDataset/types'; interface LeftPanelProps { setDataset: Dispatch>; diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/RightPanel/RightPanel.test.tsx b/superset-frontend/src/features/datasets/AddDataset/RightPanel/RightPanel.test.tsx similarity index 93% rename from superset-frontend/src/views/CRUD/data/dataset/AddDataset/RightPanel/RightPanel.test.tsx rename to superset-frontend/src/features/datasets/AddDataset/RightPanel/RightPanel.test.tsx index 987d96abf..34b6ec25d 100644 --- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/RightPanel/RightPanel.test.tsx +++ b/superset-frontend/src/features/datasets/AddDataset/RightPanel/RightPanel.test.tsx @@ -18,7 +18,7 @@ */ import React from 'react'; import { render, screen } from 'spec/helpers/testing-library'; -import RightPanel from 'src/views/CRUD/data/dataset/AddDataset/RightPanel'; +import RightPanel from 'src/features/datasets/AddDataset/RightPanel'; describe('RightPanel', () => { it('renders a blank state RightPanel', () => { diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/RightPanel/index.tsx b/superset-frontend/src/features/datasets/AddDataset/RightPanel/index.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/data/dataset/AddDataset/RightPanel/index.tsx rename to superset-frontend/src/features/datasets/AddDataset/RightPanel/index.tsx diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/types.tsx b/superset-frontend/src/features/datasets/AddDataset/types.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/data/dataset/AddDataset/types.tsx rename to superset-frontend/src/features/datasets/AddDataset/types.tsx diff --git a/superset-frontend/src/views/CRUD/data/dataset/DatasetLayout/DatasetLayout.test.tsx b/superset-frontend/src/features/datasets/DatasetLayout/DatasetLayout.test.tsx similarity index 85% rename from superset-frontend/src/views/CRUD/data/dataset/DatasetLayout/DatasetLayout.test.tsx rename to superset-frontend/src/features/datasets/DatasetLayout/DatasetLayout.test.tsx index a1939761a..a851b2b3b 100644 --- a/superset-frontend/src/views/CRUD/data/dataset/DatasetLayout/DatasetLayout.test.tsx +++ b/superset-frontend/src/features/datasets/DatasetLayout/DatasetLayout.test.tsx @@ -18,12 +18,12 @@ */ import React from 'react'; import { render, screen, waitFor } from 'spec/helpers/testing-library'; -import DatasetLayout from 'src/views/CRUD/data/dataset/DatasetLayout'; -import Header from 'src/views/CRUD/data/dataset/AddDataset/Header'; -import LeftPanel from 'src/views/CRUD/data/dataset/AddDataset/LeftPanel'; -import DatasetPanel from 'src/views/CRUD/data/dataset/AddDataset/DatasetPanel'; -import RightPanel from 'src/views/CRUD/data/dataset/AddDataset/RightPanel'; -import Footer from 'src/views/CRUD/data/dataset/AddDataset/Footer'; +import DatasetLayout from 'src/features/datasets/DatasetLayout'; +import Header from 'src/features/datasets/AddDataset/Header'; +import LeftPanel from 'src/features/datasets/AddDataset/LeftPanel'; +import DatasetPanel from 'src/features/datasets/AddDataset/DatasetPanel'; +import RightPanel from 'src/features/datasets/AddDataset/RightPanel'; +import Footer from 'src/features/datasets/AddDataset/Footer'; const mockHistoryPush = jest.fn(); jest.mock('react-router-dom', () => ({ diff --git a/superset-frontend/src/views/CRUD/data/dataset/DatasetLayout/index.tsx b/superset-frontend/src/features/datasets/DatasetLayout/index.tsx similarity index 98% rename from superset-frontend/src/views/CRUD/data/dataset/DatasetLayout/index.tsx rename to superset-frontend/src/features/datasets/DatasetLayout/index.tsx index 7702efcb5..d264fab06 100644 --- a/superset-frontend/src/views/CRUD/data/dataset/DatasetLayout/index.tsx +++ b/superset-frontend/src/features/datasets/DatasetLayout/index.tsx @@ -29,7 +29,7 @@ import { StyledLayoutDatasetPanel, StyledLayoutRightPanel, StyledLayoutFooter, -} from 'src/views/CRUD/data/dataset/styles'; +} from '../styles'; interface DatasetLayoutProps { header?: ReactElement> | null; diff --git a/superset-frontend/src/views/CRUD/data/dataset/DuplicateDatasetModal.tsx b/superset-frontend/src/features/datasets/DuplicateDatasetModal.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/data/dataset/DuplicateDatasetModal.tsx rename to superset-frontend/src/features/datasets/DuplicateDatasetModal.tsx diff --git a/superset-frontend/src/views/CRUD/data/dataset/constants.ts b/superset-frontend/src/features/datasets/constants.ts similarity index 100% rename from superset-frontend/src/views/CRUD/data/dataset/constants.ts rename to superset-frontend/src/features/datasets/constants.ts diff --git a/superset-frontend/src/views/CRUD/data/hooks.ts b/superset-frontend/src/features/datasets/hooks/useDatasetLists.ts similarity index 54% rename from superset-frontend/src/views/CRUD/data/hooks.ts rename to superset-frontend/src/features/datasets/hooks/useDatasetLists.ts index 4e7a51de3..1c4b00df2 100644 --- a/superset-frontend/src/views/CRUD/data/hooks.ts +++ b/superset-frontend/src/features/datasets/hooks/useDatasetLists.ts @@ -20,70 +20,13 @@ import { useState, useEffect, useCallback } from 'react'; import { SupersetClient, logging, t } from '@superset-ui/core'; import rison from 'rison'; import { addDangerToast } from 'src/components/MessageToasts/actions'; -import { DatasetObject } from 'src/views/CRUD/data/dataset/AddDataset/types'; +import { DatasetObject } from 'src/features/datasets/AddDataset/types'; import { DatabaseObject } from 'src/components/DatabaseSelector'; -type BaseQueryObject = { - id: number; -}; - -export function useQueryPreviewState({ - queries, - fetchData, - currentQueryId, -}: { - queries: D[]; - fetchData: (id: number) => any; - currentQueryId: number; -}) { - const index = queries.findIndex(query => query.id === currentQueryId); - const [currentIndex, setCurrentIndex] = useState(index); - const [disablePrevious, setDisablePrevious] = useState(false); - const [disableNext, setDisableNext] = useState(false); - - function checkIndex() { - setDisablePrevious(currentIndex === 0); - setDisableNext(currentIndex === queries.length - 1); - } - - function handleDataChange(previous: boolean) { - const offset = previous ? -1 : 1; - const index = currentIndex + offset; - if (index >= 0 && index < queries.length) { - fetchData(queries[index].id); - setCurrentIndex(index); - checkIndex(); - } - } - - function handleKeyPress(ev: any) { - if (currentIndex >= 0 && currentIndex < queries.length) { - if (ev.key === 'ArrowDown' || ev.key === 'k') { - ev.preventDefault(); - handleDataChange(false); - } else if (ev.key === 'ArrowUp' || ev.key === 'j') { - ev.preventDefault(); - handleDataChange(true); - } - } - } - - useEffect(() => { - checkIndex(); - }); - - return { - handleKeyPress, - handleDataChange, - disablePrevious, - disableNext, - }; -} - /** * Retrieves all pages of dataset results */ -export const useDatasetsList = ( +const useDatasetsList = ( db: | (DatabaseObject & { owners: [number]; @@ -145,34 +88,4 @@ export const useDatasetsList = ( return { datasets, datasetNames }; }; -export const useGetDatasetRelatedCounts = (id: string) => { - const [usageCount, setUsageCount] = useState(0); - - const getDatasetRelatedObjects = useCallback( - () => - SupersetClient.get({ - endpoint: `/api/v1/dataset/${id}/related_objects`, - }) - .then(({ json }) => { - setUsageCount(json?.charts.count); - }) - .catch(error => { - addDangerToast( - t(`There was an error fetching dataset's related objects`), - ); - logging.error(error); - }), - [id], - ); - - useEffect(() => { - // Todo: this useEffect should be used to call all count methods conncurently - // when we populate data for the new tabs. For right separating out this - // api call for building the usage page. - if (id) { - getDatasetRelatedObjects(); - } - }, [id, getDatasetRelatedObjects]); - - return { usageCount }; -}; +export default useDatasetsList; diff --git a/superset-frontend/src/features/datasets/hooks/useGetDatasetRelatedCounts.ts b/superset-frontend/src/features/datasets/hooks/useGetDatasetRelatedCounts.ts new file mode 100644 index 000000000..470345b77 --- /dev/null +++ b/superset-frontend/src/features/datasets/hooks/useGetDatasetRelatedCounts.ts @@ -0,0 +1,55 @@ +/** + * 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. + */ +import { useState, useEffect, useCallback } from 'react'; +import { SupersetClient, logging, t } from '@superset-ui/core'; +import { addDangerToast } from 'src/components/MessageToasts/actions'; + +const useGetDatasetRelatedCounts = (id: string) => { + const [usageCount, setUsageCount] = useState(0); + + const getDatasetRelatedObjects = useCallback( + () => + SupersetClient.get({ + endpoint: `/api/v1/dataset/${id}/related_objects`, + }) + .then(({ json }) => { + setUsageCount(json?.charts.count); + }) + .catch(error => { + addDangerToast( + t(`There was an error fetching dataset's related objects`), + ); + logging.error(error); + }), + [id], + ); + + useEffect(() => { + // Todo: this useEffect should be used to call all count methods conncurently + // when we populate data for the new tabs. For right separating out this + // api call for building the usage page. + if (id) { + getDatasetRelatedObjects(); + } + }, [id, getDatasetRelatedObjects]); + + return { usageCount }; +}; + +export default useGetDatasetRelatedCounts; diff --git a/superset-frontend/src/views/CRUD/data/dataset/styles.ts b/superset-frontend/src/features/datasets/styles.ts similarity index 100% rename from superset-frontend/src/views/CRUD/data/dataset/styles.ts rename to superset-frontend/src/features/datasets/styles.ts diff --git a/superset-frontend/src/views/CRUD/data/dataset/types.ts b/superset-frontend/src/features/datasets/types.ts similarity index 100% rename from superset-frontend/src/views/CRUD/data/dataset/types.ts rename to superset-frontend/src/features/datasets/types.ts diff --git a/superset-frontend/src/views/CRUD/welcome/ActivityTable.test.tsx b/superset-frontend/src/features/home/ActivityTable.test.tsx similarity index 98% rename from superset-frontend/src/views/CRUD/welcome/ActivityTable.test.tsx rename to superset-frontend/src/features/home/ActivityTable.test.tsx index 66d521f36..65ef15ee2 100644 --- a/superset-frontend/src/views/CRUD/welcome/ActivityTable.test.tsx +++ b/superset-frontend/src/features/home/ActivityTable.test.tsx @@ -24,8 +24,8 @@ import { Provider } from 'react-redux'; import fetchMock from 'fetch-mock'; import thunk from 'redux-thunk'; import configureStore from 'redux-mock-store'; -import ActivityTable from 'src/views/CRUD/welcome/ActivityTable'; import { TableTab } from 'src/views/CRUD/types'; +import ActivityTable from './ActivityTable'; const mockStore = configureStore([thunk]); const store = mockStore({}); diff --git a/superset-frontend/src/views/CRUD/welcome/ActivityTable.tsx b/superset-frontend/src/features/home/ActivityTable.tsx similarity index 99% rename from superset-frontend/src/views/CRUD/welcome/ActivityTable.tsx rename to superset-frontend/src/features/home/ActivityTable.tsx index 08c18f765..22a6f597c 100644 --- a/superset-frontend/src/views/CRUD/welcome/ActivityTable.tsx +++ b/superset-frontend/src/features/home/ActivityTable.tsx @@ -22,7 +22,6 @@ import { styled, t } from '@superset-ui/core'; import { setItem, LocalStorageKeys } from 'src/utils/localStorageHelpers'; 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/pages/Home'; import { @@ -31,9 +30,8 @@ import { getEditedObjects, } from 'src/views/CRUD/utils'; import { Chart } from 'src/types/Chart'; - import Icons from 'src/components/Icons'; - +import SubMenu from './SubMenu'; import EmptyState from './EmptyState'; import { WelcomeTable } from './types'; diff --git a/superset-frontend/src/views/CRUD/welcome/ChartTable.test.tsx b/superset-frontend/src/features/home/ChartTable.test.tsx similarity index 98% rename from superset-frontend/src/views/CRUD/welcome/ChartTable.test.tsx rename to superset-frontend/src/features/home/ChartTable.test.tsx index 45e348302..ee6160bc2 100644 --- a/superset-frontend/src/views/CRUD/welcome/ChartTable.test.tsx +++ b/superset-frontend/src/features/home/ChartTable.test.tsx @@ -21,11 +21,10 @@ import { styledMount as mount } from 'spec/helpers/theming'; import thunk from 'redux-thunk'; import fetchMock from 'fetch-mock'; import configureStore from 'redux-mock-store'; - import { act } from 'react-dom/test-utils'; -import ChartTable from 'src/views/CRUD/welcome/ChartTable'; import { ReactWrapper } from 'enzyme'; import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint'; +import ChartTable from './ChartTable'; const mockStore = configureStore([thunk]); const store = mockStore({}); diff --git a/superset-frontend/src/views/CRUD/welcome/ChartTable.tsx b/superset-frontend/src/features/home/ChartTable.tsx similarity index 98% rename from superset-frontend/src/views/CRUD/welcome/ChartTable.tsx rename to superset-frontend/src/features/home/ChartTable.tsx index d0d4db410..c84a0c81c 100644 --- a/superset-frontend/src/views/CRUD/welcome/ChartTable.tsx +++ b/superset-frontend/src/features/home/ChartTable.tsx @@ -40,14 +40,14 @@ import { PAGE_SIZE, } from 'src/views/CRUD/utils'; import { LoadingCards } from 'src/pages/Home'; -import ChartCard from 'src/views/CRUD/chart/ChartCard'; +import ChartCard from 'src/features/charts/ChartCard'; import Chart from 'src/types/Chart'; import handleResourceExport from 'src/utils/export'; import Loading from 'src/components/Loading'; import ErrorBoundary from 'src/components/ErrorBoundary'; -import SubMenu from 'src/views/components/SubMenu'; import EmptyState from './EmptyState'; import { WelcomeTable } from './types'; +import SubMenu from './SubMenu'; interface ChartTableProps { addDangerToast: (message: string) => void; diff --git a/superset-frontend/src/views/CRUD/welcome/DashboardTable.test.tsx b/superset-frontend/src/features/home/DashboardTable.test.tsx similarity index 95% rename from superset-frontend/src/views/CRUD/welcome/DashboardTable.test.tsx rename to superset-frontend/src/features/home/DashboardTable.test.tsx index 79f88e312..3e2a33d56 100644 --- a/superset-frontend/src/views/CRUD/welcome/DashboardTable.test.tsx +++ b/superset-frontend/src/features/home/DashboardTable.test.tsx @@ -24,8 +24,8 @@ import fetchMock from 'fetch-mock'; import { act } from 'react-dom/test-utils'; import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint'; -import DashboardTable from 'src/views/CRUD/welcome/DashboardTable'; -import DashboardCard from 'src/views/CRUD/dashboard/DashboardCard'; +import DashboardCard from 'src/features/dashboards/DashboardCard'; +import DashboardTable from './DashboardTable'; // store needed for withToasts(DashboardTable) const mockStore = configureStore([thunk]); diff --git a/superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx b/superset-frontend/src/features/home/DashboardTable.tsx similarity index 98% rename from superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx rename to superset-frontend/src/features/home/DashboardTable.tsx index b38b0b847..36ea29e95 100644 --- a/superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx +++ b/superset-frontend/src/features/home/DashboardTable.tsx @@ -40,9 +40,9 @@ import withToasts from 'src/components/MessageToasts/withToasts'; import Loading from 'src/components/Loading'; import DeleteModal from 'src/components/DeleteModal'; import PropertiesModal from 'src/dashboard/components/PropertiesModal'; -import DashboardCard from 'src/views/CRUD/dashboard/DashboardCard'; -import SubMenu from 'src/views/components/SubMenu'; +import DashboardCard from 'src/features/dashboards/DashboardCard'; import EmptyState from './EmptyState'; +import SubMenu from './SubMenu'; import { WelcomeTable } from './types'; function DashboardTable({ diff --git a/superset-frontend/src/views/CRUD/welcome/EmptyState.test.tsx b/superset-frontend/src/features/home/EmptyState.test.tsx similarity index 97% rename from superset-frontend/src/views/CRUD/welcome/EmptyState.test.tsx rename to superset-frontend/src/features/home/EmptyState.test.tsx index fb8ae48ee..14b9cba4e 100644 --- a/superset-frontend/src/views/CRUD/welcome/EmptyState.test.tsx +++ b/superset-frontend/src/features/home/EmptyState.test.tsx @@ -19,7 +19,7 @@ import React from 'react'; import { styledMount as mount } from 'spec/helpers/theming'; import { TableTab } from 'src/views/CRUD/types'; -import EmptyState, { EmptyStateProps } from 'src/views/CRUD/welcome/EmptyState'; +import EmptyState, { EmptyStateProps } from './EmptyState'; import { WelcomeTable } from './types'; describe('EmptyState', () => { diff --git a/superset-frontend/src/views/CRUD/welcome/EmptyState.tsx b/superset-frontend/src/features/home/EmptyState.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/welcome/EmptyState.tsx rename to superset-frontend/src/features/home/EmptyState.tsx diff --git a/superset-frontend/src/views/components/LanguagePicker.test.tsx b/superset-frontend/src/features/home/LanguagePicker.test.tsx similarity index 100% rename from superset-frontend/src/views/components/LanguagePicker.test.tsx rename to superset-frontend/src/features/home/LanguagePicker.test.tsx diff --git a/superset-frontend/src/views/components/LanguagePicker.tsx b/superset-frontend/src/features/home/LanguagePicker.tsx similarity index 100% rename from superset-frontend/src/views/components/LanguagePicker.tsx rename to superset-frontend/src/features/home/LanguagePicker.tsx diff --git a/superset-frontend/src/views/components/Menu.test.tsx b/superset-frontend/src/features/home/Menu.test.tsx similarity index 100% rename from superset-frontend/src/views/components/Menu.test.tsx rename to superset-frontend/src/features/home/Menu.test.tsx diff --git a/superset-frontend/src/views/components/Menu.tsx b/superset-frontend/src/features/home/Menu.tsx similarity index 100% rename from superset-frontend/src/views/components/Menu.tsx rename to superset-frontend/src/features/home/Menu.tsx diff --git a/superset-frontend/src/views/components/RightMenu.test.tsx b/superset-frontend/src/features/home/RightMenu.test.tsx similarity index 99% rename from superset-frontend/src/views/components/RightMenu.test.tsx rename to superset-frontend/src/features/home/RightMenu.test.tsx index 907c305ff..95d61def4 100644 --- a/superset-frontend/src/views/components/RightMenu.test.tsx +++ b/superset-frontend/src/features/home/RightMenu.test.tsx @@ -29,7 +29,7 @@ jest.mock('react-redux', () => ({ useSelector: jest.fn(), })); -jest.mock('src/views/CRUD/data/database/DatabaseModal', () => () => ); +jest.mock('src/features/databases/DatabaseModal', () => () => ); const dropdownItems = [ { diff --git a/superset-frontend/src/views/components/RightMenu.tsx b/superset-frontend/src/features/home/RightMenu.tsx similarity index 98% rename from superset-frontend/src/views/components/RightMenu.tsx rename to superset-frontend/src/features/home/RightMenu.tsx index e245096f4..d0b8e44ab 100644 --- a/superset-frontend/src/views/components/RightMenu.tsx +++ b/superset-frontend/src/features/home/RightMenu.tsx @@ -44,9 +44,9 @@ import { MenuObjectChildProps, } from 'src/types/bootstrapTypes'; import { RootState } from 'src/dashboard/types'; +import DatabaseModal from 'src/features/databases/DatabaseModal'; +import { uploadUserPerms } from 'src/views/CRUD/utils'; import LanguagePicker from './LanguagePicker'; -import DatabaseModal from '../CRUD/data/database/DatabaseModal'; -import { uploadUserPerms } from '../CRUD/utils'; import { ExtensionConfigs, GlobalMenuDataOptions, @@ -67,10 +67,9 @@ const StyledI = styled.div` `; const styledDisabled = (theme: SupersetTheme) => css` - color: ${theme.colors.grayscale.base}; - backgroundColor: ${theme.colors.grayscale.light2}}; - .ant-menu-item:hover { - color: ${theme.colors.grayscale.base}; + color: ${theme.colors.grayscale.light1}; + .ant-menu-item-active { + color: ${theme.colors.grayscale.light1}; cursor: default; } `; diff --git a/superset-frontend/src/views/CRUD/welcome/SavedQueries.test.tsx b/superset-frontend/src/features/home/SavedQueries.test.tsx similarity index 96% rename from superset-frontend/src/views/CRUD/welcome/SavedQueries.test.tsx rename to superset-frontend/src/features/home/SavedQueries.test.tsx index f656a9e8e..3d9c16f80 100644 --- a/superset-frontend/src/views/CRUD/welcome/SavedQueries.test.tsx +++ b/superset-frontend/src/features/home/SavedQueries.test.tsx @@ -22,10 +22,9 @@ import { styledMount as mount } from 'spec/helpers/theming'; import fetchMock from 'fetch-mock'; import configureStore from 'redux-mock-store'; import { act } from 'react-dom/test-utils'; - import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint'; -import SubMenu from 'src/views/components/SubMenu'; -import SavedQueries from 'src/views/CRUD/welcome/SavedQueries'; +import SubMenu from './SubMenu'; +import SavedQueries from './SavedQueries'; // store needed for withToasts(DashboardTable) const mockStore = configureStore([thunk]); diff --git a/superset-frontend/src/views/CRUD/welcome/SavedQueries.tsx b/superset-frontend/src/features/home/SavedQueries.tsx similarity index 99% rename from superset-frontend/src/views/CRUD/welcome/SavedQueries.tsx rename to superset-frontend/src/features/home/SavedQueries.tsx index c7d43b0e4..9417f03be 100644 --- a/superset-frontend/src/views/CRUD/welcome/SavedQueries.tsx +++ b/superset-frontend/src/features/home/SavedQueries.tsx @@ -30,16 +30,16 @@ import { copyQueryLink, useListViewResource } from 'src/views/CRUD/hooks'; import ListViewCard from 'src/components/ListViewCard'; import DeleteModal from 'src/components/DeleteModal'; import Icons from 'src/components/Icons'; -import SubMenu from 'src/views/components/SubMenu'; import { User } from 'src/types/bootstrapTypes'; -import EmptyState from './EmptyState'; import { CardContainer, createErrorHandler, getFilterValues, PAGE_SIZE, shortenSQL, -} from '../utils'; +} from 'src/views/CRUD/utils'; +import SubMenu from './SubMenu'; +import EmptyState from './EmptyState'; import { WelcomeTable } from './types'; SyntaxHighlighter.registerLanguage('sql', sql); diff --git a/superset-frontend/src/views/components/SubMenu.test.tsx b/superset-frontend/src/features/home/SubMenu.test.tsx similarity index 100% rename from superset-frontend/src/views/components/SubMenu.test.tsx rename to superset-frontend/src/features/home/SubMenu.test.tsx diff --git a/superset-frontend/src/views/components/SubMenu.tsx b/superset-frontend/src/features/home/SubMenu.tsx similarity index 98% rename from superset-frontend/src/views/components/SubMenu.tsx rename to superset-frontend/src/features/home/SubMenu.tsx index 4d21c0f3a..e5b9f7090 100644 --- a/superset-frontend/src/views/components/SubMenu.tsx +++ b/superset-frontend/src/features/home/SubMenu.tsx @@ -161,11 +161,10 @@ const StyledHeader = styled.div` `; const styledDisabled = (theme: SupersetTheme) => css` - color: ${theme.colors.grayscale.base}; - backgroundColor: ${theme.colors.grayscale.light2}}; + color: ${theme.colors.grayscale.light1}; - .ant-menu-item:hover { - color: ${theme.colors.grayscale.base}; + .ant-menu-item-active { + color: ${theme.colors.grayscale.light1}; cursor: default; } `; diff --git a/superset-frontend/src/views/CRUD/data/common.ts b/superset-frontend/src/features/home/commonMenuData.ts similarity index 100% rename from superset-frontend/src/views/CRUD/data/common.ts rename to superset-frontend/src/features/home/commonMenuData.ts diff --git a/superset-frontend/src/views/components/types.ts b/superset-frontend/src/features/home/types.ts similarity index 85% rename from superset-frontend/src/views/components/types.ts rename to superset-frontend/src/features/home/types.ts index 2cdc3ae92..59a3c2668 100644 --- a/superset-frontend/src/views/components/types.ts +++ b/superset-frontend/src/features/home/types.ts @@ -17,8 +17,18 @@ * under the License. */ +import { Filter } from 'src/views/CRUD/types'; import { NavBarProps, MenuObjectProps } from 'src/types/bootstrapTypes'; +export enum WelcomeTable { + Charts = 'CHARTS', + Dashboards = 'DASHBOARDS', + Recents = 'RECENTS', + SavedQueries = 'SAVED_QUERIES', +} + +export type WelcomePageLastTab = 'examples' | 'all' | [string, Filter[]]; + export interface ExtensionConfigs { ALLOWED_EXTENSIONS: Array; CSV_EXTENSIONS: Array; diff --git a/superset-frontend/src/views/CRUD/data/query/QueryPreviewModal.test.tsx b/superset-frontend/src/features/queries/QueryPreviewModal.test.tsx similarity index 98% rename from superset-frontend/src/views/CRUD/data/query/QueryPreviewModal.test.tsx rename to superset-frontend/src/features/queries/QueryPreviewModal.test.tsx index 96498f6e6..f6501877c 100644 --- a/superset-frontend/src/views/CRUD/data/query/QueryPreviewModal.test.tsx +++ b/superset-frontend/src/features/queries/QueryPreviewModal.test.tsx @@ -23,11 +23,11 @@ import configureStore from 'redux-mock-store'; import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint'; import { styledMount as mount } from 'spec/helpers/theming'; -import QueryPreviewModal from 'src/views/CRUD/data/query/QueryPreviewModal'; import { QueryObject } from 'src/views/CRUD/types'; import SyntaxHighlighter from 'react-syntax-highlighter/dist/cjs/light'; import { act } from 'react-dom/test-utils'; import { QueryState } from '@superset-ui/core'; +import QueryPreviewModal from './QueryPreviewModal'; // store needed for withToasts const mockStore = configureStore([thunk]); diff --git a/superset-frontend/src/views/CRUD/data/query/QueryPreviewModal.tsx b/superset-frontend/src/features/queries/QueryPreviewModal.tsx similarity index 97% rename from superset-frontend/src/views/CRUD/data/query/QueryPreviewModal.tsx rename to superset-frontend/src/features/queries/QueryPreviewModal.tsx index e8d7b5e20..fccdeb7b9 100644 --- a/superset-frontend/src/views/CRUD/data/query/QueryPreviewModal.tsx +++ b/superset-frontend/src/features/queries/QueryPreviewModal.tsx @@ -24,8 +24,8 @@ import Button from 'src/components/Button'; import withToasts, { ToastProps, } from 'src/components/MessageToasts/withToasts'; -import SyntaxHighlighterCopy from 'src/views/CRUD/data/components/SyntaxHighlighterCopy'; -import { useQueryPreviewState } from 'src/views/CRUD/data/hooks'; +import SyntaxHighlighterCopy from 'src/features/queries/SyntaxHighlighterCopy'; +import useQueryPreviewState from 'src/features/queries/hooks/useQueryPreviewState'; import { QueryObject } from 'src/views/CRUD/types'; const QueryTitle = styled.div` diff --git a/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryPreviewModal.test.jsx b/superset-frontend/src/features/queries/SavedQueryPreviewModal.test.jsx similarity index 97% rename from superset-frontend/src/views/CRUD/data/savedquery/SavedQueryPreviewModal.test.jsx rename to superset-frontend/src/features/queries/SavedQueryPreviewModal.test.jsx index e6f17f4ea..66e388bc1 100644 --- a/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryPreviewModal.test.jsx +++ b/superset-frontend/src/features/queries/SavedQueryPreviewModal.test.jsx @@ -21,11 +21,11 @@ import thunk from 'redux-thunk'; import configureStore from 'redux-mock-store'; import fetchMock from 'fetch-mock'; import { styledMount as mount } from 'spec/helpers/theming'; -import SavedQueryPreviewModal from 'src/views/CRUD/data/savedquery/SavedQueryPreviewModal'; import Button from 'src/components/Button'; import Modal from 'src/components/Modal'; import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint'; import { act } from 'react-dom/test-utils'; +import SavedQueryPreviewModal from './SavedQueryPreviewModal'; // store needed for withToasts(DatabaseList) const mockStore = configureStore([thunk]); diff --git a/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryPreviewModal.tsx b/superset-frontend/src/features/queries/SavedQueryPreviewModal.tsx similarity index 96% rename from superset-frontend/src/views/CRUD/data/savedquery/SavedQueryPreviewModal.tsx rename to superset-frontend/src/features/queries/SavedQueryPreviewModal.tsx index 29efb634a..d46212b93 100644 --- a/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryPreviewModal.tsx +++ b/superset-frontend/src/features/queries/SavedQueryPreviewModal.tsx @@ -20,11 +20,11 @@ import React, { FunctionComponent } from 'react'; import { styled, t } from '@superset-ui/core'; import Modal from 'src/components/Modal'; import Button from 'src/components/Button'; -import SyntaxHighlighterCopy from 'src/views/CRUD/data/components/SyntaxHighlighterCopy'; +import SyntaxHighlighterCopy from 'src/features/queries/SyntaxHighlighterCopy'; import withToasts, { ToastProps, } from 'src/components/MessageToasts/withToasts'; -import { useQueryPreviewState } from 'src/views/CRUD/data/hooks'; +import useQueryPreviewState from 'src/features/queries/hooks/useQueryPreviewState'; const QueryTitle = styled.div` color: ${({ theme }) => theme.colors.secondary.light2}; diff --git a/superset-frontend/src/views/CRUD/data/components/SyntaxHighlighterCopy/index.tsx b/superset-frontend/src/features/queries/SyntaxHighlighterCopy.tsx similarity index 100% rename from superset-frontend/src/views/CRUD/data/components/SyntaxHighlighterCopy/index.tsx rename to superset-frontend/src/features/queries/SyntaxHighlighterCopy.tsx diff --git a/superset-frontend/src/features/queries/hooks/useQueryPreviewState.ts b/superset-frontend/src/features/queries/hooks/useQueryPreviewState.ts new file mode 100644 index 000000000..898b6a68a --- /dev/null +++ b/superset-frontend/src/features/queries/hooks/useQueryPreviewState.ts @@ -0,0 +1,76 @@ +/** + * 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. + */ +import { useState, useEffect } from 'react'; + +type BaseQueryObject = { + id: number; +}; + +export default function useQueryPreviewState({ + queries, + fetchData, + currentQueryId, +}: { + queries: D[]; + fetchData: (id: number) => any; + currentQueryId: number; +}) { + const index = queries.findIndex(query => query.id === currentQueryId); + const [currentIndex, setCurrentIndex] = useState(index); + const [disablePrevious, setDisablePrevious] = useState(false); + const [disableNext, setDisableNext] = useState(false); + + function checkIndex() { + setDisablePrevious(currentIndex === 0); + setDisableNext(currentIndex === queries.length - 1); + } + + function handleDataChange(previous: boolean) { + const offset = previous ? -1 : 1; + const index = currentIndex + offset; + if (index >= 0 && index < queries.length) { + fetchData(queries[index].id); + setCurrentIndex(index); + checkIndex(); + } + } + + function handleKeyPress(ev: any) { + if (currentIndex >= 0 && currentIndex < queries.length) { + if (ev.key === 'ArrowDown' || ev.key === 'k') { + ev.preventDefault(); + handleDataChange(false); + } else if (ev.key === 'ArrowUp' || ev.key === 'j') { + ev.preventDefault(); + handleDataChange(true); + } + } + } + + useEffect(() => { + checkIndex(); + }); + + return { + handleKeyPress, + handleDataChange, + disablePrevious, + disableNext, + }; +} diff --git a/superset-frontend/src/views/CRUD/tags/TagCard.tsx b/superset-frontend/src/features/tags/TagCard.tsx similarity index 98% rename from superset-frontend/src/views/CRUD/tags/TagCard.tsx rename to superset-frontend/src/features/tags/TagCard.tsx index 7ed8c1df0..869678545 100644 --- a/superset-frontend/src/views/CRUD/tags/TagCard.tsx +++ b/superset-frontend/src/features/tags/TagCard.tsx @@ -27,7 +27,7 @@ import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; import ListViewCard from 'src/components/ListViewCard'; import Icons from 'src/components/Icons'; import { Tag } from 'src/views/CRUD/types'; -import { deleteTags } from 'src/tags'; +import { deleteTags } from 'src/features/tags/tags'; interface TagCardProps { tag: Tag; diff --git a/superset-frontend/src/tags.ts b/superset-frontend/src/features/tags/tags.ts similarity index 100% rename from superset-frontend/src/tags.ts rename to superset-frontend/src/features/tags/tags.ts diff --git a/superset-frontend/src/pages/AlertReportList/AlertReportList.test.jsx b/superset-frontend/src/pages/AlertReportList/AlertReportList.test.jsx index 492b63aa3..67fbcbd2d 100644 --- a/superset-frontend/src/pages/AlertReportList/AlertReportList.test.jsx +++ b/superset-frontend/src/pages/AlertReportList/AlertReportList.test.jsx @@ -25,7 +25,7 @@ import { styledMount as mount } from 'spec/helpers/theming'; 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 SubMenu from 'src/features/home/SubMenu'; import AlertList from 'src/pages/AlertReportList'; import IndeterminateCheckbox from 'src/components/IndeterminateCheckbox'; import { act } from 'react-dom/test-utils'; diff --git a/superset-frontend/src/pages/AlertReportList/index.tsx b/superset-frontend/src/pages/AlertReportList/index.tsx index c4a35435a..45504eb3c 100644 --- a/superset-frontend/src/pages/AlertReportList/index.tsx +++ b/superset-frontend/src/pages/AlertReportList/index.tsx @@ -35,16 +35,15 @@ import ListView, { Filters, ListViewProps, } from 'src/components/ListView'; -import SubMenu, { SubMenuProps } from 'src/views/components/SubMenu'; +import SubMenu, { SubMenuProps } from 'src/features/home/SubMenu'; import { Switch } from 'src/components/Switch'; import { DATETIME_WITH_TIME_ZONE } from 'src/constants'; import withToasts from 'src/components/MessageToasts/withToasts'; -import AlertStatusIcon from 'src/views/CRUD/alert/components/AlertStatusIcon'; -import RecipientIcon from 'src/views/CRUD/alert/components/RecipientIcon'; +import AlertStatusIcon from 'src/features/alerts/components/AlertStatusIcon'; +import RecipientIcon from 'src/features/alerts/components/RecipientIcon'; import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; import DeleteModal from 'src/components/DeleteModal'; import LastUpdated from 'src/components/LastUpdated'; - import { useListViewResource, useSingleViewResource, @@ -52,8 +51,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 'src/views/CRUD/alert/AlertReportModal'; -import { AlertObject, AlertState } from 'src/views/CRUD/alert/types'; +import AlertReportModal from 'src/features/alerts/AlertReportModal'; +import { AlertObject, AlertState } from 'src/features/alerts/types'; const extensionsRegistry = getExtensionsRegistry(); diff --git a/superset-frontend/src/pages/AllEntities/index.tsx b/superset-frontend/src/pages/AllEntities/index.tsx index de9df56e9..7dfef8eb9 100644 --- a/superset-frontend/src/pages/AllEntities/index.tsx +++ b/superset-frontend/src/pages/AllEntities/index.tsx @@ -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 'src/views/CRUD/allentities/AllEntitiesTable'; +import AllEntitiesTable from 'src/features/allEntities/AllEntitiesTable'; const AllEntitiesContainer = styled.div` ${({ theme }) => ` diff --git a/superset-frontend/src/pages/AnnotationLayerList/AnnotationLayerList.test.jsx b/superset-frontend/src/pages/AnnotationLayerList/AnnotationLayerList.test.jsx index d3efb1f8b..09e1301dc 100644 --- a/superset-frontend/src/pages/AnnotationLayerList/AnnotationLayerList.test.jsx +++ b/superset-frontend/src/pages/AnnotationLayerList/AnnotationLayerList.test.jsx @@ -24,8 +24,8 @@ import { Provider } from 'react-redux'; import { styledMount as mount } from 'spec/helpers/theming'; import AnnotationLayersList from 'src/pages/AnnotationLayerList'; -import AnnotationLayerModal from 'src/views/CRUD/annotationlayers/AnnotationLayerModal'; -import SubMenu from 'src/views/components/SubMenu'; +import AnnotationLayerModal from 'src/features/annotationLayers/AnnotationLayerModal'; +import SubMenu from 'src/features/home/SubMenu'; import ListView from 'src/components/ListView'; import Filters from 'src/components/ListView/Filters'; import DeleteModal from 'src/components/DeleteModal'; diff --git a/superset-frontend/src/pages/AnnotationLayerList/index.tsx b/superset-frontend/src/pages/AnnotationLayerList/index.tsx index 9b30934ce..47981a206 100644 --- a/superset-frontend/src/pages/AnnotationLayerList/index.tsx +++ b/superset-frontend/src/pages/AnnotationLayerList/index.tsx @@ -25,7 +25,7 @@ import moment from 'moment'; import { useListViewResource } from 'src/views/CRUD/hooks'; import { createFetchRelated, createErrorHandler } from 'src/views/CRUD/utils'; import withToasts from 'src/components/MessageToasts/withToasts'; -import SubMenu, { SubMenuProps } from 'src/views/components/SubMenu'; +import SubMenu, { SubMenuProps } from 'src/features/home/SubMenu'; import ActionsBar, { ActionProps } from 'src/components/ListView/ActionsBar'; import ListView, { ListViewProps, @@ -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 'src/views/CRUD/annotationlayers/AnnotationLayerModal'; -import { AnnotationLayerObject } from 'src/views/CRUD/annotationlayers/types'; +import AnnotationLayerModal from 'src/features/annotationLayers/AnnotationLayerModal'; +import { AnnotationLayerObject } from 'src/features/annotationLayers/types'; const PAGE_SIZE = 25; const MOMENT_FORMAT = 'MMM DD, YYYY'; diff --git a/superset-frontend/src/pages/AnnotationList/AnnotationList.test.jsx b/superset-frontend/src/pages/AnnotationList/AnnotationList.test.jsx index 26cd063d5..49e777523 100644 --- a/superset-frontend/src/pages/AnnotationList/AnnotationList.test.jsx +++ b/superset-frontend/src/pages/AnnotationList/AnnotationList.test.jsx @@ -27,7 +27,7 @@ import AnnotationList from 'src/pages/AnnotationList'; import DeleteModal from 'src/components/DeleteModal'; import IndeterminateCheckbox from 'src/components/IndeterminateCheckbox'; import ListView from 'src/components/ListView'; -import SubMenu from 'src/views/components/SubMenu'; +import SubMenu from 'src/features/home/SubMenu'; import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint'; import { act } from 'react-dom/test-utils'; diff --git a/superset-frontend/src/pages/AnnotationList/index.tsx b/superset-frontend/src/pages/AnnotationList/index.tsx index dead2fc72..ee2550216 100644 --- a/superset-frontend/src/pages/AnnotationList/index.tsx +++ b/superset-frontend/src/pages/AnnotationList/index.tsx @@ -27,14 +27,14 @@ import ActionsBar, { ActionProps } from 'src/components/ListView/ActionsBar'; import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; import DeleteModal from 'src/components/DeleteModal'; import ListView, { ListViewProps } from 'src/components/ListView'; -import SubMenu, { SubMenuProps } from 'src/views/components/SubMenu'; +import SubMenu, { SubMenuProps } from 'src/features/home/SubMenu'; import { getClientErrorObject } from 'src/utils/getClientErrorObject'; import withToasts from 'src/components/MessageToasts/withToasts'; import { useListViewResource } from 'src/views/CRUD/hooks'; import { createErrorHandler } from 'src/views/CRUD/utils'; -import { AnnotationObject } from 'src/views/CRUD/annotation/types'; -import AnnotationModal from 'src/views/CRUD/annotation/AnnotationModal'; +import { AnnotationObject } from 'src/features/annotations/types'; +import AnnotationModal from 'src/features/annotations/AnnotationModal'; const PAGE_SIZE = 25; diff --git a/superset-frontend/src/pages/ChartList/index.tsx b/superset-frontend/src/pages/ChartList/index.tsx index 826560455..5a869e3c4 100644 --- a/superset-frontend/src/pages/ChartList/index.tsx +++ b/superset-frontend/src/pages/ChartList/index.tsx @@ -43,7 +43,7 @@ import { import handleResourceExport from 'src/utils/export'; import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; import { TagsList } from 'src/components/Tags'; -import SubMenu, { SubMenuProps } from 'src/views/components/SubMenu'; +import SubMenu, { SubMenuProps } from 'src/features/home/SubMenu'; import FaveStar from 'src/components/FaveStar'; import { Link, useHistory } from 'react-router-dom'; import ListView, { @@ -71,7 +71,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 'src/views/CRUD/chart/ChartCard'; +import ChartCard from 'src/features/charts/ChartCard'; const FlexRowContainer = styled.div` align-items: center; diff --git a/superset-frontend/src/pages/CssTemplateList/CssTemplateList.test.jsx b/superset-frontend/src/pages/CssTemplateList/CssTemplateList.test.jsx index d513523a7..c43724704 100644 --- a/superset-frontend/src/pages/CssTemplateList/CssTemplateList.test.jsx +++ b/superset-frontend/src/pages/CssTemplateList/CssTemplateList.test.jsx @@ -24,7 +24,7 @@ import fetchMock from 'fetch-mock'; import { styledMount as mount } from 'spec/helpers/theming'; import CssTemplatesList from 'src/pages/CssTemplateList'; -import SubMenu from 'src/views/components/SubMenu'; +import SubMenu from 'src/features/home/SubMenu'; import ListView from 'src/components/ListView'; import Filters from 'src/components/ListView/Filters'; import DeleteModal from 'src/components/DeleteModal'; diff --git a/superset-frontend/src/pages/CssTemplateList/index.tsx b/superset-frontend/src/pages/CssTemplateList/index.tsx index 4d678b0a3..7e2882d21 100644 --- a/superset-frontend/src/pages/CssTemplateList/index.tsx +++ b/superset-frontend/src/pages/CssTemplateList/index.tsx @@ -25,7 +25,7 @@ import moment from 'moment'; import { useListViewResource } from 'src/views/CRUD/hooks'; import { createFetchRelated, createErrorHandler } from 'src/views/CRUD/utils'; import withToasts from 'src/components/MessageToasts/withToasts'; -import SubMenu, { SubMenuProps } from 'src/views/components/SubMenu'; +import SubMenu, { SubMenuProps } from 'src/features/home/SubMenu'; import DeleteModal from 'src/components/DeleteModal'; import { Tooltip } from 'src/components/Tooltip'; import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; @@ -35,8 +35,8 @@ import ListView, { Filters, FilterOperator, } from 'src/components/ListView'; -import CssTemplateModal from 'src/views/CRUD/csstemplates/CssTemplateModal'; -import { TemplateObject } from 'src/views/CRUD/csstemplates/types'; +import CssTemplateModal from 'src/features/cssTemplates/CssTemplateModal'; +import { TemplateObject } from 'src/features/cssTemplates/types'; const PAGE_SIZE = 25; diff --git a/superset-frontend/src/pages/DashboardList/index.tsx b/superset-frontend/src/pages/DashboardList/index.tsx index e0f81e0bf..22e7b6c12 100644 --- a/superset-frontend/src/pages/DashboardList/index.tsx +++ b/superset-frontend/src/pages/DashboardList/index.tsx @@ -31,7 +31,7 @@ import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; import { TagsList } from 'src/components/Tags'; import handleResourceExport from 'src/utils/export'; import Loading from 'src/components/Loading'; -import SubMenu, { SubMenuProps } from 'src/views/components/SubMenu'; +import SubMenu, { SubMenuProps } from 'src/features/home/SubMenu'; import ListView, { ListViewProps, Filter, @@ -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 'src/views/CRUD/dashboard/DashboardCard'; -import { DashboardStatus } from 'src/views/CRUD/dashboard/types'; +import DashboardCard from 'src/features/dashboards/DashboardCard'; +import { DashboardStatus } from 'src/features/dashboards/types'; const PAGE_SIZE = 25; const PASSWORDS_NEEDED_MESSAGE = t( diff --git a/superset-frontend/src/pages/DatabaseList/DatabaseList.test.jsx b/superset-frontend/src/pages/DatabaseList/DatabaseList.test.jsx index 42cf1491d..2ab5d067b 100644 --- a/superset-frontend/src/pages/DatabaseList/DatabaseList.test.jsx +++ b/superset-frontend/src/pages/DatabaseList/DatabaseList.test.jsx @@ -25,9 +25,9 @@ import { Provider } from 'react-redux'; import { styledMount as mount } from 'spec/helpers/theming'; import DatabaseList from 'src/pages/DatabaseList'; -import DatabaseModal from 'src/views/CRUD/data/database/DatabaseModal'; +import DatabaseModal from 'src/features/databases/DatabaseModal'; import DeleteModal from 'src/components/DeleteModal'; -import SubMenu from 'src/views/components/SubMenu'; +import SubMenu from 'src/features/home/SubMenu'; import ListView from 'src/components/ListView'; import Filters from 'src/components/ListView/Filters'; import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint'; diff --git a/superset-frontend/src/pages/DatabaseList/index.tsx b/superset-frontend/src/pages/DatabaseList/index.tsx index a9ae567c6..0a59ccc3b 100644 --- a/superset-frontend/src/pages/DatabaseList/index.tsx +++ b/superset-frontend/src/pages/DatabaseList/index.tsx @@ -28,7 +28,7 @@ import { isFeatureEnabled } from 'src/featureFlags'; import { useListViewResource } from 'src/views/CRUD/hooks'; import { createErrorHandler, uploadUserPerms } from 'src/views/CRUD/utils'; import withToasts from 'src/components/MessageToasts/withToasts'; -import SubMenu, { SubMenuProps } from 'src/views/components/SubMenu'; +import SubMenu, { SubMenuProps } from 'src/features/home/SubMenu'; import DeleteModal from 'src/components/DeleteModal'; import { getUrlParam } from 'src/utils/urlUtils'; import { URL_PARAMS } from 'src/constants'; @@ -37,11 +37,11 @@ import Icons from 'src/components/Icons'; import { isUserAdmin } from 'src/dashboard/util/permissionUtils'; import ListView, { FilterOperator, Filters } from 'src/components/ListView'; import handleResourceExport from 'src/utils/export'; -import { ExtensionConfigs } from 'src/views/components/types'; +import { ExtensionConfigs } from 'src/features/home/types'; import { UserWithPermissionsAndRoles } from 'src/types/bootstrapTypes'; import type { MenuObjectProps } from 'src/types/bootstrapTypes'; -import DatabaseModal from 'src/views/CRUD/data/database/DatabaseModal'; -import { DatabaseObject } from 'src/views/CRUD/data/database/types'; +import DatabaseModal from 'src/features/databases/DatabaseModal'; +import { DatabaseObject } from 'src/features/databases/types'; const PAGE_SIZE = 25; diff --git a/superset-frontend/src/pages/DatasetCreation/index.tsx b/superset-frontend/src/pages/DatasetCreation/index.tsx index 18c180b2d..baeaa01e3 100644 --- a/superset-frontend/src/pages/DatasetCreation/index.tsx +++ b/superset-frontend/src/pages/DatasetCreation/index.tsx @@ -18,18 +18,18 @@ */ 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 '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 useDatasetsList from 'src/features/datasets/hooks/useDatasetLists'; +import Header from 'src/features/datasets/AddDataset/Header'; +import EditPage from 'src/features/datasets/AddDataset/EditDataset'; +import DatasetPanel from 'src/features/datasets/AddDataset/DatasetPanel'; +import LeftPanel from 'src/features/datasets/AddDataset/LeftPanel'; +import Footer from 'src/features/datasets/AddDataset/Footer'; import { DatasetActionType, DatasetObject, DSReducerActionType, -} from 'src/views/CRUD/data/dataset/AddDataset/types'; -import DatasetLayout from 'src/views/CRUD/data/dataset/DatasetLayout'; +} from 'src/features/datasets/AddDataset/types'; +import DatasetLayout from 'src/features/datasets/DatasetLayout'; type Schema = { schema: string; diff --git a/superset-frontend/src/pages/DatasetList/DatasetList.test.tsx b/superset-frontend/src/pages/DatasetList/DatasetList.test.tsx index c061d1ab2..861624716 100644 --- a/superset-frontend/src/pages/DatasetList/DatasetList.test.tsx +++ b/superset-frontend/src/pages/DatasetList/DatasetList.test.tsx @@ -34,7 +34,7 @@ import Button from 'src/components/Button'; import IndeterminateCheckbox from 'src/components/IndeterminateCheckbox'; import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint'; import { act } from 'react-dom/test-utils'; -import SubMenu from 'src/views/components/SubMenu'; +import SubMenu from 'src/features/home/SubMenu'; // store needed for withToasts(DatasetList) const mockStore = configureStore([thunk]); diff --git a/superset-frontend/src/pages/DatasetList/index.tsx b/superset-frontend/src/pages/DatasetList/index.tsx index 68f6c1134..28b9a522b 100644 --- a/superset-frontend/src/pages/DatasetList/index.tsx +++ b/superset-frontend/src/pages/DatasetList/index.tsx @@ -30,7 +30,7 @@ import { createFetchDistinct, createErrorHandler, } from 'src/views/CRUD/utils'; -import { ColumnObject } from 'src/views/CRUD/data/dataset/types'; +import { ColumnObject } from 'src/features/datasets/types'; import { useListViewResource } from 'src/views/CRUD/hooks'; import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; import { DatasourceModal } from 'src/components/Datasource'; @@ -42,10 +42,7 @@ import ListView, { FilterOperator, } from 'src/components/ListView'; import Loading from 'src/components/Loading'; -import SubMenu, { - SubMenuProps, - ButtonProps, -} from 'src/views/components/SubMenu'; +import SubMenu, { SubMenuProps, ButtonProps } from 'src/features/home/SubMenu'; import Owner from 'src/types/Owner'; import withToasts from 'src/components/MessageToasts/withToasts'; import { Tooltip } from 'src/components/Tooltip'; @@ -64,8 +61,8 @@ import { SORT_BY, PASSWORDS_NEEDED_MESSAGE, CONFIRM_OVERWRITE_MESSAGE, -} from 'src/views/CRUD/data/dataset/constants'; -import DuplicateDatasetModal from 'src/views/CRUD/data/dataset/DuplicateDatasetModal'; +} from 'src/features/datasets/constants'; +import DuplicateDatasetModal from 'src/features/datasets/DuplicateDatasetModal'; const FlexRowContainer = styled.div` align-items: center; diff --git a/superset-frontend/src/pages/ExecutionLogList/index.tsx b/superset-frontend/src/pages/ExecutionLogList/index.tsx index 48c1bde78..2e32fe01c 100644 --- a/superset-frontend/src/pages/ExecutionLogList/index.tsx +++ b/superset-frontend/src/pages/ExecutionLogList/index.tsx @@ -23,15 +23,15 @@ import React, { useEffect, useMemo } from 'react'; import { Link, useParams } from 'react-router-dom'; import ListView from 'src/components/ListView'; import { Tooltip } from 'src/components/Tooltip'; -import SubMenu from 'src/views/components/SubMenu'; +import SubMenu from 'src/features/home/SubMenu'; import withToasts from 'src/components/MessageToasts/withToasts'; import { fDuration } from 'src/utils/dates'; -import AlertStatusIcon from 'src/views/CRUD/alert/components/AlertStatusIcon'; +import AlertStatusIcon from 'src/features/alerts/components/AlertStatusIcon'; import { useListViewResource, useSingleViewResource, } from 'src/views/CRUD/hooks'; -import { AlertObject, LogObject } from 'src/views/CRUD/alert/types'; +import { AlertObject, LogObject } from 'src/features/alerts/types'; const PAGE_SIZE = 25; diff --git a/superset-frontend/src/pages/Home/index.tsx b/superset-frontend/src/pages/Home/index.tsx index 6018b38bf..21217ae3b 100644 --- a/superset-frontend/src/pages/Home/index.tsx +++ b/superset-frontend/src/pages/Home/index.tsx @@ -49,13 +49,13 @@ import { isFeatureEnabled } from 'src/featureFlags'; import { AntdSwitch } from 'src/components'; import getBootstrapData from 'src/utils/getBootstrapData'; import { TableTab } from 'src/views/CRUD/types'; -import SubMenu, { SubMenuProps } from 'src/views/components/SubMenu'; +import SubMenu, { SubMenuProps } from 'src/features/home/SubMenu'; import { canUserAccessSqlLab } from 'src/dashboard/util/permissionUtils'; -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'; +import { WelcomePageLastTab } from 'src/features/home/types'; +import ActivityTable from 'src/features/home/ActivityTable'; +import ChartTable from 'src/features/home/ChartTable'; +import SavedQueries from 'src/features/home/SavedQueries'; +import DashboardTable from 'src/features/home/DashboardTable'; const extensionsRegistry = getExtensionsRegistry(); diff --git a/superset-frontend/src/pages/QueryHistoryList/QueryHistoryList.test.tsx b/superset-frontend/src/pages/QueryHistoryList/QueryHistoryList.test.tsx index 540dd47ad..e39c279a5 100644 --- a/superset-frontend/src/pages/QueryHistoryList/QueryHistoryList.test.tsx +++ b/superset-frontend/src/pages/QueryHistoryList/QueryHistoryList.test.tsx @@ -27,12 +27,12 @@ import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint'; import { styledMount as mount } from 'spec/helpers/theming'; import QueryList from 'src/pages/QueryHistoryList'; -import QueryPreviewModal from 'src/views/CRUD/data/query/QueryPreviewModal'; +import QueryPreviewModal from 'src/features/queries/QueryPreviewModal'; import { QueryObject } from 'src/views/CRUD/types'; import ListView from 'src/components/ListView'; import Filters from 'src/components/ListView/Filters'; import SyntaxHighlighter from 'react-syntax-highlighter/dist/cjs/light'; -import SubMenu from 'src/views/components/SubMenu'; +import SubMenu from 'src/features/home/SubMenu'; import { QueryState } from '@superset-ui/core'; // store needed for withToasts diff --git a/superset-frontend/src/pages/QueryHistoryList/index.tsx b/superset-frontend/src/pages/QueryHistoryList/index.tsx index ffed99d3f..95944dd32 100644 --- a/superset-frontend/src/pages/QueryHistoryList/index.tsx +++ b/superset-frontend/src/pages/QueryHistoryList/index.tsx @@ -33,9 +33,9 @@ import { } from 'src/views/CRUD/utils'; import withToasts from 'src/components/MessageToasts/withToasts'; import { useListViewResource } from 'src/views/CRUD/hooks'; -import SubMenu, { SubMenuProps } from 'src/views/components/SubMenu'; +import SubMenu, { SubMenuProps } from 'src/features/home/SubMenu'; import Popover from 'src/components/Popover'; -import { commonMenuData } from 'src/views/CRUD/data/common'; +import { commonMenuData } from 'src/features/home/commonMenuData'; import ListView, { Filters, FilterOperator, @@ -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 'src/views/CRUD/data/query/QueryPreviewModal'; +import QueryPreviewModal from 'src/features/queries/QueryPreviewModal'; const PAGE_SIZE = 25; const SQL_PREVIEW_MAX_LINES = 4; diff --git a/superset-frontend/src/pages/SavedQueryList/SavedQueryList.test.jsx b/superset-frontend/src/pages/SavedQueryList/SavedQueryList.test.jsx index 8882d8149..5d9b35a4a 100644 --- a/superset-frontend/src/pages/SavedQueryList/SavedQueryList.test.jsx +++ b/superset-frontend/src/pages/SavedQueryList/SavedQueryList.test.jsx @@ -29,7 +29,7 @@ import { QueryParamProvider } from 'use-query-params'; import { act } from 'react-dom/test-utils'; import * as featureFlags from 'src/featureFlags'; import SavedQueryList from 'src/pages/SavedQueryList'; -import SubMenu from 'src/views/components/SubMenu'; +import SubMenu from 'src/features/home/SubMenu'; import ListView from 'src/components/ListView'; import Filters from 'src/components/ListView/Filters'; import ActionsBar from 'src/components/ListView/ActionsBar'; diff --git a/superset-frontend/src/pages/SavedQueryList/index.tsx b/superset-frontend/src/pages/SavedQueryList/index.tsx index 71eedc1de..a985bd8ea 100644 --- a/superset-frontend/src/pages/SavedQueryList/index.tsx +++ b/superset-frontend/src/pages/SavedQueryList/index.tsx @@ -31,10 +31,7 @@ import withToasts from 'src/components/MessageToasts/withToasts'; import { useListViewResource } from 'src/views/CRUD/hooks'; import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; import handleResourceExport from 'src/utils/export'; -import SubMenu, { - SubMenuProps, - ButtonProps, -} from 'src/views/components/SubMenu'; +import SubMenu, { SubMenuProps, ButtonProps } from 'src/features/home/SubMenu'; import ListView, { ListViewProps, Filters, @@ -45,7 +42,7 @@ import DeleteModal from 'src/components/DeleteModal'; import ActionsBar, { ActionProps } from 'src/components/ListView/ActionsBar'; import { TagsList } from 'src/components/Tags'; import { Tooltip } from 'src/components/Tooltip'; -import { commonMenuData } from 'src/views/CRUD/data/common'; +import { commonMenuData } from 'src/features/home/commonMenuData'; import { SavedQueryObject } from 'src/views/CRUD/types'; import copyTextToClipboard from 'src/utils/copy'; import Tag from 'src/types/TagType'; @@ -53,7 +50,7 @@ import { isFeatureEnabled } 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 'src/views/CRUD/data/savedquery/SavedQueryPreviewModal'; +import SavedQueryPreviewModal from 'src/features/queries/SavedQueryPreviewModal'; const PAGE_SIZE = 25; const PASSWORDS_NEEDED_MESSAGE = t( diff --git a/superset-frontend/src/pages/Tags/index.tsx b/superset-frontend/src/pages/Tags/index.tsx index 13c3e8ec4..87cf7c787 100644 --- a/superset-frontend/src/pages/Tags/index.tsx +++ b/superset-frontend/src/pages/Tags/index.tsx @@ -26,7 +26,7 @@ import { } from 'src/views/CRUD/utils'; import { useListViewResource } from 'src/views/CRUD/hooks'; import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; -import SubMenu, { SubMenuProps } from 'src/views/components/SubMenu'; +import SubMenu, { SubMenuProps } from 'src/features/home/SubMenu'; import ListView, { ListViewProps, Filters, @@ -38,10 +38,10 @@ import Icons from 'src/components/Icons'; import { Tooltip } from 'src/components/Tooltip'; import FacePile from 'src/components/FacePile'; import { Link } from 'react-router-dom'; -import { deleteTags } from 'src/tags'; +import { deleteTags } from 'src/features/tags/tags'; import { Tag as AntdTag } from 'antd'; import { Tag } from 'src/views/CRUD/types'; -import TagCard from 'src/views/CRUD/tags/TagCard'; +import TagCard from 'src/features/tags/TagCard'; const PAGE_SIZE = 25; diff --git a/superset-frontend/src/types/bootstrapTypes.ts b/superset-frontend/src/types/bootstrapTypes.ts index db646b84a..971012f2f 100644 --- a/superset-frontend/src/types/bootstrapTypes.ts +++ b/superset-frontend/src/types/bootstrapTypes.ts @@ -7,8 +7,8 @@ import { SequentialSchemeConfig, } from '@superset-ui/core'; import { isPlainObject } from 'lodash'; +import { Languages } from 'src/features/home/LanguagePicker'; import { FlashMessage } from '../components/FlashProvider'; -import { Languages } from '../views/components/LanguagePicker'; /** * Licensed to the Apache Software Foundation (ASF) under one diff --git a/superset-frontend/src/views/App.tsx b/superset-frontend/src/views/App.tsx index cacfaa145..3443e336e 100644 --- a/superset-frontend/src/views/App.tsx +++ b/superset-frontend/src/views/App.tsx @@ -28,7 +28,7 @@ import { bindActionCreators } from 'redux'; import { GlobalStyles } from 'src/GlobalStyles'; import ErrorBoundary from 'src/components/ErrorBoundary'; import Loading from 'src/components/Loading'; -import Menu from 'src/views/components/Menu'; +import Menu from 'src/features/home/Menu'; import getBootstrapData from 'src/utils/getBootstrapData'; import ToastContainer from 'src/components/MessageToasts/ToastContainer'; import setupApp from 'src/setup/setupApp'; diff --git a/superset-frontend/src/views/CRUD/utils.test.tsx b/superset-frontend/src/views/CRUD/utils.test.tsx index b9b8047f4..28d3a175d 100644 --- a/superset-frontend/src/views/CRUD/utils.test.tsx +++ b/superset-frontend/src/views/CRUD/utils.test.tsx @@ -33,8 +33,8 @@ import { isNeedsSSHPrivateKeyPassword, } from 'src/views/CRUD/utils'; import { User } from 'src/types/bootstrapTypes'; +import { WelcomeTable } from 'src/features/home/types'; import { Filter, TableTab } from './types'; -import { WelcomeTable } from './welcome/types'; const terminalErrors = { errors: [ diff --git a/superset-frontend/src/views/CRUD/utils.tsx b/superset-frontend/src/views/CRUD/utils.tsx index f12f13e02..514a39964 100644 --- a/superset-frontend/src/views/CRUD/utils.tsx +++ b/superset-frontend/src/views/CRUD/utils.tsx @@ -34,8 +34,8 @@ import { FetchDataConfig, FilterValue } from 'src/components/ListView'; import SupersetText from 'src/utils/textUtils'; import { findPermission } from 'src/utils/findPermission'; import { User } from 'src/types/bootstrapTypes'; +import { WelcomeTable } from 'src/features/home/types'; import { Dashboard, Filter, TableTab } from './types'; -import { WelcomeTable } from './welcome/types'; // Modifies the rison encoding slightly to match the backend's rison encoding/decoding. Applies globally. // Code pulled from rison.js (https://github.com/Nanonid/rison), rison is licensed under the MIT license. diff --git a/superset-frontend/src/views/CRUD/welcome/types.ts b/superset-frontend/src/views/CRUD/welcome/types.ts deleted file mode 100644 index b6e34e8b5..000000000 --- a/superset-frontend/src/views/CRUD/welcome/types.ts +++ /dev/null @@ -1,29 +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. - */ - -import { Filter } from '../types'; - -export enum WelcomeTable { - Charts = 'CHARTS', - Dashboards = 'DASHBOARDS', - Recents = 'RECENTS', - SavedQueries = 'SAVED_QUERIES', -} - -export type WelcomePageLastTab = 'examples' | 'all' | [string, Filter[]]; diff --git a/superset-frontend/src/views/menu.tsx b/superset-frontend/src/views/menu.tsx index 88de0cc41..fed5782a5 100644 --- a/superset-frontend/src/views/menu.tsx +++ b/superset-frontend/src/views/menu.tsx @@ -27,7 +27,7 @@ import { CacheProvider } from '@emotion/react'; import { QueryParamProvider } from 'use-query-params'; import createCache from '@emotion/cache'; import { ThemeProvider } from '@superset-ui/core'; -import Menu from 'src/views/components/Menu'; +import Menu from 'src/features/home/Menu'; import { theme } from 'src/preamble'; import getBootstrapData from 'src/utils/getBootstrapData'; import { setupStore } from './store'; diff --git a/superset-frontend/src/views/types.ts b/superset-frontend/src/views/types.ts index c0ffead6a..437e7d77e 100644 --- a/superset-frontend/src/views/types.ts +++ b/superset-frontend/src/views/types.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { NotificationMethodOption } from './CRUD/alert/types'; +import { NotificationMethodOption } from 'src/features/alerts/types'; export interface ViewState { common: {