mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-15 18:33:40 +00:00
Fix: issue-612 fixed sampleData breaks (#630)
* Fix: issue-612 fixed sampleData breaks * optimised conditional rendering
This commit is contained in:
parent
b231e68c6e
commit
9671850c55
@ -24,15 +24,16 @@ import { isEven } from '../../utils/CommonUtils';
|
|||||||
export type SampleColumns = { name: string; dataType: string };
|
export type SampleColumns = { name: string; dataType: string };
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
sampleData: {
|
sampleData?: {
|
||||||
columns: Array<SampleColumns>;
|
columns?: Array<SampleColumns>;
|
||||||
rows: TableData['rows'];
|
rows?: TableData['rows'];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const SampleDataTable: FunctionComponent<Props> = ({ sampleData }: Props) => {
|
const SampleDataTable: FunctionComponent<Props> = ({ sampleData }: Props) => {
|
||||||
return (
|
return (
|
||||||
<div className="tw-table-responsive">
|
<div className="tw-table-responsive">
|
||||||
|
{sampleData?.rows && sampleData?.columns ? (
|
||||||
<table
|
<table
|
||||||
className="tw-min-w-max tw-w-full tw-table-auto"
|
className="tw-min-w-max tw-w-full tw-table-auto"
|
||||||
data-testid="sample-data-table">
|
data-testid="sample-data-table">
|
||||||
@ -78,6 +79,11 @@ const SampleDataTable: FunctionComponent<Props> = ({ sampleData }: Props) => {
|
|||||||
})}
|
})}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
) : (
|
||||||
|
<div className="tw-flex tw-justify-center tw-font-medium tw-items-center tw-border tw-border-main tw-rounded-md tw-p-8">
|
||||||
|
No sample data available
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -81,8 +81,8 @@ const SchemaTab: FunctionComponent<Props> = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
columns: updatedColumns as SampleColumns[],
|
columns: updatedColumns as SampleColumns[] | undefined,
|
||||||
rows: sampleData.rows,
|
rows: sampleData?.rows,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user