Merge pull request #6124 from backstage/rugvip/noroutes
plugins,dev-utils: remove usage of deprecated route registrations
This commit is contained in:
@@ -30,6 +30,13 @@ import graphqlApiEntity from './graphql-example-api.yaml';
|
||||
import openapiApiEntity from './openapi-example-api.yaml';
|
||||
import otherApiEntity from './other-example-api.yaml';
|
||||
|
||||
const mockEntities = ([
|
||||
openapiApiEntity,
|
||||
asyncapiApiEntity,
|
||||
graphqlApiEntity,
|
||||
otherApiEntity,
|
||||
] as unknown) as Entity[];
|
||||
|
||||
createDevApp()
|
||||
.registerApi({
|
||||
api: catalogApiRef,
|
||||
@@ -38,14 +45,12 @@ createDevApp()
|
||||
(({
|
||||
async getEntities() {
|
||||
return {
|
||||
items: [
|
||||
openapiApiEntity,
|
||||
asyncapiApiEntity,
|
||||
graphqlApiEntity,
|
||||
otherApiEntity,
|
||||
],
|
||||
items: mockEntities.slice(),
|
||||
};
|
||||
},
|
||||
async getEntityByName(name: string) {
|
||||
return mockEntities.find(e => e.metadata.name === name);
|
||||
},
|
||||
} as unknown) as typeof catalogApiRef.T),
|
||||
})
|
||||
.registerApi({
|
||||
|
||||
@@ -22,7 +22,6 @@ import {
|
||||
createRoutableExtension,
|
||||
} from '@backstage/core';
|
||||
import { defaultDefinitionWidgets } from './components/ApiDefinitionCard';
|
||||
import { ApiExplorerPage as Page } from './components/ApiExplorerPage/ApiExplorerPage';
|
||||
import { apiDocsConfigRef } from './config';
|
||||
import { createComponentRouteRef, rootRoute } from './routes';
|
||||
|
||||
@@ -48,9 +47,6 @@ export const apiDocsPlugin = createPlugin({
|
||||
externalRoutes: {
|
||||
createComponent: createComponentRouteRef,
|
||||
},
|
||||
register({ router }) {
|
||||
router.addRoute(rootRoute, Page);
|
||||
},
|
||||
});
|
||||
|
||||
export const ApiExplorerPage = apiDocsPlugin.provide(
|
||||
|
||||
Reference in New Issue
Block a user