diff --git a/superset-frontend/src/views/CRUD/welcome/ActivityTable.tsx b/superset-frontend/src/views/CRUD/welcome/ActivityTable.tsx index 930cfca8220fb..f9d026c6ee0e1 100644 --- a/superset-frontend/src/views/CRUD/welcome/ActivityTable.tsx +++ b/superset-frontend/src/views/CRUD/welcome/ActivityTable.tsx @@ -16,18 +16,18 @@ * specific language governing permissions and limitations * under the License. */ -import React, { useState, useEffect } from 'react'; +import React, { useEffect, useState } from 'react'; import moment from 'moment'; import { styled, t } from '@superset-ui/core'; import { setInLocalStorage } from 'src/utils/localStorageHelpers'; import ListViewCard from 'src/components/ListViewCard'; import SubMenu from 'src/components/Menu/SubMenu'; -import { LoadingCards, ActivityData } from 'src/views/CRUD/welcome/Welcome'; +import { ActivityData, LoadingCards } from 'src/views/CRUD/welcome/Welcome'; import { + CardContainer, CardStyles, getEditedObjects, - CardContainer, } from 'src/views/CRUD/utils'; import { HOMEPAGE_ACTIVITY_FILTER } from 'src/views/CRUD/storageKeys'; import { Chart } from 'src/types/Chart'; @@ -36,6 +36,7 @@ import { Dashboard, SavedQueryObject } from 'src/views/CRUD/types'; import Icons from 'src/components/Icons'; import EmptyState from './EmptyState'; +import { WelcomeTable } from './types'; /** * Return result from /superset/recent_activity/{user_id} @@ -241,7 +242,7 @@ export default function ActivityTable({ {renderActivity()} ) : ( - + )} ); diff --git a/superset-frontend/src/views/CRUD/welcome/ChartTable.tsx b/superset-frontend/src/views/CRUD/welcome/ChartTable.tsx index c673d2a71e570..2a940539af66f 100644 --- a/superset-frontend/src/views/CRUD/welcome/ChartTable.tsx +++ b/superset-frontend/src/views/CRUD/welcome/ChartTable.tsx @@ -16,17 +16,17 @@ * specific language governing permissions and limitations * under the License. */ -import React, { useState, useMemo, useEffect } from 'react'; +import React, { useEffect, useMemo, useState } from 'react'; import { t } from '@superset-ui/core'; import { filter } from 'lodash'; import { - useListViewResource, useChartEditModal, useFavoriteStatus, + useListViewResource, } from 'src/views/CRUD/hooks'; import { - setInLocalStorage, getFromLocalStorage, + setInLocalStorage, } from 'src/utils/localStorageHelpers'; import withToasts from 'src/components/MessageToasts/withToasts'; import { useHistory } from 'react-router-dom'; @@ -43,6 +43,7 @@ import Loading from 'src/components/Loading'; import ErrorBoundary from 'src/components/ErrorBoundary'; import SubMenu from 'src/components/Menu/SubMenu'; import EmptyState from './EmptyState'; +import { WelcomeTable } from './types'; interface ChartTableProps { addDangerToast: (message: string) => void; @@ -249,7 +250,7 @@ function ChartTable({ ))} ) : ( - + )} {preparingExport && } diff --git a/superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx b/superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx index f4a3d9d112512..6d1666e8cca7b 100644 --- a/superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx +++ b/superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx @@ -16,10 +16,10 @@ * specific language governing permissions and limitations * under the License. */ -import React, { useState, useMemo, useEffect } from 'react'; +import React, { useEffect, useMemo, useState } from 'react'; import { SupersetClient, t } from '@superset-ui/core'; import { filter } from 'lodash'; -import { useListViewResource, useFavoriteStatus } from 'src/views/CRUD/hooks'; +import { useFavoriteStatus, useListViewResource } from 'src/views/CRUD/hooks'; import { Dashboard, DashboardTableProps, @@ -28,13 +28,13 @@ import { import handleResourceExport from 'src/utils/export'; import { useHistory } from 'react-router-dom'; import { - setInLocalStorage, getFromLocalStorage, + setInLocalStorage, } from 'src/utils/localStorageHelpers'; import { LoadingCards } from 'src/views/CRUD/welcome/Welcome'; import { - createErrorHandler, CardContainer, + createErrorHandler, PAGE_SIZE, } from 'src/views/CRUD/utils'; import { HOMEPAGE_DASHBOARD_FILTER } from 'src/views/CRUD/storageKeys'; @@ -44,6 +44,7 @@ import PropertiesModal from 'src/dashboard/components/PropertiesModal'; import DashboardCard from 'src/views/CRUD/dashboard/DashboardCard'; import SubMenu from 'src/components/Menu/SubMenu'; import EmptyState from './EmptyState'; +import { WelcomeTable } from './types'; export interface FilterValue { col: string; @@ -263,7 +264,7 @@ function DashboardTable({ )} {dashboards.length === 0 && ( - + )} {preparingExport && } diff --git a/superset-frontend/src/views/CRUD/welcome/EmptyState.test.tsx b/superset-frontend/src/views/CRUD/welcome/EmptyState.test.tsx index 96ec1ec51472c..908ebed6c4f85 100644 --- a/superset-frontend/src/views/CRUD/welcome/EmptyState.test.tsx +++ b/superset-frontend/src/views/CRUD/welcome/EmptyState.test.tsx @@ -19,46 +19,47 @@ import React from 'react'; import { styledMount as mount } from 'spec/helpers/theming'; import EmptyState from 'src/views/CRUD/welcome/EmptyState'; +import { WelcomeTable } from './types'; describe('EmptyState', () => { const variants = [ { tab: 'Favorite', - tableName: 'DASHBOARDS', + tableName: WelcomeTable.Dashboards, }, { tab: 'Mine', - tableName: 'DASHBOARDS', + tableName: WelcomeTable.Dashboards, }, { tab: 'Favorite', - tableName: 'CHARTS', + tableName: WelcomeTable.Charts, }, { tab: 'Mine', - tableName: 'CHARTS', + tableName: WelcomeTable.Charts, }, { tab: 'Favorite', - tableName: 'SAVED_QUERIES', + tableName: WelcomeTable.SavedQueries, }, { tab: 'Mine', - tableName: 'SAVED_QUEREIS', + tableName: WelcomeTable.SavedQueries, }, ]; const recents = [ { tab: 'Viewed', - tableName: 'RECENTS', + tableName: WelcomeTable.Recents, }, { tab: 'Edited', - tableName: 'RECENTS', + tableName: WelcomeTable.Recents, }, { tab: 'Created', - tableName: 'RECENTS', + tableName: WelcomeTable.Recents, }, ]; variants.forEach(variant => { diff --git a/superset-frontend/src/views/CRUD/welcome/SavedQueries.tsx b/superset-frontend/src/views/CRUD/welcome/SavedQueries.tsx index 6bf50fa17af24..a9505cf957264 100644 --- a/superset-frontend/src/views/CRUD/welcome/SavedQueries.tsx +++ b/superset-frontend/src/views/CRUD/welcome/SavedQueries.tsx @@ -17,14 +17,14 @@ * under the License. */ import React, { useState } from 'react'; -import { t, SupersetClient, styled, useTheme } from '@superset-ui/core'; +import { styled, SupersetClient, t, useTheme } from '@superset-ui/core'; import SyntaxHighlighter from 'react-syntax-highlighter/dist/cjs/light'; import sql from 'react-syntax-highlighter/dist/cjs/languages/hljs/sql'; import github from 'react-syntax-highlighter/dist/cjs/styles/hljs/github'; import { LoadingCards } from 'src/views/CRUD/welcome/Welcome'; import withToasts from 'src/components/MessageToasts/withToasts'; import { Dropdown, Menu } from 'src/common/components'; -import { useListViewResource, copyQueryLink } from 'src/views/CRUD/hooks'; +import { copyQueryLink, useListViewResource } from 'src/views/CRUD/hooks'; import ListViewCard from 'src/components/ListViewCard'; import DeleteModal from 'src/components/DeleteModal'; import Icons from 'src/components/Icons'; @@ -33,9 +33,10 @@ import EmptyState from './EmptyState'; import { CardContainer, createErrorHandler, - shortenSQL, PAGE_SIZE, + shortenSQL, } from '../utils'; +import { WelcomeTable } from './types'; SyntaxHighlighter.registerLanguage('sql', sql); @@ -364,7 +365,7 @@ const SavedQueries = ({ ))} ) : ( - + )} );