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 2021/02/16 20:01:57 UTC

[superset] 01/01: grab dataset intially on mount

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

hugh pushed a commit to branch hugh/overwrite-ds
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 517f1a8c8a35792b17d51e574c38b62a544867cb
Author: hughhhh <hu...@gmail.com>
AuthorDate: Tue Feb 16 15:00:56 2021 -0500

    grab dataset intially on mount
---
 superset-frontend/src/SqlLab/components/ResultSet.tsx | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/superset-frontend/src/SqlLab/components/ResultSet.tsx b/superset-frontend/src/SqlLab/components/ResultSet.tsx
index 7daae5f..69e67bc 100644
--- a/superset-frontend/src/SqlLab/components/ResultSet.tsx
+++ b/superset-frontend/src/SqlLab/components/ResultSet.tsx
@@ -159,9 +159,23 @@ export default class ResultSet extends React.PureComponent<
     this.handleExploreBtnClick = this.handleExploreBtnClick.bind(this);
   }
 
-  componentDidMount() {
+  async componentDidMount() {
     // only do this the first time the component is rendered/mounted
     this.reRunQueryIfSessionTimeoutErrorOnMount();
+
+    const response = await makeApi({
+      method: 'GET',
+      endpoint: '/api/v1/dataset',
+    })(``);
+
+    const userDatasetsOwned = response.result.map(
+      (r: { table_name: string; id: number }) => ({
+        value: r.table_name,
+        datasetId: r.id,
+      }),
+    );
+
+    this.setState({ userDatasetOptions: userDatasetsOwned });
   }
 
   UNSAFE_componentWillReceiveProps(nextProps: ResultSetProps) {