From 2d3b4603a359a9ce6ecef04519c70c49eabecff5 Mon Sep 17 00:00:00 2001 From: Aniket Katkar Date: Fri, 20 Oct 2023 10:50:23 +0530 Subject: [PATCH] fix(ui): incorrect field data showing in data type for search indexes (#13654) * fixed wrong field showing in data type for search indexes * added tests for the new changes --- .../main/resources/ui/src/mocks/SearchIndex.mock.ts | 1 - .../SearchIndexFieldsTable.test.tsx | 12 ++++++++++++ .../SearchIndexFieldsTable.tsx | 6 +++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/mocks/SearchIndex.mock.ts b/openmetadata-ui/src/main/resources/ui/src/mocks/SearchIndex.mock.ts index 627029ef028..a27d21bd310 100644 --- a/openmetadata-ui/src/main/resources/ui/src/mocks/SearchIndex.mock.ts +++ b/openmetadata-ui/src/main/resources/ui/src/mocks/SearchIndex.mock.ts @@ -22,7 +22,6 @@ export const MOCK_SEARCH_INDEX_FIELDS: SearchIndexField[] = [ { name: 'name', dataType: DataType.Text, - dataTypeDisplay: 'text', description: 'Table Entity Name.', fullyQualifiedName: 'elasticsearch_sample.table_search_index.name', tags: [ diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/SearchIndexDetailsPage/SearchIndexFieldsTable/SearchIndexFieldsTable.test.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/SearchIndexDetailsPage/SearchIndexFieldsTable/SearchIndexFieldsTable.test.tsx index f24465aec28..8f654644700 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/SearchIndexDetailsPage/SearchIndexFieldsTable/SearchIndexFieldsTable.test.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/SearchIndexDetailsPage/SearchIndexFieldsTable/SearchIndexFieldsTable.test.tsx @@ -94,4 +94,16 @@ describe('SearchIndexFieldsTable component', () => { expect(screen.queryByText('description')).toBeNull(); expect(screen.queryByText('column_description')).toBeNull(); }); + + it('SearchIndexFieldsTable should show value from dataType field when there is no dataTypeDisplay is present', () => { + render( + + ); + const dataTypeFieldForColumnName = screen.getByTestId('name-data-type'); + + expect(dataTypeFieldForColumnName).toHaveTextContent('text'); + }); }); diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/SearchIndexDetailsPage/SearchIndexFieldsTable/SearchIndexFieldsTable.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/SearchIndexDetailsPage/SearchIndexFieldsTable/SearchIndexFieldsTable.tsx index 15e42325332..e16f1786ef5 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/SearchIndexDetailsPage/SearchIndexFieldsTable/SearchIndexFieldsTable.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/SearchIndexDetailsPage/SearchIndexFieldsTable/SearchIndexFieldsTable.tsx @@ -111,7 +111,7 @@ const SearchIndexFieldsTable = ({ > = useCallback( (dataTypeDisplay, record) => { const displayValue = isEmpty(dataTypeDisplay) - ? record.name + ? record.dataType : dataTypeDisplay; if (isEmpty(displayValue)) { @@ -119,7 +119,7 @@ const SearchIndexFieldsTable = ({ } return ( - <> +
{isReadOnly || (displayValue && displayValue.length < 25 && !isReadOnly) ? ( toLower(displayValue) @@ -130,7 +130,7 @@ const SearchIndexFieldsTable = ({ )} - +
); }, [isReadOnly]