2
* Copyright 2020 The Backstage Authors
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
8
* http://www.apache.org/licenses/LICENSE-2.0
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.
17
import { useEntity } from '@backstage/plugin-catalog-react';
18
import React from 'react';
19
import { sentryPlugin, rootRouteRef } from './plugin';
21
createComponentExtension,
22
createRoutableExtension,
23
} from '@backstage/core-plugin-api';
24
import { Options } from '@material-table/core';
27
export type SentryPageProps = {
28
statsFor?: '24h' | '14d' | '';
29
tableOptions?: Options<never>;
33
export const EntitySentryContent = sentryPlugin.provide(
34
createRoutableExtension({
35
name: 'EntitySentryContent',
36
mountPoint: rootRouteRef,
38
import('./components/SentryIssuesWidget').then(
39
({ SentryIssuesWidget }) => {
40
const SentryPage = (props: SentryPageProps) => {
41
const { entity } = useEntity();
42
const defaultOptions: Options<never> = {
51
statsFor={props.statsFor || '24h'}
52
tableOptions={{ ...defaultOptions, ...props.tableOptions }}
63
export const EntitySentryCard = sentryPlugin.provide(
64
createComponentExtension({
65
name: 'EntitySentryCard',
68
import('./components/SentryIssuesWidget').then(
69
({ SentryIssuesWidget }) => {
70
const SentryCard = (props: SentryPageProps) => {
71
const { entity } = useEntity();
75
statsFor={props.statsFor || '24h'}
77
props.tableOptions || {