Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
villebro committed Nov 22, 2021
1 parent 031e14e commit 6054708
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 26 deletions.
9 changes: 5 additions & 4 deletions superset-frontend/src/views/CRUD/welcome/ActivityTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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}
Expand Down Expand Up @@ -241,7 +242,7 @@ export default function ActivityTable({
{renderActivity()}
</CardContainer>
) : (
<EmptyState tableName="RECENTS" tab={activeChild} />
<EmptyState tableName={WelcomeTable.Recents} tab={activeChild} />
)}
</Styles>
);
Expand Down
9 changes: 5 additions & 4 deletions superset-frontend/src/views/CRUD/welcome/ChartTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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;
Expand Down Expand Up @@ -249,7 +250,7 @@ function ChartTable({
))}
</CardContainer>
) : (
<EmptyState tableName="CHARTS" tab={chartFilter} />
<EmptyState tableName={WelcomeTable.Charts} tab={chartFilter} />
)}
{preparingExport && <Loading />}
</ErrorBoundary>
Expand Down
11 changes: 6 additions & 5 deletions superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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';
Expand All @@ -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;
Expand Down Expand Up @@ -263,7 +264,7 @@ function DashboardTable({
</CardContainer>
)}
{dashboards.length === 0 && (
<EmptyState tableName="DASHBOARDS" tab={dashboardFilter} />
<EmptyState tableName={WelcomeTable.Dashboards} tab={dashboardFilter} />
)}
{preparingExport && <Loading />}
</>
Expand Down
19 changes: 10 additions & 9 deletions superset-frontend/src/views/CRUD/welcome/EmptyState.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
9 changes: 5 additions & 4 deletions superset-frontend/src/views/CRUD/welcome/SavedQueries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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);

Expand Down Expand Up @@ -364,7 +365,7 @@ const SavedQueries = ({
))}
</CardContainer>
) : (
<EmptyState tableName="SAVED_QUERIES" tab={queryFilter} />
<EmptyState tableName={WelcomeTable.SavedQueries} tab={queryFilter} />
)}
</>
);
Expand Down

0 comments on commit 6054708

Please sign in to comment.