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
This commit is contained in:
Aniket Katkar 2023-10-20 10:50:23 +05:30 committed by GitHub
parent 1bd833d9a2
commit 2d3b4603a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 4 deletions

View File

@ -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: [

View File

@ -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(
<SearchIndexFieldsTable
{...mockProps}
searchedFields={mockSearchedFields}
/>
);
const dataTypeFieldForColumnName = screen.getByTestId('name-data-type');
expect(dataTypeFieldForColumnName).toHaveTextContent('text');
});
});

View File

@ -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 (
<>
<div data-testid={`${record.name}-data-type`}>
{isReadOnly ||
(displayValue && displayValue.length < 25 && !isReadOnly) ? (
toLower(displayValue)
@ -130,7 +130,7 @@ const SearchIndexFieldsTable = ({
</Typography.Text>
</Tooltip>
)}
</>
</div>
);
},
[isReadOnly]