feat(Techdocs) fix the annotations

Signed-off-by: jrwpatterson <jrwpatterson@gmail.com>
This commit is contained in:
jrwpatterson
2023-08-28 08:00:23 +10:00
parent 56e5baf7f0
commit 0299919d86
4 changed files with 16 additions and 10 deletions
+4 -2
View File
@@ -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
+1 -1
View File
@@ -84,7 +84,7 @@ export const EmbeddedDocsRouter = (props: PropsWithChildren<{}>) => {
if (!projectId) {
return (
<MissingAnnotationEmptyState
annotation={[TECHDOCS_ANNOTATION, TECHDOCS_EXTERNAL_ANNOTATION]}
annotation={[TECHDOCS_ANNOTATION]}
/>
);
}