backstage

Форк
0
66 строк · 1.7 Кб
1
/*
2
 * Copyright 2020 The Backstage Authors
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
import React from 'react';
18
import { createDevApp } from '@backstage/dev-utils';
19
import {
20
  githubAuthApiRef,
21
  errorApiRef,
22
  IconComponent,
23
} from '@backstage/core-plugin-api';
24
import {
25
  graphiqlPlugin,
26
  GraphiQLIcon,
27
  GraphQLEndpoints,
28
  graphQlBrowseApiRef,
29
  GraphiQLPage,
30
} from '../src';
31

32
createDevApp()
33
  .registerPlugin(graphiqlPlugin)
34
  .registerApi({
35
    api: graphQlBrowseApiRef,
36
    deps: {
37
      errorApi: errorApiRef,
38
      githubAuthApi: githubAuthApiRef,
39
    },
40
    factory({ errorApi, githubAuthApi }) {
41
      return GraphQLEndpoints.from([
42
        GraphQLEndpoints.github({
43
          id: 'github',
44
          title: 'GitHub',
45
          errorApi,
46
          githubAuthApi,
47
        }),
48
        GraphQLEndpoints.create({
49
          id: 'gitlab',
50
          title: 'GitLab',
51
          url: 'https://gitlab.com/api/graphql',
52
        }),
53
        GraphQLEndpoints.create({
54
          id: 'countries',
55
          title: 'Countries',
56
          url: 'https://countries.trevorblades.com/',
57
        }),
58
      ]);
59
    },
60
  })
61
  .addPage({
62
    title: 'GraphiQL',
63
    icon: GraphiQLIcon as IconComponent,
64
    element: <GraphiQLPage />,
65
  })
66
  .render();
67

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.