From 9b17e86b447dc36fd39c3912d3ed3baf78d3bb2e Mon Sep 17 00:00:00 2001 From: "Michael S. Molina" <70410625+michael-s-molina@users.noreply.github.com> Date: Wed, 22 Sep 2021 07:44:54 -0300 Subject: [PATCH] chore: Moves messageToasts to the components folder (#14431) * chore: Moves messageToasts to the components folder * Rebases --- superset-frontend/spec/fixtures/mockState.js | 2 +- .../spec/fixtures/mockStateWithoutUser.tsx | 2 +- .../spec/helpers/reducerIndex.ts | 2 +- .../dashboard/actions/dashboardLayout_spec.js | 2 +- .../spec/javascripts/messageToasts/.eslintrc | 30 ---------------- .../javascripts/sqllab/actions/sqlLab_spec.js | 2 +- .../src/SqlLab/actions/sqlLab.js | 8 ++--- .../src/SqlLab/components/App.jsx | 14 ++++---- .../SqlLab/components/ShareSqlLabQuery.tsx | 3 +- .../src/SqlLab/reducers/getInitialState.js | 2 +- .../src/SqlLab/reducers/index.js | 3 +- superset-frontend/src/chart/chartAction.js | 20 +++++------ .../CopyToClipboard.stories.tsx | 4 +-- .../src/components/CopyToClipboard/index.jsx | 2 +- .../src/components/FlashProvider/index.tsx | 2 +- .../components/MessageToasts/Toast.test.jsx} | 4 +-- .../MessageToasts}/Toast.tsx | 3 +- .../MessageToasts/ToastContainer.jsx} | 4 +-- .../MessageToasts/ToastPresenter.test.jsx} | 7 ++-- .../MessageToasts}/ToastPresenter.tsx | 2 +- .../MessageToasts/actions.ts} | 2 +- .../getToastsFromPyFlashMessages.js | 4 +-- .../getToastsFromPyFlashMessages.test.js} | 5 ++- .../MessageToasts}/mockMessageToasts.js | 2 +- .../MessageToasts/reducers.js} | 2 +- .../MessageToasts/reducers.test.js} | 4 +-- .../MessageToasts}/types.ts | 0 .../MessageToasts}/withToasts.tsx | 2 +- .../src/components/ReportModal/index.tsx | 2 +- .../TableLoader/TableLoader.test.tsx | 4 +-- .../src/components/TableLoader/index.tsx | 2 +- .../URLShortLinkButton.test.tsx | 4 +-- .../components/URLShortLinkButton/index.jsx | 2 +- .../src/dashboard/actions/dashboardLayout.js | 17 +++++---- .../src/dashboard/actions/dashboardState.js | 35 +++++++++---------- .../src/dashboard/actions/sliceEntities.js | 2 +- .../components/PropertiesModal/index.jsx | 2 +- .../FiltersConfigForm/ColumnSelect.tsx | 2 +- .../FiltersConfigForm/FiltersConfigForm.tsx | 2 +- .../src/dashboard/containers/Chart.jsx | 24 +++++++------ .../containers/DashboardComponent.jsx | 18 +++++----- .../dashboard/containers/DashboardHeader.jsx | 19 +++++----- .../dashboard/containers/DashboardPage.tsx | 2 +- .../src/datasource/ChangeDatasourceModal.tsx | 2 +- .../src/datasource/DatasourceEditor.jsx | 2 +- .../src/datasource/DatasourceModal.tsx | 2 +- superset-frontend/src/explore/App.jsx | 14 ++++---- .../src/explore/actions/exploreActions.ts | 5 ++- .../components/ExploreActionButtons.tsx | 2 +- .../MetricControl/MetricDefinitionOption.jsx | 3 +- .../controls/SelectAsyncControl/index.jsx | 2 +- .../src/explore/reducers/getInitialState.ts | 2 +- .../src/explore/reducers/index.js | 6 ++-- .../src/messageToasts/constants.ts | 28 --------------- superset-frontend/src/profile/App.tsx | 6 ++-- .../src/reports/actions/reports.js | 5 ++- .../src/utils/downloadAsImage.ts | 2 +- superset-frontend/src/views/App.tsx | 4 +-- .../src/views/CRUD/alert/AlertList.tsx | 2 +- .../src/views/CRUD/alert/AlertReportModal.tsx | 2 +- .../src/views/CRUD/alert/ExecutionLog.tsx | 2 +- .../views/CRUD/annotation/AnnotationList.tsx | 2 +- .../views/CRUD/annotation/AnnotationModal.tsx | 2 +- .../annotationlayers/AnnotationLayerModal.tsx | 2 +- .../annotationlayers/AnnotationLayersList.tsx | 2 +- .../src/views/CRUD/chart/ChartList.tsx | 2 +- .../CRUD/csstemplates/CssTemplateModal.tsx | 2 +- .../CRUD/csstemplates/CssTemplatesList.tsx | 2 +- .../views/CRUD/dashboard/DashboardList.tsx | 2 +- .../SyntaxHighlighterCopy/index.tsx | 2 +- .../views/CRUD/data/database/DatabaseList.tsx | 2 +- .../data/database/DatabaseModal/index.tsx | 2 +- .../CRUD/data/dataset/AddDatasetModal.tsx | 2 +- .../views/CRUD/data/dataset/DatasetList.tsx | 2 +- .../src/views/CRUD/data/query/QueryList.tsx | 2 +- .../CRUD/data/query/QueryPreviewModal.tsx | 4 ++- .../CRUD/data/savedquery/SavedQueryList.tsx | 2 +- .../savedquery/SavedQueryPreviewModal.tsx | 4 ++- .../src/views/CRUD/welcome/ChartTable.tsx | 2 +- .../src/views/CRUD/welcome/DashboardTable.tsx | 3 +- .../src/views/CRUD/welcome/SavedQueries.tsx | 2 +- .../src/views/CRUD/welcome/Welcome.tsx | 2 +- superset-frontend/src/views/store.ts | 2 +- 83 files changed, 179 insertions(+), 237 deletions(-) delete mode 100644 superset-frontend/spec/javascripts/messageToasts/.eslintrc rename superset-frontend/{spec/javascripts/messageToasts/components/Toast_spec.jsx => src/components/MessageToasts/Toast.test.jsx} (94%) rename superset-frontend/src/{messageToasts/components => components/MessageToasts}/Toast.tsx (97%) rename superset-frontend/src/{messageToasts/containers/ToastPresenter.jsx => components/MessageToasts/ToastContainer.jsx} (91%) rename superset-frontend/{spec/javascripts/messageToasts/components/ToastPresenter_spec.jsx => src/components/MessageToasts/ToastPresenter.test.jsx} (90%) rename superset-frontend/src/{messageToasts/components => components/MessageToasts}/ToastPresenter.tsx (97%) rename superset-frontend/src/{messageToasts/actions/index.ts => components/MessageToasts/actions.ts} (98%) rename superset-frontend/src/{messageToasts/utils => components/MessageToasts}/getToastsFromPyFlashMessages.js (93%) rename superset-frontend/{spec/javascripts/messageToasts/utils/getToastsFromPyFlashMessages_spec.js => src/components/MessageToasts/getToastsFromPyFlashMessages.test.js} (90%) rename superset-frontend/{spec/javascripts/messageToasts => src/components/MessageToasts}/mockMessageToasts.js (93%) rename superset-frontend/src/{messageToasts/reducers/index.js => components/MessageToasts/reducers.js} (96%) rename superset-frontend/{spec/javascripts/messageToasts/reducers/messageToasts_spec.js => src/components/MessageToasts/reducers.test.js} (90%) rename superset-frontend/src/{messageToasts => components/MessageToasts}/types.ts (100%) rename superset-frontend/src/{messageToasts/enhancers => components/MessageToasts}/withToasts.tsx (98%) delete mode 100644 superset-frontend/src/messageToasts/constants.ts diff --git a/superset-frontend/spec/fixtures/mockState.js b/superset-frontend/spec/fixtures/mockState.js index 36870045e..a31e2ab92 100644 --- a/superset-frontend/spec/fixtures/mockState.js +++ b/superset-frontend/spec/fixtures/mockState.js @@ -17,7 +17,7 @@ * under the License. */ import datasources from 'spec/fixtures/mockDatasource'; -import messageToasts from 'spec/javascripts/messageToasts/mockMessageToasts'; +import messageToasts from 'src/components/MessageToasts/mockMessageToasts'; import { nativeFiltersInfo, mockDataMaskInfo, diff --git a/superset-frontend/spec/fixtures/mockStateWithoutUser.tsx b/superset-frontend/spec/fixtures/mockStateWithoutUser.tsx index bc92df4df..3dab2b575 100644 --- a/superset-frontend/spec/fixtures/mockStateWithoutUser.tsx +++ b/superset-frontend/spec/fixtures/mockStateWithoutUser.tsx @@ -17,7 +17,7 @@ * under the License. */ import datasources from 'spec/fixtures/mockDatasource'; -import messageToasts from 'spec/javascripts/messageToasts/mockMessageToasts'; +import messageToasts from 'src/components/MessageToasts/mockMessageToasts'; import { nativeFiltersInfo, mockDataMaskInfo, diff --git a/superset-frontend/spec/helpers/reducerIndex.ts b/superset-frontend/spec/helpers/reducerIndex.ts index 113368389..5073d9fd6 100644 --- a/superset-frontend/spec/helpers/reducerIndex.ts +++ b/superset-frontend/spec/helpers/reducerIndex.ts @@ -25,7 +25,7 @@ import nativeFilters from 'src/dashboard/reducers/nativeFilters'; import datasources from 'src/dashboard/reducers/datasources'; import sliceEntities from 'src/dashboard/reducers/sliceEntities'; import dashboardLayout from 'src/dashboard/reducers/undoableDashboardLayout'; -import messageToasts from 'src/messageToasts/reducers'; +import messageToasts from 'src/components/MessageToasts/reducers'; import saveModal from 'src/explore/reducers/saveModalReducer'; import explore from 'src/explore/reducers/exploreReducer'; import sqlLab from 'src/SqlLab/reducers/sqlLab'; diff --git a/superset-frontend/spec/javascripts/dashboard/actions/dashboardLayout_spec.js b/superset-frontend/spec/javascripts/dashboard/actions/dashboardLayout_spec.js index 5779b9ec8..aaf85dd0d 100644 --- a/superset-frontend/spec/javascripts/dashboard/actions/dashboardLayout_spec.js +++ b/superset-frontend/spec/javascripts/dashboard/actions/dashboardLayout_spec.js @@ -40,7 +40,7 @@ import { import { setUnsavedChanges } from 'src/dashboard/actions/dashboardState'; import * as dashboardFilters from 'src/dashboard/actions/dashboardFilters'; -import { ADD_TOAST } from 'src/messageToasts/actions'; +import { ADD_TOAST } from 'src/components/MessageToasts/actions'; import { DASHBOARD_GRID_TYPE, diff --git a/superset-frontend/spec/javascripts/messageToasts/.eslintrc b/superset-frontend/spec/javascripts/messageToasts/.eslintrc deleted file mode 100644 index 7a8a576a8..000000000 --- a/superset-frontend/spec/javascripts/messageToasts/.eslintrc +++ /dev/null @@ -1,30 +0,0 @@ -{ - "extends": "prettier", - "plugins": ["prettier"], - "rules": { - "prefer-template": 2, - "new-cap": 2, - "no-restricted-syntax": 2, - "guard-for-in": 2, - "prefer-arrow-callback": 2, - "func-names": 2, - "react/jsx-no-bind": 2, - "no-confusing-arrow": 2, - "jsx-a11y/no-static-element-interactions": 2, - "jsx-a11y/anchor-has-content": 2, - "react/require-default-props": 2, - "no-plusplus": 2, - "no-mixed-operators": 0, - "no-continue": 2, - "no-bitwise": 2, - "no-multi-assign": 2, - "no-restricted-properties": 2, - "no-prototype-builtins": 2, - "class-methods-use-this": 2, - "import/no-named-as-default": 2, - "react/no-unescaped-entities": 2, - "react/no-string-refs": 2, - "react/jsx-indent": 0, - "prettier/prettier": "error" - } -} diff --git a/superset-frontend/spec/javascripts/sqllab/actions/sqlLab_spec.js b/superset-frontend/spec/javascripts/sqllab/actions/sqlLab_spec.js index 3c391aaf8..bc16c6409 100644 --- a/superset-frontend/spec/javascripts/sqllab/actions/sqlLab_spec.js +++ b/superset-frontend/spec/javascripts/sqllab/actions/sqlLab_spec.js @@ -23,7 +23,7 @@ import configureMockStore from 'redux-mock-store'; import thunk from 'redux-thunk'; import shortid from 'shortid'; import * as featureFlags from 'src/featureFlags'; -import { ADD_TOAST } from 'src/messageToasts/actions'; +import { ADD_TOAST } from 'src/components/MessageToasts/actions'; import * as actions from 'src/SqlLab/actions/sqlLab'; import { defaultQueryEditor, query } from '../fixtures'; diff --git a/superset-frontend/src/SqlLab/actions/sqlLab.js b/superset-frontend/src/SqlLab/actions/sqlLab.js index 1b46749ae..a7fa368d4 100644 --- a/superset-frontend/src/SqlLab/actions/sqlLab.js +++ b/superset-frontend/src/SqlLab/actions/sqlLab.js @@ -23,15 +23,15 @@ import invert from 'lodash/invert'; import mapKeys from 'lodash/mapKeys'; import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; -import { now } from '../../modules/dates'; +import { now } from 'src/modules/dates'; import { addDangerToast as addDangerToastAction, addInfoToast as addInfoToastAction, addSuccessToast as addSuccessToastAction, addWarningToast as addWarningToastAction, -} from '../../messageToasts/actions/index'; -import { getClientErrorObject } from '../../utils/getClientErrorObject'; -import COMMON_ERR_MESSAGES from '../../utils/errorMessages'; +} from 'src/components/MessageToasts/actions'; +import { getClientErrorObject } from 'src/utils/getClientErrorObject'; +import COMMON_ERR_MESSAGES from 'src/utils/errorMessages'; export const RESET_STATE = 'RESET_STATE'; export const ADD_QUERY_EDITOR = 'ADD_QUERY_EDITOR'; diff --git a/superset-frontend/src/SqlLab/components/App.jsx b/superset-frontend/src/SqlLab/components/App.jsx index e0c58a787..3521d7c24 100644 --- a/superset-frontend/src/SqlLab/components/App.jsx +++ b/superset-frontend/src/SqlLab/components/App.jsx @@ -23,16 +23,16 @@ import { connect } from 'react-redux'; import { t, supersetTheme, ThemeProvider } from '@superset-ui/core'; import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; import throttle from 'lodash/throttle'; -import TabbedSqlEditors from './TabbedSqlEditors'; -import QueryAutoRefresh from './QueryAutoRefresh'; -import QuerySearch from './QuerySearch'; -import ToastPresenter from '../../messageToasts/containers/ToastPresenter'; +import ToastContainer from 'src/components/MessageToasts/ToastContainer'; import { LOCALSTORAGE_MAX_USAGE_KB, LOCALSTORAGE_WARNING_THRESHOLD, LOCALSTORAGE_WARNING_MESSAGE_THROTTLE_MS, -} from '../constants'; -import * as Actions from '../actions/sqlLab'; +} from 'src/SqlLab/constants'; +import * as Actions from 'src/SqlLab/actions/sqlLab'; +import TabbedSqlEditors from './TabbedSqlEditors'; +import QueryAutoRefresh from './QueryAutoRefresh'; +import QuerySearch from './QuerySearch'; class App extends React.PureComponent { constructor(props) { @@ -109,7 +109,7 @@ class App extends React.PureComponent {
{content} - +
); diff --git a/superset-frontend/src/SqlLab/components/ShareSqlLabQuery.tsx b/superset-frontend/src/SqlLab/components/ShareSqlLabQuery.tsx index 66d6902a3..db49fcc8d 100644 --- a/superset-frontend/src/SqlLab/components/ShareSqlLabQuery.tsx +++ b/superset-frontend/src/SqlLab/components/ShareSqlLabQuery.tsx @@ -18,10 +18,9 @@ */ import React from 'react'; import { t, useTheme, styled } from '@superset-ui/core'; - import Button from 'src/components/Button'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; import Icons from 'src/components/Icons'; +import withToasts from 'src/components/MessageToasts/withToasts'; import CopyToClipboard from 'src/components/CopyToClipboard'; import { storeQuery } from 'src/utils/common'; import { getClientErrorObject } from 'src/utils/getClientErrorObject'; diff --git a/superset-frontend/src/SqlLab/reducers/getInitialState.js b/superset-frontend/src/SqlLab/reducers/getInitialState.js index 92ffa0d6d..0eceebfa3 100644 --- a/superset-frontend/src/SqlLab/reducers/getInitialState.js +++ b/superset-frontend/src/SqlLab/reducers/getInitialState.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/core'; -import getToastsFromPyFlashMessages from '../../messageToasts/utils/getToastsFromPyFlashMessages'; +import getToastsFromPyFlashMessages from 'src/components/MessageToasts/getToastsFromPyFlashMessages'; export default function getInitialState({ defaultDbId, diff --git a/superset-frontend/src/SqlLab/reducers/index.js b/superset-frontend/src/SqlLab/reducers/index.js index 904b30607..8ae0608ef 100644 --- a/superset-frontend/src/SqlLab/reducers/index.js +++ b/superset-frontend/src/SqlLab/reducers/index.js @@ -17,10 +17,9 @@ * under the License. */ import { combineReducers } from 'redux'; - +import messageToasts from 'src/components/MessageToasts/reducers'; import sqlLab from './sqlLab'; import localStorageUsageInKilobytes from './localStorageUsage'; -import messageToasts from '../../messageToasts/reducers/index'; import common from './common'; export default combineReducers({ diff --git a/superset-frontend/src/chart/chartAction.js b/superset-frontend/src/chart/chartAction.js index 5052416df..5410caa5a 100644 --- a/superset-frontend/src/chart/chartAction.js +++ b/superset-frontend/src/chart/chartAction.js @@ -21,7 +21,7 @@ import moment from 'moment'; import { t, SupersetClient } from '@superset-ui/core'; import { getControlsState } from 'src/explore/store'; -import { isFeatureEnabled, FeatureFlag } from '../featureFlags'; +import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; import { getAnnotationJsonUrl, getExploreUrl, @@ -30,19 +30,19 @@ import { postForm, shouldUseLegacyApi, getChartDataUri, -} from '../explore/exploreUtils'; +} from 'src/explore/exploreUtils'; import { requiresQuery, ANNOTATION_SOURCE_TYPES, -} from '../modules/AnnotationTypes'; +} from 'src/modules/AnnotationTypes'; -import { addDangerToast } from '../messageToasts/actions'; -import { logEvent } from '../logger/actions'; -import { Logger, LOG_ACTIONS_LOAD_CHART } from '../logger/LogUtils'; -import { getClientErrorObject } from '../utils/getClientErrorObject'; -import { allowCrossDomain as domainShardingEnabled } from '../utils/hostNamesConfig'; -import { updateDataMask } from '../dataMask/actions'; -import { waitForAsyncData } from '../middleware/asyncEvent'; +import { addDangerToast } from 'src/components/MessageToasts/actions'; +import { logEvent } from 'src/logger/actions'; +import { Logger, LOG_ACTIONS_LOAD_CHART } from 'src/logger/LogUtils'; +import { getClientErrorObject } from 'src/utils/getClientErrorObject'; +import { allowCrossDomain as domainShardingEnabled } from 'src/utils/hostNamesConfig'; +import { updateDataMask } from 'src/dataMask/actions'; +import { waitForAsyncData } from 'src/middleware/asyncEvent'; export const CHART_UPDATE_STARTED = 'CHART_UPDATE_STARTED'; export function chartUpdateStarted(queryController, latestQueryFormData, key) { diff --git a/superset-frontend/src/components/CopyToClipboard/CopyToClipboard.stories.tsx b/superset-frontend/src/components/CopyToClipboard/CopyToClipboard.stories.tsx index 875d5f734..adb44a36f 100644 --- a/superset-frontend/src/components/CopyToClipboard/CopyToClipboard.stories.tsx +++ b/superset-frontend/src/components/CopyToClipboard/CopyToClipboard.stories.tsx @@ -20,7 +20,7 @@ import React from 'react'; import { useTheme } from '@superset-ui/core'; import Button from 'src/components/Button'; import Icons from 'src/components/Icons'; -import ToastPresenter from 'src/messageToasts/containers/ToastPresenter'; +import ToastContainer from 'src/components/MessageToasts/ToastContainer'; import CopyToClipboard from '.'; export default { @@ -39,7 +39,7 @@ export const InteractiveCopyToClipboard = ({ copyNode, ...rest }: any) => { return ( <> - + ); }; diff --git a/superset-frontend/src/components/CopyToClipboard/index.jsx b/superset-frontend/src/components/CopyToClipboard/index.jsx index 8f384bcaa..cfd607bde 100644 --- a/superset-frontend/src/components/CopyToClipboard/index.jsx +++ b/superset-frontend/src/components/CopyToClipboard/index.jsx @@ -20,7 +20,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { t } from '@superset-ui/core'; import { Tooltip } from 'src/components/Tooltip'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; import copyTextToClipboard from 'src/utils/copy'; const propTypes = { diff --git a/superset-frontend/src/components/FlashProvider/index.tsx b/superset-frontend/src/components/FlashProvider/index.tsx index 21c1fff54..61690c920 100644 --- a/superset-frontend/src/components/FlashProvider/index.tsx +++ b/superset-frontend/src/components/FlashProvider/index.tsx @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { useToasts } from 'src/messageToasts/enhancers/withToasts'; +import { useToasts } from 'src/components/MessageToasts/withToasts'; import { useComponentDidMount } from 'src/common/hooks/useComponentDidMount'; type FlashMessageType = 'info' | 'alert' | 'danger' | 'warning' | 'success'; diff --git a/superset-frontend/spec/javascripts/messageToasts/components/Toast_spec.jsx b/superset-frontend/src/components/MessageToasts/Toast.test.jsx similarity index 94% rename from superset-frontend/spec/javascripts/messageToasts/components/Toast_spec.jsx rename to superset-frontend/src/components/MessageToasts/Toast.test.jsx index 0686f82f9..f0280c485 100644 --- a/superset-frontend/spec/javascripts/messageToasts/components/Toast_spec.jsx +++ b/superset-frontend/src/components/MessageToasts/Toast.test.jsx @@ -19,9 +19,9 @@ import React from 'react'; import { mount } from 'enzyme'; import { ThemeProvider, supersetTheme } from '@superset-ui/core'; -import Toast from 'src/messageToasts/components/Toast'; +import Toast from 'src/components/MessageToasts/Toast'; import { act } from 'react-dom/test-utils'; -import mockMessageToasts from '../mockMessageToasts'; +import mockMessageToasts from './mockMessageToasts'; const props = { toast: mockMessageToasts[0], diff --git a/superset-frontend/src/messageToasts/components/Toast.tsx b/superset-frontend/src/components/MessageToasts/Toast.tsx similarity index 97% rename from superset-frontend/src/messageToasts/components/Toast.tsx rename to superset-frontend/src/components/MessageToasts/Toast.tsx index 5f7416aa4..82a57e199 100644 --- a/superset-frontend/src/messageToasts/components/Toast.tsx +++ b/superset-frontend/src/components/MessageToasts/Toast.tsx @@ -21,8 +21,7 @@ import cx from 'classnames'; import Interweave from 'interweave'; import React, { useCallback, useEffect, useRef, useState } from 'react'; import Icons from 'src/components/Icons'; -import { ToastType } from 'src/messageToasts/constants'; -import { ToastMeta } from '../types'; +import { ToastType, ToastMeta } from './types'; const ToastContainer = styled.div` display: flex; diff --git a/superset-frontend/src/messageToasts/containers/ToastPresenter.jsx b/superset-frontend/src/components/MessageToasts/ToastContainer.jsx similarity index 91% rename from superset-frontend/src/messageToasts/containers/ToastPresenter.jsx rename to superset-frontend/src/components/MessageToasts/ToastContainer.jsx index 97506cc40..d61920de5 100644 --- a/superset-frontend/src/messageToasts/containers/ToastPresenter.jsx +++ b/superset-frontend/src/components/MessageToasts/ToastContainer.jsx @@ -18,9 +18,9 @@ */ import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; -import ToastPresenter from '../components/ToastPresenter'; +import ToastPresenter from './ToastPresenter'; -import { removeToast } from '../actions'; +import { removeToast } from './actions'; export default connect( ({ messageToasts: toasts }) => ({ toasts }), diff --git a/superset-frontend/spec/javascripts/messageToasts/components/ToastPresenter_spec.jsx b/superset-frontend/src/components/MessageToasts/ToastPresenter.test.jsx similarity index 90% rename from superset-frontend/spec/javascripts/messageToasts/components/ToastPresenter_spec.jsx rename to superset-frontend/src/components/MessageToasts/ToastPresenter.test.jsx index bd9b6cf98..c1e287556 100644 --- a/superset-frontend/spec/javascripts/messageToasts/components/ToastPresenter_spec.jsx +++ b/superset-frontend/src/components/MessageToasts/ToastPresenter.test.jsx @@ -18,10 +18,9 @@ */ import React from 'react'; import { shallow } from 'enzyme'; -import Toast from 'src/messageToasts/components/Toast'; -import ToastPresenter from 'src/messageToasts/components/ToastPresenter'; - -import mockMessageToasts from '../mockMessageToasts'; +import Toast from 'src/components/MessageToasts/Toast'; +import ToastPresenter from 'src/components/MessageToasts/ToastPresenter'; +import mockMessageToasts from './mockMessageToasts'; describe('ToastPresenter', () => { const props = { diff --git a/superset-frontend/src/messageToasts/components/ToastPresenter.tsx b/superset-frontend/src/components/MessageToasts/ToastPresenter.tsx similarity index 97% rename from superset-frontend/src/messageToasts/components/ToastPresenter.tsx rename to superset-frontend/src/components/MessageToasts/ToastPresenter.tsx index 05e3cee2c..18f2ed9fc 100644 --- a/superset-frontend/src/messageToasts/components/ToastPresenter.tsx +++ b/superset-frontend/src/components/MessageToasts/ToastPresenter.tsx @@ -18,7 +18,7 @@ */ import React from 'react'; import { styled } from '@superset-ui/core'; -import { ToastMeta } from 'src/messageToasts/types'; +import { ToastMeta } from 'src/components/MessageToasts/types'; import Toast from './Toast'; const StyledToastPresenter = styled.div` diff --git a/superset-frontend/src/messageToasts/actions/index.ts b/superset-frontend/src/components/MessageToasts/actions.ts similarity index 98% rename from superset-frontend/src/messageToasts/actions/index.ts rename to superset-frontend/src/components/MessageToasts/actions.ts index 3eaf51c3c..37fcf80f1 100644 --- a/superset-frontend/src/messageToasts/actions/index.ts +++ b/superset-frontend/src/components/MessageToasts/actions.ts @@ -17,7 +17,7 @@ * under the License. */ import shortid from 'shortid'; -import { ToastType, ToastMeta } from '../types'; +import { ToastType, ToastMeta } from './types'; type ToastOptions = Partial>; diff --git a/superset-frontend/src/messageToasts/utils/getToastsFromPyFlashMessages.js b/superset-frontend/src/components/MessageToasts/getToastsFromPyFlashMessages.js similarity index 93% rename from superset-frontend/src/messageToasts/utils/getToastsFromPyFlashMessages.js rename to superset-frontend/src/components/MessageToasts/getToastsFromPyFlashMessages.js index 6f921c495..982df1710 100644 --- a/superset-frontend/src/messageToasts/utils/getToastsFromPyFlashMessages.js +++ b/superset-frontend/src/components/MessageToasts/getToastsFromPyFlashMessages.js @@ -16,8 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -import { addToast } from '../actions'; -import { ToastType } from '../constants'; +import { addToast } from './actions'; +import { ToastType } from './types'; export default function toastsFromPyFlashMessages(flashMessages = []) { const toasts = []; diff --git a/superset-frontend/spec/javascripts/messageToasts/utils/getToastsFromPyFlashMessages_spec.js b/superset-frontend/src/components/MessageToasts/getToastsFromPyFlashMessages.test.js similarity index 90% rename from superset-frontend/spec/javascripts/messageToasts/utils/getToastsFromPyFlashMessages_spec.js rename to superset-frontend/src/components/MessageToasts/getToastsFromPyFlashMessages.test.js index 59f8a45d2..d19ac0c5d 100644 --- a/superset-frontend/spec/javascripts/messageToasts/utils/getToastsFromPyFlashMessages_spec.js +++ b/superset-frontend/src/components/MessageToasts/getToastsFromPyFlashMessages.test.js @@ -16,9 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -import { ToastType } from 'src/messageToasts/constants'; - -import getToastsFromPyFlashMessages from 'src/messageToasts/utils/getToastsFromPyFlashMessages'; +import { ToastType } from 'src/components/MessageToasts/types'; +import getToastsFromPyFlashMessages from 'src/components/MessageToasts/getToastsFromPyFlashMessages'; describe('getToastsFromPyFlashMessages', () => { it('should return an info toast', () => { diff --git a/superset-frontend/spec/javascripts/messageToasts/mockMessageToasts.js b/superset-frontend/src/components/MessageToasts/mockMessageToasts.js similarity index 93% rename from superset-frontend/spec/javascripts/messageToasts/mockMessageToasts.js rename to superset-frontend/src/components/MessageToasts/mockMessageToasts.js index 311e62662..4604e5de6 100644 --- a/superset-frontend/spec/javascripts/messageToasts/mockMessageToasts.js +++ b/superset-frontend/src/components/MessageToasts/mockMessageToasts.js @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { ToastType } from 'src/messageToasts/constants'; +import { ToastType } from 'src/components/MessageToasts/types'; export default [ { id: 'info_id', toastType: ToastType.INFO, text: 'info toast' }, diff --git a/superset-frontend/src/messageToasts/reducers/index.js b/superset-frontend/src/components/MessageToasts/reducers.js similarity index 96% rename from superset-frontend/src/messageToasts/reducers/index.js rename to superset-frontend/src/components/MessageToasts/reducers.js index 2203bf837..e999d12ad 100644 --- a/superset-frontend/src/messageToasts/reducers/index.js +++ b/superset-frontend/src/components/MessageToasts/reducers.js @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { ADD_TOAST, REMOVE_TOAST } from '../actions'; +import { ADD_TOAST, REMOVE_TOAST } from './actions'; export default function messageToastsReducer(toasts = [], action) { switch (action.type) { diff --git a/superset-frontend/spec/javascripts/messageToasts/reducers/messageToasts_spec.js b/superset-frontend/src/components/MessageToasts/reducers.test.js similarity index 90% rename from superset-frontend/spec/javascripts/messageToasts/reducers/messageToasts_spec.js rename to superset-frontend/src/components/MessageToasts/reducers.test.js index 11a509e7b..d3d5d61de 100644 --- a/superset-frontend/spec/javascripts/messageToasts/reducers/messageToasts_spec.js +++ b/superset-frontend/src/components/MessageToasts/reducers.test.js @@ -16,8 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -import { ADD_TOAST, REMOVE_TOAST } from 'src/messageToasts/actions'; -import messageToastsReducer from 'src/messageToasts/reducers'; +import { ADD_TOAST, REMOVE_TOAST } from 'src/components/MessageToasts/actions'; +import messageToastsReducer from 'src/components/MessageToasts/reducers'; describe('messageToasts reducer', () => { it('should return initial state', () => { diff --git a/superset-frontend/src/messageToasts/types.ts b/superset-frontend/src/components/MessageToasts/types.ts similarity index 100% rename from superset-frontend/src/messageToasts/types.ts rename to superset-frontend/src/components/MessageToasts/types.ts diff --git a/superset-frontend/src/messageToasts/enhancers/withToasts.tsx b/superset-frontend/src/components/MessageToasts/withToasts.tsx similarity index 98% rename from superset-frontend/src/messageToasts/enhancers/withToasts.tsx rename to superset-frontend/src/components/MessageToasts/withToasts.tsx index 50d98513f..2d0486a65 100644 --- a/superset-frontend/src/messageToasts/enhancers/withToasts.tsx +++ b/superset-frontend/src/components/MessageToasts/withToasts.tsx @@ -26,7 +26,7 @@ import { addInfoToast, addSuccessToast, addWarningToast, -} from '../actions'; +} from './actions'; export interface ToastProps { addDangerToast: typeof addDangerToast; diff --git a/superset-frontend/src/components/ReportModal/index.tsx b/superset-frontend/src/components/ReportModal/index.tsx index e24d1d756..178e39412 100644 --- a/superset-frontend/src/components/ReportModal/index.tsx +++ b/superset-frontend/src/components/ReportModal/index.tsx @@ -33,7 +33,7 @@ import { AlertObject } from 'src/views/CRUD/alert/types'; import TimezoneSelector from 'src/components/TimezoneSelector'; import LabeledErrorBoundInput from 'src/components/Form/LabeledErrorBoundInput'; import Icons from 'src/components/Icons'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; import { CronError } from 'src/components/CronPicker'; import { RadioChangeEvent } from 'src/common/components'; import { diff --git a/superset-frontend/src/components/TableLoader/TableLoader.test.tsx b/superset-frontend/src/components/TableLoader/TableLoader.test.tsx index c0c46878f..d8de53c2e 100644 --- a/superset-frontend/src/components/TableLoader/TableLoader.test.tsx +++ b/superset-frontend/src/components/TableLoader/TableLoader.test.tsx @@ -21,7 +21,7 @@ import { render, screen } from 'spec/helpers/testing-library'; import { Provider } from 'react-redux'; import fetchMock from 'fetch-mock'; import { storeWithState } from 'spec/fixtures/mockStore'; -import ToastPresenter from 'src/messageToasts/containers/ToastPresenter'; +import ToastContainer from 'src/components/MessageToasts/ToastContainer'; import TableLoader, { TableLoaderProps } from '.'; fetchMock.get('glob:*/api/v1/mock', [ @@ -38,7 +38,7 @@ function renderWithProps(props: TableLoaderProps = defaultProps) { return render( - + , ); } diff --git a/superset-frontend/src/components/TableLoader/index.tsx b/superset-frontend/src/components/TableLoader/index.tsx index c6224499d..2956df3f7 100644 --- a/superset-frontend/src/components/TableLoader/index.tsx +++ b/superset-frontend/src/components/TableLoader/index.tsx @@ -19,7 +19,7 @@ import React, { useState, useEffect, useMemo } from 'react'; import { t, SupersetClient, JsonObject } from '@superset-ui/core'; import TableView, { EmptyWrapperType } from 'src/components/TableView'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; import Loading from 'src/components/Loading'; import 'stylesheets/reactable-pagination.less'; diff --git a/superset-frontend/src/components/URLShortLinkButton/URLShortLinkButton.test.tsx b/superset-frontend/src/components/URLShortLinkButton/URLShortLinkButton.test.tsx index 6bba1dee4..f54a2ba36 100644 --- a/superset-frontend/src/components/URLShortLinkButton/URLShortLinkButton.test.tsx +++ b/superset-frontend/src/components/URLShortLinkButton/URLShortLinkButton.test.tsx @@ -21,7 +21,7 @@ import { render, screen } from 'spec/helpers/testing-library'; import userEvent from '@testing-library/user-event'; import fetchMock from 'fetch-mock'; import URLShortLinkButton from 'src/components/URLShortLinkButton'; -import ToastPresenter from 'src/messageToasts/containers/ToastPresenter'; +import ToastContainer from 'src/components/MessageToasts/ToastContainer'; const fakeUrl = 'http://fakeurl.com'; @@ -65,7 +65,7 @@ test('renders error message on short url error', async () => { render( <> - + , { useRedux: true }, ); diff --git a/superset-frontend/src/components/URLShortLinkButton/index.jsx b/superset-frontend/src/components/URLShortLinkButton/index.jsx index f20498575..1678471b6 100644 --- a/superset-frontend/src/components/URLShortLinkButton/index.jsx +++ b/superset-frontend/src/components/URLShortLinkButton/index.jsx @@ -22,7 +22,7 @@ import { t } from '@superset-ui/core'; import Popover from 'src/components/Popover'; import CopyToClipboard from 'src/components/CopyToClipboard'; import { getShortUrl } from 'src/utils/urlUtils'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; const propTypes = { url: PropTypes.string, diff --git a/superset-frontend/src/dashboard/actions/dashboardLayout.js b/superset-frontend/src/dashboard/actions/dashboardLayout.js index 51df31503..fc64f8c67 100644 --- a/superset-frontend/src/dashboard/actions/dashboardLayout.js +++ b/superset-frontend/src/dashboard/actions/dashboardLayout.js @@ -18,19 +18,18 @@ */ import { ActionCreators as UndoActionCreators } from 'redux-undo'; import { t } from '@superset-ui/core'; - -import { addWarningToast } from '../../messageToasts/actions'; -import { updateLayoutComponents } from './dashboardFilters'; -import { setUnsavedChanges } from './dashboardState'; -import { TABS_TYPE, ROW_TYPE } from '../util/componentTypes'; +import { addWarningToast } from 'src/components/MessageToasts/actions'; +import { TABS_TYPE, ROW_TYPE } from 'src/dashboard/util/componentTypes'; import { DASHBOARD_ROOT_ID, NEW_COMPONENTS_SOURCE_ID, DASHBOARD_HEADER_ID, -} from '../util/constants'; -import dropOverflowsParent from '../util/dropOverflowsParent'; -import findParentId from '../util/findParentId'; -import isInDifferentFilterScopes from '../util/isInDifferentFilterScopes'; +} from 'src/dashboard/util/constants'; +import dropOverflowsParent from 'src/dashboard/util/dropOverflowsParent'; +import findParentId from 'src/dashboard/util/findParentId'; +import isInDifferentFilterScopes from 'src/dashboard/util/isInDifferentFilterScopes'; +import { updateLayoutComponents } from './dashboardFilters'; +import { setUnsavedChanges } from './dashboardState'; // Component CRUD ------------------------------------------------------------- export const UPDATE_COMPONENTS = 'UPDATE_COMPONENTS'; diff --git a/superset-frontend/src/dashboard/actions/dashboardState.js b/superset-frontend/src/dashboard/actions/dashboardState.js index 36868b85d..15d68feed 100644 --- a/superset-frontend/src/dashboard/actions/dashboardState.js +++ b/superset-frontend/src/dashboard/actions/dashboardState.js @@ -19,30 +19,29 @@ /* eslint camelcase: 0 */ import { ActionCreators as UndoActionCreators } from 'redux-undo'; import { t, SupersetClient } from '@superset-ui/core'; - -import { addChart, removeChart, refreshChart } from '../../chart/chartAction'; -import { chart as initChart } from '../../chart/chartReducer'; +import { addChart, removeChart, refreshChart } from 'src/chart/chartAction'; +import { chart as initChart } from 'src/chart/chartReducer'; +import { applyDefaultFormData } from 'src/explore/store'; +import { getClientErrorObject } from 'src/utils/getClientErrorObject'; +import { SAVE_TYPE_OVERWRITE } from 'src/dashboard/util/constants'; +import { + addSuccessToast, + addWarningToast, + addDangerToast, +} from 'src/components/MessageToasts/actions'; +import serializeActiveFilterValues from 'src/dashboard/util/serializeActiveFilterValues'; +import serializeFilterScopes from 'src/dashboard/util/serializeFilterScopes'; +import { getActiveFilters } from 'src/dashboard/util/activeDashboardFilters'; +import { safeStringify } from 'src/utils/safeStringify'; +import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; +import { UPDATE_COMPONENTS_PARENTS_LIST } from './dashboardLayout'; +import { setChartConfiguration } from './dashboardInfo'; import { fetchDatasourceMetadata } from './datasources'; import { addFilter, removeFilter, updateDirectPathToFilter, } from './dashboardFilters'; -import { applyDefaultFormData } from '../../explore/store'; -import { getClientErrorObject } from '../../utils/getClientErrorObject'; -import { SAVE_TYPE_OVERWRITE } from '../util/constants'; -import { - addSuccessToast, - addWarningToast, - addDangerToast, -} from '../../messageToasts/actions'; -import { UPDATE_COMPONENTS_PARENTS_LIST } from './dashboardLayout'; -import serializeActiveFilterValues from '../util/serializeActiveFilterValues'; -import serializeFilterScopes from '../util/serializeFilterScopes'; -import { getActiveFilters } from '../util/activeDashboardFilters'; -import { safeStringify } from '../../utils/safeStringify'; -import { FeatureFlag, isFeatureEnabled } from '../../featureFlags'; -import { setChartConfiguration } from './dashboardInfo'; export const SET_UNSAVED_CHANGES = 'SET_UNSAVED_CHANGES'; export function setUnsavedChanges(hasUnsavedChanges) { diff --git a/superset-frontend/src/dashboard/actions/sliceEntities.js b/superset-frontend/src/dashboard/actions/sliceEntities.js index 441968d98..388fddedd 100644 --- a/superset-frontend/src/dashboard/actions/sliceEntities.js +++ b/superset-frontend/src/dashboard/actions/sliceEntities.js @@ -20,7 +20,7 @@ import { t, SupersetClient } from '@superset-ui/core'; import rison from 'rison'; -import { addDangerToast } from 'src/messageToasts/actions'; +import { addDangerToast } from 'src/components/MessageToasts/actions'; import { getDatasourceParameter } from 'src/modules/utils'; import { getClientErrorObject } from 'src/utils/getClientErrorObject'; diff --git a/superset-frontend/src/dashboard/components/PropertiesModal/index.jsx b/superset-frontend/src/dashboard/components/PropertiesModal/index.jsx index 6ca383063..4d464fe07 100644 --- a/superset-frontend/src/dashboard/components/PropertiesModal/index.jsx +++ b/superset-frontend/src/dashboard/components/PropertiesModal/index.jsx @@ -37,7 +37,7 @@ import { JsonEditor } from 'src/components/AsyncAceEditor'; import ColorSchemeControlWrapper from 'src/dashboard/components/ColorSchemeControlWrapper'; import { getClientErrorObject } from 'src/utils/getClientErrorObject'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; const StyledJsonEditor = styled(JsonEditor)` diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/ColumnSelect.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/ColumnSelect.tsx index 8fc4cc4b9..693e60410 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/ColumnSelect.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/ColumnSelect.tsx @@ -21,7 +21,7 @@ import { FormInstance } from 'antd/lib/form'; import { Column, ensureIsArray, SupersetClient, t } from '@superset-ui/core'; import { useChangeEffect } from 'src/common/hooks/useChangeEffect'; import { Select } from 'src/components'; -import { useToasts } from 'src/messageToasts/enhancers/withToasts'; +import { useToasts } from 'src/components/MessageToasts/withToasts'; import { getClientErrorObject } from 'src/utils/getClientErrorObject'; import { cacheWrapper } from 'src/utils/cacheWrapper'; import { NativeFiltersForm } from '../types'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx index dba9cc66b..0721f81c8 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx @@ -51,7 +51,7 @@ import { Select } from 'src/components'; import { cacheWrapper } from 'src/utils/cacheWrapper'; import AdhocFilterControl from 'src/explore/components/controls/FilterControl/AdhocFilterControl'; import DateFilterControl from 'src/explore/components/controls/DateFilterControl'; -import { addDangerToast } from 'src/messageToasts/actions'; +import { addDangerToast } from 'src/components/MessageToasts/actions'; import { ClientErrorObject } from 'src/utils/getClientErrorObject'; import Collapse from 'src/components/Collapse'; import { getChartDataRequest } from 'src/chart/chartAction'; diff --git a/superset-frontend/src/dashboard/containers/Chart.jsx b/superset-frontend/src/dashboard/containers/Chart.jsx index c629209d4..09bd59f2b 100644 --- a/superset-frontend/src/dashboard/containers/Chart.jsx +++ b/superset-frontend/src/dashboard/containers/Chart.jsx @@ -18,24 +18,26 @@ */ import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; - import { toggleExpandSlice, setFocusedFilterField, unsetFocusedFilterField, -} from '../actions/dashboardState'; -import { updateComponents } from '../actions/dashboardLayout'; -import { changeFilter } from '../actions/dashboardFilters'; -import { addSuccessToast, addDangerToast } from '../../messageToasts/actions'; -import { refreshChart } from '../../chart/chartAction'; -import { logEvent } from '../../logger/actions'; +} from 'src/dashboard/actions/dashboardState'; +import { updateComponents } from 'src/dashboard/actions/dashboardLayout'; +import { changeFilter } from 'src/dashboard/actions/dashboardFilters'; +import { + addSuccessToast, + addDangerToast, +} from 'src/components/MessageToasts/actions'; +import { refreshChart } from 'src/chart/chartAction'; +import { logEvent } from 'src/logger/actions'; import { getActiveFilters, getAppliedFilterValues, -} from '../util/activeDashboardFilters'; -import getFormDataWithExtraFilters from '../util/charts/getFormDataWithExtraFilters'; -import Chart from '../components/gridComponents/Chart'; -import { PLACEHOLDER_DATASOURCE } from '../constants'; +} from 'src/dashboard/util/activeDashboardFilters'; +import getFormDataWithExtraFilters from 'src/dashboard/util/charts/getFormDataWithExtraFilters'; +import Chart from 'src/dashboard/components/gridComponents/Chart'; +import { PLACEHOLDER_DATASOURCE } from 'src/dashboard/constants'; const EMPTY_OBJECT = {}; diff --git a/superset-frontend/src/dashboard/containers/DashboardComponent.jsx b/superset-frontend/src/dashboard/containers/DashboardComponent.jsx index 12397eaae..08b7ed9f8 100644 --- a/superset-frontend/src/dashboard/containers/DashboardComponent.jsx +++ b/superset-frontend/src/dashboard/containers/DashboardComponent.jsx @@ -20,26 +20,24 @@ import React from 'react'; import PropTypes from 'prop-types'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; - import { logEvent } from 'src/logger/actions'; -import { addDangerToast } from 'src/messageToasts/actions'; -import { componentLookup } from '../components/gridComponents'; -import getDetailedComponentWidth from '../util/getDetailedComponentWidth'; -import { getActiveFilters } from '../util/activeDashboardFilters'; -import { componentShape } from '../util/propShapes'; -import { COLUMN_TYPE, ROW_TYPE } from '../util/componentTypes'; - +import { addDangerToast } from 'src/components/MessageToasts/actions'; +import { componentLookup } from 'src/dashboard/components/gridComponents'; +import getDetailedComponentWidth from 'src/dashboard/util/getDetailedComponentWidth'; +import { getActiveFilters } from 'src/dashboard/util/activeDashboardFilters'; +import { componentShape } from 'src/dashboard/util/propShapes'; +import { COLUMN_TYPE, ROW_TYPE } from 'src/dashboard/util/componentTypes'; import { createComponent, deleteComponent, updateComponents, handleComponentDrop, -} from '../actions/dashboardLayout'; +} from 'src/dashboard/actions/dashboardLayout'; import { setDirectPathToChild, setActiveTabs, setFullSizeChartId, -} from '../actions/dashboardState'; +} from 'src/dashboard/actions/dashboardState'; const propTypes = { id: PropTypes.string, diff --git a/superset-frontend/src/dashboard/containers/DashboardHeader.jsx b/superset-frontend/src/dashboard/containers/DashboardHeader.jsx index bcd6caf9d..e8d68bad0 100644 --- a/superset-frontend/src/dashboard/containers/DashboardHeader.jsx +++ b/superset-frontend/src/dashboard/containers/DashboardHeader.jsx @@ -20,10 +20,10 @@ import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { updateDataMask } from 'src/dataMask/actions'; -import DashboardHeader from '../components/Header'; -import isDashboardLoading from '../util/isDashboardLoading'; +import DashboardHeader from 'src/dashboard/components/Header'; +import isDashboardLoading from 'src/dashboard/util/isDashboardLoading'; -import { dashboardInfoChanged } from '../actions/dashboardInfo'; +import { dashboardInfoChanged } from 'src/dashboard/actions/dashboardInfo'; import { setEditMode, @@ -40,28 +40,27 @@ import { maxUndoHistoryToast, setRefreshFrequency, onRefresh, -} from '../actions/dashboardState'; +} from 'src/dashboard/actions/dashboardState'; import { undoLayoutAction, redoLayoutAction, updateDashboardTitle, dashboardTitleChanged, -} from '../actions/dashboardLayout'; - +} from 'src/dashboard/actions/dashboardLayout'; import { addSuccessToast, addDangerToast, addWarningToast, -} from '../../messageToasts/actions'; +} from 'src/components/MessageToasts/actions'; -import { logEvent } from '../../logger/actions'; -import { DASHBOARD_HEADER_ID } from '../util/constants'; +import { logEvent } from 'src/logger/actions'; +import { DASHBOARD_HEADER_ID } from 'src/dashboard/util/constants'; import { fetchUISpecificReport, toggleActive, deleteActiveReport, -} from '../../reports/actions/reports'; +} from 'src/reports/actions/reports'; function mapStateToProps({ dashboardLayout: undoableLayout, diff --git a/superset-frontend/src/dashboard/containers/DashboardPage.tsx b/superset-frontend/src/dashboard/containers/DashboardPage.tsx index 878d2117e..01f488684 100644 --- a/superset-frontend/src/dashboard/containers/DashboardPage.tsx +++ b/superset-frontend/src/dashboard/containers/DashboardPage.tsx @@ -20,7 +20,7 @@ import React, { useEffect, FC } from 'react'; import { t } from '@superset-ui/core'; import { useDispatch } from 'react-redux'; import { useParams } from 'react-router-dom'; -import { useToasts } from 'src/messageToasts/enhancers/withToasts'; +import { useToasts } from 'src/components/MessageToasts/withToasts'; import Loading from 'src/components/Loading'; import { useDashboard, diff --git a/superset-frontend/src/datasource/ChangeDatasourceModal.tsx b/superset-frontend/src/datasource/ChangeDatasourceModal.tsx index 2980d4019..7aa80bb12 100644 --- a/superset-frontend/src/datasource/ChangeDatasourceModal.tsx +++ b/superset-frontend/src/datasource/ChangeDatasourceModal.tsx @@ -35,12 +35,12 @@ import { useDebouncedEffect } from 'src/explore/exploreUtils'; import { SLOW_DEBOUNCE } from 'src/constants'; import { getClientErrorObject } from 'src/utils/getClientErrorObject'; import Loading from 'src/components/Loading'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; import { Input, AntdInput } from 'src/common/components'; import { PAGE_SIZE as DATASET_PAGE_SIZE, SORT_BY as DATASET_SORT_BY, } from 'src/views/CRUD/data/dataset/constants'; +import withToasts from 'src/components/MessageToasts/withToasts'; import FacePile from '../components/FacePile'; const CONFIRM_WARNING_MESSAGE = t( diff --git a/superset-frontend/src/datasource/DatasourceEditor.jsx b/superset-frontend/src/datasource/DatasourceEditor.jsx index b32276e18..6d79a9e52 100644 --- a/superset-frontend/src/datasource/DatasourceEditor.jsx +++ b/superset-frontend/src/datasource/DatasourceEditor.jsx @@ -49,7 +49,7 @@ import CollectionTable from 'src/CRUD/CollectionTable'; import Fieldset from 'src/CRUD/Fieldset'; import Field from 'src/CRUD/Field'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; import Icons from 'src/components/Icons'; diff --git a/superset-frontend/src/datasource/DatasourceModal.tsx b/superset-frontend/src/datasource/DatasourceModal.tsx index 0b85d462e..8f23b93af 100644 --- a/superset-frontend/src/datasource/DatasourceModal.tsx +++ b/superset-frontend/src/datasource/DatasourceModal.tsx @@ -26,7 +26,7 @@ import AsyncEsmComponent from 'src/components/AsyncEsmComponent'; import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; import { getClientErrorObject } from 'src/utils/getClientErrorObject'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; const DatasourceEditor = AsyncEsmComponent(() => import('./DatasourceEditor')); diff --git a/superset-frontend/src/explore/App.jsx b/superset-frontend/src/explore/App.jsx index e7973fe91..86e04020a 100644 --- a/superset-frontend/src/explore/App.jsx +++ b/superset-frontend/src/explore/App.jsx @@ -23,13 +23,13 @@ import { DndProvider } from 'react-dnd'; import { HTML5Backend } from 'react-dnd-html5-backend'; import { ThemeProvider } from '@superset-ui/core'; import { DynamicPluginProvider } from 'src/components/DynamicPlugins'; -import ToastPresenter from '../messageToasts/containers/ToastPresenter'; -import ExploreViewContainer from './components/ExploreViewContainer'; -import setupApp from '../setup/setupApp'; -import setupPlugins from '../setup/setupPlugins'; +import ToastContainer from 'src/components/MessageToasts/ToastContainer'; +import setupApp from 'src/setup/setupApp'; +import setupPlugins from 'src/setup/setupPlugins'; import './main.less'; -import '../../stylesheets/reactable-pagination.less'; -import { theme } from '../preamble'; +import 'stylesheets/reactable-pagination.less'; +import { theme } from 'src/preamble'; +import ExploreViewContainer from './components/ExploreViewContainer'; setupApp(); setupPlugins(); @@ -40,7 +40,7 @@ const App = ({ store }) => ( - + diff --git a/superset-frontend/src/explore/actions/exploreActions.ts b/superset-frontend/src/explore/actions/exploreActions.ts index c4faf793b..2528bc060 100644 --- a/superset-frontend/src/explore/actions/exploreActions.ts +++ b/superset-frontend/src/explore/actions/exploreActions.ts @@ -25,7 +25,10 @@ import { QueryFormData, } from '@superset-ui/core'; import { Dispatch } from 'redux'; -import { addDangerToast, toastActions } from 'src/messageToasts/actions'; +import { + addDangerToast, + toastActions, +} from 'src/components/MessageToasts/actions'; import { Slice } from 'src/types/Chart'; const FAVESTAR_BASE_URL = '/superset/favstar/slice'; diff --git a/superset-frontend/src/explore/components/ExploreActionButtons.tsx b/superset-frontend/src/explore/components/ExploreActionButtons.tsx index 3b020ae17..c01305a69 100644 --- a/superset-frontend/src/explore/components/ExploreActionButtons.tsx +++ b/superset-frontend/src/explore/components/ExploreActionButtons.tsx @@ -22,7 +22,7 @@ import { t } from '@superset-ui/core'; import Icons from 'src/components/Icons'; import { Tooltip } from 'src/components/Tooltip'; import copyTextToClipboard from 'src/utils/copy'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; import { useUrlShortener } from 'src/common/hooks/useUrlShortener'; import EmbedCodeButton from './EmbedCodeButton'; import { exportChart, getExploreLongUrl } from '../exploreUtils'; diff --git a/superset-frontend/src/explore/components/controls/MetricControl/MetricDefinitionOption.jsx b/superset-frontend/src/explore/components/controls/MetricControl/MetricDefinitionOption.jsx index b0acad229..20f8854cd 100644 --- a/superset-frontend/src/explore/components/controls/MetricControl/MetricDefinitionOption.jsx +++ b/superset-frontend/src/explore/components/controls/MetricControl/MetricDefinitionOption.jsx @@ -18,12 +18,11 @@ */ import React from 'react'; import PropTypes from 'prop-types'; - -import withToasts from 'src/messageToasts/enhancers/withToasts'; import { StyledColumnOption, StyledMetricOption, } from 'src/explore/components/optionRenderers'; +import withToasts from 'src/components/MessageToasts/withToasts'; import AggregateOption from './AggregateOption'; import columnType from './columnType'; import aggregateOptionType from './aggregateOptionType'; diff --git a/superset-frontend/src/explore/components/controls/SelectAsyncControl/index.jsx b/superset-frontend/src/explore/components/controls/SelectAsyncControl/index.jsx index 092498d09..db7075513 100644 --- a/superset-frontend/src/explore/components/controls/SelectAsyncControl/index.jsx +++ b/superset-frontend/src/explore/components/controls/SelectAsyncControl/index.jsx @@ -22,7 +22,7 @@ import { t } from '@superset-ui/core'; import Select from 'src/components/AsyncSelect'; import ControlHeader from 'src/explore/components/ControlHeader'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; const propTypes = { dataEndpoint: PropTypes.string.isRequired, diff --git a/superset-frontend/src/explore/reducers/getInitialState.ts b/superset-frontend/src/explore/reducers/getInitialState.ts index 28a270d2f..b7f8a62f9 100644 --- a/superset-frontend/src/explore/reducers/getInitialState.ts +++ b/superset-frontend/src/explore/reducers/getInitialState.ts @@ -26,7 +26,7 @@ import { CommonBootstrapData, UserWithPermissionsAndRoles, } from 'src/types/bootstrapTypes'; -import getToastsFromPyFlashMessages from 'src/messageToasts/utils/getToastsFromPyFlashMessages'; +import getToastsFromPyFlashMessages from 'src/components/MessageToasts/getToastsFromPyFlashMessages'; import { ChartState, Slice } from 'src/explore/types'; import { getChartKey } from 'src/explore/exploreUtils'; diff --git a/superset-frontend/src/explore/reducers/index.js b/superset-frontend/src/explore/reducers/index.js index e387c49c1..555922dd0 100644 --- a/superset-frontend/src/explore/reducers/index.js +++ b/superset-frontend/src/explore/reducers/index.js @@ -19,11 +19,11 @@ import { combineReducers } from 'redux'; import reports from 'src/reports/reducers/reports'; -import charts from '../../chart/chartReducer'; +import charts from 'src/chart/chartReducer'; +import dataMask from 'src/dataMask/reducer'; +import messageToasts from 'src/components/MessageToasts/reducers'; import saveModal from './saveModalReducer'; import explore from './exploreReducer'; -import dataMask from '../../dataMask/reducer'; -import messageToasts from '../../messageToasts/reducers'; const impressionId = (state = '') => state; diff --git a/superset-frontend/src/messageToasts/constants.ts b/superset-frontend/src/messageToasts/constants.ts deleted file mode 100644 index e22616c8a..000000000 --- a/superset-frontend/src/messageToasts/constants.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -// Toast types -import { ToastType } from './types'; - -export { ToastType } from './types'; - -// for backward compatibility -export const INFO_TOAST = ToastType.INFO; -export const SUCCES_TOAST = ToastType.SUCCESS; -export const WARNING_TOAST = ToastType.WARNING; -export const DANGER_TOAST = ToastType.DANGER; diff --git a/superset-frontend/src/profile/App.tsx b/superset-frontend/src/profile/App.tsx index d3c5e43c9..85f4ccc83 100644 --- a/superset-frontend/src/profile/App.tsx +++ b/superset-frontend/src/profile/App.tsx @@ -23,12 +23,12 @@ import { createStore, applyMiddleware, compose, combineReducers } from 'redux'; import { Provider } from 'react-redux'; import { ThemeProvider } from '@superset-ui/core'; import App from 'src/profile/components/App'; -import messageToastReducer from 'src/messageToasts/reducers'; +import messageToastReducer from 'src/components/MessageToasts/reducers'; import { initEnhancer } from 'src/reduxUtils'; import setupApp from 'src/setup/setupApp'; import './main.less'; import { theme } from 'src/preamble'; -import ToastPresenter from 'src/messageToasts/containers/ToastPresenter'; +import ToastContainer from 'src/components/MessageToasts/ToastContainer'; setupApp(); @@ -49,7 +49,7 @@ const Application = () => ( - + ); diff --git a/superset-frontend/src/reports/actions/reports.js b/superset-frontend/src/reports/actions/reports.js index 7b3bc814c..345cfa1e4 100644 --- a/superset-frontend/src/reports/actions/reports.js +++ b/superset-frontend/src/reports/actions/reports.js @@ -20,7 +20,10 @@ import { t, SupersetClient } from '@superset-ui/core'; import rison from 'rison'; import { getClientErrorObject } from 'src/utils/getClientErrorObject'; -import { addDangerToast, addSuccessToast } from '../../messageToasts/actions'; +import { + addDangerToast, + addSuccessToast, +} from 'src/components/MessageToasts/actions'; export const SET_REPORT = 'SET_REPORT'; export function setReport(report) { diff --git a/superset-frontend/src/utils/downloadAsImage.ts b/superset-frontend/src/utils/downloadAsImage.ts index 8ec472f40..b19dfe29a 100644 --- a/superset-frontend/src/utils/downloadAsImage.ts +++ b/superset-frontend/src/utils/downloadAsImage.ts @@ -20,7 +20,7 @@ import { SyntheticEvent } from 'react'; import domToImage, { Options } from 'dom-to-image'; import kebabCase from 'lodash/kebabCase'; import { t } from '@superset-ui/core'; -import { addWarningToast } from 'src/messageToasts/actions'; +import { addWarningToast } from 'src/components/MessageToasts/actions'; /** * @remark diff --git a/superset-frontend/src/views/App.tsx b/superset-frontend/src/views/App.tsx index d04b08d93..e23695c9d 100644 --- a/superset-frontend/src/views/App.tsx +++ b/superset-frontend/src/views/App.tsx @@ -36,7 +36,7 @@ import Loading from 'src/components/Loading'; import Menu from 'src/components/Menu/Menu'; import FlashProvider from 'src/components/FlashProvider'; import { theme } from 'src/preamble'; -import ToastPresenter from 'src/messageToasts/containers/ToastPresenter'; +import ToastContainer from 'src/components/MessageToasts/ToastContainer'; import setupApp from 'src/setup/setupApp'; import { routes, isFrontendRoute } from 'src/views/routes'; import { Logger } from 'src/logger/LogUtils'; @@ -98,7 +98,7 @@ const App = () => ( ))} - + ); diff --git a/superset-frontend/src/views/CRUD/alert/AlertList.tsx b/superset-frontend/src/views/CRUD/alert/AlertList.tsx index e0c691fc6..1ebf55f54 100644 --- a/superset-frontend/src/views/CRUD/alert/AlertList.tsx +++ b/superset-frontend/src/views/CRUD/alert/AlertList.tsx @@ -33,7 +33,7 @@ import ListView, { import SubMenu, { SubMenuProps } from 'src/components/Menu/SubMenu'; import { Switch } from 'src/components/Switch'; import { DATETIME_WITH_TIME_ZONE } from 'src/constants'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +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 ConfirmStatusChange from 'src/components/ConfirmStatusChange'; diff --git a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx index 56e1eba7f..a3944184d 100644 --- a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx +++ b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx @@ -40,7 +40,7 @@ import TimezoneSelector from 'src/components/TimezoneSelector'; import { Radio } from 'src/components/Radio'; import { Select } from 'src/components'; import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; import Owner from 'src/types/Owner'; import TextAreaControl from 'src/explore/components/controls/TextAreaControl'; import { useCommonConf } from 'src/views/CRUD/data/database/state'; diff --git a/superset-frontend/src/views/CRUD/alert/ExecutionLog.tsx b/superset-frontend/src/views/CRUD/alert/ExecutionLog.tsx index 7ea859075..e9c7baff2 100644 --- a/superset-frontend/src/views/CRUD/alert/ExecutionLog.tsx +++ b/superset-frontend/src/views/CRUD/alert/ExecutionLog.tsx @@ -23,7 +23,7 @@ import React, { useEffect, useMemo } from 'react'; import { Link, useParams } from 'react-router-dom'; import ListView from 'src/components/ListView'; import SubMenu from 'src/components/Menu/SubMenu'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; import { fDuration } from 'src/modules/dates'; import AlertStatusIcon from 'src/views/CRUD/alert/components/AlertStatusIcon'; import { diff --git a/superset-frontend/src/views/CRUD/annotation/AnnotationList.tsx b/superset-frontend/src/views/CRUD/annotation/AnnotationList.tsx index e207da03d..aeebb2bf2 100644 --- a/superset-frontend/src/views/CRUD/annotation/AnnotationList.tsx +++ b/superset-frontend/src/views/CRUD/annotation/AnnotationList.tsx @@ -30,7 +30,7 @@ import DeleteModal from 'src/components/DeleteModal'; import ListView, { ListViewProps } from 'src/components/ListView'; import SubMenu, { SubMenuProps } from 'src/components/Menu/SubMenu'; import { getClientErrorObject } from 'src/utils/getClientErrorObject'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; import { useListViewResource } from 'src/views/CRUD/hooks'; import { createErrorHandler } from 'src/views/CRUD/utils'; diff --git a/superset-frontend/src/views/CRUD/annotation/AnnotationModal.tsx b/superset-frontend/src/views/CRUD/annotation/AnnotationModal.tsx index cf0c2411f..bab4d2f7e 100644 --- a/superset-frontend/src/views/CRUD/annotation/AnnotationModal.tsx +++ b/superset-frontend/src/views/CRUD/annotation/AnnotationModal.tsx @@ -23,8 +23,8 @@ import { RangePicker } from 'src/components/DatePicker'; import moment from 'moment'; import Icons from 'src/components/Icons'; import Modal from 'src/components/Modal'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; import { StyledIcon } from 'src/views/CRUD/utils'; +import withToasts from 'src/components/MessageToasts/withToasts'; import { JsonEditor } from 'src/components/AsyncAceEditor'; import { AnnotationObject } from './types'; diff --git a/superset-frontend/src/views/CRUD/annotationlayers/AnnotationLayerModal.tsx b/superset-frontend/src/views/CRUD/annotationlayers/AnnotationLayerModal.tsx index 118f9117a..d683448ab 100644 --- a/superset-frontend/src/views/CRUD/annotationlayers/AnnotationLayerModal.tsx +++ b/superset-frontend/src/views/CRUD/annotationlayers/AnnotationLayerModal.tsx @@ -23,7 +23,7 @@ import { useSingleViewResource } from 'src/views/CRUD/hooks'; import Icons from 'src/components/Icons'; import { StyledIcon } from 'src/views/CRUD/utils'; import Modal from 'src/components/Modal'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; import { AnnotationLayerObject } from './types'; diff --git a/superset-frontend/src/views/CRUD/annotationlayers/AnnotationLayersList.tsx b/superset-frontend/src/views/CRUD/annotationlayers/AnnotationLayersList.tsx index 0b3e50304..56c5884f8 100644 --- a/superset-frontend/src/views/CRUD/annotationlayers/AnnotationLayersList.tsx +++ b/superset-frontend/src/views/CRUD/annotationlayers/AnnotationLayersList.tsx @@ -24,7 +24,7 @@ import { Link, useHistory } from 'react-router-dom'; import moment from 'moment'; import { useListViewResource } from 'src/views/CRUD/hooks'; import { createFetchRelated, createErrorHandler } from 'src/views/CRUD/utils'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; import SubMenu, { SubMenuProps } from 'src/components/Menu/SubMenu'; import ActionsBar, { ActionProps } from 'src/components/ListView/ActionsBar'; import ListView, { diff --git a/superset-frontend/src/views/CRUD/chart/ChartList.tsx b/superset-frontend/src/views/CRUD/chart/ChartList.tsx index 0838e9d31..547482a7f 100644 --- a/superset-frontend/src/views/CRUD/chart/ChartList.tsx +++ b/superset-frontend/src/views/CRUD/chart/ChartList.tsx @@ -50,7 +50,7 @@ import ListView, { } from 'src/components/ListView'; import Loading from 'src/components/Loading'; import { getFromLocalStorage } from 'src/utils/localStorageHelpers'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; import PropertiesModal from 'src/explore/components/PropertiesModal'; import ImportModelsModal from 'src/components/ImportModal/index'; import Chart from 'src/types/Chart'; diff --git a/superset-frontend/src/views/CRUD/csstemplates/CssTemplateModal.tsx b/superset-frontend/src/views/CRUD/csstemplates/CssTemplateModal.tsx index 4b4baa61f..c1d15a766 100644 --- a/superset-frontend/src/views/CRUD/csstemplates/CssTemplateModal.tsx +++ b/superset-frontend/src/views/CRUD/csstemplates/CssTemplateModal.tsx @@ -23,7 +23,7 @@ import { useSingleViewResource } from 'src/views/CRUD/hooks'; import Icons from 'src/components/Icons'; import { StyledIcon } from 'src/views/CRUD/utils'; import Modal from 'src/components/Modal'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; import { CssEditor } from 'src/components/AsyncAceEditor'; import { TemplateObject } from './types'; diff --git a/superset-frontend/src/views/CRUD/csstemplates/CssTemplatesList.tsx b/superset-frontend/src/views/CRUD/csstemplates/CssTemplatesList.tsx index 2d5a5dff5..b1b53f2f4 100644 --- a/superset-frontend/src/views/CRUD/csstemplates/CssTemplatesList.tsx +++ b/superset-frontend/src/views/CRUD/csstemplates/CssTemplatesList.tsx @@ -24,7 +24,7 @@ import rison from 'rison'; import moment from 'moment'; import { useListViewResource } from 'src/views/CRUD/hooks'; import { createFetchRelated, createErrorHandler } from 'src/views/CRUD/utils'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; import SubMenu, { SubMenuProps } from 'src/components/Menu/SubMenu'; import DeleteModal from 'src/components/DeleteModal'; import { Tooltip } from 'src/components/Tooltip'; diff --git a/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx b/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx index 775bc3e6b..8d6be338e 100644 --- a/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx +++ b/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx @@ -39,7 +39,7 @@ import ListView, { } from 'src/components/ListView'; import { getFromLocalStorage } from 'src/utils/localStorageHelpers'; import Owner from 'src/types/Owner'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; import FacePile from 'src/components/FacePile'; import Icons from 'src/components/Icons'; import FaveStar from 'src/components/FaveStar'; diff --git a/superset-frontend/src/views/CRUD/data/components/SyntaxHighlighterCopy/index.tsx b/superset-frontend/src/views/CRUD/data/components/SyntaxHighlighterCopy/index.tsx index e8d693d67..73a0f8e9c 100644 --- a/superset-frontend/src/views/CRUD/data/components/SyntaxHighlighterCopy/index.tsx +++ b/superset-frontend/src/views/CRUD/data/components/SyntaxHighlighterCopy/index.tsx @@ -25,8 +25,8 @@ import markdownSyntax from 'react-syntax-highlighter/dist/cjs/languages/hljs/mar import jsonSyntax from 'react-syntax-highlighter/dist/cjs/languages/hljs/json'; import github from 'react-syntax-highlighter/dist/cjs/styles/hljs/github'; import SyntaxHighlighter from 'react-syntax-highlighter/dist/cjs/light'; -import { ToastProps } from 'src/messageToasts/enhancers/withToasts'; import Icons from 'src/components/Icons'; +import { ToastProps } from 'src/components/MessageToasts/withToasts'; import copyTextToClipboard from 'src/utils/copy'; SyntaxHighlighter.registerLanguage('sql', sqlSyntax); diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseList.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseList.tsx index 560ab1f5c..8c83b7f5b 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseList.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseList.tsx @@ -22,7 +22,7 @@ import Loading from 'src/components/Loading'; import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; import { useListViewResource } from 'src/views/CRUD/hooks'; import { createErrorHandler } from 'src/views/CRUD/utils'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; import SubMenu, { SubMenuProps } from 'src/components/Menu/SubMenu'; import DeleteModal from 'src/components/DeleteModal'; import { Tooltip } from 'src/components/Tooltip'; diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx index 82db9e7f1..1cb308268 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx @@ -36,7 +36,7 @@ import Modal from 'src/components/Modal'; import Button from 'src/components/Button'; import IconButton from 'src/components/IconButton'; import InfoTooltip from 'src/components/InfoTooltip'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; import { testDatabaseConnection, useSingleViewResource, diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDatasetModal.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDatasetModal.tsx index 0a3e24361..527b92a07 100644 --- a/superset-frontend/src/views/CRUD/data/dataset/AddDatasetModal.tsx +++ b/superset-frontend/src/views/CRUD/data/dataset/AddDatasetModal.tsx @@ -22,7 +22,7 @@ import { useSingleViewResource } from 'src/views/CRUD/hooks'; import { isEmpty, isNil } from 'lodash'; import Modal from 'src/components/Modal'; import TableSelector from 'src/components/TableSelector'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; type DatasetAddObject = { id: number; diff --git a/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx b/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx index 384054b03..bc2199280 100644 --- a/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx +++ b/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx @@ -46,7 +46,7 @@ import SubMenu, { } from 'src/components/Menu/SubMenu'; import { commonMenuData } from 'src/views/CRUD/data/common'; import Owner from 'src/types/Owner'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; import { Tooltip } from 'src/components/Tooltip'; import Icons from 'src/components/Icons'; import FacePile from 'src/components/FacePile'; diff --git a/superset-frontend/src/views/CRUD/data/query/QueryList.tsx b/superset-frontend/src/views/CRUD/data/query/QueryList.tsx index 82d5307b2..aa56d5c1a 100644 --- a/superset-frontend/src/views/CRUD/data/query/QueryList.tsx +++ b/superset-frontend/src/views/CRUD/data/query/QueryList.tsx @@ -25,7 +25,7 @@ import { createErrorHandler, shortenSQL, } from 'src/views/CRUD/utils'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; import { useListViewResource } from 'src/views/CRUD/hooks'; import SubMenu, { SubMenuProps } from 'src/components/Menu/SubMenu'; import Popover from 'src/components/Popover'; diff --git a/superset-frontend/src/views/CRUD/data/query/QueryPreviewModal.tsx b/superset-frontend/src/views/CRUD/data/query/QueryPreviewModal.tsx index cea45a9f7..458b8c1fb 100644 --- a/superset-frontend/src/views/CRUD/data/query/QueryPreviewModal.tsx +++ b/superset-frontend/src/views/CRUD/data/query/QueryPreviewModal.tsx @@ -21,7 +21,9 @@ import { styled, t } from '@superset-ui/core'; import Modal from 'src/components/Modal'; import cx from 'classnames'; import Button from 'src/components/Button'; -import withToasts, { ToastProps } from 'src/messageToasts/enhancers/withToasts'; +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 { QueryObject } from 'src/views/CRUD/types'; diff --git a/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.tsx b/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.tsx index 9c18e9df1..25eb4933e 100644 --- a/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.tsx +++ b/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.tsx @@ -27,7 +27,7 @@ import { createErrorHandler, } from 'src/views/CRUD/utils'; import Popover from 'src/components/Popover'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +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'; diff --git a/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryPreviewModal.tsx b/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryPreviewModal.tsx index 6f556b279..d14b32166 100644 --- a/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryPreviewModal.tsx +++ b/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryPreviewModal.tsx @@ -21,7 +21,9 @@ 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 withToasts, { ToastProps } from 'src/messageToasts/enhancers/withToasts'; +import withToasts, { + ToastProps, +} from 'src/components/MessageToasts/withToasts'; import { useQueryPreviewState } from 'src/views/CRUD/data/hooks'; const QueryTitle = styled.div` diff --git a/superset-frontend/src/views/CRUD/welcome/ChartTable.tsx b/superset-frontend/src/views/CRUD/welcome/ChartTable.tsx index d487e8a24..b7d81b37f 100644 --- a/superset-frontend/src/views/CRUD/welcome/ChartTable.tsx +++ b/superset-frontend/src/views/CRUD/welcome/ChartTable.tsx @@ -28,7 +28,7 @@ import { setInLocalStorage, getFromLocalStorage, } from 'src/utils/localStorageHelpers'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; import { useHistory } from 'react-router-dom'; import { TableTabTypes } from 'src/views/CRUD/types'; import PropertiesModal from 'src/explore/components/PropertiesModal'; diff --git a/superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx b/superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx index a6c470aae..4f8c1ff00 100644 --- a/superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx +++ b/superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx @@ -38,8 +38,7 @@ import { PAGE_SIZE, } from 'src/views/CRUD/utils'; import { HOMEPAGE_DASHBOARD_FILTER } from 'src/views/CRUD/storageKeys'; - -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; import Loading from 'src/components/Loading'; import PropertiesModal from 'src/dashboard/components/PropertiesModal'; import DashboardCard from 'src/views/CRUD/dashboard/DashboardCard'; diff --git a/superset-frontend/src/views/CRUD/welcome/SavedQueries.tsx b/superset-frontend/src/views/CRUD/welcome/SavedQueries.tsx index 4a20b389f..6bf50fa17 100644 --- a/superset-frontend/src/views/CRUD/welcome/SavedQueries.tsx +++ b/superset-frontend/src/views/CRUD/welcome/SavedQueries.tsx @@ -21,8 +21,8 @@ import { t, SupersetClient, styled, useTheme } from '@superset-ui/core'; import SyntaxHighlighter from 'react-syntax-highlighter/dist/cjs/light'; import sql from 'react-syntax-highlighter/dist/cjs/languages/hljs/sql'; import github from 'react-syntax-highlighter/dist/cjs/styles/hljs/github'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; import { LoadingCards } from 'src/views/CRUD/welcome/Welcome'; +import withToasts from 'src/components/MessageToasts/withToasts'; import { Dropdown, Menu } from 'src/common/components'; import { useListViewResource, copyQueryLink } from 'src/views/CRUD/hooks'; import ListViewCard from 'src/components/ListViewCard'; diff --git a/superset-frontend/src/views/CRUD/welcome/Welcome.tsx b/superset-frontend/src/views/CRUD/welcome/Welcome.tsx index 63d777617..8b59fbcad 100644 --- a/superset-frontend/src/views/CRUD/welcome/Welcome.tsx +++ b/superset-frontend/src/views/CRUD/welcome/Welcome.tsx @@ -26,7 +26,7 @@ import { setInLocalStorage, } from 'src/utils/localStorageHelpers'; import ListViewCard from 'src/components/ListViewCard'; -import withToasts from 'src/messageToasts/enhancers/withToasts'; +import withToasts from 'src/components/MessageToasts/withToasts'; import { createErrorHandler, getRecentAcitivtyObjs, diff --git a/superset-frontend/src/views/store.ts b/superset-frontend/src/views/store.ts index 4704da8d0..651b50fa6 100644 --- a/superset-frontend/src/views/store.ts +++ b/superset-frontend/src/views/store.ts @@ -18,7 +18,7 @@ */ import { applyMiddleware, combineReducers, compose, createStore } from 'redux'; import thunk from 'redux-thunk'; -import messageToastReducer from 'src/messageToasts/reducers'; +import messageToastReducer from 'src/components/MessageToasts/reducers'; import { initEnhancer } from 'src/reduxUtils'; import charts from 'src/chart/chartReducer'; import dataMask from 'src/dataMask/reducer';