fix(techdocs): entity page links
Signed-off-by: Camila Belo <camilaibs@gmail.com>
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
"@backstage/catalog-model": "^1.0.1-next.1",
|
||||
"@backstage/config": "^1.0.0",
|
||||
"@backstage/core-components": "^0.9.3-next.1",
|
||||
"@backstage/core-app-api": "^1.0.0",
|
||||
"@backstage/core-plugin-api": "^1.0.0",
|
||||
"@backstage/errors": "^1.0.0",
|
||||
"@backstage/integration": "^1.1.0-next.1",
|
||||
|
||||
@@ -16,26 +16,15 @@
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import { configApiRef, useApi } from '@backstage/core-plugin-api';
|
||||
import { DEFAULT_NAMESPACE, Entity } from '@backstage/catalog-model';
|
||||
import { Entity, getCompoundEntityRef } from '@backstage/catalog-model';
|
||||
|
||||
import { toLowerMaybe } from './helpers';
|
||||
import { TechDocsReaderPage } from './plugin';
|
||||
import { TechDocsReaderLayout } from './reader';
|
||||
|
||||
type EntityPageDocsProps = { entity: Entity };
|
||||
|
||||
export const EntityPageDocs = ({ entity }: EntityPageDocsProps) => {
|
||||
const config = useApi(configApiRef);
|
||||
|
||||
const entityName = {
|
||||
namespace: toLowerMaybe(
|
||||
entity.metadata.namespace ?? DEFAULT_NAMESPACE,
|
||||
config,
|
||||
),
|
||||
kind: toLowerMaybe(entity.kind, config),
|
||||
name: toLowerMaybe(entity.metadata.name, config),
|
||||
};
|
||||
const entityName = getCompoundEntityRef(entity);
|
||||
|
||||
return (
|
||||
<TechDocsReaderPage entityName={entityName}>
|
||||
|
||||
@@ -15,13 +15,16 @@
|
||||
*/
|
||||
|
||||
import React, { PropsWithChildren } from 'react';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { useEntity } from '@backstage/plugin-catalog-react';
|
||||
import { Route, Routes } from 'react-router-dom';
|
||||
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { FlatRoutes } from '@backstage/core-app-api';
|
||||
import { useEntity } from '@backstage/plugin-catalog-react';
|
||||
import { MissingAnnotationEmptyState } from '@backstage/core-components';
|
||||
|
||||
import { EntityPageDocs } from './EntityPageDocs';
|
||||
import { TechDocsIndexPage } from './home/components/TechDocsIndexPage';
|
||||
import { TechDocsReaderPage } from './reader/components/TechDocsReaderPage';
|
||||
import { EntityPageDocs } from './EntityPageDocs';
|
||||
import { MissingAnnotationEmptyState } from '@backstage/core-components';
|
||||
|
||||
const TECHDOCS_ANNOTATION = 'backstage.io/techdocs-ref';
|
||||
|
||||
@@ -66,10 +69,10 @@ export const EmbeddedDocsRouter = (props: PropsWithChildren<{}>) => {
|
||||
}
|
||||
|
||||
return (
|
||||
<Routes>
|
||||
<FlatRoutes>
|
||||
<Route path="/*" element={<EntityPageDocs entity={entity} />}>
|
||||
{children}
|
||||
</Route>
|
||||
</Routes>
|
||||
</FlatRoutes>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user