You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by hu...@apache.org on 2022/07/18 16:32:37 UTC

[superset] branch master updated: fix: set reference to columns properly for sqllab -> explore (#20747)

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

hugh 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 510c1c4817 fix: set reference to columns properly for sqllab -> explore (#20747)
510c1c4817 is described below

commit 510c1c4817024af051cc30f315a042c282dbd3b2
Author: Hugh A. Miles II <hu...@gmail.com>
AuthorDate: Mon Jul 18 12:32:31 2022 -0400

    fix: set reference to columns properly for sqllab -> explore (#20747)
    
    * set reference to columns properly
    
    * fix logic
---
 superset-frontend/src/SqlLab/components/ResultSet/index.tsx    | 10 +++++-----
 superset-frontend/src/explore/components/ExploreChartPanel.jsx |  5 +++--
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/superset-frontend/src/SqlLab/components/ResultSet/index.tsx b/superset-frontend/src/SqlLab/components/ResultSet/index.tsx
index b9b60c898e..124d2546a6 100644
--- a/superset-frontend/src/SqlLab/components/ResultSet/index.tsx
+++ b/superset-frontend/src/SqlLab/components/ResultSet/index.tsx
@@ -225,12 +225,12 @@ export default class ResultSet extends React.PureComponent<
       const { query } = this.props;
 
       const datasource: ISaveableDatasource = {
-        columns: query.columns as ISimpleColumn[],
+        columns: query.results.columns as ISimpleColumn[],
         name: query?.tab || 'Untitled',
-        dbId: 1,
-        sql: query.sql,
-        templateParams: query.templateParams,
-        schema: query.schema,
+        dbId: query?.dbId,
+        sql: query?.sql,
+        templateParams: query?.templateParams,
+        schema: query?.schema,
       };
 
       return (
diff --git a/superset-frontend/src/explore/components/ExploreChartPanel.jsx b/superset-frontend/src/explore/components/ExploreChartPanel.jsx
index 92d39ef0e4..6fc3fe941d 100644
--- a/superset-frontend/src/explore/components/ExploreChartPanel.jsx
+++ b/superset-frontend/src/explore/components/ExploreChartPanel.jsx
@@ -27,6 +27,7 @@ import {
   t,
   useTheme,
   getChartMetadataRegistry,
+  DatasourceType,
 } from '@superset-ui/core';
 import { useResizeDetector } from 'react-resize-detector';
 import { chartPropShape } from 'src/dashboard/util/propShapes';
@@ -153,8 +154,8 @@ const ExploreChartPanel = ({
 
   const metaDataRegistry = getChartMetadataRegistry();
   const { useLegacyApi } = metaDataRegistry.get(vizType);
-  const vizTypeNeedsDataset = useLegacyApi && datasource.type !== 'dataset';
-
+  const vizTypeNeedsDataset =
+    useLegacyApi && datasource.type !== DatasourceType.Table;
   // added boolean column to below show boolean so that the errors aren't overlapping
   const showAlertBanner =
     !chartAlert &&