Merge pull request #8782 from akz08/reroute-register-api
Reroute register api
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
---
|
||||
'@backstage/create-app': patch
|
||||
---
|
||||
|
||||
Rebind external route for catalog import plugin from `scaffolderPlugin.routes.root` to `catalogImportPlugin.routes.importPage`.
|
||||
|
||||
To make this change to an existing app, make the following change to `packages/app/src/App.tsx`
|
||||
|
||||
```diff
|
||||
const App = createApp({
|
||||
...
|
||||
bindRoutes({ bind }) {
|
||||
...
|
||||
bind(apiDocsPlugin.externalRoutes, {
|
||||
- createComponent: scaffolderPlugin.routes.root,
|
||||
+ registerApi: catalogImportPlugin.routes.importPage,
|
||||
});
|
||||
...
|
||||
},
|
||||
});
|
||||
```
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-api-docs': minor
|
||||
---
|
||||
|
||||
Renamed the `createComponent` external route to `registerApi` since it's now recommended to link to the entity registration page rather than the creation page.
|
||||
@@ -117,7 +117,7 @@ const app = createApp({
|
||||
catalogEntity: catalogPlugin.routes.catalogEntity,
|
||||
});
|
||||
bind(apiDocsPlugin.externalRoutes, {
|
||||
createComponent: scaffolderPlugin.routes.root,
|
||||
registerApi: catalogImportPlugin.routes.importPage,
|
||||
});
|
||||
bind(explorePlugin.externalRoutes, {
|
||||
catalogEntity: catalogPlugin.routes.catalogEntity,
|
||||
|
||||
@@ -37,7 +37,7 @@ const app = createApp({
|
||||
viewTechDoc: techdocsPlugin.routes.docRoot,
|
||||
});
|
||||
bind(apiDocsPlugin.externalRoutes, {
|
||||
createComponent: scaffolderPlugin.routes.root,
|
||||
registerApi: catalogImportPlugin.routes.importPage,
|
||||
});
|
||||
bind(scaffolderPlugin.externalRoutes, {
|
||||
registerComponent: catalogImportPlugin.routes.importPage,
|
||||
|
||||
@@ -47,7 +47,7 @@ const apiDocsPlugin: BackstagePlugin<
|
||||
root: RouteRef<undefined>;
|
||||
},
|
||||
{
|
||||
createComponent: ExternalRouteRef<undefined, true>;
|
||||
registerApi: ExternalRouteRef<undefined, true>;
|
||||
}
|
||||
>;
|
||||
export { apiDocsPlugin };
|
||||
|
||||
@@ -42,7 +42,7 @@ import {
|
||||
UserListPicker,
|
||||
} from '@backstage/plugin-catalog-react';
|
||||
import React from 'react';
|
||||
import { createComponentRouteRef } from '../../routes';
|
||||
import { registerComponentRouteRef } from '../../routes';
|
||||
|
||||
const defaultColumns: TableColumn<CatalogTableRow>[] = [
|
||||
CatalogTable.columns.createNameColumn({ defaultKind: 'API' }),
|
||||
@@ -77,7 +77,7 @@ export const DefaultApiExplorerPage = ({
|
||||
const generatedSubtitle = `${
|
||||
configApi.getOptionalString('organization.name') ?? 'Backstage'
|
||||
} API Explorer`;
|
||||
const createComponentLink = useRouteRef(createComponentRouteRef);
|
||||
const registerComponentLink = useRouteRef(registerComponentRouteRef);
|
||||
|
||||
return (
|
||||
<PageWithHeader
|
||||
@@ -90,7 +90,7 @@ export const DefaultApiExplorerPage = ({
|
||||
<ContentHeader title="">
|
||||
<CreateButton
|
||||
title="Register Existing API"
|
||||
to={createComponentLink?.()}
|
||||
to={registerComponentLink?.()}
|
||||
/>
|
||||
<SupportButton>All your APIs</SupportButton>
|
||||
</ContentHeader>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import { ApiEntity } from '@backstage/catalog-model';
|
||||
import { defaultDefinitionWidgets } from './components/ApiDefinitionCard';
|
||||
import { apiDocsConfigRef } from './config';
|
||||
import { createComponentRouteRef, rootRoute } from './routes';
|
||||
import { registerComponentRouteRef, rootRoute } from './routes';
|
||||
import {
|
||||
createApiFactory,
|
||||
createComponentExtension,
|
||||
@@ -45,7 +45,7 @@ export const apiDocsPlugin = createPlugin({
|
||||
}),
|
||||
],
|
||||
externalRoutes: {
|
||||
createComponent: createComponentRouteRef,
|
||||
registerApi: registerComponentRouteRef,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ export const rootRoute = createRouteRef({
|
||||
id: 'api-docs',
|
||||
});
|
||||
|
||||
export const createComponentRouteRef = createExternalRouteRef({
|
||||
id: 'create-component',
|
||||
export const registerComponentRouteRef = createExternalRouteRef({
|
||||
id: 'register-component',
|
||||
optional: true,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user