diff --git a/plugins/catalog/src/components/CatalogEntityPage/CatalogEntityPage.tsx b/plugins/catalog/src/components/CatalogEntityPage/CatalogEntityPage.tsx new file mode 100644 index 0000000000..e0a314a391 --- /dev/null +++ b/plugins/catalog/src/components/CatalogEntityPage/CatalogEntityPage.tsx @@ -0,0 +1,27 @@ +/* + * Copyright 2020 Spotify AB + * + * 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 React from 'react'; +import { Outlet } from 'react-router'; +import { EntityProvider } from '../EntityProvider'; + +export const CatalogEntityPage = () => { + return ( + + + + ); +}; diff --git a/plugins/catalog/src/components/CatalogEntityPage/index.ts b/plugins/catalog/src/components/CatalogEntityPage/index.ts new file mode 100644 index 0000000000..627ca80e48 --- /dev/null +++ b/plugins/catalog/src/components/CatalogEntityPage/index.ts @@ -0,0 +1,16 @@ +/* + * Copyright 2020 Spotify AB + * + * 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. + */ +export { CatalogEntityPage } from './CatalogEntityPage'; diff --git a/plugins/catalog/src/extensions.tsx b/plugins/catalog/src/extensions.tsx new file mode 100644 index 0000000000..dcb9ba2aff --- /dev/null +++ b/plugins/catalog/src/extensions.tsx @@ -0,0 +1,37 @@ +/* + * Copyright 2020 Spotify AB + * + * 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 { createRoutableExtension } from '@backstage/core'; +import { catalogRouteRef, entityRouteRef } from './routes'; +import { plugin } from './plugin'; + +export const CatalogIndexPage = plugin.provide( + createRoutableExtension({ + component: () => + import('./components/CatalogPage').then(m => m.CatalogPage), + mountPoint: catalogRouteRef, + }), +); + +export const CatalogEntityPage = plugin.provide( + createRoutableExtension({ + component: () => + import('./components/CatalogEntityPage/CatalogEntityPage').then( + m => m.CatalogEntityPage, + ), + mountPoint: entityRouteRef, + }), +); diff --git a/plugins/catalog/src/index.ts b/plugins/catalog/src/index.ts index 606ad9028d..1ee6f44dad 100644 --- a/plugins/catalog/src/index.ts +++ b/plugins/catalog/src/index.ts @@ -22,3 +22,4 @@ export { useEntityCompoundName } from './components/useEntityCompoundName'; export { EntityContext, useEntity } from './hooks/useEntity'; export { catalogApiRef, plugin } from './plugin'; export * from './routes'; +export * from './extensions'; diff --git a/plugins/catalog/src/plugin.ts b/plugins/catalog/src/plugin.ts index 5f737ec12d..0c2b3b18c5 100644 --- a/plugins/catalog/src/plugin.ts +++ b/plugins/catalog/src/plugin.ts @@ -21,6 +21,7 @@ import { createPlugin, discoveryApiRef, } from '@backstage/core'; +import { catalogRouteRef, entityRouteRef } from './routes'; export const catalogApiRef = createApiRef({ id: 'plugin.catalog.service', @@ -37,4 +38,8 @@ export const plugin = createPlugin({ factory: ({ discoveryApi }) => new CatalogClient({ discoveryApi }), }), ], + routes: { + catalogIndex: catalogRouteRef, + catalogEntity: entityRouteRef, + }, }); diff --git a/plugins/catalog/src/routes.ts b/plugins/catalog/src/routes.ts index a39883e92b..2983b464ac 100644 --- a/plugins/catalog/src/routes.ts +++ b/plugins/catalog/src/routes.ts @@ -24,11 +24,14 @@ export const rootRoute = createRouteRef({ path: '', title: 'Catalog', }); +export const catalogRouteRef = rootRoute; + export const entityRoute = createRouteRef({ icon: NoIcon, path: ':namespace/:kind/:name/*', title: 'Entity', }); +export const entityRouteRef = entityRoute; // Utility function to get suitable route params for entityRoute, given an // entity instance