backstage

Форк
0
63 строки · 1.9 Кб
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
import React from 'react';
17
import { createDevApp } from '@backstage/dev-utils';
18
import { microsoftCalendarPlugin, MicrosoftCalendarCard } from '../src/plugin';
19
import { microsoftCalendarApiRef } from '../src';
20
import responseMock from './mock.json';
21
import { microsoftAuthApiRef } from '@backstage/core-plugin-api';
22
import { Content, Page } from '@backstage/core-components';
23
import { Grid } from '@material-ui/core';
24

25
createDevApp()
26
  .registerPlugin(microsoftCalendarPlugin)
27
  .registerApi({
28
    api: microsoftAuthApiRef,
29
    deps: {},
30
    factory: () =>
31
      ({
32
        async getAccessToken() {
33
          return Promise.resolve('token');
34
        },
35
      } as unknown as typeof microsoftAuthApiRef.T),
36
  })
37
  .registerApi({
38
    api: microsoftCalendarApiRef,
39
    deps: {},
40
    factory: () =>
41
      ({
42
        async getCalendars() {
43
          return Promise.resolve(responseMock.calendars);
44
        },
45
        async getEvents() {
46
          return Promise.resolve(responseMock.events);
47
        },
48
      } as unknown as typeof microsoftCalendarApiRef.T),
49
  })
50
  .addPage({
51
    element: (
52
      <Page themeId="home">
53
        <Content>
54
          <Grid item xs={12} md={6}>
55
            <MicrosoftCalendarCard />
56
          </Grid>
57
        </Content>
58
      </Page>
59
    ),
60
    title: 'Microsoft-Calendar Plugin Demo',
61
    path: '/microsoft-calendar',
62
  })
63
  .render();
64

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

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

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

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