core-api,plugins/graphiql: export extension APIs from core-api and port the graphiql plugin

Co-authored-by: blam <ben@blam.sh>
This commit is contained in:
Patrik Oldsberg
2020-12-08 15:56:34 +01:00
parent 797d170873
commit ad66d1c8c4
5 changed files with 19 additions and 4 deletions
+2 -2
View File
@@ -29,7 +29,7 @@ import { hot } from 'react-hot-loader/root';
import { providers } from './identityProviders';
import { Router as CatalogRouter } from '@backstage/plugin-catalog';
import { Router as DocsRouter } from '@backstage/plugin-techdocs';
import { Router as GraphiQLRouter } from '@backstage/plugin-graphiql';
import { GraphiQLPage } from '@backstage/plugin-graphiql';
import { Router as TechRadarRouter } from '@backstage/plugin-tech-radar';
import { Router as LighthouseRouter } from '@backstage/plugin-lighthouse';
import { Router as RegisterComponentRouter } from '@backstage/plugin-register-component';
@@ -81,7 +81,7 @@ const AppRoutes = () => (
path="/tech-radar"
element={<TechRadarRouter width={1500} height={800} />}
/>
<Route path="/graphiql" element={<GraphiQLRouter />} />
<Route path="/graphiql" element={<GraphiQLPage />} />
<Route path="/lighthouse/*" element={<LighthouseRouter />} />
<Route
path="/register-component"
+1
View File
@@ -16,6 +16,7 @@
export * from './apis';
export * from './app';
export * from './extensions';
export * from './icons';
export * from './plugin';
export * from './routing';
+1
View File
@@ -22,3 +22,4 @@ export type {
MutableRouteRef,
} from './types';
export { createRouteRef } from './RouteRef';
export { useRouteRef } from './hooks';
+1 -1
View File
@@ -14,7 +14,7 @@
* limitations under the License.
*/
export { plugin } from './plugin';
export { plugin, GraphiQLPage } from './plugin';
export { GraphiQLPage as Router } from './components';
export * from './lib/api';
export * from './route-refs';
+14 -1
View File
@@ -14,8 +14,14 @@
* limitations under the License.
*/
import { createPlugin, createApiFactory } from '@backstage/core';
import {
createPlugin,
createApiFactory,
createRoutableExtension,
} from '@backstage/core';
import { GraphiQLPage as Component } from './components';
import { graphQlBrowseApiRef, GraphQLEndpoints } from './lib/api';
import { graphiQLRouteRef } from './route-refs';
export const plugin = createPlugin({
id: 'graphiql',
@@ -33,3 +39,10 @@ export const plugin = createPlugin({
),
],
});
export const GraphiQLPage = plugin.provide(
createRoutableExtension({
component: Component,
mountPoint: graphiQLRouteRef,
}),
);