Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use SPA Dataset link in Chart and Dashboard #20941

Merged
merged 4 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { t, isFeatureEnabled, FeatureFlag, css } from '@superset-ui/core';
import ImageLoader from 'src/components/ListViewCard/ImageLoader';
import { usePluginContext } from 'src/components/DynamicPlugins';
import { Tooltip } from 'src/components/Tooltip';
import { GenericLink } from 'src/components/GenericLink/GenericLink';
import { Theme } from '@emotion/react';

const FALLBACK_THUMBNAIL_URL = '/static/assets/images/chart-card-fallback.svg';
Expand Down Expand Up @@ -264,7 +265,15 @@ const AddSliceCard: React.FC<{
<MetadataItem label={t('Viz type')} value={vizName} />
<MetadataItem
label={t('Dataset')}
value={<a href={datasourceUrl}>{datasourceName}</a>}
value={
datasourceUrl ? (
<GenericLink to={datasourceUrl}>
{datasourceName}
</GenericLink>
) : (
datasourceName
)
}
/>
<MetadataItem label={t('Modified')} value={lastModified} />
</div>
Expand Down
3 changes: 2 additions & 1 deletion superset-frontend/src/views/CRUD/chart/ChartList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import { nativeFilterGate } from 'src/dashboard/components/nativeFilters/utils';
import setupPlugins from 'src/setup/setupPlugins';
import InfoTooltip from 'src/components/InfoTooltip';
import CertifiedBadge from 'src/components/CertifiedBadge';
import { GenericLink } from 'src/components/GenericLink/GenericLink';
import ChartCard from './ChartCard';

const FlexRowContainer = styled.div`
Expand Down Expand Up @@ -310,7 +311,7 @@ function ChartList(props: ChartListProps) {
datasource_url: dsUrl,
},
},
}: any) => <a href={dsUrl}>{dsNameTxt}</a>,
}: any) => <GenericLink to={dsUrl}>{dsNameTxt}</GenericLink>,
Header: t('Dataset'),
accessor: 'datasource_id',
disableSortBy: true,
Expand Down