Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2022-08-19 09:52:22 +02:00
parent e117ad2fec
commit dbd7365130
10 changed files with 187 additions and 31 deletions
+164 -27
View File
@@ -12,44 +12,28 @@ import { Entity } from '@backstage/catalog-model';
import { IdentityApi } from '@backstage/core-plugin-api';
import { RouteRef } from '@backstage/core-plugin-api';
// Warning: (ae-missing-release-tag) "EntityPageRollbar" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const EntityPageRollbar: () => JSX.Element;
// Warning: (ae-missing-release-tag) "EntityRollbarContent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const EntityRollbarContent: (_props: {}) => JSX.Element;
export const EntityRollbarContent: () => JSX.Element;
// Warning: (ae-missing-release-tag) "isPluginApplicableToEntity" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
const isPluginApplicableToEntity: (entity: Entity) => boolean;
export { isPluginApplicableToEntity };
export { isPluginApplicableToEntity as isRollbarAvailable };
// Warning: (ae-missing-release-tag) "ROLLBAR_ANNOTATION" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const ROLLBAR_ANNOTATION = 'rollbar.com/project-slug';
// Warning: (ae-missing-release-tag) "RollbarApi" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface RollbarApi {
// Warning: (ae-forgotten-export) The symbol "RollbarProject" needs to be exported by the entry point index.d.ts
//
// (undocumented)
getAllProjects(): Promise<RollbarProject[]>;
// (undocumented)
getProject(projectName: string): Promise<RollbarProject>;
// Warning: (ae-forgotten-export) The symbol "RollbarItemsResponse" needs to be exported by the entry point index.d.ts
//
// (undocumented)
getProjectItems(project: string): Promise<RollbarItemsResponse>;
// Warning: (ae-forgotten-export) The symbol "RollbarTopActiveItem" needs to be exported by the entry point index.d.ts
//
// (undocumented)
getTopActiveItems(
project: string,
@@ -57,13 +41,9 @@ export interface RollbarApi {
): Promise<RollbarTopActiveItem[]>;
}
// Warning: (ae-missing-release-tag) "rollbarApiRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const rollbarApiRef: ApiRef<RollbarApi>;
// Warning: (ae-missing-release-tag) "RollbarClient" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export class RollbarClient implements RollbarApi {
constructor(options: {
@@ -84,8 +64,131 @@ export class RollbarClient implements RollbarApi {
): Promise<RollbarTopActiveItem[]>;
}
// Warning: (ae-missing-release-tag) "rollbarPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type RollbarEnvironment = 'production' | string;
// @public (undocumented)
export enum RollbarFrameworkId {
// (undocumented)
'browser-js' = 7,
// (undocumented)
'node-js' = 4,
// (undocumented)
'rollbar-system' = 8,
// (undocumented)
'android' = 9,
// (undocumented)
'celery' = 17,
// (undocumented)
'django' = 2,
// (undocumented)
'flask' = 16,
// (undocumented)
'ios' = 10,
// (undocumented)
'logentries' = 12,
// (undocumented)
'mailgun' = 11,
// (undocumented)
'php' = 6,
// (undocumented)
'pylons' = 5,
// (undocumented)
'pyramid' = 3,
// (undocumented)
'python' = 13,
// (undocumented)
'rails' = 1,
// (undocumented)
'rq' = 18,
// (undocumented)
'ruby' = 14,
// (undocumented)
'sidekiq' = 15,
// (undocumented)
'unknown' = 0,
}
// @public (undocumented)
export type RollbarItem = {
publicItemId: number;
integrationsData: null;
levelLock: number;
controllingId: number;
lastActivatedTimestamp: number;
assignedUserId: number;
groupStatus: number;
hash: string;
id: number;
environment: RollbarEnvironment;
titleLock: number;
title: string;
lastOccurrenceId: number;
lastOccurrenceTimestamp: number;
platform: RollbarPlatformId;
firstOccurrenceTimestamp: number;
project_id: number;
resolvedInVersion: string;
status: 'enabled' | string;
uniqueOccurrences: number;
groupItemId: number;
framework: RollbarFrameworkId;
totalOccurrences: number;
level: RollbarLevel;
counter: number;
lastModifiedBy: number;
firstOccurrenceId: number;
activatingOccurrenceId: number;
lastResolvedTimestamp: number;
};
// @public (undocumented)
export type RollbarItemCount = {
timestamp: number;
count: number;
};
// @public (undocumented)
export type RollbarItemsResponse = {
items: RollbarItem[];
page: number;
totalCount: number;
};
// @public (undocumented)
export enum RollbarLevel {
// (undocumented)
critical = 50,
// (undocumented)
debug = 10,
// (undocumented)
error = 40,
// (undocumented)
info = 20,
// (undocumented)
warning = 30,
}
// @public (undocumented)
export enum RollbarPlatformId {
// (undocumented)
'google-app-engine' = 6,
// (undocumented)
'android' = 3,
// (undocumented)
'browser' = 1,
// (undocumented)
'client' = 7,
// (undocumented)
'flash' = 2,
// (undocumented)
'heroku' = 5,
// (undocumented)
'ios' = 4,
// (undocumented)
'unknown' = 0,
}
// @public (undocumented)
const rollbarPlugin: BackstagePlugin<
{
@@ -97,9 +200,43 @@ const rollbarPlugin: BackstagePlugin<
export { rollbarPlugin as plugin };
export { rollbarPlugin };
// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "Router" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const Router: (_props: Props) => JSX.Element;
export type RollbarProject = {
id: number;
name: string;
accountId: number;
status: 'enabled' | string;
};
// @public (undocumented)
export type RollbarProjectAccessToken = {
projectId: number;
name: string;
scopes: RollbarProjectAccessTokenScope[];
accessToken: string;
status: 'enabled' | string;
};
// @public (undocumented)
export type RollbarProjectAccessTokenScope = 'read' | 'write';
// @public (undocumented)
export type RollbarTopActiveItem = {
item: {
id: number;
counter: number;
environment: RollbarEnvironment;
framework: RollbarFrameworkId;
lastOccurrenceTimestamp: number;
level: number;
occurrences: number;
projectId: number;
title: string;
uniqueOccurrences: number;
};
counts: number[];
};
// @public (undocumented)
export const Router: () => JSX.Element;
```
+2
View File
@@ -21,10 +21,12 @@ import {
} from './types';
import { createApiRef } from '@backstage/core-plugin-api';
/** @public */
export const rollbarApiRef = createApiRef<RollbarApi>({
id: 'plugin.rollbar.service',
});
/** @public */
export interface RollbarApi {
getAllProjects(): Promise<RollbarProject[]>;
getProject(projectName: string): Promise<RollbarProject>;
+1
View File
@@ -22,6 +22,7 @@ import {
} from './types';
import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';
/** @public */
export class RollbarClient implements RollbarApi {
private readonly discoveryApi: DiscoveryApi;
private readonly identityApi: IdentityApi;
+1
View File
@@ -16,3 +16,4 @@
export * from './RollbarApi';
export * from './RollbarClient';
export * from './types';
+12
View File
@@ -16,9 +16,13 @@
// TODO: Make this shared/dry with backend
/** @public */
export type RollbarProjectAccessTokenScope = 'read' | 'write';
/** @public */
export type RollbarEnvironment = 'production' | string;
/** @public */
export enum RollbarLevel {
debug = 10,
info = 20,
@@ -27,6 +31,7 @@ export enum RollbarLevel {
critical = 50,
}
/** @public */
export enum RollbarFrameworkId {
'unknown' = 0,
'rails' = 1,
@@ -49,6 +54,7 @@ export enum RollbarFrameworkId {
'rq' = 18,
}
/** @public */
export enum RollbarPlatformId {
'unknown' = 0,
'browser' = 1,
@@ -60,6 +66,7 @@ export enum RollbarPlatformId {
'client' = 7,
}
/** @public */
export type RollbarProject = {
id: number;
name: string;
@@ -67,6 +74,7 @@ export type RollbarProject = {
status: 'enabled' | string;
};
/** @public */
export type RollbarProjectAccessToken = {
projectId: number;
name: string;
@@ -75,6 +83,7 @@ export type RollbarProjectAccessToken = {
status: 'enabled' | string;
};
/** @public */
export type RollbarItem = {
publicItemId: number;
integrationsData: null;
@@ -107,17 +116,20 @@ export type RollbarItem = {
lastResolvedTimestamp: number;
};
/** @public */
export type RollbarItemsResponse = {
items: RollbarItem[];
page: number;
totalCount: number;
};
/** @public */
export type RollbarItemCount = {
timestamp: number;
count: number;
};
/** @public */
export type RollbarTopActiveItem = {
item: {
id: number;
@@ -18,6 +18,7 @@ import { useEntity } from '@backstage/plugin-catalog-react';
import React from 'react';
import { RollbarProject } from '../RollbarProject/RollbarProject';
/** @public */
export const EntityPageRollbar = () => {
const { entity } = useEntity();
+3 -3
View File
@@ -22,12 +22,12 @@ import { ROLLBAR_ANNOTATION } from '../constants';
import { EntityPageRollbar } from './EntityPageRollbar/EntityPageRollbar';
import { MissingAnnotationEmptyState } from '@backstage/core-components';
/** @public */
export const isPluginApplicableToEntity = (entity: Entity) =>
Boolean(entity.metadata.annotations?.[ROLLBAR_ANNOTATION]);
type Props = {};
export const Router = (_props: Props) => {
/** @public */
export const Router = () => {
const { entity } = useEntity();
if (!isPluginApplicableToEntity(entity)) {
+1
View File
@@ -14,4 +14,5 @@
* limitations under the License.
*/
/** @public */
export const ROLLBAR_ANNOTATION = 'rollbar.com/project-slug';
+2
View File
@@ -29,6 +29,7 @@ export const rootRouteRef = createRouteRef({
id: 'rollbar',
});
/** @public */
export const rollbarPlugin = createPlugin({
id: 'rollbar',
apis: [
@@ -44,6 +45,7 @@ export const rollbarPlugin = createPlugin({
},
});
/** @public */
export const EntityRollbarContent = rollbarPlugin.provide(
createRoutableExtension({
name: 'EntityRollbarContent',
-1
View File
@@ -233,7 +233,6 @@ const ALLOW_WARNINGS = [
'plugins/newrelic',
'plugins/newrelic-dashboard',
'plugins/pagerduty',
'plugins/rollbar',
'plugins/rollbar-backend',
'plugins/search-backend-module-pg',
'plugins/sentry',