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
@@ -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