backstage

Форк
0
69 строк · 1.7 Кб
1
/*
2
 * Copyright 2023 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

19
import {
20
  coreExtensionData,
21
  createExtensionDataRef,
22
  createExtensionInput,
23
  createPageExtension,
24
  createPlugin,
25
  createRouteRef,
26
} from '@backstage/frontend-plugin-api';
27
import { compatWrapper } from '@backstage/core-compat-api';
28

29
const rootRouteRef = createRouteRef();
30

31
/**
32
 * @alpha
33
 */
34
export const titleExtensionDataRef = createExtensionDataRef<string>('title');
35

36
const homePage = createPageExtension({
37
  defaultPath: '/home',
38
  routeRef: rootRouteRef,
39
  inputs: {
40
    props: createExtensionInput(
41
      {
42
        children: coreExtensionData.reactElement.optional(),
43
        title: titleExtensionDataRef.optional(),
44
      },
45

46
      {
47
        singleton: true,
48
        optional: true,
49
      },
50
    ),
51
  },
52
  loader: ({ inputs }) =>
53
    import('./components/').then(m =>
54
      compatWrapper(
55
        <m.HomepageCompositionRoot
56
          children={inputs.props?.output.children}
57
          title={inputs.props?.output.title}
58
        />,
59
      ),
60
    ),
61
});
62

63
/**
64
 * @alpha
65
 */
66
export default createPlugin({
67
  id: 'home',
68
  extensions: [homePage],
69
});
70

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

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

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

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