From 2b114fde44793a93e09311b11233e6be2cc1b2ac Mon Sep 17 00:00:00 2001 From: Esteban Barrios Date: Mon, 7 Sep 2020 13:53:30 +0200 Subject: [PATCH] Show Display name in catalog instead of userId (#2310) * Use display name instead of userid if this exists in the user profile for the catalog welcome banner * Rename variable for clarity * Updated test for CatalogPage to include getProfile function --- plugins/catalog/src/components/CatalogPage/CatalogLayout.tsx | 3 ++- .../catalog/src/components/CatalogPage/CatalogPage.test.tsx | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/catalog/src/components/CatalogPage/CatalogLayout.tsx b/plugins/catalog/src/components/CatalogPage/CatalogLayout.tsx index 39b3c66013..92f51ace06 100644 --- a/plugins/catalog/src/components/CatalogPage/CatalogLayout.tsx +++ b/plugins/catalog/src/components/CatalogPage/CatalogLayout.tsx @@ -31,12 +31,13 @@ type Props = { const CatalogLayout = ({ children }: Props) => { const greeting = getTimeBasedGreeting(); + const profile = useApi(identityApiRef).getProfile(); const userId = useApi(identityApiRef).getUserId(); return (
{ getLocationByEntity: () => Promise.resolve({ id: 'id', type: 'github', target: 'url' }), }; + const testProfile: Partial = { + displayName: 'Display Name', + }; const indentityApi: Partial = { getUserId: () => 'tools@example.com', + getProfile: () => testProfile, }; const renderWrapped = (children: React.ReactNode) =>