diff --git a/datahub-web-react/src/app/entity/dataset/profile/__tests__/SchemaDescriptionField.test.tsx b/datahub-web-react/src/app/entity/dataset/profile/__tests__/SchemaDescriptionField.test.tsx index f5223791a2a679..87aa5cc0cd3182 100644 --- a/datahub-web-react/src/app/entity/dataset/profile/__tests__/SchemaDescriptionField.test.tsx +++ b/datahub-web-react/src/app/entity/dataset/profile/__tests__/SchemaDescriptionField.test.tsx @@ -18,7 +18,12 @@ describe('SchemaDescriptionField', () => { it('renders update description modal', async () => { const { getByText, getByRole, queryByText } = render( - {}} /> + {}} + /> , ); expect(queryByText('Update description')).not.toBeInTheDocument(); diff --git a/datahub-web-react/src/app/entity/dataset/profile/schema/SchemaTable.tsx b/datahub-web-react/src/app/entity/dataset/profile/schema/SchemaTable.tsx index ccfa69eb67724a..49ab6f1a76377f 100644 --- a/datahub-web-react/src/app/entity/dataset/profile/schema/SchemaTable.tsx +++ b/datahub-web-react/src/app/entity/dataset/profile/schema/SchemaTable.tsx @@ -143,6 +143,7 @@ export default function SchemaTable({ return ( onUpdateDescription(updatedDescription, record)} editable={editMode} diff --git a/datahub-web-react/src/app/entity/dataset/profile/schema/components/CustomPagination.tsx b/datahub-web-react/src/app/entity/dataset/profile/schema/components/CustomPagination.tsx index bf53a656e32784..8d270898a44566 100644 --- a/datahub-web-react/src/app/entity/dataset/profile/schema/components/CustomPagination.tsx +++ b/datahub-web-react/src/app/entity/dataset/profile/schema/components/CustomPagination.tsx @@ -32,8 +32,8 @@ type Props = { }; export default function CustomPagination({ onChange, maxVersion }: Props) { - const [version1, setVersion1] = useState(maxVersion || 1); - const [version2, setVersion2] = useState(maxVersion ? maxVersion - 1 : 0); + const [version1, setVersion1] = useState(maxVersion || 1); // current version - first dropdown selected + const [version2, setVersion2] = useState(maxVersion ? maxVersion - 1 : 0); // past version comparing with current - second dropdown const onNextClick = () => { setVersion1((v) => v - 1); @@ -64,8 +64,8 @@ export default function CustomPagination({ onChange, maxVersion }: Props) { {[...Array(maxVersion)].map((_, i) => ( // eslint-disable-next-line react/no-array-index-key - - {`version ${i + 1}`} + + {i === 0 ? 'latest' : `version ${maxVersion + 1 - i}`} ))} @@ -75,8 +75,8 @@ export default function CustomPagination({ onChange, maxVersion }: Props) { {[...Array(version1)].map((_, i) => ( // eslint-disable-next-line react/no-array-index-key - - {`version ${i}`} + + {`version ${version1 - i}`} ))} @@ -93,11 +93,13 @@ export default function CustomPagination({ onChange, maxVersion }: Props) { /> Comparing - {`version ${version1}`} + + {version1 === maxVersion ? 'latest' : `version ${version1 + 1}`} + to - {`version ${version2}`} + {`version ${version2 + 1}`} Promise, Record> | void>; @@ -72,7 +73,13 @@ type Props = { isEdited?: boolean; }; -export default function DescriptionField({ description, onUpdate, editable = true, isEdited = false }: Props) { +export default function DescriptionField({ + description, + onUpdate, + editable = true, + isEdited = false, + original, +}: Props) { const [showAddModal, setShowAddModal] = useState(false); const onCloseModal = () => setShowAddModal(false); @@ -105,7 +112,7 @@ export default function DescriptionField({ description, onUpdate, editable = tru [SchemaFieldDataType.Struct]: { icon: null, size: 0, text: 'Struct' }, }; +const truncate = (length: number, input?: string | null) => { + if (!input) return ''; + if (input.length > length) { + return `${input.substring(0, length)}...`; + } + return input; +}; + type Props = { type: SchemaFieldDataType; nativeDataType: string | null | undefined; @@ -96,7 +104,7 @@ export default function TypeIcon({ type, nativeDataType }: Props) { {Icon && } - {nativeFallback ? nativeDataType : text} + {nativeFallback ? truncate(250, nativeDataType) : text}