Merge pull request #12097 from kuangp/feat/myGroups

refactor(MyGroupsSidebarItem): Render namespaces with subtitles
This commit is contained in:
Ben Lambert
2022-06-23 14:11:56 +02:00
committed by GitHub
5 changed files with 42 additions and 6 deletions
@@ -15,7 +15,10 @@
*/
import React from 'react';
import { stringifyEntityRef } from '@backstage/catalog-model';
import {
DEFAULT_NAMESPACE,
stringifyEntityRef,
} from '@backstage/catalog-model';
import {
SidebarItem,
SidebarSubmenu,
@@ -32,7 +35,6 @@ import {
catalogApiRef,
CatalogApi,
entityRouteRef,
humanizeEntityRef,
} from '@backstage/plugin-catalog-react';
import { getCompoundEntityRef } from '@backstage/catalog-model';
@@ -94,9 +96,11 @@ export const MyGroupsSidebarItem = (props: {
{groups?.map(function groupsMap(group) {
return (
<SidebarSubmenuItem
title={
group.metadata.title ||
humanizeEntityRef(group, { defaultKind: 'group' })
title={group.metadata.title || group.metadata.name}
subtitle={
group.metadata.namespace !== DEFAULT_NAMESPACE
? group.metadata.namespace
: undefined
}
to={catalogEntityRoute(getCompoundEntityRef(group))}
icon={icon}