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/25 02:07:44 UTC

[incubator-superset] branch so-1119 updated (07a3f03 -> 8f3be86)

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

hugh pushed a change to branch so-1119
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git.


    from 07a3f03  update tableview with dataset endpoint
     new 7d0cae1  saving for now
     new 3b7dd04  update network calls to pull data from dataset
     new 8f3be86  cleanup

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/datasource/ChangeDatasourceModal.tsx       | 84 ++++++++--------------
 1 file changed, 29 insertions(+), 55 deletions(-)


[incubator-superset] 03/03: cleanup

Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 8f3be86c045489546fbe10330cb3e448443fdd8c
Author: hughhhh <hu...@gmail.com>
AuthorDate: Tue Nov 24 18:06:31 2020 -0800

    cleanup
---
 .../src/datasource/ChangeDatasourceModal.tsx       | 52 ++++++++++++----------
 1 file changed, 28 insertions(+), 24 deletions(-)

diff --git a/superset-frontend/src/datasource/ChangeDatasourceModal.tsx b/superset-frontend/src/datasource/ChangeDatasourceModal.tsx
index 55b8598..0c8005b 100644
--- a/superset-frontend/src/datasource/ChangeDatasourceModal.tsx
+++ b/superset-frontend/src/datasource/ChangeDatasourceModal.tsx
@@ -67,7 +67,7 @@ const ChangeDatasourceModal: FunctionComponent<ChangeDatasourceModalProps> = ({
 
   useEffect(() => {
     const selectDatasource = (datasource: any) => {
-      console.log(datasource)
+      console.log(datasource);
       SupersetClient.get({
         endpoint: `/datasource/get/table/${datasource.id}`,
       })
@@ -86,6 +86,7 @@ const ChangeDatasourceModal: FunctionComponent<ChangeDatasourceModalProps> = ({
             },
           );
         });
+
       onHide();
     };
 
@@ -96,30 +97,33 @@ const ChangeDatasourceModal: FunctionComponent<ChangeDatasourceModalProps> = ({
       if (!datasources) {
         SupersetClient.get({
           endpoint: '/api/v1/dataset/',
-        }).then(({ json }) => {
-          const data = json.result.map((ds: any) => ({
-            rawName: ds.table_name,
-            connection: ds.database.database_name,
-            schema: ds.schema,
-            name: (
-              <a
-                href="#"
-                onClick={() => selectDatasource(ds)}
-                className="datasource-link"
-              >
-                {ds.table_name}
-              </a>
-            ),
-            type: ds.kind,
-          }));
-          setLoading(false);
-          setDatasources(data);
-        }).catch(response => {
-          setLoading(false);
-          getClientErrorObject(response).then(({ error }: any) => {
-            addDangerToast(error.error || error.statusText || error);
+        })
+          .then(({ json }) => {
+            const data = json.result.map((ds: any) => ({
+              rawName: ds.table_name,
+              connection: ds.database.database_name,
+              schema: ds.schema,
+              name: (
+                <a
+                  href="#"
+                  onClick={() => selectDatasource(ds)}
+                  className="datasource-link"
+                >
+                  {ds.table_name}
+                </a>
+              ),
+              type: ds.kind,
+            }));
+            setLoading(false);
+            setDatasources(data);
+          })
+          .catch(response => {
+            setLoading(false);
+            getClientErrorObject(response).then(({ error }: any) => {
+              addDangerToast(error.error || error.statusText || error);
+            });
           });
-        });
+      }
     };
 
     if (show) {


[incubator-superset] 01/03: saving for now

Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 7d0cae1b20c4ba125edd82460cc100da2797d551
Author: hughhhh <hu...@gmail.com>
AuthorDate: Fri Nov 20 11:37:51 2020 -0800

    saving for now
---
 .../src/datasource/ChangeDatasourceModal.tsx       | 112 +++++++++++----------
 1 file changed, 57 insertions(+), 55 deletions(-)

diff --git a/superset-frontend/src/datasource/ChangeDatasourceModal.tsx b/superset-frontend/src/datasource/ChangeDatasourceModal.tsx
index 70486be..2c7a032 100644
--- a/superset-frontend/src/datasource/ChangeDatasourceModal.tsx
+++ b/superset-frontend/src/datasource/ChangeDatasourceModal.tsx
@@ -67,10 +67,12 @@ const ChangeDatasourceModal: FunctionComponent<ChangeDatasourceModalProps> = ({
 
   useEffect(() => {
     const selectDatasource = (datasource: any) => {
+      console.log(datasource)
       SupersetClient.get({
-        endpoint: `/datasource/get/${datasource.kind}/${datasource.id}`,
+        endpoint: `/datasource/get/${datasource.type}/${datasource.id}`,
       })
         .then(({ json }) => {
+          console.log(json)
           onDatasourceSave(json);
           onChange(datasource.uid);
         })
@@ -93,62 +95,62 @@ const ChangeDatasourceModal: FunctionComponent<ChangeDatasourceModalProps> = ({
       }
       if (!datasources) {
 
-        SupersetClient.get({
-          endpoint: '/api/v1/dataset/',
-        }).then(({ json }) => {
-          console.log(json);
-          const data = json.result.map((ds: any) => ({
-            rawName: ds.table_name,
-            connection: ds.database.database_name,
-            schema: ds.schema,
-            name: (
-              <a
-                href="#"
-                onClick={() => selectDatasource(ds)}
-                className="datasource-link"
-              >
-                {ds.table_name}
-              </a>
-            ),
-            type: ds.kind,
-          }));
-          setLoading(false);
-          setDatasources(data);
-        }).catch(response => {
-          setLoading(false);
-          getClientErrorObject(response).then(({ error }: any) => {
-            addDangerToast(error.error || error.statusText || error);
-          });
-        });
-
         // SupersetClient.get({
-        //   endpoint: '/superset/datasources/',
-        // })
-        //   .then(({ json }) => {
-        //     const data = json.map((ds: any) => ({
-        //       rawName: ds.name,
-        //       connection: ds.connection,
-        //       schema: ds.schema,
-        //       name: (
-        //         <a
-        //           href="#"
-        //           onClick={() => selectDatasource(ds)}
-        //           className="datasource-link"
-        //         >
-        //           {ds.name}
-        //         </a>
-        //       ),
-        //       type: ds.type,
-        //     }));
-        //     setLoading(false);
-        //     setDatasources(data);
-        //   })
-        //   .catch(response => {
-        //     setLoading(false);
-        //     getClientErrorObject(response).then(({ error }: any) => {
-        //       addDangerToast(error.error || error.statusText || error);
-        //     });
+        //   endpoint: '/api/v1/dataset/',
+        // }).then(({ json }) => {
+        //   console.log(json);
+        //   const data = json.result.map((ds: any) => ({
+        //     rawName: ds.table_name,
+        //     connection: ds.database.database_name,
+        //     schema: ds.schema,
+        //     name: (
+        //       <a
+        //         href="#"
+        //         onClick={() => selectDatasource(ds)}
+        //         className="datasource-link"
+        //       >
+        //         {ds.table_name}
+        //       </a>
+        //     ),
+        //     type: ds.kind,
+        //   }));
+        //   setLoading(false);
+        //   setDatasources(data);
+        // }).catch(response => {
+        //   setLoading(false);
+        //   getClientErrorObject(response).then(({ error }: any) => {
+        //     addDangerToast(error.error || error.statusText || error);
         //   });
+        // });
+
+        SupersetClient.get({
+          endpoint: '/superset/datasources/',
+        })
+          .then(({ json }) => {
+            const data = json.map((ds: any) => ({
+              rawName: ds.name,
+              connection: ds.connection,
+              schema: ds.schema,
+              name: (
+                <a
+                  href="#"
+                  onClick={() => selectDatasource(ds)}
+                  className="datasource-link"
+                >
+                  {ds.name}
+                </a>
+              ),
+              type: ds.type,
+            }));
+            setLoading(false);
+            setDatasources(data);
+          })
+          .catch(response => {
+            setLoading(false);
+            getClientErrorObject(response).then(({ error }: any) => {
+              addDangerToast(error.error || error.statusText || error);
+            });
+          });
       }
     };
 


[incubator-superset] 02/03: update network calls to pull data from dataset

Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 3b7dd043f4ace793452f4e6436dd1518abd91d16
Author: hughhhh <hu...@gmail.com>
AuthorDate: Tue Nov 24 18:02:44 2020 -0800

    update network calls to pull data from dataset
---
 .../src/datasource/ChangeDatasourceModal.tsx       | 82 +++++++---------------
 1 file changed, 25 insertions(+), 57 deletions(-)

diff --git a/superset-frontend/src/datasource/ChangeDatasourceModal.tsx b/superset-frontend/src/datasource/ChangeDatasourceModal.tsx
index 2c7a032..55b8598 100644
--- a/superset-frontend/src/datasource/ChangeDatasourceModal.tsx
+++ b/superset-frontend/src/datasource/ChangeDatasourceModal.tsx
@@ -69,7 +69,7 @@ const ChangeDatasourceModal: FunctionComponent<ChangeDatasourceModalProps> = ({
     const selectDatasource = (datasource: any) => {
       console.log(datasource)
       SupersetClient.get({
-        endpoint: `/datasource/get/${datasource.type}/${datasource.id}`,
+        endpoint: `/datasource/get/table/${datasource.id}`,
       })
         .then(({ json }) => {
           console.log(json)
@@ -94,64 +94,32 @@ const ChangeDatasourceModal: FunctionComponent<ChangeDatasourceModalProps> = ({
         searchRef.current.focus();
       }
       if (!datasources) {
-
-        // SupersetClient.get({
-        //   endpoint: '/api/v1/dataset/',
-        // }).then(({ json }) => {
-        //   console.log(json);
-        //   const data = json.result.map((ds: any) => ({
-        //     rawName: ds.table_name,
-        //     connection: ds.database.database_name,
-        //     schema: ds.schema,
-        //     name: (
-        //       <a
-        //         href="#"
-        //         onClick={() => selectDatasource(ds)}
-        //         className="datasource-link"
-        //       >
-        //         {ds.table_name}
-        //       </a>
-        //     ),
-        //     type: ds.kind,
-        //   }));
-        //   setLoading(false);
-        //   setDatasources(data);
-        // }).catch(response => {
-        //   setLoading(false);
-        //   getClientErrorObject(response).then(({ error }: any) => {
-        //     addDangerToast(error.error || error.statusText || error);
-        //   });
-        // });
-
         SupersetClient.get({
-          endpoint: '/superset/datasources/',
-        })
-          .then(({ json }) => {
-            const data = json.map((ds: any) => ({
-              rawName: ds.name,
-              connection: ds.connection,
-              schema: ds.schema,
-              name: (
-                <a
-                  href="#"
-                  onClick={() => selectDatasource(ds)}
-                  className="datasource-link"
-                >
-                  {ds.name}
-                </a>
-              ),
-              type: ds.type,
-            }));
-            setLoading(false);
-            setDatasources(data);
-          })
-          .catch(response => {
-            setLoading(false);
-            getClientErrorObject(response).then(({ error }: any) => {
-              addDangerToast(error.error || error.statusText || error);
-            });
+          endpoint: '/api/v1/dataset/',
+        }).then(({ json }) => {
+          const data = json.result.map((ds: any) => ({
+            rawName: ds.table_name,
+            connection: ds.database.database_name,
+            schema: ds.schema,
+            name: (
+              <a
+                href="#"
+                onClick={() => selectDatasource(ds)}
+                className="datasource-link"
+              >
+                {ds.table_name}
+              </a>
+            ),
+            type: ds.kind,
+          }));
+          setLoading(false);
+          setDatasources(data);
+        }).catch(response => {
+          setLoading(false);
+          getClientErrorObject(response).then(({ error }: any) => {
+            addDangerToast(error.error || error.statusText || error);
           });
-      }
+        });
     };
 
     if (show) {