diff --git a/plugins/catalog/src/components/AboutCard/AboutCard.tsx b/plugins/catalog/src/components/AboutCard/AboutCard.tsx index 6a782cffc1..34aa463c39 100644 --- a/plugins/catalog/src/components/AboutCard/AboutCard.tsx +++ b/plugins/catalog/src/components/AboutCard/AboutCard.tsx @@ -61,6 +61,10 @@ import EditIcon from '@material-ui/icons/Edit'; import { isTemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common'; import { parseEntityRef } from '@backstage/catalog-model'; +const TECHDOCS_ANNOTATION = 'backstage.io/techdocs-ref'; + +const TECHDOCS_EXTERNAL_ANNOTATION = 'backstage.io/techdocs-entity'; + const useStyles = makeStyles({ gridItemCard: { display: 'flex', @@ -114,10 +118,10 @@ export function AboutCard(props: AboutCardProps) { let techdocsRef: CompoundEntityRef | undefined; - if (entity.metadata.annotations?.['backstage.io/techdocs-entity']) { + if (entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]) { try { techdocsRef = parseEntityRef( - entity.metadata.annotations?.['backstage.io/techdocs-entity'], + entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION], ); // not a fan of this but we don't care if the parseEntityRef fails } catch { @@ -135,8 +139,8 @@ export function AboutCard(props: AboutCardProps) { label: 'View TechDocs', disabled: !( - entity.metadata.annotations?.['backstage.io/techdocs-ref'] || - entity.metadata.annotations?.['backstage.io/techdocs-entity'] + entity.metadata.annotations?.[TECHDOCS_ANNOTATION] || + entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION] ) || !viewTechdocLink, icon: , href: diff --git a/plugins/techdocs/src/EntityPageDocs.tsx b/plugins/techdocs/src/EntityPageDocs.tsx index 3d9aced9f3..af184bb1a8 100644 --- a/plugins/techdocs/src/EntityPageDocs.tsx +++ b/plugins/techdocs/src/EntityPageDocs.tsx @@ -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 diff --git a/plugins/techdocs/src/Router.tsx b/plugins/techdocs/src/Router.tsx index 3a0d2515d8..b06fec8fb7 100644 --- a/plugins/techdocs/src/Router.tsx +++ b/plugins/techdocs/src/Router.tsx @@ -84,7 +84,7 @@ export const EmbeddedDocsRouter = (props: PropsWithChildren<{}>) => { if (!projectId) { return ( ); } diff --git a/yarn.lock b/yarn.lock index 40bb6fcaa8..ae6b5bac8a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -21147,9 +21147,9 @@ __metadata: linkType: hard "caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30001400": - version: 1.0.30001407 - resolution: "caniuse-lite@npm:1.0.30001407" - checksum: e1c449d22f120a708accc956c1780f1da01af6c226cb6a324e531dc9f26f53075bff98e6c9cfce806157cdeede459aa8de03a3407b05f71d292a57b2910018b1 + version: 1.0.30001522 + resolution: "caniuse-lite@npm:1.0.30001522" + checksum: 56e3551c02ae595085114073cf242f7d9d54d32255c80893ca9098a44f44fc6eef353936f234f31c7f4cb894dd2b6c9c4626e30649ee29e04d70aa127eeefeb0 languageName: node linkType: hard