diff --git a/.changeset/fuzzy-buses-shop.md b/.changeset/fuzzy-buses-shop.md deleted file mode 100644 index eb300d1535..0000000000 --- a/.changeset/fuzzy-buses-shop.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@backstage/plugin-catalog': patch ---- - -Fix link for 'View TechDocs' button on entity's page: kind should be in lowercase by default, uppercase could be enabled -if `techdocs.legacyUseCaseSensitiveTripletPaths` is set to `true`. diff --git a/plugins/catalog/package.json b/plugins/catalog/package.json index 89d22ea886..66718424cd 100644 --- a/plugins/catalog/package.json +++ b/plugins/catalog/package.json @@ -44,7 +44,6 @@ "@backstage/plugin-catalog-react": "^1.1.2-next.3", "@backstage/plugin-search-common": "^0.3.6-next.0", "@backstage/plugin-search-react": "^0.2.2-next.3", - "@backstage/plugin-techdocs-react": "1.0.2-next.2", "@backstage/theme": "^0.2.16-next.1", "@backstage/types": "^1.0.0", "@material-ui/core": "^4.12.2", diff --git a/plugins/catalog/src/components/AboutCard/AboutCard.test.tsx b/plugins/catalog/src/components/AboutCard/AboutCard.test.tsx index e892bf8554..f2fee7d9f4 100644 --- a/plugins/catalog/src/components/AboutCard/AboutCard.test.tsx +++ b/plugins/catalog/src/components/AboutCard/AboutCard.test.tsx @@ -26,7 +26,6 @@ import { CatalogApi, entityRouteRef, } from '@backstage/plugin-catalog-react'; -import { ConfigApi, configApiRef } from '@backstage/core-plugin-api'; import { renderInTestApp, TestApiProvider } from '@backstage/test-utils'; import userEvent from '@testing-library/user-event'; import React from 'react'; @@ -394,63 +393,6 @@ describe('', () => { }, ); - expect(getByText('View TechDocs').closest('a')).toHaveAttribute( - 'href', - '/docs/default/component/software', - ); - }); - - it('renders techdocs link if techdocs.legacyUseCaseSensitiveTripletPaths is true', async () => { - const configApi: ConfigApi = new ConfigReader({ - integrations: { - github: [ - { - host: 'github.com', - token: '...', - }, - ], - }, - techdocs: { - legacyUseCaseSensitiveTripletPaths: true, - }, - }); - - const entity = { - apiVersion: 'v1', - kind: 'Component', - metadata: { - name: 'software', - annotations: { - 'backstage.io/techdocs-ref': './', - }, - }, - spec: { - owner: 'guest', - type: 'service', - lifecycle: 'production', - }, - }; - - const { getByText } = await renderInTestApp( - - - - - , - { - mountedRoutes: { - '/docs/:namespace/:kind/:name': viewTechDocRouteRef, - '/catalog/:namespace/:kind/:name': entityRouteRef, - }, - }, - ); - expect(getByText('View TechDocs').closest('a')).toHaveAttribute( 'href', '/docs/default/Component/software', diff --git a/plugins/catalog/src/components/AboutCard/AboutCard.tsx b/plugins/catalog/src/components/AboutCard/AboutCard.tsx index 757b5b10a6..b7ccd49b31 100644 --- a/plugins/catalog/src/components/AboutCard/AboutCard.tsx +++ b/plugins/catalog/src/components/AboutCard/AboutCard.tsx @@ -17,7 +17,7 @@ import { ANNOTATION_EDIT_URL, ANNOTATION_LOCATION, - getCompoundEntityRef, + DEFAULT_NAMESPACE, stringifyEntityRef, } from '@backstage/catalog-model'; import { @@ -26,12 +26,7 @@ import { InfoCardVariants, Link, } from '@backstage/core-components'; -import { - alertApiRef, - configApiRef, - useApi, - useRouteRef, -} from '@backstage/core-plugin-api'; +import { alertApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api'; import { ScmIntegrationIcon, scmIntegrationsApiRef, @@ -55,7 +50,6 @@ import EditIcon from '@material-ui/icons/Edit'; import React, { useCallback } from 'react'; import { viewTechDocRouteRef } from '../../routes'; import { AboutContent } from './AboutContent'; -import { toLowercaseEntityRefMaybe } from '@backstage/plugin-techdocs-react'; const useStyles = makeStyles({ gridItemCard: { @@ -97,8 +91,6 @@ export function AboutCard(props: AboutCardProps) { const catalogApi = useApi(catalogApiRef); const alertApi = useApi(alertApiRef); const viewTechdocLink = useRouteRef(viewTechDocRouteRef); - const config = useApi(configApiRef); - const entityRef = getCompoundEntityRef(entity); const entitySourceLocation = getEntitySourceLocation( entity, @@ -121,7 +113,11 @@ export function AboutCard(props: AboutCardProps) { icon: , href: viewTechdocLink && - viewTechdocLink(toLowercaseEntityRefMaybe(entityRef, config)), + viewTechdocLink({ + namespace: entity.metadata.namespace || DEFAULT_NAMESPACE, + kind: entity.kind, + name: entity.metadata.name, + }), }; let cardClass = '';