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

View File

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