@@ -17,5 +17,12 @@
|
||||
export * from './mock';
|
||||
export type { SentryApi } from './sentry-api';
|
||||
export { sentryApiRef } from './sentry-api';
|
||||
export type { SentryIssue } from './sentry-issue';
|
||||
export type {
|
||||
EventPoint,
|
||||
SentryApiError,
|
||||
SentryIssue,
|
||||
SentryIssueMetadata,
|
||||
SentryPlatform,
|
||||
SentryProject,
|
||||
} from './sentry-issue';
|
||||
export { ProductionSentryApi } from './production-api';
|
||||
|
||||
@@ -30,9 +30,12 @@ function getMockIssue(): SentryIssue {
|
||||
stats: randomizedStats,
|
||||
};
|
||||
}
|
||||
|
||||
function getMockIssues(number: number): SentryIssue[] {
|
||||
return new Array(number).fill(0).map(getMockIssue);
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export class MockSentryApi implements SentryApi {
|
||||
fetchIssues(): Promise<SentryIssue[]> {
|
||||
return new Promise(resolve => {
|
||||
|
||||
@@ -14,24 +14,29 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
type SentryPlatform = 'javascript' | 'javascript-react' | string;
|
||||
/** @public */
|
||||
export type SentryPlatform = 'javascript' | 'javascript-react' | string;
|
||||
|
||||
type EventPoint = number[];
|
||||
/** @public */
|
||||
export type EventPoint = number[];
|
||||
|
||||
type SentryProject = {
|
||||
/** @public */
|
||||
export type SentryProject = {
|
||||
platform: SentryPlatform;
|
||||
slug: string;
|
||||
id: string;
|
||||
name: string;
|
||||
};
|
||||
|
||||
type SentryIssueMetadata = {
|
||||
/** @public */
|
||||
export type SentryIssueMetadata = {
|
||||
function?: string;
|
||||
type?: string;
|
||||
value?: string;
|
||||
filename?: string;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type SentryIssue = {
|
||||
platform: SentryPlatform;
|
||||
lastSeen: string;
|
||||
@@ -65,6 +70,7 @@ export type SentryIssue = {
|
||||
statusDetails: any;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type SentryApiError = {
|
||||
detail: string;
|
||||
};
|
||||
|
||||
@@ -64,11 +64,8 @@ type SentryIssuesTableProps = {
|
||||
tableOptions: Options<never>;
|
||||
};
|
||||
|
||||
const SentryIssuesTable = ({
|
||||
sentryIssues,
|
||||
statsFor,
|
||||
tableOptions,
|
||||
}: SentryIssuesTableProps) => {
|
||||
const SentryIssuesTable = (props: SentryIssuesTableProps) => {
|
||||
const { sentryIssues, statsFor, tableOptions } = props;
|
||||
return (
|
||||
<Table
|
||||
columns={columns}
|
||||
|
||||
@@ -23,11 +23,13 @@ import {
|
||||
} from '@backstage/core-plugin-api';
|
||||
import { Options } from '@material-table/core';
|
||||
|
||||
type SentryPageProps = {
|
||||
/** @public */
|
||||
export type SentryPageProps = {
|
||||
statsFor?: '24h' | '14d' | '';
|
||||
tableOptions?: Options<never>;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export const EntitySentryContent = sentryPlugin.provide(
|
||||
createRoutableExtension({
|
||||
name: 'EntitySentryContent',
|
||||
@@ -35,7 +37,7 @@ export const EntitySentryContent = sentryPlugin.provide(
|
||||
component: () =>
|
||||
import('./components/SentryIssuesWidget').then(
|
||||
({ SentryIssuesWidget }) => {
|
||||
const SentryPage = ({ statsFor, tableOptions }: SentryPageProps) => {
|
||||
const SentryPage = (props: SentryPageProps) => {
|
||||
const { entity } = useEntity();
|
||||
const defaultOptions: Options<never> = {
|
||||
padding: 'dense',
|
||||
@@ -46,8 +48,8 @@ export const EntitySentryContent = sentryPlugin.provide(
|
||||
return (
|
||||
<SentryIssuesWidget
|
||||
entity={entity}
|
||||
statsFor={statsFor || '24h'}
|
||||
tableOptions={{ ...defaultOptions, ...tableOptions }}
|
||||
statsFor={props.statsFor || '24h'}
|
||||
tableOptions={{ ...defaultOptions, ...props.tableOptions }}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@@ -57,6 +59,7 @@ export const EntitySentryContent = sentryPlugin.provide(
|
||||
}),
|
||||
);
|
||||
|
||||
/** @public */
|
||||
export const EntitySentryCard = sentryPlugin.provide(
|
||||
createComponentExtension({
|
||||
name: 'EntitySentryCard',
|
||||
@@ -64,17 +67,14 @@ export const EntitySentryCard = sentryPlugin.provide(
|
||||
lazy: () =>
|
||||
import('./components/SentryIssuesWidget').then(
|
||||
({ SentryIssuesWidget }) => {
|
||||
const SentryCard = ({
|
||||
statsFor,
|
||||
tableOptions,
|
||||
}: SentryPageProps) => {
|
||||
const SentryCard = (props: SentryPageProps) => {
|
||||
const { entity } = useEntity();
|
||||
return (
|
||||
<SentryIssuesWidget
|
||||
entity={entity}
|
||||
statsFor={statsFor || '24h'}
|
||||
statsFor={props.statsFor || '24h'}
|
||||
tableOptions={
|
||||
tableOptions || {
|
||||
props.tableOptions || {
|
||||
padding: 'dense',
|
||||
paging: true,
|
||||
search: false,
|
||||
|
||||
@@ -23,5 +23,6 @@
|
||||
export * from './api';
|
||||
export * from './components';
|
||||
export { sentryPlugin, sentryPlugin as plugin } from './plugin';
|
||||
export type { SentryPageProps } from './extensions';
|
||||
export { EntitySentryCard, EntitySentryContent } from './extensions';
|
||||
export { Router } from './components/Router';
|
||||
|
||||
Reference in New Issue
Block a user