From 81b8710c2a2725788e82e5eae7c4c049b1e9fd7f Mon Sep 17 00:00:00 2001 From: Sachin Chaurasiya Date: Thu, 14 Jul 2022 18:22:46 +0530 Subject: [PATCH] =?UTF-8?q?Fix=20#6086=20[UI]=20Ui=20sends=20@mention=20as?= =?UTF-8?q?=20<#E::undefined::undefined|[@mohit](/users/mohit)>=EF=BB=BF?= =?UTF-8?q?=20hi=20(#6087)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/ui/src/utils/FeedUtils.tsx | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/FeedUtils.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/FeedUtils.tsx index a73bb446c8d..58052a260af 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/FeedUtils.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/utils/FeedUtils.tsx @@ -150,6 +150,10 @@ export const getThreadValue = ( return threadValue; }; +export const buildMentionLink = (entityType: string, entityFqn: string) => { + return `${document.location.protocol}//${document.location.host}/${entityType}/${entityFqn}`; +}; + export async function suggestions(searchTerm: string, mentionChar: string) { if (mentionChar === '@') { let atValues = []; @@ -166,9 +170,10 @@ export async function suggestions(searchTerm: string, mentionChar: string) { `@${hit._source.name ?? hit._source.display_name}`, hit._source.deleted ), - link: `/${entityUrlMap[entityType as keyof typeof entityUrlMap]}/${ + link: buildMentionLink( + entityUrlMap[entityType as keyof typeof entityUrlMap], hit._source.name - }`, + ), }; }); } else { @@ -184,9 +189,10 @@ export async function suggestions(searchTerm: string, mentionChar: string) { `@${hit._source.name ?? hit._source.display_name}`, hit._source.deleted ), - link: `/${entityUrlMap[entityType as keyof typeof entityUrlMap]}/${ + link: buildMentionLink( + entityUrlMap[entityType as keyof typeof entityUrlMap], hit._source.name - }`, + ), }; }); } @@ -204,7 +210,10 @@ export async function suggestions(searchTerm: string, mentionChar: string) { return { id: hit._id, value: `#${entityType}/${hit._source.name}`, - link: `/${entityType}/${getEncodedFqn(hit._source.fqdn)}`, + link: buildMentionLink( + entityType, + getEncodedFqn(hit._source.fullyQualifiedName) + ), }; }); } else { @@ -217,7 +226,10 @@ export async function suggestions(searchTerm: string, mentionChar: string) { return { id: hit._id, value: `#${entityType}/${hit._source.name}`, - link: `/${entityType}/${getEncodedFqn(hit._source.fqdn)}`, + link: buildMentionLink( + entityType, + getEncodedFqn(hit._source.fullyQualifiedName) + ), }; }); }