michael-s-molina commented on a change in pull request #15792:
URL: https://github.com/apache/superset/pull/15792#discussion_r673116035
##########
File path: superset-frontend/src/views/CRUD/welcome/ChartTable.tsx
##########
@@ -18,6 +18,7 @@
*/
import React, { useState, useMemo, useEffect } from 'react';
import { t } from '@superset-ui/core';
+import { reject } from 'lodash';
Review comment:
```suggestion
import { filter } from 'lodash';
```
##########
File path: superset-frontend/src/views/CRUD/welcome/ChartTable.tsx
##########
@@ -60,11 +62,18 @@ function ChartTable({
addSuccessToast,
mine,
showThumbnails,
+ examples,
}: ChartTableProps) {
const history = useHistory();
const filterStore = getFromLocalStorage(HOMEPAGE_CHART_FILTER, null);
const initialFilter = filterStore || TableTabTypes.MINE;
+ // @ts-ignore
+ // eslint-disable-next-line consistent-return
+ const filteredExamples = reject(examples, obj => {
+ if (!('viz_type' in obj)) return obj;
+ }).map(r => r);
+
Review comment:
```suggestion
const filteredExamples = filter(examples, obj => !('viz_type' in obj));
```
##########
File path: superset-frontend/src/views/CRUD/types.ts
##########
@@ -42,6 +43,7 @@ export interface DashboardTableProps {
mine: Array<Dashboard>;
showThumbnails?: boolean;
featureFlag?: boolean;
+ examples: Array<object>;
Review comment:
```suggestion
examples: Dashboard[];
```
##########
File path: superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx
##########
@@ -18,6 +18,7 @@
*/
import React, { useState, useMemo, useEffect } from 'react';
import { SupersetClient, t } from '@superset-ui/core';
+import { reject } from 'lodash';
Review comment:
```suggestion
import { filter } from 'lodash';
```
##########
File path: superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx
##########
@@ -54,10 +55,17 @@ function DashboardTable({
addSuccessToast,
mine,
showThumbnails,
+ examples,
}: DashboardTableProps) {
const history = useHistory();
const filterStore = getFromLocalStorage(HOMEPAGE_DASHBOARD_FILTER, null);
- const defaultFilter = filterStore || TableTabTypes.MINE;
+ const defaultFilter = filterStore || TableTabTypes.EXAMPLES;
+
+ // @ts-ignore
+ // eslint-disable-next-line consistent-return
+ const filteredExamples: Array<Dashboard> = reject(examples, obj => {
+ if ('viz_type' in obj) return obj;
+ }).map(r => r);
Review comment:
```suggestion
const filteredExamples = filter(examples, obj => !('viz_type' in obj));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]