Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(#14068): show displayName if present in column and search should also show the result considering displayName #14542

Merged
merged 2 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
groupBy,
isEmpty,
isUndefined,
lowerCase,
set,
sortBy,
toLower,
Expand Down Expand Up @@ -48,14 +47,14 @@ import { TagLabel } from '../../generated/type/tagLabel';
import {
getEntityName,
getFrequentlyJoinedColumns,
searchInColumns,
} from '../../utils/EntityUtils';
import { getDecodedFqn } from '../../utils/StringsUtils';
import {
getAllTags,
searchTagInData,
} from '../../utils/TableTags/TableTags.utils';
import {
getDataTypeString,
getFilterIcon,
getTableExpandableConfig,
makeData,
Expand Down Expand Up @@ -191,34 +190,6 @@ const SchemaTable = ({
}
};

const searchInColumns = (table: Column[], searchText: string): Column[] => {
const searchedValue: Column[] = table.reduce((searchedCols, column) => {
const isContainData =
lowerCase(column.name).includes(searchText) ||
lowerCase(column.description).includes(searchText) ||
lowerCase(getDataTypeString(column.dataType)).includes(searchText);

if (isContainData) {
return [...searchedCols, column];
} else if (!isUndefined(column.children)) {
const searchedChildren = searchInColumns(column.children, searchText);
if (searchedChildren.length > 0) {
return [
...searchedCols,
{
...column,
children: searchedChildren,
},
];
}
}

return searchedCols;
}, [] as Column[]);

return searchedValue;
};

const handleUpdate = (column: Column) => {
handleEditColumn(column);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import { Column, ColumnProfile } from '../../../generated/entity/data/table';
import { TestCase, TestCaseStatus } from '../../../generated/tests/testCase';
import { formatNumberWithComma } from '../../../utils/CommonUtils';
import { updateTestResults } from '../../../utils/DataQualityAndProfilerUtils';
import { getEntityName, searchInColumns } from '../../../utils/EntityUtils';
import {
getAddCustomMetricPath,
getAddDataQualityTableTestPath,
Expand Down Expand Up @@ -124,15 +125,15 @@ const ColumnProfileTable = () => {
key: 'name',
width: 250,
fixed: 'left',
render: (name: string, record) => {
render: (_, record) => {
return (
<Button
className="break-word p-0"
type="link"
onClick={() =>
updateActiveColumnFqn(record.fullyQualifiedName || '')
}>
{name}
{getEntityName(record)}
</Button>
);
},
Expand Down Expand Up @@ -345,7 +346,8 @@ const ColumnProfileTable = () => {
const handleSearchAction = (searchText: string) => {
setSearchText(searchText);
if (searchText) {
setData(columns.filter((col) => col.name?.includes(searchText)));
const searchCols = searchInColumns(columns, searchText);
setData(searchCols);
} else {
setData(columns);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,7 @@ export const searchInColumns = <T extends Column | SearchIndexField>(
const searchLowerCase = lowerCase(searchText);
const isContainData =
lowerCase(column.name).includes(searchLowerCase) ||
lowerCase(column.displayName).includes(searchLowerCase) ||
lowerCase(column.description).includes(searchLowerCase) ||
lowerCase(getDataTypeString(column.dataType)).includes(searchLowerCase);

Expand Down
Loading