Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
fisjac committed Nov 27, 2024
1 parent 30a3e59 commit fc3f83c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -198,10 +197,7 @@ const DatasourceModal: FunctionComponent<DatasourceModalProps> = ({
// 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,
Expand Down
15 changes: 4 additions & 11 deletions superset-frontend/src/components/Datasource/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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:
Expand All @@ -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;
}

0 comments on commit fc3f83c

Please sign in to comment.