From 08374355317d114e0ac182a3676d8ba695490404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Marschollek?= Date: Thu, 3 Sep 2020 09:20:04 +0200 Subject: [PATCH] Conditionally add Sentry widget to component page This adds the Sentry widget back to the component page (from which it was removed in #2246) if the component declares its own Sentry project ID in the annotation named backstage.io/sentry-project-id. The widget is hidden otherwise. Previous to #2246, the widget was just displaying an empty list because it was trying to load data for a hardcoded project name of sample-sentry-project-id. Fixes #2257 --- plugins/catalog/package.json | 1 + .../EntityPageOverview/EntityPageOverview.tsx | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/plugins/catalog/package.json b/plugins/catalog/package.json index b088e1699b..e393be9d17 100644 --- a/plugins/catalog/package.json +++ b/plugins/catalog/package.json @@ -27,6 +27,7 @@ "@backstage/plugin-github-actions": "^0.1.1-alpha.21", "@backstage/plugin-jenkins": "^0.1.1-alpha.21", "@backstage/plugin-scaffolder": "^0.1.1-alpha.21", + "@backstage/plugin-sentry": "^0.1.1-alpha.21", "@backstage/plugin-techdocs": "^0.1.1-alpha.21", "@backstage/theme": "^0.1.1-alpha.21", "@material-ui/core": "^4.9.1", diff --git a/plugins/catalog/src/components/EntityPageOverview/EntityPageOverview.tsx b/plugins/catalog/src/components/EntityPageOverview/EntityPageOverview.tsx index 9b29b205cf..f261698f7d 100644 --- a/plugins/catalog/src/components/EntityPageOverview/EntityPageOverview.tsx +++ b/plugins/catalog/src/components/EntityPageOverview/EntityPageOverview.tsx @@ -17,6 +17,7 @@ // TODO(shmidt-i): move to the app import { Entity } from '@backstage/catalog-model'; import { Content } from '@backstage/core'; +import { SentryIssuesWidget } from '@backstage/plugin-sentry'; import { LatestWorkflowRunCard } from '@backstage/plugin-github-actions'; import { JenkinsBuildsWidget, @@ -52,6 +53,16 @@ export const EntityPageOverview: FC<{ entity: Entity }> = ({ entity }) => { )} + {entity.metadata?.annotations?.['backstage.io/sentry-project-id'] && ( + + + + )} );