You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by yj...@apache.org on 2020/10/29 05:45:11 UTC
[incubator-superset] 28/33: update from comments
This is an automated email from the ASF dual-hosted git repository.
yjc pushed a commit to branch home-screen-mvp
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
commit f94502beaee46e03386f1988eca8a54ddea08b5d
Author: Phillip Kelley-Dotson <pk...@yahoo.com>
AuthorDate: Sun Oct 25 20:42:42 2020 -0700
update from comments
---
.../spec/javascripts/views/CRUD/welcome/EmptyState_spec.tsx | 3 ---
.../javascripts/views/CRUD/welcome/SavedQueries_spec.tsx | 4 +---
superset-frontend/src/components/ListViewCard/index.tsx | 8 ++++----
superset-frontend/src/components/Menu/SubMenu.tsx | 2 --
superset-frontend/src/views/CRUD/chart/ChartCard.tsx | 11 +++++------
.../src/views/CRUD/dashboard/DashboardCard.tsx | 11 +++++------
superset-frontend/src/views/CRUD/utils.tsx | 5 ++++-
superset-frontend/src/views/CRUD/welcome/ActivityTable.tsx | 13 ++++---------
8 files changed, 23 insertions(+), 34 deletions(-)
diff --git a/superset-frontend/spec/javascripts/views/CRUD/welcome/EmptyState_spec.tsx b/superset-frontend/spec/javascripts/views/CRUD/welcome/EmptyState_spec.tsx
index 7eaa234..96ec1ec 100644
--- a/superset-frontend/spec/javascripts/views/CRUD/welcome/EmptyState_spec.tsx
+++ b/superset-frontend/spec/javascripts/views/CRUD/welcome/EmptyState_spec.tsx
@@ -75,9 +75,6 @@ describe('EmptyState', () => {
: variant.tableName.toLowerCase()
} yet`,
);
- console.log('wrapper', wrapper.debug());
- console.log('wrapper', wrapper.find('ant-empty-image').children().debug());
- //expect(wrapper.find('ant-empty-image').children()).toHaveLength(1);
expect(wrapper.find('button')).toHaveLength(1);
});
});
diff --git a/superset-frontend/spec/javascripts/views/CRUD/welcome/SavedQueries_spec.tsx b/superset-frontend/spec/javascripts/views/CRUD/welcome/SavedQueries_spec.tsx
index 015e4eb..2670482 100644
--- a/superset-frontend/spec/javascripts/views/CRUD/welcome/SavedQueries_spec.tsx
+++ b/superset-frontend/spec/javascripts/views/CRUD/welcome/SavedQueries_spec.tsx
@@ -90,12 +90,11 @@ describe('SavedQueries', () => {
it('it renders a submenu with clickable tables and buttons', async () => {
expect(wrapper.find(SubMenu)).toExist();
expect(wrapper.find('MenuItem')).toHaveLength(2);
- console.log('button', wrapper.find('button').length);
+ expect(wrapper.find('button')).toHaveLength(2);
act(() => {
wrapper.find('MenuItem').at(1).simulate('click');
});
- console.log('menu item', wrapper.find('MenuItem').at(1).debug());
await waitForComponentToPaint(wrapper);
expect(fetchMock.calls(/saved_query\/\?q/)).toHaveLength(1);
});
@@ -103,6 +102,5 @@ describe('SavedQueries', () => {
it('fetches queries favorites and renders listviewcard cards', () => {
expect(fetchMock.calls(/saved_query\/\?q/)).toHaveLength(1);
expect(wrapper.find('ListViewCard')).toExist();
- console.log('wrapper', wrapper);
});
});
diff --git a/superset-frontend/src/components/ListViewCard/index.tsx b/superset-frontend/src/components/ListViewCard/index.tsx
index a974889..02f60f6 100644
--- a/superset-frontend/src/components/ListViewCard/index.tsx
+++ b/superset-frontend/src/components/ListViewCard/index.tsx
@@ -145,8 +145,8 @@ const QueryData = styled.div`
justify-content: flex-start;
border-bottom: 1px solid ${({ theme }) => theme.colors.grayscale.light2};
.title {
- font-weight: 500;
- color: #b2b2b2;
+ font-weight: ${({ theme }) => theme.typography.weights.normal};
+ color: ${({ theme }) => theme.colors.grayscale.light2};
}
.holder {
margin: ${({ theme }) => theme.gridUnit * 2}px;
@@ -157,9 +157,9 @@ const paragraphConfig = { rows: 1, width: 150 };
interface CardProps {
title: React.ReactNode;
url?: string;
- imgURL: string;
+ imgURL?: string;
tables?: string | number;
- imgFallbackURL: string;
+ imgFallbackURL?: string;
imgPosition?: BackgroundPosition;
description: string;
loading: boolean;
diff --git a/superset-frontend/src/components/Menu/SubMenu.tsx b/superset-frontend/src/components/Menu/SubMenu.tsx
index 60cecb5..e9c7976 100644
--- a/superset-frontend/src/components/Menu/SubMenu.tsx
+++ b/superset-frontend/src/components/Menu/SubMenu.tsx
@@ -74,8 +74,6 @@ const StyledHeader = styled.header`
}
`;
-type MenuClickHandler = React.MouseEventHandler<MenuItem>;
-
type MenuChild = {
label: string;
name: string;
diff --git a/superset-frontend/src/views/CRUD/chart/ChartCard.tsx b/superset-frontend/src/views/CRUD/chart/ChartCard.tsx
index 368b0f6..9e3b696 100644
--- a/superset-frontend/src/views/CRUD/chart/ChartCard.tsx
+++ b/superset-frontend/src/views/CRUD/chart/ChartCard.tsx
@@ -54,12 +54,11 @@ export default function ChartCard({
}: ChartCardProps) {
const canEdit = hasPerm('can_edit');
const canDelete = hasPerm('can_delete');
- const [
- favoriteStatusRef,
- fetchFaveStar,
- saveFaveStar,
- favoriteStatus,
- ] = useFavoriteStatus({}, FAVESTAR_BASE_URL, addDangerToast);
+ const [, fetchFaveStar, saveFaveStar, favoriteStatus] = useFavoriteStatus(
+ {},
+ FAVESTAR_BASE_URL,
+ addDangerToast,
+ );
function handleChartDelete({ id, slice_name: sliceName }: Chart) {
SupersetClient.delete({
diff --git a/superset-frontend/src/views/CRUD/dashboard/DashboardCard.tsx b/superset-frontend/src/views/CRUD/dashboard/DashboardCard.tsx
index 2469d64..6058563 100644
--- a/superset-frontend/src/views/CRUD/dashboard/DashboardCard.tsx
+++ b/superset-frontend/src/views/CRUD/dashboard/DashboardCard.tsx
@@ -27,12 +27,11 @@ function DashboardCard({
const canEdit = hasPerm('can_edit');
const canDelete = hasPerm('can_delete');
const canExport = hasPerm('can_mulexport');
- const [
- favoriteStatusRef,
- fetchFaveStar,
- saveFaveStar,
- favoriteStatus,
- ] = useFavoriteStatus({}, FAVESTAR_BASE_URL, addDangerToast);
+ const [, fetchFaveStar, saveFaveStar, favoriteStatus] = useFavoriteStatus(
+ {},
+ FAVESTAR_BASE_URL,
+ addDangerToast,
+ );
function handleDashboardDelete({
id,
diff --git a/superset-frontend/src/views/CRUD/utils.tsx b/superset-frontend/src/views/CRUD/utils.tsx
index 449d57f..55ae299 100644
--- a/superset-frontend/src/views/CRUD/utils.tsx
+++ b/superset-frontend/src/views/CRUD/utils.tsx
@@ -54,7 +54,10 @@ const createFetchResourceMethod = (method: string) => (
return [];
};
-export const getBatchData = (userId: string | number, recent: string) => {
+export const getRecentAcitivtyObjs = (
+ userId: string | number,
+ recent: string,
+) => {
const getParams = (filters?: Array<any>) => {
const params = {
order_column: 'changed_on_delta_humanized',
diff --git a/superset-frontend/src/views/CRUD/welcome/ActivityTable.tsx b/superset-frontend/src/views/CRUD/welcome/ActivityTable.tsx
index ed963f6..5d80003 100644
--- a/superset-frontend/src/views/CRUD/welcome/ActivityTable.tsx
+++ b/superset-frontend/src/views/CRUD/welcome/ActivityTable.tsx
@@ -24,7 +24,7 @@ import ListViewCard from 'src/components/ListViewCard';
import { addDangerToast } from 'src/messageToasts/actions';
import SubMenu from 'src/components/Menu/SubMenu';
import { reject } from 'lodash';
-import { getBatchData, mq } from '../utils';
+import { getRecentAcitivtyObjs, mq } from '../utils';
import EmptyState from './EmptyState';
interface MapProps {
@@ -102,9 +102,6 @@ export default function ActivityTable({ user }: ActivityProps) {
if (e.url?.includes('dashboard')) {
return 'nav-dashboard';
}
- if (e.url?.indexOf('explore') !== -1) {
- return 'nav-charts';
- }
if (e.url?.includes('explore') || e.item_url?.includes('explore')) {
return 'nav-charts';
}
@@ -147,7 +144,7 @@ export default function ActivityTable({ user }: ActivityProps) {
}
useEffect(() => {
- getBatchData(user.userId, recent)
+ getRecentAcitivtyObjs(user.userId, recent)
.then(res => {
const data: any = {
Created: [...res.createdByChart, ...res.createdByDash],
@@ -173,13 +170,11 @@ export default function ActivityTable({ user }: ActivityProps) {
}, []);
const renderActivity = () => {
- return activityData[activeChild].map((e: MapProps, i: number) => (
+ return activityData[activeChild].map((e: MapProps) => (
<ListViewCard
- key={`${i}`}
+ key={`${e.id}`}
isRecent
loading={loading}
- imgURL=""
- imgFallbackURL=""
url={e.sql ? `/supserset/sqllab?queryId=${e.id}` : e.url}
title={getFilterTitle(e)}
description={`Last Edited: ${moment(e.changed_on_utc).format(