org: switched catalog index route to use an external route ref
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
---
|
||||
'@backstage/plugin-org': minor
|
||||
---
|
||||
|
||||
**BREAKING**: Added a new and required `catalogIndex` external route. It should typically be linked to the `catalogIndex` route of the Catalog plugin:
|
||||
|
||||
```ts
|
||||
bind(orgPlugin.externalRoutes, {
|
||||
catalogIndex: catalogPlugin.routes.catalogIndex,
|
||||
});
|
||||
```
|
||||
@@ -53,6 +53,7 @@ import {
|
||||
CostInsightsPage,
|
||||
CostInsightsProjectGrowthInstructionsPage,
|
||||
} from '@backstage/plugin-cost-insights';
|
||||
import { orgPlugin } from '@backstage/plugin-org';
|
||||
import { ExplorePage, explorePlugin } from '@backstage/plugin-explore';
|
||||
import { GcpProjectsPage } from '@backstage/plugin-gcp-projects';
|
||||
import { GraphiQLPage } from '@backstage/plugin-graphiql';
|
||||
@@ -125,6 +126,9 @@ const app = createApp({
|
||||
bind(scaffolderPlugin.externalRoutes, {
|
||||
registerComponent: catalogImportPlugin.routes.importPage,
|
||||
});
|
||||
bind(orgPlugin.externalRoutes, {
|
||||
catalogIndex: catalogPlugin.routes.catalogIndex,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
import { BackstagePlugin } from '@backstage/core-plugin-api';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { ExternalRouteRef } from '@backstage/core-plugin-api';
|
||||
import { GroupEntity } from '@backstage/catalog-model';
|
||||
import { InfoCardVariants } from '@backstage/core-components';
|
||||
import { UserEntity } from '@backstage/catalog-model';
|
||||
@@ -74,7 +75,12 @@ export const MembersListCard: (_props: {
|
||||
// Warning: (ae-missing-release-tag) "orgPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
const orgPlugin: BackstagePlugin<{}, {}>;
|
||||
const orgPlugin: BackstagePlugin<
|
||||
{},
|
||||
{
|
||||
catalogIndex: ExternalRouteRef<undefined, false>;
|
||||
}
|
||||
>;
|
||||
export { orgPlugin };
|
||||
export { orgPlugin as plugin };
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ import { ApiProvider } from '@backstage/core-app-api';
|
||||
import {
|
||||
CatalogApi,
|
||||
catalogApiRef,
|
||||
catalogRouteRef,
|
||||
EntityProvider,
|
||||
} from '@backstage/plugin-catalog-react';
|
||||
import { TestApiRegistry, wrapInTestApp } from '@backstage/test-utils';
|
||||
@@ -31,6 +30,7 @@ import {
|
||||
} from '@backstage/theme';
|
||||
import { Grid, ThemeProvider } from '@material-ui/core';
|
||||
import React from 'react';
|
||||
import { catalogIndexRouteRef } from '../../../routes';
|
||||
import { OwnershipCard } from './OwnershipCard';
|
||||
|
||||
export default {
|
||||
@@ -100,7 +100,7 @@ export const Default = () =>
|
||||
</EntityProvider>
|
||||
</ApiProvider>,
|
||||
{
|
||||
mountedRoutes: { '/catalog': catalogRouteRef },
|
||||
mountedRoutes: { '/catalog': catalogIndexRouteRef },
|
||||
},
|
||||
);
|
||||
|
||||
@@ -134,6 +134,6 @@ export const Themed = () =>
|
||||
</ApiProvider>
|
||||
</ThemeProvider>,
|
||||
{
|
||||
mountedRoutes: { '/catalog': catalogRouteRef },
|
||||
mountedRoutes: { '/catalog': catalogIndexRouteRef },
|
||||
},
|
||||
);
|
||||
|
||||
@@ -23,11 +23,11 @@ import {
|
||||
CatalogApi,
|
||||
catalogApiRef,
|
||||
EntityProvider,
|
||||
catalogRouteRef,
|
||||
} from '@backstage/plugin-catalog-react';
|
||||
import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
|
||||
import { queryByText } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { catalogIndexRouteRef } from '../../../routes';
|
||||
import { OwnershipCard } from './OwnershipCard';
|
||||
|
||||
const items = [
|
||||
@@ -159,7 +159,7 @@ describe('OwnershipCard', () => {
|
||||
</TestApiProvider>,
|
||||
{
|
||||
mountedRoutes: {
|
||||
'/create': catalogRouteRef,
|
||||
'/create': catalogIndexRouteRef,
|
||||
},
|
||||
},
|
||||
);
|
||||
@@ -205,7 +205,7 @@ describe('OwnershipCard', () => {
|
||||
</TestApiProvider>,
|
||||
{
|
||||
mountedRoutes: {
|
||||
'/create': catalogRouteRef,
|
||||
'/create': catalogIndexRouteRef,
|
||||
},
|
||||
},
|
||||
);
|
||||
@@ -236,7 +236,7 @@ describe('OwnershipCard', () => {
|
||||
</TestApiProvider>,
|
||||
{
|
||||
mountedRoutes: {
|
||||
'/create': catalogRouteRef,
|
||||
'/create': catalogIndexRouteRef,
|
||||
},
|
||||
},
|
||||
);
|
||||
@@ -282,7 +282,7 @@ describe('OwnershipCard', () => {
|
||||
</TestApiProvider>,
|
||||
{
|
||||
mountedRoutes: {
|
||||
'/create': catalogRouteRef,
|
||||
'/create': catalogIndexRouteRef,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
@@ -25,7 +25,6 @@ import {
|
||||
import { useApi, useRouteRef } from '@backstage/core-plugin-api';
|
||||
import {
|
||||
catalogApiRef,
|
||||
catalogRouteRef,
|
||||
formatEntityRefTitle,
|
||||
isOwnerOf,
|
||||
useEntity,
|
||||
@@ -42,6 +41,7 @@ import qs from 'qs';
|
||||
import React from 'react';
|
||||
import pluralize from 'pluralize';
|
||||
import useAsync from 'react-use/lib/useAsync';
|
||||
import { catalogIndexRouteRef } from '../../../routes';
|
||||
|
||||
type EntityTypeProps = {
|
||||
kind: string;
|
||||
@@ -138,7 +138,7 @@ export const OwnershipCard = ({
|
||||
}) => {
|
||||
const { entity } = useEntity();
|
||||
const catalogApi = useApi(catalogApiRef);
|
||||
const catalogLink = useRouteRef(catalogRouteRef);
|
||||
const catalogLink = useRouteRef(catalogIndexRouteRef);
|
||||
|
||||
const {
|
||||
loading,
|
||||
|
||||
@@ -17,9 +17,13 @@ import {
|
||||
createComponentExtension,
|
||||
createPlugin,
|
||||
} from '@backstage/core-plugin-api';
|
||||
import { catalogIndexRouteRef } from './routes';
|
||||
|
||||
export const orgPlugin = createPlugin({
|
||||
id: 'org',
|
||||
externalRoutes: {
|
||||
catalogIndex: catalogIndexRouteRef,
|
||||
},
|
||||
});
|
||||
|
||||
export const EntityGroupProfileCard = orgPlugin.provide(
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright 2020 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createExternalRouteRef } from '@backstage/core-plugin-api';
|
||||
|
||||
export const catalogIndexRouteRef = createExternalRouteRef({
|
||||
id: 'catalog-index',
|
||||
});
|
||||
Reference in New Issue
Block a user