Skip to content

Commit 815e688

Browse files
authoredFeb 26, 2025··
fix(ui) Properly get display name when downloading search results (#12720)
1 parent 6a8254c commit 815e688

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed
 

‎datahub-web-react/src/app/entity/shared/components/styled/search/downloadAsCsvUtil.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const getSearchCsvDownloadHeader = (sampleResult?: SearchResultInterface)
3333
};
3434

3535
export const transformGenericEntityPropertiesToCsvRow = (
36+
entityRegistry: EntityRegistry,
3637
properties: GenericEntityProperties | null,
3738
entityUrl: string,
3839
result: SearchResultInterface,
@@ -41,11 +42,11 @@ export const transformGenericEntityPropertiesToCsvRow = (
4142
// urn
4243
properties?.urn || '',
4344
// name
44-
properties?.name || '',
45+
entityRegistry.getDisplayName(result.entity.type, result.entity) || properties?.name || '',
4546
// type
4647
result.entity.type || '',
4748
// description
48-
properties?.properties?.description || '',
49+
properties?.properties?.description || properties?.editableProperties?.description || '',
4950
// user owners
5051
properties?.ownership?.owners
5152
?.filter((owner) => owner.owner.type === EntityType.CorpUser)
@@ -98,6 +99,6 @@ export const transformResultsToCsvRow = (results: SearchResultInterface[], entit
9899
return results.map((result) => {
99100
const genericEntityProperties = entityRegistry.getGenericEntityProperties(result.entity.type, result.entity);
100101
const entityUrl = entityRegistry.getEntityUrl(result.entity.type, result.entity.urn);
101-
return transformGenericEntityPropertiesToCsvRow(genericEntityProperties, entityUrl, result);
102+
return transformGenericEntityPropertiesToCsvRow(entityRegistry, genericEntityProperties, entityUrl, result);
102103
});
103104
};

‎datahub-web-react/src/app/entityV2/shared/components/styled/search/downloadAsCsvUtil.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const getSearchCsvDownloadHeader = (sampleResult?: SearchResultInterface)
3333
};
3434

3535
export const transformGenericEntityPropertiesToCsvRow = (
36+
entityRegistry: EntityRegistry,
3637
properties: GenericEntityProperties | null,
3738
entityUrl: string,
3839
result: SearchResultInterface,
@@ -41,7 +42,7 @@ export const transformGenericEntityPropertiesToCsvRow = (
4142
// urn
4243
properties?.urn || '',
4344
// name
44-
properties?.name || '',
45+
entityRegistry.getDisplayName(result.entity.type, result.entity) || properties?.name || '',
4546
// type
4647
result.entity.type || '',
4748
// description
@@ -98,6 +99,6 @@ export const transformResultsToCsvRow = (results: SearchResultInterface[], entit
9899
return results.map((result) => {
99100
const genericEntityProperties = entityRegistry.getGenericEntityProperties(result.entity.type, result.entity);
100101
const entityUrl = entityRegistry.getEntityUrl(result.entity.type, result.entity.urn);
101-
return transformGenericEntityPropertiesToCsvRow(genericEntityProperties, entityUrl, result);
102+
return transformGenericEntityPropertiesToCsvRow(entityRegistry, genericEntityProperties, entityUrl, result);
102103
});
103104
};

0 commit comments

Comments
 (0)
Please sign in to comment.