feat(Techdocs) fix the annotations
Signed-off-by: jrwpatterson <jrwpatterson@gmail.com>
This commit is contained in:
@@ -25,15 +25,17 @@ import { TechDocsReaderPage } from './plugin';
|
||||
import { TechDocsReaderPageContent } from './reader/components/TechDocsReaderPageContent';
|
||||
import { TechDocsReaderPageSubheader } from './reader/components/TechDocsReaderPageSubheader';
|
||||
|
||||
const TECHDOCS_EXTERNAL_ANNOTATION = 'backstage.io/techdocs-entity';
|
||||
|
||||
type EntityPageDocsProps = { entity: Entity };
|
||||
|
||||
export const EntityPageDocs = ({ entity }: EntityPageDocsProps) => {
|
||||
let entityRef = getCompoundEntityRef(entity);
|
||||
|
||||
if (entity.metadata.annotations?.['backstage.io/techdocs-entity']) {
|
||||
if (entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]) {
|
||||
try {
|
||||
entityRef = parseEntityRef(
|
||||
entity.metadata.annotations?.['backstage.io/techdocs-entity'],
|
||||
entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION],
|
||||
);
|
||||
} catch {
|
||||
// not a fan of this but we don't care if the parseEntityRef fails
|
||||
|
||||
@@ -84,7 +84,7 @@ export const EmbeddedDocsRouter = (props: PropsWithChildren<{}>) => {
|
||||
if (!projectId) {
|
||||
return (
|
||||
<MissingAnnotationEmptyState
|
||||
annotation={[TECHDOCS_ANNOTATION, TECHDOCS_EXTERNAL_ANNOTATION]}
|
||||
annotation={[TECHDOCS_ANNOTATION]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user