@@ -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>;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -16,3 +16,4 @@
|
||||
|
||||
export * from './RollbarApi';
|
||||
export * from './RollbarClient';
|
||||
export * from './types';
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -14,4 +14,5 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @public */
|
||||
export const ROLLBAR_ANNOTATION = 'rollbar.com/project-slug';
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user