rusackas commented on a change in pull request #11557:
URL:
https://github.com/apache/incubator-superset/pull/11557#discussion_r519074383
##########
File path: superset-frontend/src/views/CRUD/welcome/ActivityTable.tsx
##########
@@ -143,53 +139,37 @@ export default function ActivityTable({ user }:
ActivityProps) {
});
}
- useEffect(() => {
- getRecentAcitivtyObjs(user.userId, recent, addDangerToast)
- .then(res => {
- const data: any = {
- Created: [
- ...res.createdByChart,
- ...res.createdByDash,
- ...res.createdByQuery,
- ],
- Edited: [...res.editedChart, ...res.editedDash],
- };
- if (res.viewed) {
- const filtered = reject(res.viewed, ['item_url', null]).map(r => r);
- data.Viewed = filtered;
- setActiveChild('Viewed');
- } else {
- data.Examples = res.examples;
- setActiveChild('Examples');
- }
- setActivityData(data);
- setLoading(false);
- })
- .catch(e => {
- setLoading(false);
- addDangerToast(
- `There was an issue fetching your recent Acitivity: ${e}`,
- );
- });
- }, []);
-
const renderActivity = () => {
- return activityData[activeChild].map((e: ActivityObjects) => (
- <ListViewCard
- key={`${e.id}`}
- loading={loading}
- cover={<></>}
- url={e.sql ? `/supserset/sqllab?queryId=${e.id}` : e.url}
- title={getFilterTitle(e)}
- description={`Last Edited: ${moment(e.changed_on_utc).format(
- 'MM/DD/YYYY HH:mm:ss',
- )}`}
- avatar={getIconName(e)}
- actions={null}
- />
- ));
+ const getRecentRef = (e: ActivityObjects) => {
+ if (activeChild === 'Viewed') {
+ return e.item_url;
+ }
+ return e.sql ? `/superset/sqllab?savedQueryId=${e.id}` : e.url;
+ };
+ return activityData[activeChild].map((e: ActivityObjects) => {
+ return (
+ <CardStyles
+ onClick={() => {
+ window.location.href = getRecentRef(e);
+ }}
+ key={e.id}
+ >
+ <ListViewCard
+ loading={loading}
+ cover={<></>}
Review comment:
```suggestion
cover={<></>}
```
null?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]