graphiql: finalize composability port

This commit is contained in:
Patrik Oldsberg
2021-02-01 19:19:57 +01:00
parent 8dfdec6139
commit f8eefd6c8f
4 changed files with 21 additions and 7 deletions
+12 -2
View File
@@ -14,12 +14,18 @@
* limitations under the License.
*/
import React from 'react';
import { createDevApp } from '@backstage/dev-utils';
import { githubAuthApiRef, errorApiRef } from '@backstage/core';
import { plugin, GraphQLEndpoints, graphQlBrowseApiRef } from '../src';
import {
graphiqlPlugin,
GraphQLEndpoints,
graphQlBrowseApiRef,
GraphiQLPage,
} from '../src';
createDevApp()
.registerPlugin(plugin)
.registerPlugin(graphiqlPlugin)
.registerApi({
api: graphQlBrowseApiRef,
deps: {
@@ -47,4 +53,8 @@ createDevApp()
]);
},
})
.addPage({
title: 'GraphiQL',
element: <GraphiQLPage />,
})
.render();
+5 -1
View File
@@ -14,7 +14,11 @@
* limitations under the License.
*/
export { plugin, GraphiQLPage } from './plugin';
export {
graphiqlPlugin,
graphiqlPlugin as plugin,
GraphiQLPage,
} from './plugin';
export { GraphiQLPage as Router } from './components';
export * from './lib/api';
export * from './route-refs';
+2 -2
View File
@@ -14,10 +14,10 @@
* limitations under the License.
*/
import { plugin } from './plugin';
import { graphiqlPlugin } from './plugin';
describe('graphiql', () => {
it('should export plugin', () => {
expect(plugin).toBeDefined();
expect(graphiqlPlugin).toBeDefined();
});
});
+2 -2
View File
@@ -22,7 +22,7 @@ import {
import { graphQlBrowseApiRef, GraphQLEndpoints } from './lib/api';
import { graphiQLRouteRef } from './route-refs';
export const plugin = createPlugin({
export const graphiqlPlugin = createPlugin({
id: 'graphiql',
apis: [
// GitLab is used as an example endpoint, but most will want to plug in
@@ -40,7 +40,7 @@ export const plugin = createPlugin({
],
});
export const GraphiQLPage = plugin.provide(
export const GraphiQLPage = graphiqlPlugin.provide(
createRoutableExtension({
component: () => import('./components').then(m => m.GraphiQLPage),
mountPoint: graphiQLRouteRef,