Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2022-08-19 10:21:26 +02:00
parent 17f07f3070
commit 37bfd1a4dd
8 changed files with 68 additions and 44 deletions
+34 -23
View File
@@ -14,28 +14,18 @@ import { InfoCardVariants } from '@backstage/core-components';
import { Options } from '@material-table/core';
import { RouteRef } from '@backstage/core-plugin-api';
// Warning: (ae-forgotten-export) The symbol "SentryPageProps" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "EntitySentryCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const EntitySentryCard: ({
statsFor,
tableOptions,
}: SentryPageProps) => JSX.Element;
export const EntitySentryCard: (props: SentryPageProps) => JSX.Element;
// Warning: (ae-missing-release-tag) "EntitySentryContent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const EntitySentryContent: ({
statsFor,
tableOptions,
}: SentryPageProps) => JSX.Element;
export const EntitySentryContent: (props: SentryPageProps) => JSX.Element;
// @public (undocumented)
export type EventPoint = number[];
// @public
export const isSentryAvailable: (entity: Entity) => boolean;
// Warning: (ae-missing-release-tag) "MockSentryApi" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export class MockSentryApi implements SentryApi {
// (undocumented)
@@ -74,11 +64,14 @@ export interface SentryApi {
): Promise<SentryIssue[]>;
}
// @public (undocumented)
export type SentryApiError = {
detail: string;
};
// @public (undocumented)
export const sentryApiRef: ApiRef<SentryApi>;
// Warning: (ae-missing-release-tag) "SentryIssue" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type SentryIssue = {
platform: SentryPlatform;
@@ -113,6 +106,14 @@ export type SentryIssue = {
statusDetails: any;
};
// @public (undocumented)
export type SentryIssueMetadata = {
function?: string;
type?: string;
value?: string;
filename?: string;
};
// @public (undocumented)
export const SentryIssuesWidget: (props: {
entity: Entity;
@@ -122,6 +123,15 @@ export const SentryIssuesWidget: (props: {
query?: string;
}) => JSX.Element;
// @public (undocumented)
export type SentryPageProps = {
statsFor?: '24h' | '14d' | '';
tableOptions?: Options<never>;
};
// @public (undocumented)
export type SentryPlatform = 'javascript' | 'javascript-react' | string;
// @public (undocumented)
const sentryPlugin: BackstagePlugin<
{
@@ -133,10 +143,11 @@ const sentryPlugin: BackstagePlugin<
export { sentryPlugin as plugin };
export { sentryPlugin };
// Warnings were encountered during analysis:
//
// src/api/sentry-issue.d.ts:16:5 - (ae-forgotten-export) The symbol "SentryPlatform" needs to be exported by the entry point index.d.ts
// src/api/sentry-issue.d.ts:21:9 - (ae-forgotten-export) The symbol "EventPoint" needs to be exported by the entry point index.d.ts
// src/api/sentry-issue.d.ts:31:5 - (ae-forgotten-export) The symbol "SentryIssueMetadata" needs to be exported by the entry point index.d.ts
// src/api/sentry-issue.d.ts:44:5 - (ae-forgotten-export) The symbol "SentryProject" needs to be exported by the entry point index.d.ts
// @public (undocumented)
export type SentryProject = {
platform: SentryPlatform;
slug: string;
id: string;
name: string;
};
```
+8 -1
View File
@@ -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';
+3
View File
@@ -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 => {
+10 -4
View File
@@ -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}
+10 -10
View File
@@ -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,
+1
View File
@@ -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';
-1
View File
@@ -234,7 +234,6 @@ const ALLOW_WARNINGS = [
'plugins/newrelic-dashboard',
'plugins/pagerduty',
'plugins/search-backend-module-pg',
'plugins/sentry',
'plugins/shortcuts',
'plugins/splunk-on-call',
'plugins/tech-radar',