catalog: export new CatalogIndexPage and CatalogEntityPage
This commit is contained in:
@@ -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 (
|
||||
<EntityProvider>
|
||||
<Outlet />
|
||||
</EntityProvider>
|
||||
);
|
||||
};
|
||||
@@ -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';
|
||||
@@ -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,
|
||||
}),
|
||||
);
|
||||
@@ -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';
|
||||
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
createPlugin,
|
||||
discoveryApiRef,
|
||||
} from '@backstage/core';
|
||||
import { catalogRouteRef, entityRouteRef } from './routes';
|
||||
|
||||
export const catalogApiRef = createApiRef<CatalogApi>({
|
||||
id: 'plugin.catalog.service',
|
||||
@@ -37,4 +38,8 @@ export const plugin = createPlugin({
|
||||
factory: ({ discoveryApi }) => new CatalogClient({ discoveryApi }),
|
||||
}),
|
||||
],
|
||||
routes: {
|
||||
catalogIndex: catalogRouteRef,
|
||||
catalogEntity: entityRouteRef,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user