Merge pull request #9880 from backstage/blam/catalog-route-refs
🧹 Clean up the routes in `catalog-react`
This commit is contained in:
@@ -95,9 +95,6 @@ export type CatalogReactUserListPickerClassKey =
|
||||
| 'menuItem'
|
||||
| 'groupWrapper';
|
||||
|
||||
// @public @deprecated (undocumented)
|
||||
export const catalogRouteRef: RouteRef<undefined>;
|
||||
|
||||
// @public (undocumented)
|
||||
export const columnFactories: Readonly<{
|
||||
createEntityRefColumn<T extends Entity>(options: {
|
||||
@@ -272,13 +269,6 @@ export type EntityRefLinksProps = {
|
||||
defaultKind?: string;
|
||||
} & Omit<LinkProps, 'to'>;
|
||||
|
||||
// @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<undefined>;
|
||||
|
||||
// @public
|
||||
export interface StarredEntitiesApi {
|
||||
starredEntitie$(): Observable<Set<string>>;
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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('<EntityOrphanWarning />', () => {
|
||||
@@ -59,7 +56,7 @@ describe('<EntityOrphanWarning />', () => {
|
||||
</TestApiProvider>,
|
||||
{
|
||||
mountedRoutes: {
|
||||
'/create': catalogRouteRef,
|
||||
'/create': rootRouteRef,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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,
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
@@ -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',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user