eschutho commented on code in PR #22136: URL: https://github.com/apache/superset/pull/22136#discussion_r1025854683
########## superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx: ########## @@ -73,6 +75,38 @@ export default function AddDataset() { Reducer<Partial<DatasetObject> | null, DSReducerActionType> >(datasetReducer, null); const [hasColumns, setHasColumns] = useState(false); + const [linkedDatasets, setLinkedDatasets] = useState<DatasetObject[]>([]); + const linkedDatasetNames = linkedDatasets.map(dataset => dataset.table_name); + const encodedSchema = dataset?.schema + ? encodeURIComponent(dataset?.schema) + : undefined; + + const queryParams = dataset?.schema + ? rison.encode_uri({ + filters: [ + { col: 'schema', opr: 'eq', value: encodedSchema }, + { col: 'sql', opr: 'dataset_is_null_or_empty', value: '!t' }, + ], + }) + : undefined; + + const getDatasetsList = () => { + SupersetClient.get({ + endpoint: `/api/v1/dataset/?q=${queryParams}`, + }) + .then(({ json }) => { + json.result.map((dataset: any) => + setLinkedDatasets(linkedDatasets => [...linkedDatasets, dataset]), + ); + }) + .catch(error => + console.log('There was an error fetching dataset', error), + ); + }; + + useEffect(() => { + if (dataset?.schema) getDatasetsList(); Review Comment: agree on the lint rule +1 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org