@@ -20,6 +20,7 @@ import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { getProjectSlug, getOrganization } from './annotations';
|
||||
|
||||
/** @public */
|
||||
export class ProductionSentryApi implements SentryApi {
|
||||
constructor(
|
||||
private readonly discoveryApi: DiscoveryApi,
|
||||
|
||||
@@ -18,10 +18,12 @@ import { SentryIssue } from './sentry-issue';
|
||||
import { createApiRef } from '@backstage/core-plugin-api';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
|
||||
/** @public */
|
||||
export const sentryApiRef = createApiRef<SentryApi>({
|
||||
id: 'plugin.sentry.service',
|
||||
});
|
||||
|
||||
/** @public */
|
||||
export interface SentryApi {
|
||||
fetchIssues(
|
||||
entity: Entity,
|
||||
|
||||
@@ -19,14 +19,15 @@ import { Entity } from '@backstage/catalog-model';
|
||||
import { Route, Routes } from 'react-router';
|
||||
import { SentryIssuesWidget } from './SentryIssuesWidget';
|
||||
|
||||
export const Router = ({ entity }: { entity: Entity }) => {
|
||||
/** @public */
|
||||
export const Router = (props: { entity: Entity }) => {
|
||||
return (
|
||||
<Routes>
|
||||
<Route
|
||||
path="/"
|
||||
element={
|
||||
<SentryIssuesWidget
|
||||
entity={entity}
|
||||
entity={props.entity}
|
||||
statsFor="24h"
|
||||
tableOptions={{
|
||||
padding: 'dense',
|
||||
|
||||
@@ -32,19 +32,21 @@ import {
|
||||
import { ErrorApi, errorApiRef, useApi } from '@backstage/core-plugin-api';
|
||||
import { Options } from '@material-table/core';
|
||||
|
||||
export const SentryIssuesWidget = ({
|
||||
entity,
|
||||
statsFor,
|
||||
tableOptions,
|
||||
variant = 'gridItem',
|
||||
query = '',
|
||||
}: {
|
||||
/** @public */
|
||||
export const SentryIssuesWidget = (props: {
|
||||
entity: Entity;
|
||||
statsFor: '24h' | '14d' | '';
|
||||
tableOptions: Options<never>;
|
||||
variant?: InfoCardVariants;
|
||||
query?: string;
|
||||
}) => {
|
||||
const {
|
||||
entity,
|
||||
statsFor,
|
||||
tableOptions,
|
||||
variant = 'gridItem',
|
||||
query = '',
|
||||
} = props;
|
||||
const errorApi = useApi<ErrorApi>(errorApiRef);
|
||||
const sentryApi = useApi(sentryApiRef);
|
||||
|
||||
|
||||
@@ -24,10 +24,12 @@ import {
|
||||
identityApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
|
||||
/** @public */
|
||||
export const rootRouteRef = createRouteRef({
|
||||
id: 'sentry',
|
||||
});
|
||||
|
||||
/** @public */
|
||||
export const sentryPlugin = createPlugin({
|
||||
id: 'sentry',
|
||||
apis: [
|
||||
|
||||
Reference in New Issue
Block a user