From 88d71cd34684706d1227b42665090d920a538c2b Mon Sep 17 00:00:00 2001 From: David Dyball Date: Thu, 2 Jul 2020 14:07:20 +0100 Subject: [PATCH 1/2] Use Config for Filter Org List Header --- plugins/catalog/src/components/CatalogPage/CatalogPage.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/catalog/src/components/CatalogPage/CatalogPage.tsx b/plugins/catalog/src/components/CatalogPage/CatalogPage.tsx index e59b753363..c1e02b3c28 100644 --- a/plugins/catalog/src/components/CatalogPage/CatalogPage.tsx +++ b/plugins/catalog/src/components/CatalogPage/CatalogPage.tsx @@ -19,6 +19,7 @@ import { ContentHeader, identityApiRef, SupportButton, + configApiRef, useApi, } from '@backstage/core'; import { rootRoute as scaffolderRootRoute } from '@backstage/plugin-scaffolder'; @@ -51,6 +52,8 @@ const CatalogPageContents = () => { const userId = useApi(identityApiRef).getUserId(); const [selectedTab, setSelectedTab] = useState(); const [selectedSidebarItem, setSelectedSidebarItem] = useState(); + const orgName = + useApi(configApiRef).getOptionalString('organization.name') ?? 'Company'; const tabs = useMemo( () => [ @@ -79,7 +82,7 @@ const CatalogPageContents = () => { ); const filterGroups = useMemo( - () => [ + (org: orgName) => [ { name: 'Personal', items: [ @@ -98,7 +101,7 @@ const CatalogPageContents = () => { ], }, { - name: 'Company', // TODO: Replace with Company name, read from app config. + name: org, items: [ { id: 'all', From d78d9f20a7a994298285ada3de8491b7de64b933 Mon Sep 17 00:00:00 2001 From: David Dyball Date: Thu, 2 Jul 2020 14:48:37 +0100 Subject: [PATCH 2/2] Fix variable --- plugins/catalog/src/components/CatalogPage/CatalogPage.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/catalog/src/components/CatalogPage/CatalogPage.tsx b/plugins/catalog/src/components/CatalogPage/CatalogPage.tsx index c1e02b3c28..e58b2d407b 100644 --- a/plugins/catalog/src/components/CatalogPage/CatalogPage.tsx +++ b/plugins/catalog/src/components/CatalogPage/CatalogPage.tsx @@ -82,7 +82,7 @@ const CatalogPageContents = () => { ); const filterGroups = useMemo( - (org: orgName) => [ + () => [ { name: 'Personal', items: [ @@ -101,7 +101,7 @@ const CatalogPageContents = () => { ], }, { - name: org, + name: orgName, items: [ { id: 'all', @@ -111,7 +111,7 @@ const CatalogPageContents = () => { ], }, ], - [isStarredEntity, userId], + [isStarredEntity, userId, orgName], ); return (