You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by kg...@apache.org on 2022/08/03 07:09:45 UTC

[superset] branch master updated: fix: Use SPA Dataset link in Chart and Dashboard (#20941)

This is an automated email from the ASF dual-hosted git repository.

kgabryje pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 96a63bcbfe fix: Use SPA Dataset link in Chart and Dashboard (#20941)
96a63bcbfe is described below

commit 96a63bcbfedb72a9f2b3a65eb31fc231d851496f
Author: EugeneTorap <ev...@gmail.com>
AuthorDate: Wed Aug 3 10:09:33 2022 +0300

    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
---
 .../src/dashboard/components/AddSliceCard/AddSliceCard.tsx    | 11 ++++++++++-
 superset-frontend/src/views/CRUD/chart/ChartList.tsx          |  3 ++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/superset-frontend/src/dashboard/components/AddSliceCard/AddSliceCard.tsx b/superset-frontend/src/dashboard/components/AddSliceCard/AddSliceCard.tsx
index c87fbf89bb..8b18663991 100644
--- a/superset-frontend/src/dashboard/components/AddSliceCard/AddSliceCard.tsx
+++ b/superset-frontend/src/dashboard/components/AddSliceCard/AddSliceCard.tsx
@@ -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';
@@ -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>
diff --git a/superset-frontend/src/views/CRUD/chart/ChartList.tsx b/superset-frontend/src/views/CRUD/chart/ChartList.tsx
index 8173b73c06..ec58b28bb1 100644
--- a/superset-frontend/src/views/CRUD/chart/ChartList.tsx
+++ b/superset-frontend/src/views/CRUD/chart/ChartList.tsx
@@ -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`
@@ -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,