diff --git a/.changeset/ninety-kids-drop.md b/.changeset/ninety-kids-drop.md new file mode 100644 index 0000000000..ed5cf6330b --- /dev/null +++ b/.changeset/ninety-kids-drop.md @@ -0,0 +1,8 @@ +--- +'@backstage/plugin-catalog-react': minor +--- + +Removed some previously deprecated `routeRefs` as follows: + +- **BREAKING**: Removed `entityRoute` in favor of `entityRouteRef`. +- **BREAKING**: Removed the previously deprecated `rootRoute` and `catalogRouteRef`. If you want to refer to the catalog index page from a public plugin you now need to use an `ExternalRouteRef` instead. For private plugins it is possible to take the shortcut of referring directly to `catalogPlugin.routes.indexPage` instead. diff --git a/.changeset/spicy-onions-kiss.md b/.changeset/spicy-onions-kiss.md new file mode 100644 index 0000000000..777e233b88 --- /dev/null +++ b/.changeset/spicy-onions-kiss.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog': patch +--- + +- Replaced usage of the deprecated and now removed `rootRoute` and `catalogRouteRef`s from the `catalog-react` package diff --git a/plugins/catalog-react/api-report.md b/plugins/catalog-react/api-report.md index 96c34d5fbf..2d2b56b634 100644 --- a/plugins/catalog-react/api-report.md +++ b/plugins/catalog-react/api-report.md @@ -95,9 +95,6 @@ export type CatalogReactUserListPickerClassKey = | 'menuItem' | 'groupWrapper'; -// @public @deprecated (undocumented) -export const catalogRouteRef: RouteRef; - // @public (undocumented) export const columnFactories: Readonly<{ createEntityRefColumn(options: { @@ -272,13 +269,6 @@ export type EntityRefLinksProps = { defaultKind?: string; } & Omit; -// @public @deprecated (undocumented) -export const entityRoute: RouteRef<{ - name: string; - kind: string; - namespace: string; -}>; - // @public export function entityRouteParams(entity: Entity): { readonly kind: string; @@ -494,9 +484,6 @@ export function reduceEntityFilters( filters: EntityFilter[], ): (entity: Entity) => boolean; -// @public @deprecated (undocumented) -export const rootRoute: RouteRef; - // @public export interface StarredEntitiesApi { starredEntitie$(): Observable>; diff --git a/plugins/catalog-react/src/index.ts b/plugins/catalog-react/src/index.ts index 7bf1bd1221..2279d49a2c 100644 --- a/plugins/catalog-react/src/index.ts +++ b/plugins/catalog-react/src/index.ts @@ -27,13 +27,7 @@ export * from './apis'; export * from './components'; export * from './hooks'; export * from './filters'; -export { - catalogRouteRef, - entityRoute, - entityRouteParams, - entityRouteRef, - rootRoute, -} from './routes'; +export { entityRouteParams, entityRouteRef } from './routes'; export * from './testUtils'; export * from './types'; export * from './utils'; diff --git a/plugins/catalog-react/src/routes.ts b/plugins/catalog-react/src/routes.ts index b9aa0de531..013bf7b5be 100644 --- a/plugins/catalog-react/src/routes.ts +++ b/plugins/catalog-react/src/routes.ts @@ -18,21 +18,6 @@ import { Entity, DEFAULT_NAMESPACE } from '@backstage/catalog-model'; import { createRouteRef } from '@backstage/core-plugin-api'; import { getOrCreateGlobalSingleton } from '@backstage/version-bridge'; -// TODO(Rugvip): Move these route refs back to the catalog plugin once we're all ported to using external routes -/** - * @deprecated Use an `ExternalRouteRef` instead, which can point to `catalogPlugin.routes.catalogIndex`. - * @public - */ -export const rootRoute = createRouteRef({ - id: 'catalog', -}); - -/** - * @deprecated Use an `ExternalRouteRef` instead, which can point to `catalogPlugin.routes.catalogIndex`. - * @public - */ -export const catalogRouteRef = rootRoute; - /** * A stable route ref that points to the catalog page for an individual entity. * @@ -52,12 +37,6 @@ export const entityRouteRef = getOrCreateGlobalSingleton( }), ); -/** - * @deprecated use `entityRouteRef` instead. - * @public - */ -export const entityRoute = entityRouteRef; - /** * Utility function to get suitable route params for entityRoute, given an * @public diff --git a/plugins/catalog/src/components/EntityOrphanWarning/EntityOrphanWarning.test.tsx b/plugins/catalog/src/components/EntityOrphanWarning/EntityOrphanWarning.test.tsx index a8aac405fe..f00474868f 100644 --- a/plugins/catalog/src/components/EntityOrphanWarning/EntityOrphanWarning.test.tsx +++ b/plugins/catalog/src/components/EntityOrphanWarning/EntityOrphanWarning.test.tsx @@ -14,14 +14,11 @@ * limitations under the License. */ -import { - catalogApiRef, - catalogRouteRef, - EntityProvider, -} from '@backstage/plugin-catalog-react'; +import { catalogApiRef, EntityProvider } from '@backstage/plugin-catalog-react'; import { renderInTestApp, TestApiProvider } from '@backstage/test-utils'; import React from 'react'; +import { rootRouteRef } from '../../routes'; import { EntityOrphanWarning } from './EntityOrphanWarning'; describe('', () => { @@ -59,7 +56,7 @@ describe('', () => { , { mountedRoutes: { - '/create': catalogRouteRef, + '/create': rootRouteRef, }, }, ); diff --git a/plugins/catalog/src/components/EntityOrphanWarning/EntityOrphanWarning.tsx b/plugins/catalog/src/components/EntityOrphanWarning/EntityOrphanWarning.tsx index aba28c558f..26b0e5de45 100644 --- a/plugins/catalog/src/components/EntityOrphanWarning/EntityOrphanWarning.tsx +++ b/plugins/catalog/src/components/EntityOrphanWarning/EntityOrphanWarning.tsx @@ -15,12 +15,13 @@ */ import { Entity } from '@backstage/catalog-model'; -import { catalogRouteRef, useEntity } from '@backstage/plugin-catalog-react'; +import { useEntity } from '@backstage/plugin-catalog-react'; import { Alert } from '@material-ui/lab'; import React, { useState } from 'react'; import { useNavigate } from 'react-router'; import { DeleteEntityDialog } from './DeleteEntityDialog'; import { useRouteRef } from '@backstage/core-plugin-api'; +import { rootRouteRef } from '../../routes'; /** * Returns true if the given entity has the orphan annotation given by the @@ -40,7 +41,7 @@ export function isOrphan(entity: Entity): boolean { */ export function EntityOrphanWarning() { const navigate = useNavigate(); - const catalogLink = useRouteRef(catalogRouteRef); + const catalogLink = useRouteRef(rootRouteRef); const [confirmationDialogOpen, setConfirmationDialogOpen] = useState(false); const { entity } = useEntity(); diff --git a/plugins/catalog/src/plugin.ts b/plugins/catalog/src/plugin.ts index 520656e921..1b9083e7ca 100644 --- a/plugins/catalog/src/plugin.ts +++ b/plugins/catalog/src/plugin.ts @@ -18,7 +18,6 @@ import { CatalogClient } from '@backstage/catalog-client'; import { Entity } from '@backstage/catalog-model'; import { catalogApiRef, - catalogRouteRef, entityRouteRef, starredEntitiesApiRef, } from '@backstage/plugin-catalog-react'; @@ -43,6 +42,7 @@ import { HasResourcesCardProps } from './components/HasResourcesCard'; import { HasSubcomponentsCardProps } from './components/HasSubcomponentsCard'; import { HasSystemsCardProps } from './components/HasSystemsCard'; import { RelatedEntitiesCardProps } from './components/RelatedEntitiesCard'; +import { rootRouteRef } from './routes'; /** @public */ export const catalogPlugin = createPlugin({ @@ -65,7 +65,7 @@ export const catalogPlugin = createPlugin({ }), ], routes: { - catalogIndex: catalogRouteRef, + catalogIndex: rootRouteRef, catalogEntity: entityRouteRef, }, externalRoutes: { @@ -81,7 +81,7 @@ export const CatalogIndexPage: (props: DefaultCatalogPageProps) => JSX.Element = name: 'CatalogIndexPage', component: () => import('./components/CatalogPage').then(m => m.CatalogPage), - mountPoint: catalogRouteRef, + mountPoint: rootRouteRef, }), ); diff --git a/plugins/catalog/src/routes.ts b/plugins/catalog/src/routes.ts index 63d9ccfb87..5c0d195d74 100644 --- a/plugins/catalog/src/routes.ts +++ b/plugins/catalog/src/routes.ts @@ -14,7 +14,10 @@ * limitations under the License. */ -import { createExternalRouteRef } from '@backstage/core-plugin-api'; +import { + createExternalRouteRef, + createRouteRef, +} from '@backstage/core-plugin-api'; export const createComponentRouteRef = createExternalRouteRef({ id: 'create-component', @@ -26,3 +29,7 @@ export const viewTechDocRouteRef = createExternalRouteRef({ optional: true, params: ['namespace', 'kind', 'name'], }); + +export const rootRouteRef = createRouteRef({ + id: 'catalog', +});