just some more api report cleanup
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -47,7 +47,9 @@ type GraphiQLBrowserProps = {
|
||||
endpoints: GraphQLEndpoint[];
|
||||
};
|
||||
|
||||
export const GraphiQLBrowser = ({ endpoints }: GraphiQLBrowserProps) => {
|
||||
export const GraphiQLBrowser = (props: GraphiQLBrowserProps) => {
|
||||
const { endpoints } = props;
|
||||
|
||||
const classes = useStyles();
|
||||
const [tabIndex, setTabIndex] = useState(0);
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import {
|
||||
Progress,
|
||||
} from '@backstage/core-components';
|
||||
|
||||
/** @public */
|
||||
export const GraphiQLPage = () => {
|
||||
const graphQlBrowseApi = useApi(graphQlBrowseApiRef);
|
||||
const endpoints = useAsync(() => graphQlBrowseApi.getEndpoints());
|
||||
|
||||
@@ -31,5 +31,7 @@ export {
|
||||
export { GraphiQLPage as Router } from './components';
|
||||
export * from './lib/api';
|
||||
export * from './route-refs';
|
||||
|
||||
/** @public */
|
||||
export const GraphiQLIcon: IconComponent =
|
||||
GraphiQLIconComponent as IconComponent;
|
||||
|
||||
@@ -17,7 +17,11 @@
|
||||
import { GraphQLBrowseApi, GraphQLEndpoint } from './types';
|
||||
import { ErrorApi, OAuthApi } from '@backstage/core-plugin-api';
|
||||
|
||||
// Helper for generic http endpoints
|
||||
/**
|
||||
* Helper for generic http endpoints
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type EndpointConfig = {
|
||||
id: string;
|
||||
title: string;
|
||||
@@ -29,6 +33,7 @@ export type EndpointConfig = {
|
||||
headers?: { [name in string]: string };
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type GithubEndpointConfig = {
|
||||
id: string;
|
||||
title: string;
|
||||
@@ -46,6 +51,7 @@ export type GithubEndpointConfig = {
|
||||
githubAuthApi: OAuthApi;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export class GraphQLEndpoints implements GraphQLBrowseApi {
|
||||
// Create a support
|
||||
static create(config: EndpointConfig): GraphQLEndpoint {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
import { createApiRef } from '@backstage/core-plugin-api';
|
||||
|
||||
/** @public */
|
||||
export type GraphQLEndpoint = {
|
||||
// Will be used as unique key for storing history and query data
|
||||
id: string;
|
||||
@@ -29,10 +30,12 @@ export type GraphQLEndpoint = {
|
||||
fetcher: (body: any) => Promise<any>;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type GraphQLBrowseApi = {
|
||||
getEndpoints(): Promise<GraphQLEndpoint[]>;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export const graphQlBrowseApiRef = createApiRef<GraphQLBrowseApi>({
|
||||
id: 'plugin.graphiql.browse',
|
||||
});
|
||||
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
import { graphQlBrowseApiRef, GraphQLEndpoints } from './lib/api';
|
||||
import { graphiQLRouteRef } from './route-refs';
|
||||
|
||||
/** @public */
|
||||
export const graphiqlPlugin = createPlugin({
|
||||
id: 'graphiql',
|
||||
apis: [
|
||||
@@ -40,6 +41,7 @@ export const graphiqlPlugin = createPlugin({
|
||||
],
|
||||
});
|
||||
|
||||
/** @public */
|
||||
export const GraphiQLPage = graphiqlPlugin.provide(
|
||||
createRoutableExtension({
|
||||
name: 'GraphiQLPage',
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
import { createRouteRef } from '@backstage/core-plugin-api';
|
||||
|
||||
/** @public */
|
||||
export const graphiQLRouteRef = createRouteRef({
|
||||
id: 'graphiql-root',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user