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 <[email protected]> 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) {
