replace entityId with entityRef
Signed-off-by: Emma Indal <emma.indahl@gmail.com>
This commit is contained in:
@@ -56,7 +56,7 @@ export const LegacyTechDocsPage = () => {
|
||||
<TechDocsPageHeader
|
||||
techDocsMetadata={techdocsMetadataValue}
|
||||
entityMetadata={entityMetadataValue}
|
||||
entityId={{
|
||||
entityRef={{
|
||||
kind,
|
||||
namespace,
|
||||
name,
|
||||
@@ -65,7 +65,7 @@ export const LegacyTechDocsPage = () => {
|
||||
<Content data-testid="techdocs-content">
|
||||
<Reader
|
||||
onReady={onReady}
|
||||
entityId={{
|
||||
entityRef={{
|
||||
kind,
|
||||
namespace,
|
||||
name,
|
||||
|
||||
@@ -41,7 +41,7 @@ const { useParams }: { useParams: jest.Mock } =
|
||||
describe('<Reader />', () => {
|
||||
it('should render Reader content', async () => {
|
||||
useParams.mockReturnValue({
|
||||
entityId: 'Component::backstage',
|
||||
entityRef: 'Component::backstage',
|
||||
});
|
||||
|
||||
const scmIntegrationsApi: ScmIntegrationsApi =
|
||||
@@ -68,7 +68,7 @@ describe('<Reader />', () => {
|
||||
wrapInTestApp(
|
||||
<ApiProvider apis={apiRegistry}>
|
||||
<Reader
|
||||
entityId={{
|
||||
entityRef={{
|
||||
kind: 'Component',
|
||||
namespace: 'default',
|
||||
name: 'example',
|
||||
|
||||
@@ -48,7 +48,7 @@ import { TechDocsSearch } from './TechDocsSearch';
|
||||
import { useReaderState } from './useReaderState';
|
||||
|
||||
type Props = {
|
||||
entityId: EntityName;
|
||||
entityRef: EntityName;
|
||||
onReady?: () => void;
|
||||
withSearch?: boolean;
|
||||
};
|
||||
@@ -71,8 +71,8 @@ const useStyles = makeStyles<BackstageTheme>(theme => ({
|
||||
},
|
||||
}));
|
||||
|
||||
export const Reader = ({ entityId, onReady, withSearch = true }: Props) => {
|
||||
const { kind, namespace, name } = entityId;
|
||||
export const Reader = ({ entityRef, onReady, withSearch = true }: Props) => {
|
||||
const { kind, namespace, name } = entityRef;
|
||||
const theme = useTheme<BackstageTheme>();
|
||||
const classes = useStyles();
|
||||
|
||||
@@ -448,7 +448,7 @@ export const Reader = ({ entityId, onReady, withSearch = true }: Props) => {
|
||||
|
||||
{withSearch && shadowDomRef?.current?.shadowRoot?.innerHTML && (
|
||||
<Grid container className={classes.searchBar}>
|
||||
<TechDocsSearch entityId={entityId} />
|
||||
<TechDocsSearch entityId={entityRef} />
|
||||
</Grid>
|
||||
)}
|
||||
<div data-testid="techdocs-content-shadowroot" ref={shadowDomRef} />
|
||||
|
||||
@@ -54,7 +54,7 @@ global.scroll = jest.fn();
|
||||
describe('<TechDocsPage />', () => {
|
||||
it('should render techdocs page', async () => {
|
||||
useParams.mockReturnValue({
|
||||
entityId: 'Component::backstage',
|
||||
entityRef: 'Component::backstage',
|
||||
});
|
||||
|
||||
const scmIntegrationsApi: ScmIntegrationsApi =
|
||||
@@ -111,7 +111,7 @@ describe('<TechDocsPage />', () => {
|
||||
|
||||
it('should render techdocs page with custom header', async () => {
|
||||
useParams.mockReturnValue({
|
||||
entityId: 'Component::backstage',
|
||||
entityRef: 'Component::backstage',
|
||||
});
|
||||
|
||||
const scmIntegrationsApi: ScmIntegrationsApi =
|
||||
|
||||
@@ -29,11 +29,11 @@ import { Page } from '@backstage/core-components';
|
||||
export type TechDocsPageRenderFunction = ({
|
||||
techdocsMetadataValue,
|
||||
entityMetadataValue,
|
||||
entityId,
|
||||
entityRef,
|
||||
}: {
|
||||
techdocsMetadataValue?: TechDocsMetadata | undefined;
|
||||
entityMetadataValue?: TechDocsEntityMetadata | undefined;
|
||||
entityId: EntityName;
|
||||
entityRef: EntityName;
|
||||
onReady: () => void;
|
||||
}) => JSX.Element;
|
||||
|
||||
@@ -78,7 +78,7 @@ export const TechDocsPage = ({ children }: TechDocsPageProps) => {
|
||||
? children({
|
||||
techdocsMetadataValue,
|
||||
entityMetadataValue,
|
||||
entityId: { kind, namespace, name },
|
||||
entityRef: { kind, namespace, name },
|
||||
onReady,
|
||||
})
|
||||
: children}
|
||||
|
||||
@@ -25,7 +25,7 @@ describe('<TechDocsPageHeader />', () => {
|
||||
await act(async () => {
|
||||
const rendered = await renderInTestApp(
|
||||
<TechDocsPageHeader
|
||||
entityId={{
|
||||
entityRef={{
|
||||
kind: 'test',
|
||||
name: 'test-name',
|
||||
namespace: 'test-namespace',
|
||||
@@ -67,7 +67,7 @@ describe('<TechDocsPageHeader />', () => {
|
||||
await act(async () => {
|
||||
const rendered = await renderInTestApp(
|
||||
<TechDocsPageHeader
|
||||
entityId={{
|
||||
entityRef={{
|
||||
kind: 'test',
|
||||
name: 'test-name',
|
||||
namespace: 'test-namespace',
|
||||
@@ -89,7 +89,7 @@ describe('<TechDocsPageHeader />', () => {
|
||||
await act(async () => {
|
||||
const rendered = await renderInTestApp(
|
||||
<TechDocsPageHeader
|
||||
entityId={{
|
||||
entityRef={{
|
||||
kind: 'test',
|
||||
name: 'test-name',
|
||||
namespace: 'test-namespace',
|
||||
|
||||
@@ -28,17 +28,17 @@ import { rootRouteRef } from '../../routes';
|
||||
import { TechDocsEntityMetadata, TechDocsMetadata } from '../../types';
|
||||
|
||||
export type TechDocsPageHeaderProps = {
|
||||
entityId: EntityName;
|
||||
entityRef: EntityName;
|
||||
entityMetadata?: TechDocsEntityMetadata;
|
||||
techDocsMetadata?: TechDocsMetadata;
|
||||
};
|
||||
|
||||
export const TechDocsPageHeader = ({
|
||||
entityId,
|
||||
entityRef,
|
||||
entityMetadata,
|
||||
techDocsMetadata,
|
||||
}: TechDocsPageHeaderProps) => {
|
||||
const { name } = entityId;
|
||||
const { name } = entityRef;
|
||||
|
||||
const { site_name: siteName, site_description: siteDescription } =
|
||||
techDocsMetadata || {};
|
||||
@@ -59,7 +59,7 @@ export const TechDocsPageHeader = ({
|
||||
value={
|
||||
<EntityRefLink
|
||||
color="inherit"
|
||||
entityRef={entityId}
|
||||
entityRef={entityRef}
|
||||
defaultKind="Component"
|
||||
/>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user