Merge pull request #8782 from akz08/reroute-register-api

Reroute register api
This commit is contained in:
Fredrik Adelöw
2022-01-19 11:39:37 +01:00
committed by GitHub
8 changed files with 36 additions and 10 deletions
@@ -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>
+2 -2
View File
@@ -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,
},
});
+2 -2
View File
@@ -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,
});