Add support for Pages and Sidebar items in existing app
Co-authored-by: Fredrik Adelöw <freben@gmail.com> Co-authored-by: Patrik Oldsberg <poldsberg@gmail.com> Co-authored-by: Camila Belo <camilaibs@gmail.com> Co-authored-by: Philipp Hugenroth <philipph@spotify.com> Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
import { ApiRef } from '@backstage/core-plugin-api';
|
||||
import { BackstagePlugin } from '@backstage/core-plugin-api';
|
||||
import { BackstagePlugin as BackstagePlugin_2 } from '@backstage/frontend-plugin-api';
|
||||
import { ErrorApi } from '@backstage/core-plugin-api';
|
||||
import { FetchApi } from '@backstage/core-plugin-api';
|
||||
import { IconComponent } from '@backstage/core-plugin-api';
|
||||
@@ -15,6 +16,10 @@ import { OAuthApi } from '@backstage/core-plugin-api';
|
||||
import { default as React_2 } from 'react';
|
||||
import { RouteRef } from '@backstage/core-plugin-api';
|
||||
|
||||
// @alpha (undocumented)
|
||||
const _default: BackstagePlugin_2;
|
||||
export default _default;
|
||||
|
||||
// @public
|
||||
export type EndpointConfig = {
|
||||
id: string;
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
createApiExtension,
|
||||
createExtension,
|
||||
createExtensionDataRef,
|
||||
createNavItemExtension,
|
||||
createPageExtension,
|
||||
createPlugin,
|
||||
createSchemaFromZod,
|
||||
@@ -29,15 +30,30 @@ import {
|
||||
GraphQLEndpoints,
|
||||
GraphQLEndpoint,
|
||||
} from '@backstage/plugin-graphiql';
|
||||
import { createApiFactory } from '@backstage/core-plugin-api';
|
||||
import GraphiQLIcon from './assets/graphiql.icon.svg';
|
||||
import {
|
||||
createApiFactory,
|
||||
createRouteRef,
|
||||
IconComponent,
|
||||
} from '@backstage/core-plugin-api';
|
||||
|
||||
const graphiqlRouteRef = createRouteRef({ id: 'graphiql' });
|
||||
|
||||
/** @alpha */
|
||||
export const GraphiqlPage = createPageExtension({
|
||||
id: 'plugin.graphiql.page',
|
||||
defaultPath: '/graphiql',
|
||||
routeRef: graphiqlRouteRef,
|
||||
loader: () => import('./components').then(m => <m.GraphiQLPage />),
|
||||
});
|
||||
|
||||
export const graphiqlPageSidebarItem = createNavItemExtension({
|
||||
id: 'plugin.graphiql.nav.index',
|
||||
title: 'GraphiQL',
|
||||
icon: GraphiQLIcon as IconComponent,
|
||||
routeRef: graphiqlRouteRef,
|
||||
});
|
||||
|
||||
/** @internal */
|
||||
const endpointDataRef = createExtensionDataRef<GraphQLEndpoint>(
|
||||
'plugin.graphiql.endpoint',
|
||||
@@ -103,5 +119,10 @@ const gitlabGraphiQLBrowseExtension = createEndpointExtension({
|
||||
/** @alpha */
|
||||
export default createPlugin({
|
||||
id: 'graphiql',
|
||||
extensions: [GraphiqlPage, graphiqlBrowseApi, gitlabGraphiQLBrowseExtension],
|
||||
extensions: [
|
||||
GraphiqlPage,
|
||||
graphiqlBrowseApi,
|
||||
gitlabGraphiQLBrowseExtension,
|
||||
graphiqlPageSidebarItem,
|
||||
],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user