@pagerduty/backstage-plugin
Version:
A Backstage plugin that integrates towards PagerDuty
79 lines (76 loc) • 2.44 kB
JavaScript
import { PagerDutyClient, pagerDutyApiRef } from './api/client.esm.js';
import { createRouteRef, createPlugin, createApiFactory, fetchApiRef, configApiRef, discoveryApiRef, createRoutableExtension, createComponentExtension } from '@backstage/core-plugin-api';
import { createCardExtension } from '@backstage/plugin-home-react';
const rootRouteRef = createRouteRef({
id: "pagerduty"
});
const pagerDutyPlugin = createPlugin({
id: "pagerduty",
apis: [
createApiFactory({
api: pagerDutyApiRef,
deps: {
discoveryApi: discoveryApiRef,
configApi: configApiRef,
fetchApi: fetchApiRef
},
factory: ({ configApi, discoveryApi, fetchApi }) => PagerDutyClient.fromConfig(configApi, { discoveryApi, fetchApi })
})
]
});
const PagerDutyPage = pagerDutyPlugin.provide(
createRoutableExtension({
name: "PagerDutyPage",
component: () => import('./components/PagerDutyPage/index.esm.js').then((m) => m.PagerDutyPage),
mountPoint: rootRouteRef
})
);
const EntityPagerDutyCard = pagerDutyPlugin.provide(
createComponentExtension({
name: "EntityPagerDutyCard",
component: {
lazy: () => import('./components/EntityPagerDutyCard/index.esm.js').then(
(m) => m.EntityPagerDutyCard
)
}
})
);
const EntityPagerDutySmallCard = pagerDutyPlugin.provide(
createComponentExtension({
name: "EntityPagerDutySmallCard",
component: {
lazy: () => import('./components/EntityPagerDutySmallCard/index.esm.js').then(
(m) => m.EntityPagerDutySmallCard
)
}
})
);
const HomePagePagerDutyCard = pagerDutyPlugin.provide(
createCardExtension({
name: "HomePagePagerDutyCard",
title: "PagerDuty Homepage Card",
components: () => import('./components/HomePagePagerDutyCard/index.esm.js'),
settings: {
schema: {
title: "PagerDuty",
type: "object",
properties: {
integrationKey: {
title: "PagerDuty integration key",
type: "string"
},
serviceId: {
title: "PagerDuty service id",
type: "string"
},
name: {
title: "PagerDuty service name",
type: "string"
}
}
}
}
})
);
export { EntityPagerDutyCard, EntityPagerDutySmallCard, HomePagePagerDutyCard, PagerDutyPage, pagerDutyPlugin, rootRouteRef };
//# sourceMappingURL=plugin.esm.js.map