zhaoyongjie commented on code in PR #21343:
URL: https://github.com/apache/superset/pull/21343#discussion_r963747894


##########
superset-frontend/src/dashboard/components/DrillDetailPane/DrillDetailPane.tsx:
##########
@@ -242,8 +267,77 @@ export default function DrillDetailPane({
     );
   }
 
+  // Get datasource metadata
+  const response = 
useApiV1Resource<Dataset>(`/api/v1/dataset/${datasourceId}`);
+
+  const metadata = useMemo(() => {
+    const { status, result } = response;
+    const items: ContentType[] = [];
+    if (result) {
+      const {
+        changed_on,
+        created_on,
+        description,
+        table_name,
+        changed_by,
+        created_by,
+        owners,
+      } = result;
+      const notAvailable = t('Not available');
+      const createdBy = created_by
+        ? `${created_by.first_name} ${created_by.last_name}`
+        : notAvailable;

Review Comment:
   I don't know whether the `first_name` and `last_name` would have been null 
values, so get rid of `undefined or null` value in the object might make sense.
   
   ```javascript
          const createdBy = `${created_by?.first_name ?? ""} 
${created_by?.last_name ?? ""}`.trim() || notAvailable;
   ```



##########
superset-frontend/src/dashboard/components/DrillDetailPane/DrillDetailPane.tsx:
##########
@@ -49,6 +55,25 @@ type ResultsPage = {
   colTypes: GenericDataType[];
 };
 
+type Dataset = {

Review Comment:
   nits: the type might be moved to `./type` or 
`superset-ui/core/query/types/datasource`



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to