From 0e8fc434923321248bcd4ee09c3c90119f997c04 Mon Sep 17 00:00:00 2001 From: Alec Jacobs Date: Wed, 25 May 2022 15:49:45 -0700 Subject: [PATCH] feat(plugins/pagerduty): add serviceId to pager duty entity Signed-off-by: Alec Jacobs --- plugins/pagerduty/src/hooks/index.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/plugins/pagerduty/src/hooks/index.ts b/plugins/pagerduty/src/hooks/index.ts index 40a34788f0..a5fa462e02 100644 --- a/plugins/pagerduty/src/hooks/index.ts +++ b/plugins/pagerduty/src/hooks/index.ts @@ -16,13 +16,18 @@ import { useEntity } from '@backstage/plugin-catalog-react'; -import { PAGERDUTY_INTEGRATION_KEY } from '../components/constants'; +import { + PAGERDUTY_INTEGRATION_KEY, + PAGERDUTY_SERVICE_ID, +} from '../components/constants'; export function usePagerdutyEntity() { const { entity } = useEntity(); - const integrationKey = - entity.metadata.annotations?.[PAGERDUTY_INTEGRATION_KEY]; + const { + [PAGERDUTY_INTEGRATION_KEY]: integrationKey, + [PAGERDUTY_SERVICE_ID]: serviceId, + } = entity.metadata.annotations || ({} as Record); const name = entity.metadata.name; - return { integrationKey, name }; + return { integrationKey, serviceId, name }; }