diff --git a/plugins/graphiql/src/index.ts b/plugins/graphiql/src/index.ts index a1f5587fe1..5590a0d60f 100644 --- a/plugins/graphiql/src/index.ts +++ b/plugins/graphiql/src/index.ts @@ -16,3 +16,4 @@ export { plugin } from './plugin'; export * from './lib/api'; +export * from './navTargets'; diff --git a/plugins/graphiql/src/navTargets.tsx b/plugins/graphiql/src/navTargets.tsx new file mode 100644 index 0000000000..febb6be59a --- /dev/null +++ b/plugins/graphiql/src/navTargets.tsx @@ -0,0 +1,92 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import React, { FC } from 'react'; +import { createNavTarget } from '@backstage/core'; +import { SvgIcon, SvgIconProps } from '@material-ui/core'; + +const GraphiQLIcon: FC = props => ( + + + + + + + + + + + + + + + + + + + +); + +export const navTargetGraphiQL = createNavTarget({ + icon: GraphiQLIcon, + path: '/graphiql', + title: 'GraphiQL', +}); diff --git a/plugins/graphiql/src/plugin.ts b/plugins/graphiql/src/plugin.ts index 6436380c27..9c73324b43 100644 --- a/plugins/graphiql/src/plugin.ts +++ b/plugins/graphiql/src/plugin.ts @@ -16,10 +16,11 @@ import { createPlugin } from '@backstage/core'; import { GraphiQLPage } from './components'; +import { navTargetGraphiQL } from './navTargets'; export const plugin = createPlugin({ id: 'graphiql', register({ router }) { - router.registerRoute('/graphiql', GraphiQLPage); + router.addRoute(navTargetGraphiQL, GraphiQLPage); }, });