Merge pull request #4894 from tudi2d/4825-techdocs-breadcrumbs

This commit is contained in:
Himanshu Mishra
2021-03-15 12:30:41 +01:00
committed by GitHub
3 changed files with 14 additions and 2 deletions
@@ -18,6 +18,7 @@ import { TechDocsPageHeader } from './TechDocsPageHeader';
import { act } from '@testing-library/react';
import { renderInTestApp } from '@backstage/test-utils';
import { entityRouteRef } from '@backstage/plugin-catalog-react';
import { rootRouteRef } from '../../plugin';
describe('<TechDocsPageHeader />', () => {
it('should render a techdocs page header', async () => {
@@ -54,6 +55,7 @@ describe('<TechDocsPageHeader />', () => {
{
mountedRoutes: {
'/catalog/:namespace/:kind/:name/*': entityRouteRef,
'/docs': rootRouteRef,
},
},
);
@@ -85,6 +87,7 @@ describe('<TechDocsPageHeader />', () => {
{
mountedRoutes: {
'/catalog/:namespace/:kind/:name/*': entityRouteRef,
'/docs': rootRouteRef,
},
},
);
@@ -118,6 +121,7 @@ describe('<TechDocsPageHeader />', () => {
{
mountedRoutes: {
'/catalog/:namespace/:kind/:name/*': entityRouteRef,
'/docs': rootRouteRef,
},
},
);
@@ -21,6 +21,7 @@ import { EntityName, parseEntityName } from '@backstage/catalog-model';
import { Header, HeaderLabel, Link, useRouteRef } from '@backstage/core';
import { TechDocsMetadata } from '../../types';
import { EntityRefLink, entityRouteRef } from '@backstage/plugin-catalog-react';
import { rootRouteRef } from '../../plugin';
type TechDocsPageHeaderProps = {
entityId: EntityName;
@@ -59,6 +60,8 @@ export const TechDocsPageHeader = ({
ownerEntity = parseEntityName(owner, { defaultKind: 'group' });
}
const docsRootLink = useRouteRef(rootRouteRef)();
const labels = (
<>
<HeaderLabel
@@ -112,8 +115,8 @@ export const TechDocsPageHeader = ({
subtitle={
siteDescription && siteDescription !== 'None' ? siteDescription : ''
}
type={name}
typeLink={componentLink(entityId)}
type="Docs"
typeLink={docsRootLink}
>
{labels}
</Header>