Merge pull request #2325 from spotify/rugvip/graphiql

graphiql: move to new plugin pattern
This commit is contained in:
Patrik Oldsberg
2020-09-08 11:28:41 +02:00
committed by GitHub
4 changed files with 5 additions and 7 deletions
+2
View File
@@ -28,6 +28,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 { Router as TechRadarRouter } from '@backstage/plugin-tech-radar';
import { Route, Routes, Navigate } from 'react-router';
@@ -66,6 +67,7 @@ const AppRoutes = () => (
path="/tech-radar"
element={<TechRadarRouter width={1500} height={800} />}
/>
<Route path="/graphiql" element={<GraphiQLRouter />} />
{...deprecatedAppRoutes}
</Routes>
);
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { FC } from 'react';
import React from 'react';
import {
Content,
Header,
@@ -30,7 +30,7 @@ import { graphQlBrowseApiRef } from '../../lib/api';
import { GraphiQLBrowser } from '../GraphiQLBrowser';
import { Typography } from '@material-ui/core';
export const GraphiQLPage: FC<{}> = () => {
export const GraphiQLPage = () => {
const graphQlBrowseApi = useApi(graphQlBrowseApiRef);
const endpoints = useAsync(() => graphQlBrowseApi.getEndpoints());
+1
View File
@@ -15,5 +15,6 @@
*/
export { plugin } from './plugin';
export { GraphiQLPage as Router } from './components';
export * from './lib/api';
export * from './route-refs';
-5
View File
@@ -15,12 +15,7 @@
*/
import { createPlugin } from '@backstage/core';
import { GraphiQLPage } from './components';
import { graphiQLRouteRef } from './route-refs';
export const plugin = createPlugin({
id: 'graphiql',
register({ router }) {
router.addRoute(graphiQLRouteRef, GraphiQLPage);
},
});