From fb9b81780aec0367a368c8ce692846ca6c5a0ad0 Mon Sep 17 00:00:00 2001 From: Alec Jacobs Date: Fri, 17 Jun 2022 09:29:45 -0700 Subject: [PATCH] feat(plugins/pagerduty): use getPagerDutyEntity helper in hook Signed-off-by: Alec Jacobs --- plugins/pagerduty/src/hooks/index.ts | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/plugins/pagerduty/src/hooks/index.ts b/plugins/pagerduty/src/hooks/index.ts index 503597a69e..8950e443e2 100644 --- a/plugins/pagerduty/src/hooks/index.ts +++ b/plugins/pagerduty/src/hooks/index.ts @@ -16,19 +16,10 @@ import { useEntity } from '@backstage/plugin-catalog-react'; import { PagerDutyEntity } from '../types'; - -import { - PAGERDUTY_INTEGRATION_KEY, - PAGERDUTY_SERVICE_ID, -} from '../components/constants'; +import { getPagerDutyEntity } from '../components/pagerDutyEntity'; export function usePagerdutyEntity(): PagerDutyEntity { const { entity } = useEntity(); - const { - [PAGERDUTY_INTEGRATION_KEY]: integrationKey, - [PAGERDUTY_SERVICE_ID]: serviceId, - } = entity.metadata.annotations || ({} as Record); - const name = entity.metadata.name; - return { integrationKey, serviceId, name }; + return getPagerDutyEntity(entity); }