some little fixes

Signed-off-by: Brian Fletcher <brian@roadie.io>
This commit is contained in:
Brian Fletcher
2023-05-08 08:19:27 +01:00
parent 9512f13eb3
commit f3f8b722d1
2 changed files with 30 additions and 2 deletions
+23
View File
@@ -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: {
@@ -33,7 +33,7 @@ const useStyles = makeStyles<BackstageTheme>(theme => ({
/** @public */
export function TriggerButton(props: { children?: ReactNode }) {
const { buttonStyle } = useStyles();
const { integrationKey } = usePagerdutyEntity();
const { integrationKey, name } = usePagerdutyEntity();
const [dialogShown, setDialogShown] = useState<boolean>(false);
const showDialog = useCallback(() => {
@@ -57,7 +57,12 @@ export function TriggerButton(props: { children?: ReactNode }) {
: 'Missing integration key'}
</Button>
{integrationKey && (
<TriggerDialog showDialog={dialogShown} handleDialog={hideDialog} />
<TriggerDialog
showDialog={dialogShown}
handleDialog={hideDialog}
integrationKey={integrationKey}
name={name}
/>
)}
</>
);