feat(sentry): adding a check if sentry is available
Signed-off-by: Jonathan Sundquist <jsundquist@gmail.com> Signed-off-by: Jonathan Sundquist <jonathan.sundquist@factset.com>
This commit is contained in:
committed by
Jonathan Sundquist
parent
1df3b2841b
commit
c55f6cb22d
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-sentry': patch
|
||||
---
|
||||
|
||||
Providing a way for users to determine if sentry is available.
|
||||
@@ -31,6 +31,9 @@ export const EntitySentryContent: ({
|
||||
tableOptions,
|
||||
}: SentryPageProps) => JSX.Element;
|
||||
|
||||
// @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)
|
||||
|
||||
@@ -15,3 +15,4 @@
|
||||
*/
|
||||
|
||||
export * from './SentryIssuesWidget';
|
||||
export { isSentryAvailable } from './useProjectSlug';
|
||||
|
||||
@@ -18,6 +18,13 @@ import { Entity } from '@backstage/catalog-model';
|
||||
|
||||
export const SENTRY_PROJECT_SLUG_ANNOTATION = 'sentry.io/project-slug';
|
||||
|
||||
/**
|
||||
* @public
|
||||
* Checks to see if sentry is available
|
||||
*/
|
||||
export const isSentryAvailable = (entity: Entity) =>
|
||||
Boolean(entity.metadata.annotations?.[SENTRY_PROJECT_SLUG_ANNOTATION]);
|
||||
|
||||
export const useProjectSlug = (entity: Entity) => {
|
||||
return entity?.metadata.annotations?.[SENTRY_PROJECT_SLUG_ANNOTATION] ?? '';
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user