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:45 UTC
[incubator-superset] 01/03: saving for now
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);
+ });
+ });
}
};