From 0dadf062450903397d35e3f4415d392604bc0553 Mon Sep 17 00:00:00 2001 From: "Michael S. Molina" <70410625+michael-s-molina@users.noreply.github.com> Date: Wed, 23 Aug 2023 11:02:25 -0300 Subject: [PATCH] chore: Organizes the files of the ReportModal feature (#25046) --- superset-frontend/spec/helpers/reducerIndex.ts | 2 +- .../src/dashboard/components/Header/Header.test.tsx | 1 - .../components/Header/HeaderActionsDropdown/index.jsx | 2 +- .../src/dashboard/containers/DashboardHeader.jsx | 2 -- .../components/useExploreAdditionalActionsMenu/index.jsx | 2 +- superset-frontend/src/features/alerts/AlertReportModal.tsx | 2 +- superset-frontend/src/features/alerts/types.ts | 2 +- .../ReportModal/HeaderReportDropdown/index.test.tsx | 0 .../reports}/ReportModal/HeaderReportDropdown/index.tsx | 4 ++-- .../reports}/ReportModal/ReportModal.test.tsx | 2 +- .../reports.js => features/reports/ReportModal/actions.js} | 0 .../{components => features/reports}/ReportModal/index.tsx | 7 +++++-- .../reports.js => features/reports/ReportModal/reducer.js} | 7 +------ .../reports}/ReportModal/styles.tsx | 0 superset-frontend/src/{ => features}/reports/types.ts | 0 .../src/features/rls/RowLevelSecurityModal.tsx | 2 +- superset-frontend/src/views/store.ts | 2 +- 17 files changed, 16 insertions(+), 21 deletions(-) rename superset-frontend/src/{components => features/reports}/ReportModal/HeaderReportDropdown/index.test.tsx (100%) rename superset-frontend/src/{components => features/reports}/ReportModal/HeaderReportDropdown/index.tsx (98%) rename superset-frontend/src/{components => features/reports}/ReportModal/ReportModal.test.tsx (98%) rename superset-frontend/src/{reports/actions/reports.js => features/reports/ReportModal/actions.js} (100%) rename superset-frontend/src/{components => features/reports}/ReportModal/index.tsx (98%) rename superset-frontend/src/{reports/reducers/reports.js => features/reports/ReportModal/reducer.js} (96%) rename superset-frontend/src/{components => features/reports}/ReportModal/styles.tsx (100%) rename superset-frontend/src/{ => features}/reports/types.ts (100%) diff --git a/superset-frontend/spec/helpers/reducerIndex.ts b/superset-frontend/spec/helpers/reducerIndex.ts index 459a112e2..a9cadc4f8 100644 --- a/superset-frontend/spec/helpers/reducerIndex.ts +++ b/superset-frontend/spec/helpers/reducerIndex.ts @@ -30,7 +30,7 @@ import saveModal from 'src/explore/reducers/saveModalReducer'; import explore from 'src/explore/reducers/exploreReducer'; import sqlLab from 'src/SqlLab/reducers/sqlLab'; import localStorageUsageInKilobytes from 'src/SqlLab/reducers/localStorageUsage'; -import reports from 'src/reports/reducers/reports'; +import reports from 'src/features/reports/ReportModal/reducer'; import getBootstrapData from 'src/utils/getBootstrapData'; const impressionId = (state = '') => state; diff --git a/superset-frontend/src/dashboard/components/Header/Header.test.tsx b/superset-frontend/src/dashboard/components/Header/Header.test.tsx index 4f8bf64f6..f8c474272 100644 --- a/superset-frontend/src/dashboard/components/Header/Header.test.tsx +++ b/superset-frontend/src/dashboard/components/Header/Header.test.tsx @@ -73,7 +73,6 @@ const createProps = () => ({ fetchFaveStar: jest.fn(), fetchCharts: jest.fn(), onRefresh: jest.fn(), - fetchUISpecificReport: jest.fn(), saveFaveStar: jest.fn(), savePublished: jest.fn(), isPublished: false, diff --git a/superset-frontend/src/dashboard/components/Header/HeaderActionsDropdown/index.jsx b/superset-frontend/src/dashboard/components/Header/HeaderActionsDropdown/index.jsx index 3f2caab72..1073d73ab 100644 --- a/superset-frontend/src/dashboard/components/Header/HeaderActionsDropdown/index.jsx +++ b/superset-frontend/src/dashboard/components/Header/HeaderActionsDropdown/index.jsx @@ -31,7 +31,7 @@ import ShareMenuItems from 'src/dashboard/components/menu/ShareMenuItems'; import CssEditor from 'src/dashboard/components/CssEditor'; import RefreshIntervalModal from 'src/dashboard/components/RefreshIntervalModal'; import SaveModal from 'src/dashboard/components/SaveModal'; -import HeaderReportDropdown from 'src/components/ReportModal/HeaderReportDropdown'; +import HeaderReportDropdown from 'src/features/reports/ReportModal/HeaderReportDropdown'; import injectCustomCss from 'src/dashboard/util/injectCustomCss'; import { SAVE_TYPE_NEWDASHBOARD } from 'src/dashboard/util/constants'; import FilterScopeModal from 'src/dashboard/components/filterscope/FilterScopeModal'; diff --git a/superset-frontend/src/dashboard/containers/DashboardHeader.jsx b/superset-frontend/src/dashboard/containers/DashboardHeader.jsx index a38b121e5..cc05916dc 100644 --- a/superset-frontend/src/dashboard/containers/DashboardHeader.jsx +++ b/superset-frontend/src/dashboard/containers/DashboardHeader.jsx @@ -57,7 +57,6 @@ import { import { logEvent } from 'src/logger/actions'; import { DASHBOARD_HEADER_ID } from 'src/dashboard/util/constants'; -import { fetchUISpecificReport } from 'src/reports/actions/reports'; function mapStateToProps({ dashboardLayout: undoableLayout, @@ -130,7 +129,6 @@ function mapDispatchToProps(dispatch) { dashboardInfoChanged, dashboardTitleChanged, updateDataMask, - fetchUISpecificReport, }, dispatch, ); diff --git a/superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx b/superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx index 9dd0bc0ef..45d8d3efa 100644 --- a/superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx +++ b/superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx @@ -35,7 +35,7 @@ import { exportChart, getChartKey } from 'src/explore/exploreUtils'; import downloadAsImage from 'src/utils/downloadAsImage'; import { getChartPermalink } from 'src/utils/urlUtils'; import copyTextToClipboard from 'src/utils/copy'; -import HeaderReportDropDown from 'src/components/ReportModal/HeaderReportDropdown'; +import HeaderReportDropDown from 'src/features/reports/ReportModal/HeaderReportDropdown'; import ViewQueryModal from '../controls/ViewQueryModal'; import EmbedCodeContent from '../EmbedCodeContent'; import DashboardsSubMenu from './DashboardsSubMenu'; diff --git a/superset-frontend/src/features/alerts/AlertReportModal.tsx b/superset-frontend/src/features/alerts/AlertReportModal.tsx index 497c4d7b7..571c7b1b2 100644 --- a/superset-frontend/src/features/alerts/AlertReportModal.tsx +++ b/superset-frontend/src/features/alerts/AlertReportModal.tsx @@ -47,7 +47,7 @@ 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/features/databases/state'; -import { CustomWidthHeaderStyle } from 'src/components/ReportModal/styles'; +import { CustomWidthHeaderStyle } from 'src/features/reports/ReportModal/styles'; import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls'; import { NotificationMethodOption, diff --git a/superset-frontend/src/features/alerts/types.ts b/superset-frontend/src/features/alerts/types.ts index 34eb7fd26..e01cf6f43 100644 --- a/superset-frontend/src/features/alerts/types.ts +++ b/superset-frontend/src/features/alerts/types.ts @@ -18,7 +18,7 @@ */ import Owner from 'src/types/Owner'; -import { NOTIFICATION_FORMATS } from 'src/reports/types'; +import { NOTIFICATION_FORMATS } from 'src/features/reports/types'; type user = { id: number; diff --git a/superset-frontend/src/components/ReportModal/HeaderReportDropdown/index.test.tsx b/superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.test.tsx similarity index 100% rename from superset-frontend/src/components/ReportModal/HeaderReportDropdown/index.test.tsx rename to superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.test.tsx diff --git a/superset-frontend/src/components/ReportModal/HeaderReportDropdown/index.tsx b/superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.tsx similarity index 98% rename from superset-frontend/src/components/ReportModal/HeaderReportDropdown/index.tsx rename to superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.tsx index b2e47cc53..cd428b0ab 100644 --- a/superset-frontend/src/components/ReportModal/HeaderReportDropdown/index.tsx +++ b/superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.tsx @@ -38,14 +38,14 @@ import Checkbox from 'src/components/Checkbox'; import { noOp } from 'src/utils/common'; import { NoAnimationDropdown } from 'src/components/Dropdown'; import DeleteModal from 'src/components/DeleteModal'; -import ReportModal from 'src/components/ReportModal'; +import ReportModal from 'src/features/reports/ReportModal'; import { ChartState } from 'src/explore/types'; import { UserWithPermissionsAndRoles } from 'src/types/bootstrapTypes'; import { fetchUISpecificReport, toggleActive, deleteActiveReport, -} from 'src/reports/actions/reports'; +} from 'src/features/reports/ReportModal/actions'; import { reportSelector } from 'src/views/CRUD/hooks'; import { MenuItemWithCheckboxContainer } from 'src/explore/components/useExploreAdditionalActionsMenu/index'; diff --git a/superset-frontend/src/components/ReportModal/ReportModal.test.tsx b/superset-frontend/src/features/reports/ReportModal/ReportModal.test.tsx similarity index 98% rename from superset-frontend/src/components/ReportModal/ReportModal.test.tsx rename to superset-frontend/src/features/reports/ReportModal/ReportModal.test.tsx index 63365a6ba..c5508b3c2 100644 --- a/superset-frontend/src/components/ReportModal/ReportModal.test.tsx +++ b/superset-frontend/src/features/reports/ReportModal/ReportModal.test.tsx @@ -22,7 +22,7 @@ import sinon from 'sinon'; import fetchMock from 'fetch-mock'; import { render, screen, waitFor } from 'spec/helpers/testing-library'; import * as uiCore from '@superset-ui/core'; -import * as actions from 'src/reports/actions/reports'; +import * as actions from 'src/features/reports/ReportModal/actions'; import { FeatureFlag } from '@superset-ui/core'; import ReportModal from '.'; diff --git a/superset-frontend/src/reports/actions/reports.js b/superset-frontend/src/features/reports/ReportModal/actions.js similarity index 100% rename from superset-frontend/src/reports/actions/reports.js rename to superset-frontend/src/features/reports/ReportModal/actions.js diff --git a/superset-frontend/src/components/ReportModal/index.tsx b/superset-frontend/src/features/reports/ReportModal/index.tsx similarity index 98% rename from superset-frontend/src/components/ReportModal/index.tsx rename to superset-frontend/src/features/reports/ReportModal/index.tsx index f98cddd66..ed48a8a61 100644 --- a/superset-frontend/src/components/ReportModal/index.tsx +++ b/superset-frontend/src/features/reports/ReportModal/index.tsx @@ -26,7 +26,10 @@ import React, { import { t, SupersetTheme } from '@superset-ui/core'; import { useDispatch, useSelector } from 'react-redux'; import { getClientErrorObject } from 'src/utils/getClientErrorObject'; -import { addReport, editReport } from 'src/reports/actions/reports'; +import { + addReport, + editReport, +} from 'src/features/reports/ReportModal/actions'; import Alert from 'src/components/Alert'; import TimezoneSelector from 'src/components/TimezoneSelector'; import LabeledErrorBoundInput from 'src/components/Form/LabeledErrorBoundInput'; @@ -40,7 +43,7 @@ import { ReportCreationMethod, ReportObject, NOTIFICATION_FORMATS, -} from 'src/reports/types'; +} from 'src/features/reports/types'; import { reportSelector } from 'src/views/CRUD/hooks'; import { TRANSLATIONS, diff --git a/superset-frontend/src/reports/reducers/reports.js b/superset-frontend/src/features/reports/ReportModal/reducer.js similarity index 96% rename from superset-frontend/src/reports/reducers/reports.js rename to superset-frontend/src/features/reports/ReportModal/reducer.js index 823660b64..0c53dbc60 100644 --- a/superset-frontend/src/reports/reducers/reports.js +++ b/superset-frontend/src/features/reports/ReportModal/reducer.js @@ -19,12 +19,7 @@ /* eslint-disable camelcase */ // eslint-disable-next-line import/no-extraneous-dependencies import { omit } from 'lodash'; -import { - SET_REPORT, - ADD_REPORT, - EDIT_REPORT, - DELETE_REPORT, -} from '../actions/reports'; +import { SET_REPORT, ADD_REPORT, EDIT_REPORT, DELETE_REPORT } from './actions'; export default function reportsReducer(state = {}, action) { const actionHandlers = { diff --git a/superset-frontend/src/components/ReportModal/styles.tsx b/superset-frontend/src/features/reports/ReportModal/styles.tsx similarity index 100% rename from superset-frontend/src/components/ReportModal/styles.tsx rename to superset-frontend/src/features/reports/ReportModal/styles.tsx diff --git a/superset-frontend/src/reports/types.ts b/superset-frontend/src/features/reports/types.ts similarity index 100% rename from superset-frontend/src/reports/types.ts rename to superset-frontend/src/features/reports/types.ts diff --git a/superset-frontend/src/features/rls/RowLevelSecurityModal.tsx b/superset-frontend/src/features/rls/RowLevelSecurityModal.tsx index 84d8ca11d..98ab55fa4 100644 --- a/superset-frontend/src/features/rls/RowLevelSecurityModal.tsx +++ b/superset-frontend/src/features/rls/RowLevelSecurityModal.tsx @@ -31,7 +31,7 @@ import Select from 'src/components/Select/Select'; import AsyncSelect from 'src/components/Select/AsyncSelect'; import rison from 'rison'; import { LabeledErrorBoundInput } from 'src/components/Form'; -import { noBottomMargin } from 'src/components/ReportModal/styles'; +import { noBottomMargin } from 'src/features/reports/ReportModal/styles'; import InfoTooltip from 'src/components/InfoTooltip'; import { useSingleViewResource } from 'src/views/CRUD/hooks'; import { FilterOptions } from './constants'; diff --git a/superset-frontend/src/views/store.ts b/superset-frontend/src/views/store.ts index b4fa3b405..3a46f31da 100644 --- a/superset-frontend/src/views/store.ts +++ b/superset-frontend/src/views/store.ts @@ -22,7 +22,7 @@ import { api } from 'src/hooks/apiResources/queryApi'; import messageToastReducer from 'src/components/MessageToasts/reducers'; import charts from 'src/components/Chart/chartReducer'; import dataMask from 'src/dataMask/reducer'; -import reports from 'src/reports/reducers/reports'; +import reports from 'src/features/reports/ReportModal/reducer'; import dashboardInfo from 'src/dashboard/reducers/dashboardInfo'; import dashboardState from 'src/dashboard/reducers/dashboardState'; import dashboardFilters from 'src/dashboard/reducers/dashboardFilters';