lyndsiWilliams commented on code in PR #22136:
URL: https://github.com/apache/superset/pull/22136#discussion_r1028361120


##########
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]),

Review Comment:
   When I initially set it to the entire response, it was only setting one 
dataset at a time for some reason. Looping and adding forces it to make an 
array of the datasets.



-- 
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

Reply via email to