From fc3f83cd27a89a906874212a8cd157f63a36e74d Mon Sep 17 00:00:00 2001 From: Jack Fisher Date: Tue, 26 Nov 2024 23:34:44 -0600 Subject: [PATCH] lint --- .../components/Datasource/DatasourceEditor.jsx | 5 +---- .../src/components/Datasource/DatasourceModal.tsx | 6 +----- .../src/components/Datasource/utils.js | 15 ++++----------- 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/superset-frontend/src/components/Datasource/DatasourceEditor.jsx b/superset-frontend/src/components/Datasource/DatasourceEditor.jsx index 139f3c5297e7c..f3708466ce82e 100644 --- a/superset-frontend/src/components/Datasource/DatasourceEditor.jsx +++ b/superset-frontend/src/components/Datasource/DatasourceEditor.jsx @@ -698,10 +698,7 @@ class DatasourceEditor extends PureComponent { const { datasource } = this.state; this.setState({ metadataLoading: true }); try { - const newCols = await fetchSyncedColumns( - datasource, - this.props.addDangerToast, - ); + const newCols = await fetchSyncedColumns(datasource); const columnChanges = updateColumns( datasource.columns, newCols, diff --git a/superset-frontend/src/components/Datasource/DatasourceModal.tsx b/superset-frontend/src/components/Datasource/DatasourceModal.tsx index 112d0bf66b200..5370e97a01799 100644 --- a/superset-frontend/src/components/Datasource/DatasourceModal.tsx +++ b/superset-frontend/src/components/Datasource/DatasourceModal.tsx @@ -20,7 +20,6 @@ import { FunctionComponent, useState, useRef } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import Alert from 'src/components/Alert'; import Button from 'src/components/Button'; -import { Dataset } from '@superset-ui/chart-controls'; import { FeatureFlag, isDefined, @@ -198,10 +197,7 @@ const DatasourceModal: FunctionComponent = ({ // if sql has changed, save a second time with synced columns dispatch(startMetaDataLoading()); try { - const columnJson = await fetchSyncedColumns( - currentDatasource, - addDangerToast, - ); + const columnJson = await fetchSyncedColumns(currentDatasource); const columnChanges = updateColumns( currentDatasource.columns, columnJson, diff --git a/superset-frontend/src/components/Datasource/utils.js b/superset-frontend/src/components/Datasource/utils.js index dfb20d11418c6..a87573c1e7b21 100644 --- a/superset-frontend/src/components/Datasource/utils.js +++ b/superset-frontend/src/components/Datasource/utils.js @@ -18,7 +18,7 @@ */ import { Children, cloneElement } from 'react'; import { nanoid } from 'nanoid'; -import { getClientErrorObject, SupersetClient, t } from '@superset-ui/core'; +import { SupersetClient, t } from '@superset-ui/core'; import rison from 'rison'; export function recurseReactClone(children, type, propExtender) { @@ -103,7 +103,7 @@ export function updateColumns(prevCols, newCols, addSuccessToast) { return columnChanges; } -export async function fetchSyncedColumns(datasource, addDangerToast) { +export async function fetchSyncedColumns(datasource) { const params = { datasource_type: datasource.type, database_name: @@ -123,13 +123,6 @@ export async function fetchSyncedColumns(datasource, addDangerToast) { const endpoint = `/datasource/external_metadata_by_name/?q=${rison.encode_uri( params, )}`; - try { - const { json } = await SupersetClient.get({ endpoint }); - return json; - } catch (error) { - const { error: clientError, statusText } = - await getClientErrorObject(error); - addDangerToast(clientError || statusText || t('An error has occurred')); - } - return; + const { json } = await SupersetClient.get({ endpoint }); + return json; }