feat(plugins/pagerduty): use getPagerDutyEntity helper in hook

Signed-off-by: Alec Jacobs <cajacobs5401@gmail.com>
This commit is contained in:
Alec Jacobs
2022-06-17 09:29:45 -07:00
parent ce89b1801e
commit fb9b81780a
+2 -11
View File
@@ -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<string, string>);
const name = entity.metadata.name;
return { integrationKey, serviceId, name };
return getPagerDutyEntity(entity);
}