fix the table row issue and make sample data table header fix (#15268)

This commit is contained in:
Ashish Gupta 2024-02-20 18:54:09 +05:30 committed by GitHub
parent 1cbe09c8ac
commit 9c46391e73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 8 deletions

View File

@ -94,18 +94,19 @@ const SampleDataTable = ({
name: column, name: column,
dataType: matchedColumn?.dataType ?? '', dataType: matchedColumn?.dataType ?? '',
title: ( title: (
<Space direction="vertical" size={0}> <div className="d-flex flex-column">
<Typography.Text> {column}</Typography.Text> <Typography.Text> {column}</Typography.Text>
{matchedColumn?.dataType && ( {matchedColumn?.dataType && (
<Typography.Text className="text-grey-muted text-xs font-normal">{`(${lowerCase( <Typography.Text className="text-grey-muted text-xs font-normal">{`(${lowerCase(
matchedColumn?.dataType ?? '' matchedColumn?.dataType ?? ''
)})`}</Typography.Text> )})`}</Typography.Text>
)} )}
</Space> </div>
), ),
dataIndex: column, dataIndex: column,
key: column, key: column,
accessor: column, accessor: column,
width: 210,
render: (data: SampleDataType) => <RowData data={data} />, render: (data: SampleDataType) => <RowData data={data} />,
}; };
}); });
@ -264,7 +265,7 @@ const SampleDataTable = ({
dataSource={sampleData?.rows} dataSource={sampleData?.rows}
pagination={false} pagination={false}
rowKey="name" rowKey="name"
scroll={{ x: true }} scroll={{ y: 'calc(100vh - 160px)' }}
size="small" size="small"
/> />

View File

@ -53,6 +53,7 @@ import {
searchTagInData, searchTagInData,
} from '../../../utils/TableTags/TableTags.utils'; } from '../../../utils/TableTags/TableTags.utils';
import { import {
getAllRowKeysByKeyName,
getFilterIcon, getFilterIcon,
getTableExpandableConfig, getTableExpandableConfig,
makeData, makeData,
@ -121,6 +122,12 @@ const SchemaTable = ({
[searchedColumns] [searchedColumns]
); );
const nestedTableFqnKeys = useMemo(
() =>
getAllRowKeysByKeyName<Column>(tableColumns ?? [], 'fullyQualifiedName'),
[tableColumns]
);
useEffect(() => { useEffect(() => {
if (!isEmpty(decodedEntityFqn)) { if (!isEmpty(decodedEntityFqn)) {
fetchResourcePermission(decodedEntityFqn); fetchResourcePermission(decodedEntityFqn);
@ -459,10 +466,8 @@ const SchemaTable = ({
); );
useEffect(() => { useEffect(() => {
setExpandedRowKeys(() => setExpandedRowKeys(nestedTableFqnKeys);
data.map((value) => value?.fullyQualifiedName ?? '') }, [searchText]);
);
}, [data]);
return ( return (
<> <>

View File

@ -515,7 +515,9 @@ export const prepareConstraintIcon = ({
); );
}; };
export const getAllRowKeysByKeyName = <T extends Field | SearchIndexField>( export const getAllRowKeysByKeyName = <
T extends Column | Field | SearchIndexField
>(
data: T[], data: T[],
keyName: keyof T keyName: keyof T
) => { ) => {