diff --git a/plugins/pagerduty/dev/index.tsx b/plugins/pagerduty/dev/index.tsx index e45e0ffd8f..0dca77cc76 100644 --- a/plugins/pagerduty/dev/index.tsx +++ b/plugins/pagerduty/dev/index.tsx @@ -25,6 +25,7 @@ import { PagerDutyIncident, PagerDutyChangeEvent, } from '../src/components/types'; +import { PagerDutyEntity } from '../src'; const mockEntity: Entity = { apiVersion: 'backstage.io/v1alpha1', @@ -46,6 +47,28 @@ const mockEntity: Entity = { }; const mockPagerDutyApi: PagerDutyApi = { + async getServiceByPagerDutyEntity(pagerDutyEntity: PagerDutyEntity) { + return { + service: { + name: pagerDutyEntity.name, + integrationKey: 'key', + id: '123', + html_url: 'http://service', + escalation_policy: { + id: '123', + html_url: 'http://escalationpolicy', + user: { + id: '123', + summary: 'summary', + email: 'email@email.com', + html_url: 'http://user', + name: 'some-user', + }, + }, + }, + }; + }, + async getServiceByEntity(entity: Entity) { return { service: { diff --git a/plugins/pagerduty/src/components/TriggerButton/index.tsx b/plugins/pagerduty/src/components/TriggerButton/index.tsx index 732298c6d8..1c12103d73 100644 --- a/plugins/pagerduty/src/components/TriggerButton/index.tsx +++ b/plugins/pagerduty/src/components/TriggerButton/index.tsx @@ -33,7 +33,7 @@ const useStyles = makeStyles(theme => ({ /** @public */ export function TriggerButton(props: { children?: ReactNode }) { const { buttonStyle } = useStyles(); - const { integrationKey } = usePagerdutyEntity(); + const { integrationKey, name } = usePagerdutyEntity(); const [dialogShown, setDialogShown] = useState(false); const showDialog = useCallback(() => { @@ -57,7 +57,12 @@ export function TriggerButton(props: { children?: ReactNode }) { : 'Missing integration key'} {integrationKey && ( - + )} );