explore,catalog-graph: use entityRouteRef directly

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-01-20 22:41:22 +01:00
parent bed2da46af
commit a3c4438abf
14 changed files with 69 additions and 40 deletions
+3 -3
View File
@@ -14,14 +14,14 @@ import { TabProps } from '@material-ui/core';
// Warning: (ae-missing-release-tag) "catalogEntityRouteRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public @deprecated (undocumented)
export const catalogEntityRouteRef: ExternalRouteRef<
{
name: string;
kind: string;
namespace: string;
},
false
true
>;
// Warning: (ae-forgotten-export) The symbol "DomainCardProps" needs to be exported by the entry point index.d.ts
@@ -66,7 +66,7 @@ const explorePlugin: BackstagePlugin<
kind: string;
namespace: string;
},
false
true
>;
}
>;
@@ -15,9 +15,9 @@
*/
import { DomainEntity } from '@backstage/catalog-model';
import { entityRouteRef } from '@backstage/plugin-catalog-react';
import { renderInTestApp } from '@backstage/test-utils';
import React from 'react';
import { catalogEntityRouteRef } from '../../routes';
import { DomainCard } from './DomainCard';
describe('<DomainCard />', () => {
@@ -38,7 +38,7 @@ describe('<DomainCard />', () => {
<DomainCard entity={entity} />,
{
mountedRoutes: {
'/catalog/:namespace/:kind/:name': catalogEntityRouteRef,
'/catalog/:namespace/:kind/:name': entityRouteRef,
},
},
);
@@ -18,6 +18,7 @@ import {
EntityRefLinks,
entityRouteParams,
getEntityRelations,
entityRouteRef,
} from '@backstage/plugin-catalog-react';
import {
Box,
@@ -28,7 +29,6 @@ import {
Chip,
} from '@material-ui/core';
import React from 'react';
import { catalogEntityRouteRef } from '../../routes';
import { Button, ItemCardHeader } from '@backstage/core-components';
import { useRouteRef } from '@backstage/core-plugin-api';
@@ -38,7 +38,7 @@ type DomainCardProps = {
};
export const DomainCard = ({ entity }: DomainCardProps) => {
const catalogEntityRoute = useRouteRef(catalogEntityRouteRef);
const catalogEntityRoute = useRouteRef(entityRouteRef);
const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY);
const url = catalogEntityRoute(entityRouteParams(entity));
@@ -15,11 +15,10 @@
*/
import { DomainEntity } from '@backstage/catalog-model';
import { catalogApiRef } from '@backstage/plugin-catalog-react';
import { catalogApiRef, entityRouteRef } from '@backstage/plugin-catalog-react';
import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
import { waitFor } from '@testing-library/react';
import React from 'react';
import { catalogEntityRouteRef } from '../../routes';
import { DomainExplorerContent } from './DomainExplorerContent';
describe('<DomainExplorerContent />', () => {
@@ -44,7 +43,7 @@ describe('<DomainExplorerContent />', () => {
const mountedRoutes = {
mountedRoutes: {
'/catalog/:namespace/:kind/:name': catalogEntityRouteRef,
'/catalog/:namespace/:kind/:name': entityRouteRef,
},
};
+4
View File
@@ -23,7 +23,11 @@ export const exploreRouteRef = createRouteRef({
id: 'explore',
});
/**
* @deprecated This route is no longer used and can be removed
*/
export const catalogEntityRouteRef = createExternalRouteRef({
id: 'catalog-entity',
params: ['namespace', 'kind', 'name'],
optional: true,
});