Skip to content

Commit 96a63bc

Browse files
authored
fix: Use SPA Dataset link in Chart and Dashboard (#20941)
* Use SPA Dataset link in Chart and Dashboard * Validate datasourceUrl * Show datasourceName when datasourceUrl is undefined
1 parent bce32af commit 96a63bc

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

superset-frontend/src/dashboard/components/AddSliceCard/AddSliceCard.tsx

+10-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { t, isFeatureEnabled, FeatureFlag, css } from '@superset-ui/core';
2929
import ImageLoader from 'src/components/ListViewCard/ImageLoader';
3030
import { usePluginContext } from 'src/components/DynamicPlugins';
3131
import { Tooltip } from 'src/components/Tooltip';
32+
import { GenericLink } from 'src/components/GenericLink/GenericLink';
3233
import { Theme } from '@emotion/react';
3334

3435
const FALLBACK_THUMBNAIL_URL = '/static/assets/images/chart-card-fallback.svg';
@@ -264,7 +265,15 @@ const AddSliceCard: React.FC<{
264265
<MetadataItem label={t('Viz type')} value={vizName} />
265266
<MetadataItem
266267
label={t('Dataset')}
267-
value={<a href={datasourceUrl}>{datasourceName}</a>}
268+
value={
269+
datasourceUrl ? (
270+
<GenericLink to={datasourceUrl}>
271+
{datasourceName}
272+
</GenericLink>
273+
) : (
274+
datasourceName
275+
)
276+
}
268277
/>
269278
<MetadataItem label={t('Modified')} value={lastModified} />
270279
</div>

superset-frontend/src/views/CRUD/chart/ChartList.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ import { nativeFilterGate } from 'src/dashboard/components/nativeFilters/utils';
6161
import setupPlugins from 'src/setup/setupPlugins';
6262
import InfoTooltip from 'src/components/InfoTooltip';
6363
import CertifiedBadge from 'src/components/CertifiedBadge';
64+
import { GenericLink } from 'src/components/GenericLink/GenericLink';
6465
import ChartCard from './ChartCard';
6566

6667
const FlexRowContainer = styled.div`
@@ -310,7 +311,7 @@ function ChartList(props: ChartListProps) {
310311
datasource_url: dsUrl,
311312
},
312313
},
313-
}: any) => <a href={dsUrl}>{dsNameTxt}</a>,
314+
}: any) => <GenericLink to={dsUrl}>{dsNameTxt}</GenericLink>,
314315
Header: t('Dataset'),
315316
accessor: 'datasource_id',
316317
disableSortBy: true,

0 commit comments

Comments
 (0)