You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/08/12 15:14:42 UTC

[GitHub] [superset] kgabryje commented on a change in pull request #16200: chore: Shows the dataset description in the gallery dropdown

kgabryje commented on a change in pull request #16200:
URL: https://github.com/apache/superset/pull/16200#discussion_r687824785



##########
File path: superset-frontend/src/addSlice/AddSliceContainer.tsx
##########
@@ -126,19 +118,47 @@ export default class AddSliceContainer extends React.PureComponent<
     window.location.href = this.exploreUrl();
   }
 
-  changeDatasource(value: string) {
-    this.setState({
-      datasourceValue: value,
-      datasourceId: value.split('__')[0],
-    });
+  changeDatasource(datasource: { label: string; value: string }) {
+    this.setState({ datasource });
   }
 
   changeVisType(visType: string | null) {
     this.setState({ visType });
   }
 
   isBtnDisabled() {
-    return !(this.state.datasourceId && this.state.visType);
+    return !(this.state.datasource?.value && this.state.visType);
+  }
+
+  loadDatasources(search: string, page: number, pageSize: number) {
+    const query = rison.encode({
+      columns: ['id', 'table_name', 'description', 'datasource_type'],
+      filter: search,
+      page,
+      page_size: pageSize,
+    });
+    return SupersetClient.get({
+      endpoint: `/api/v1/dataset?q=${query}`,
+    }).then(response => {
+      const list = response.json.result.map(
+        (item: {
+          id: number;
+          table_name: string;
+          description: string;
+          datasource_type: string;
+        }) => ({
+          value: `${item.id}__${item.datasource_type}`,
+          label: item.table_name,
+          title: `${item.table_name}\n\n${

Review comment:
       Can we replace `\n\n` with a span with some padding, so that we have more control over the spacings and can use grid unit from theme?




-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org