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 2020/11/16 19:00:52 UTC

[incubator-superset] branch hugh/SO-1117-modal updated: working redirect on completion

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

hugh pushed a commit to branch hugh/SO-1117-modal
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/hugh/SO-1117-modal by this push:
     new a734442  working redirect on completion
a734442 is described below

commit a73444222303d0e150fe7481d772acb12a6a9646
Author: hughhhh <hu...@gmail.com>
AuthorDate: Mon Nov 16 11:00:13 2020 -0800

    working redirect on completion
---
 .../src/SqlLab/components/ResultSet.tsx             | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/superset-frontend/src/SqlLab/components/ResultSet.tsx b/superset-frontend/src/SqlLab/components/ResultSet.tsx
index 5129939..1b8355c 100644
--- a/superset-frontend/src/SqlLab/components/ResultSet.tsx
+++ b/superset-frontend/src/SqlLab/components/ResultSet.tsx
@@ -31,6 +31,7 @@ import FilterableTable from '../../components/FilterableTable/FilterableTable';
 import QueryStateLabel from './QueryStateLabel';
 import CopyToClipboard from '../../components/CopyToClipboard';
 import { prepareCopyToClipboardTabularData } from '../../utils/common';
+import { exploreChart } from '../../explore/exploreUtils';
 import { CtasEnum } from '../actions/sqlLab';
 import { Query } from '../types';
 
@@ -190,18 +191,28 @@ export default class ResultSet extends React.PureComponent<
       selectedColumns = []
     }
 
-    this.props.actions.createDatasource({
+    this.props.actions
+      .createDatasource({
         schema,
         sql,
         dbId,
         templateParams,
         datasourceName: this.state.newSaveDatasetName,
         columns: selectedColumns,
-      }).then(data => {
-          console.log(data);
+    }).then(data => {
+        console.log('Create datasource successfully');
+        exploreChart({
+          datasource: `${data.table_id}__table`,
+          metrics: [],
+          groupby: [],
+          time_range: 'No filter',
+          viz_type: 'table',
+          all_columns: selectedColumns.map(c => c.name),
+          row_limit: 1000,
+        })
       }).catch(error => {
-          console.log('an error occurred trying to create a datasource');
-          console.log(error);
+        console.log('an error occurred trying to create a datasource');
+        console.log(error);
       });
   }