diff --git a/catalog-rest-service/src/main/resources/ui/src/components/my-data-details/SampleDataTable.tsx b/catalog-rest-service/src/main/resources/ui/src/components/my-data-details/SampleDataTable.tsx index e39c0a16f71..b37ff1d55c7 100644 --- a/catalog-rest-service/src/main/resources/ui/src/components/my-data-details/SampleDataTable.tsx +++ b/catalog-rest-service/src/main/resources/ui/src/components/my-data-details/SampleDataTable.tsx @@ -24,60 +24,66 @@ import { isEven } from '../../utils/CommonUtils'; export type SampleColumns = { name: string; dataType: string }; type Props = { - sampleData: { - columns: Array; - rows: TableData['rows']; + sampleData?: { + columns?: Array; + rows?: TableData['rows']; }; }; const SampleDataTable: FunctionComponent = ({ sampleData }: Props) => { return (
- - - - {sampleData.columns.map((column) => { + {sampleData?.rows && sampleData?.columns ? ( +
+ + + {sampleData.columns.map((column) => { + return ( + + ); + })} + + + + {sampleData?.rows?.map((row, rowIndex) => { return ( - + + {row.map((data, index) => { + return ( + + ); + })} + ); })} - - - - {sampleData?.rows?.map((row, rowIndex) => { - return ( - - {row.map((data, index) => { - return ( - - ); - })} - - ); - })} - -
+ {column.name} + + ({lowerCase(column.dataType)}) + +
- {column.name} - - ({lowerCase(column.dataType)}) - -
+ {data ? data.toString() : '--'} +
- {data ? data.toString() : '--'} -
+ + + ) : ( +
+ No sample data available +
+ )}
); }; diff --git a/catalog-rest-service/src/main/resources/ui/src/components/my-data-details/SchemaTab.tsx b/catalog-rest-service/src/main/resources/ui/src/components/my-data-details/SchemaTab.tsx index 49bb448a259..c02341a8ee5 100644 --- a/catalog-rest-service/src/main/resources/ui/src/components/my-data-details/SchemaTab.tsx +++ b/catalog-rest-service/src/main/resources/ui/src/components/my-data-details/SchemaTab.tsx @@ -81,8 +81,8 @@ const SchemaTab: FunctionComponent = ({ }); return { - columns: updatedColumns as SampleColumns[], - rows: sampleData.rows, + columns: updatedColumns as SampleColumns[] | undefined, + rows: sampleData?.rows, }; };