@pagerduty/backstage-plugin 0.20.0 → 0.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/alpha/entity-cards.esm.js +9 -12
- package/dist/alpha/entity-cards.esm.js.map +1 -1
- package/dist/alpha/pages.esm.js +41 -4
- package/dist/alpha/pages.esm.js.map +1 -1
- package/dist/alpha/plugin.esm.js +4 -3
- package/dist/alpha/plugin.esm.js.map +1 -1
- package/dist/alpha.d.ts +105 -26
- package/dist/api/client.esm.js +136 -0
- package/dist/api/client.esm.js.map +1 -1
- package/dist/components/PagerDutyPage/ConfigurationPage.esm.js +119 -0
- package/dist/components/PagerDutyPage/ConfigurationPage.esm.js.map +1 -0
- package/dist/components/PagerDutyPage/CustomFieldModal.esm.js +152 -0
- package/dist/components/PagerDutyPage/CustomFieldModal.esm.js.map +1 -0
- package/dist/components/PagerDutyPage/CustomFields/ButtonTabs.esm.js +51 -0
- package/dist/components/PagerDutyPage/CustomFields/ButtonTabs.esm.js.map +1 -0
- package/dist/components/PagerDutyPage/CustomFields/CustomFieldsEmptyState.esm.js +46 -0
- package/dist/components/PagerDutyPage/CustomFields/CustomFieldsEmptyState.esm.js.map +1 -0
- package/dist/components/PagerDutyPage/CustomFields/CustomFieldsTabPanel.esm.js +154 -0
- package/dist/components/PagerDutyPage/CustomFields/CustomFieldsTabPanel.esm.js.map +1 -0
- package/dist/components/PagerDutyPage/CustomFields/DeleteCustomFieldDialog.esm.js +63 -0
- package/dist/components/PagerDutyPage/CustomFields/DeleteCustomFieldDialog.esm.js.map +1 -0
- package/dist/components/PagerDutyPage/CustomFields/SyncLogsFilters.esm.js +126 -0
- package/dist/components/PagerDutyPage/CustomFields/SyncLogsFilters.esm.js.map +1 -0
- package/dist/components/PagerDutyPage/CustomFields/SyncLogsTab.esm.js +285 -0
- package/dist/components/PagerDutyPage/CustomFields/SyncLogsTab.esm.js.map +1 -0
- package/dist/components/PagerDutyPage/CustomFields/customFieldErrors.esm.js +13 -0
- package/dist/components/PagerDutyPage/CustomFields/customFieldErrors.esm.js.map +1 -0
- package/dist/components/PagerDutyPage/CustomFields.esm.js +192 -0
- package/dist/components/PagerDutyPage/CustomFields.esm.js.map +1 -0
- package/dist/components/PagerDutyPage/MappingsTable/MappingsTable.esm.js +1 -1
- package/dist/components/PagerDutyPage/MappingsTable/MappingsTable.esm.js.map +1 -1
- package/dist/components/PagerDutyPage/MappingsTable/MappingsTableContent.esm.js +15 -3
- package/dist/components/PagerDutyPage/MappingsTable/MappingsTableContent.esm.js.map +1 -1
- package/dist/components/PagerDutyPage/MappingsTable/NameCell.esm.js +35 -0
- package/dist/components/PagerDutyPage/MappingsTable/NameCell.esm.js.map +1 -0
- package/dist/components/PagerDutyPage/MappingsTable/TableSkeleton.esm.js +26 -29
- package/dist/components/PagerDutyPage/MappingsTable/TableSkeleton.esm.js.map +1 -1
- package/dist/components/PagerDutyPage/ServiceMappingPage.esm.js +22 -0
- package/dist/components/PagerDutyPage/ServiceMappingPage.esm.js.map +1 -0
- package/dist/components/PagerDutyPage/index.esm.js +12 -127
- package/dist/components/PagerDutyPage/index.esm.js.map +1 -1
- package/dist/index.d.ts +50 -3
- package/dist/package.json.esm.js +4 -3
- package/dist/package.json.esm.js.map +1 -1
- package/package.json +19 -18
- package/dist/alpha/nav-items.esm.js +0 -21
- package/dist/alpha/nav-items.esm.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @backstage/plugin-pagerduty
|
|
2
2
|
|
|
3
|
+
## 0.21.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3ffbcbe: Fix the alpha entity cards failing to load on Backstage 1.54. Use `configSchema` instead of the removed `config.schema` option.
|
|
8
|
+
|
|
9
|
+
## 0.21.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- bee64f1: Release the service mappings feature
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [bee64f1]
|
|
18
|
+
- @pagerduty/backstage-plugin-common@0.5.0
|
|
19
|
+
|
|
3
20
|
## 0.20.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { compatWrapper } from '@backstage/core-compat-api';
|
|
3
3
|
import { EntityCardBlueprint } from '@backstage/plugin-catalog-react/alpha';
|
|
4
|
+
import { z } from 'zod';
|
|
4
5
|
import { PAGERDUTY_INTEGRATION_KEY, PAGERDUTY_SERVICE_ID } from '../components/constants.esm.js';
|
|
5
6
|
|
|
6
7
|
const pagerDutyEntityCard = EntityCardBlueprint.makeWithOverrides({
|
|
7
8
|
name: "EntityPagerDutyCard",
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
disableOnCall: (z) => z.boolean().optional()
|
|
13
|
-
}
|
|
9
|
+
configSchema: {
|
|
10
|
+
readOnly: z.boolean().optional(),
|
|
11
|
+
disableChangeEvents: z.boolean().optional(),
|
|
12
|
+
disableOnCall: z.boolean().optional()
|
|
14
13
|
},
|
|
15
14
|
factory(originalFactory, { config }) {
|
|
16
15
|
return originalFactory({
|
|
@@ -36,12 +35,10 @@ const pagerDutyEntityCard = EntityCardBlueprint.makeWithOverrides({
|
|
|
36
35
|
const pagerDutyEntitySmallCard = EntityCardBlueprint.makeWithOverrides({
|
|
37
36
|
name: "EntityPagerDutySmallCard",
|
|
38
37
|
disabled: true,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
disableInsights: (z) => z.boolean().optional()
|
|
44
|
-
}
|
|
38
|
+
configSchema: {
|
|
39
|
+
readOnly: z.boolean().optional(),
|
|
40
|
+
disableOnCall: z.boolean().optional(),
|
|
41
|
+
disableInsights: z.boolean().optional()
|
|
45
42
|
},
|
|
46
43
|
factory(originalFactory, { config }) {
|
|
47
44
|
return originalFactory({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-cards.esm.js","sources":["../../src/alpha/entity-cards.tsx"],"sourcesContent":["import { compatWrapper } from '@backstage/core-compat-api';\nimport { EntityCardBlueprint } from '@backstage/plugin-catalog-react/alpha';\nimport { PAGERDUTY_INTEGRATION_KEY, PAGERDUTY_SERVICE_ID } from '../components/constants';\n\n/** @alpha */\nexport const pagerDutyEntityCard = EntityCardBlueprint.makeWithOverrides({\n name: 'EntityPagerDutyCard',\n
|
|
1
|
+
{"version":3,"file":"entity-cards.esm.js","sources":["../../src/alpha/entity-cards.tsx"],"sourcesContent":["import { compatWrapper } from '@backstage/core-compat-api';\nimport { EntityCardBlueprint } from '@backstage/plugin-catalog-react/alpha';\nimport { z } from 'zod';\nimport { PAGERDUTY_INTEGRATION_KEY, PAGERDUTY_SERVICE_ID } from '../components/constants';\n\n/** @alpha */\nexport const pagerDutyEntityCard = EntityCardBlueprint.makeWithOverrides({\n name: 'EntityPagerDutyCard',\n configSchema: {\n readOnly: z.boolean().optional(),\n disableChangeEvents: z.boolean().optional(),\n disableOnCall: z.boolean().optional(),\n },\n factory(originalFactory, { config }) {\n return originalFactory({\n filter: entity => Boolean(\n entity.metadata?.annotations?.[PAGERDUTY_INTEGRATION_KEY] || \n entity.metadata?.annotations?.[PAGERDUTY_SERVICE_ID]\n ),\n async loader() {\n const { EntityPagerDutyCard } = await import('../components/EntityPagerDutyCard');\n\n return compatWrapper(\n <EntityPagerDutyCard \n readOnly={config.readOnly} \n disableChangeEvents={config.disableChangeEvents}\n disableOnCall={config.disableOnCall}\n />\n );\n }\n })\n }\n});\n\n/** @alpha */\nexport const pagerDutyEntitySmallCard = EntityCardBlueprint.makeWithOverrides({\n name: 'EntityPagerDutySmallCard',\n disabled: true,\n configSchema: {\n readOnly: z.boolean().optional(),\n disableOnCall: z.boolean().optional(),\n disableInsights: z.boolean().optional(),\n },\n factory(originalFactory, { config }) {\n return originalFactory({\n filter: entity => Boolean(\n entity.metadata?.annotations?.[PAGERDUTY_INTEGRATION_KEY] || \n entity.metadata?.annotations?.[PAGERDUTY_SERVICE_ID]\n ),\n async loader() {\n const { EntityPagerDutySmallCard } = await import(\n '../components/EntityPagerDutySmallCard'\n );\n return compatWrapper(\n <EntityPagerDutySmallCard\n readOnly={config.readOnly}\n disableOnCall={config.disableOnCall}\n disableInsights={config.disableInsights}\n />,\n );\n },\n });\n },\n});\n"],"names":[],"mappings":";;;;;;AAMO,MAAM,mBAAA,GAAsB,oBAAoB,iBAAA,CAAkB;AAAA,EACvE,IAAA,EAAM,qBAAA;AAAA,EACN,YAAA,EAAc;AAAA,IACZ,QAAA,EAAU,CAAA,CAAE,OAAA,EAAQ,CAAE,QAAA,EAAS;AAAA,IAC/B,mBAAA,EAAqB,CAAA,CAAE,OAAA,EAAQ,CAAE,QAAA,EAAS;AAAA,IAC1C,aAAA,EAAe,CAAA,CAAE,OAAA,EAAQ,CAAE,QAAA;AAAS,GACtC;AAAA,EACA,OAAA,CAAQ,eAAA,EAAiB,EAAE,MAAA,EAAO,EAAG;AACnC,IAAA,OAAO,eAAA,CAAgB;AAAA,MACrB,QAAQ,CAAA,MAAA,KAAU,OAAA;AAAA,QAChB,MAAA,CAAO,UAAU,WAAA,GAAc,yBAAyB,KACxD,MAAA,CAAO,QAAA,EAAU,cAAc,oBAAoB;AAAA,OACrD;AAAA,MACA,MAAM,MAAA,GAAS;AACb,QAAA,MAAM,EAAE,mBAAA,EAAoB,GAAI,MAAM,OAAO,gDAAmC,CAAA;AAEhF,QAAA,OAAO,aAAA;AAAA,0BACL,GAAA;AAAA,YAAC,mBAAA;AAAA,YAAA;AAAA,cACC,UAAU,MAAA,CAAO,QAAA;AAAA,cACjB,qBAAqB,MAAA,CAAO,mBAAA;AAAA,cAC5B,eAAe,MAAA,CAAO;AAAA;AAAA;AACxB,SACF;AAAA,MACF;AAAA,KACD,CAAA;AAAA,EACH;AACF,CAAC;AAGM,MAAM,wBAAA,GAA2B,oBAAoB,iBAAA,CAAkB;AAAA,EAC5E,IAAA,EAAM,0BAAA;AAAA,EACN,QAAA,EAAU,IAAA;AAAA,EACV,YAAA,EAAc;AAAA,IACZ,QAAA,EAAU,CAAA,CAAE,OAAA,EAAQ,CAAE,QAAA,EAAS;AAAA,IAC/B,aAAA,EAAe,CAAA,CAAE,OAAA,EAAQ,CAAE,QAAA,EAAS;AAAA,IACpC,eAAA,EAAiB,CAAA,CAAE,OAAA,EAAQ,CAAE,QAAA;AAAS,GACxC;AAAA,EACA,OAAA,CAAQ,eAAA,EAAiB,EAAE,MAAA,EAAO,EAAG;AACnC,IAAA,OAAO,eAAA,CAAgB;AAAA,MACrB,QAAQ,CAAA,MAAA,KAAU,OAAA;AAAA,QAChB,MAAA,CAAO,UAAU,WAAA,GAAc,yBAAyB,KACxD,MAAA,CAAO,QAAA,EAAU,cAAc,oBAAoB;AAAA,OACrD;AAAA,MACA,MAAM,MAAA,GAAS;AACb,QAAA,MAAM,EAAE,wBAAA,EAAyB,GAAI,MAAM,OACzC,qDACF,CAAA;AACA,QAAA,OAAO,aAAA;AAAA,0BACL,GAAA;AAAA,YAAC,wBAAA;AAAA,YAAA;AAAA,cACC,UAAU,MAAA,CAAO,QAAA;AAAA,cACjB,eAAe,MAAA,CAAO,aAAA;AAAA,cACtB,iBAAiB,MAAA,CAAO;AAAA;AAAA;AAC1B,SACF;AAAA,MACF;AAAA,KACD,CAAA;AAAA,EACH;AACF,CAAC;;;;"}
|
package/dist/alpha/pages.esm.js
CHANGED
|
@@ -1,15 +1,52 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { convertLegacyRouteRef } from '@backstage/core-compat-api';
|
|
3
3
|
import { rootRouteRef } from '../routes.esm.js';
|
|
4
|
-
import { PageBlueprint } from '@backstage/frontend-plugin-api';
|
|
4
|
+
import { PageBlueprint, SubPageBlueprint } from '@backstage/frontend-plugin-api';
|
|
5
|
+
import '@backstage/plugin-catalog-react';
|
|
6
|
+
import '../components/PagerDutyCard/index.esm.js';
|
|
7
|
+
import '../components/PagerDutySmallCard/index.esm.js';
|
|
8
|
+
import { PagerDutyIcon } from '../components/Icons/index.esm.js';
|
|
9
|
+
import '../components/TriggerButton/index.esm.js';
|
|
5
10
|
|
|
6
11
|
const pagerDutyPage = PageBlueprint.make({
|
|
7
12
|
params: {
|
|
8
13
|
path: "/pagerduty",
|
|
9
|
-
|
|
10
|
-
|
|
14
|
+
title: "PagerDuty",
|
|
15
|
+
icon: /* @__PURE__ */ jsx(PagerDutyIcon, {}),
|
|
16
|
+
routeRef: convertLegacyRouteRef(rootRouteRef)
|
|
17
|
+
// No `loader` here on purpose: when a page has a loader the frontend
|
|
18
|
+
// system renders only that content and ignores the `pages` input. Omitting
|
|
19
|
+
// it makes the attached SubPageBlueprint extensions render as tabs, with
|
|
20
|
+
// the index route redirecting to the first tab (Service Mapping).
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const pagerDutyServiceMappingSubPage = SubPageBlueprint.make({
|
|
24
|
+
name: "service-mapping",
|
|
25
|
+
attachTo: { id: "page:pagerduty", input: "pages" },
|
|
26
|
+
params: {
|
|
27
|
+
path: "service-mapping",
|
|
28
|
+
title: "Service Mapping",
|
|
29
|
+
loader: () => import('../components/PagerDutyPage/ServiceMappingPage.esm.js').then((m) => /* @__PURE__ */ jsx(m.ServiceMappingPage, {}))
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const pagerDutyCustomFieldsSubPage = SubPageBlueprint.make({
|
|
33
|
+
name: "custom-fields",
|
|
34
|
+
attachTo: { id: "page:pagerduty", input: "pages" },
|
|
35
|
+
params: {
|
|
36
|
+
path: "custom-fields",
|
|
37
|
+
title: "Custom Fields",
|
|
38
|
+
loader: () => import('../components/PagerDutyPage/CustomFields.esm.js').then((m) => /* @__PURE__ */ jsx(m.CustomFields, {}))
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
const pagerDutyConfigurationSubPage = SubPageBlueprint.make({
|
|
42
|
+
name: "configuration",
|
|
43
|
+
attachTo: { id: "page:pagerduty", input: "pages" },
|
|
44
|
+
params: {
|
|
45
|
+
path: "settings",
|
|
46
|
+
title: "Configuration",
|
|
47
|
+
loader: () => import('../components/PagerDutyPage/ConfigurationPage.esm.js').then((m) => /* @__PURE__ */ jsx(m.ConfigurationPage, {}))
|
|
11
48
|
}
|
|
12
49
|
});
|
|
13
50
|
|
|
14
|
-
export { pagerDutyPage };
|
|
51
|
+
export { pagerDutyConfigurationSubPage, pagerDutyCustomFieldsSubPage, pagerDutyPage, pagerDutyServiceMappingSubPage };
|
|
15
52
|
//# sourceMappingURL=pages.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages.esm.js","sources":["../../src/alpha/pages.tsx"],"sourcesContent":["import { convertLegacyRouteRef } from '@backstage/core-compat-api';\nimport { rootRouteRef } from '../routes';\nimport { PageBlueprint } from '@backstage/frontend-plugin-api';\n\n/** @alpha */\nexport const pagerDutyPage = PageBlueprint.make({\n params: {\n path: '/pagerduty',\n routeRef: convertLegacyRouteRef(rootRouteRef),\n loader: ()
|
|
1
|
+
{"version":3,"file":"pages.esm.js","sources":["../../src/alpha/pages.tsx"],"sourcesContent":["import { convertLegacyRouteRef } from '@backstage/core-compat-api';\nimport { rootRouteRef } from '../routes';\nimport { PageBlueprint, SubPageBlueprint } from '@backstage/frontend-plugin-api';\nimport { PagerDutyIcon } from '../components';\n\n/** @alpha */\nexport const pagerDutyPage = PageBlueprint.make({\n params: {\n path: '/pagerduty',\n title: 'PagerDuty',\n icon: <PagerDutyIcon />,\n routeRef: convertLegacyRouteRef(rootRouteRef),\n // No `loader` here on purpose: when a page has a loader the frontend\n // system renders only that content and ignores the `pages` input. Omitting\n // it makes the attached SubPageBlueprint extensions render as tabs, with\n // the index route redirecting to the first tab (Service Mapping).\n },\n});\n\n/** @alpha */\nexport const pagerDutyServiceMappingSubPage = SubPageBlueprint.make({\n name: 'service-mapping',\n attachTo: { id: 'page:pagerduty', input: 'pages' },\n params: {\n path: 'service-mapping',\n title: 'Service Mapping',\n loader: () =>\n import('../components/PagerDutyPage/ServiceMappingPage').then(m => (\n <m.ServiceMappingPage />\n )),\n },\n});\n\n/** @alpha */\nexport const pagerDutyCustomFieldsSubPage = SubPageBlueprint.make({\n name: 'custom-fields',\n attachTo: { id: 'page:pagerduty', input: 'pages' },\n params: {\n path: 'custom-fields',\n title: 'Custom Fields',\n loader: () =>\n import('../components/PagerDutyPage/CustomFields').then(m => (\n <m.CustomFields />\n )),\n },\n});\n\n/** @alpha */\nexport const pagerDutyConfigurationSubPage = SubPageBlueprint.make({\n name: 'configuration',\n attachTo: { id: 'page:pagerduty', input: 'pages' },\n params: {\n path: 'settings',\n title: 'Configuration',\n loader: () =>\n import('../components/PagerDutyPage/ConfigurationPage').then(m => (\n <m.ConfigurationPage />\n )),\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;AAMO,MAAM,aAAA,GAAgB,cAAc,IAAA,CAAK;AAAA,EAC9C,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,YAAA;AAAA,IACN,KAAA,EAAO,WAAA;AAAA,IACP,IAAA,sBAAO,aAAA,EAAA,EAAc,CAAA;AAAA,IACrB,QAAA,EAAU,sBAAsB,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAMhD,CAAC;AAGM,MAAM,8BAAA,GAAiC,iBAAiB,IAAA,CAAK;AAAA,EAClE,IAAA,EAAM,iBAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,gBAAA,EAAkB,OAAO,OAAA,EAAQ;AAAA,EACjD,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,iBAAA;AAAA,IACN,KAAA,EAAO,iBAAA;AAAA,IACP,MAAA,EAAQ,MACN,OAAO,uDAAgD,CAAA,CAAE,IAAA,CAAK,CAAA,CAAA,qBAC5D,GAAA,CAAC,CAAA,CAAE,kBAAA,EAAF,EAAqB,CACvB;AAAA;AAEP,CAAC;AAGM,MAAM,4BAAA,GAA+B,iBAAiB,IAAA,CAAK;AAAA,EAChE,IAAA,EAAM,eAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,gBAAA,EAAkB,OAAO,OAAA,EAAQ;AAAA,EACjD,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,eAAA;AAAA,IACN,KAAA,EAAO,eAAA;AAAA,IACP,MAAA,EAAQ,MACN,OAAO,iDAA0C,CAAA,CAAE,IAAA,CAAK,CAAA,CAAA,qBACtD,GAAA,CAAC,CAAA,CAAE,YAAA,EAAF,EAAe,CACjB;AAAA;AAEP,CAAC;AAGM,MAAM,6BAAA,GAAgC,iBAAiB,IAAA,CAAK;AAAA,EACjE,IAAA,EAAM,eAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,gBAAA,EAAkB,OAAO,OAAA,EAAQ;AAAA,EACjD,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,UAAA;AAAA,IACN,KAAA,EAAO,eAAA;AAAA,IACP,MAAA,EAAQ,MACN,OAAO,sDAA+C,CAAA,CAAE,IAAA,CAAK,CAAA,CAAA,qBAC3D,GAAA,CAAC,CAAA,CAAE,iBAAA,EAAF,EAAoB,CACtB;AAAA;AAEP,CAAC;;;;"}
|
package/dist/alpha/plugin.esm.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { createFrontendPlugin } from '@backstage/frontend-plugin-api';
|
|
2
2
|
import { pagerDutyEntityCard, pagerDutyEntitySmallCard } from './entity-cards.esm.js';
|
|
3
3
|
import { pagerDutyApi } from './api.esm.js';
|
|
4
|
-
import { pagerDutyPage } from './pages.esm.js';
|
|
5
|
-
import { pagerDutyNavBarItem } from './nav-items.esm.js';
|
|
4
|
+
import { pagerDutyPage, pagerDutyServiceMappingSubPage, pagerDutyCustomFieldsSubPage, pagerDutyConfigurationSubPage } from './pages.esm.js';
|
|
6
5
|
import { convertLegacyRouteRefs } from '@backstage/core-compat-api';
|
|
7
6
|
import { rootRouteRef } from '../routes.esm.js';
|
|
8
7
|
|
|
@@ -14,7 +13,9 @@ const pagerDutyPlugin = createFrontendPlugin({
|
|
|
14
13
|
pagerDutyEntitySmallCard,
|
|
15
14
|
pagerDutyApi,
|
|
16
15
|
pagerDutyPage,
|
|
17
|
-
|
|
16
|
+
pagerDutyServiceMappingSubPage,
|
|
17
|
+
pagerDutyCustomFieldsSubPage,
|
|
18
|
+
pagerDutyConfigurationSubPage
|
|
18
19
|
],
|
|
19
20
|
routes: convertLegacyRouteRefs({
|
|
20
21
|
root: rootRouteRef
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.esm.js","sources":["../../src/alpha/plugin.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createFrontendPlugin } from \"@backstage/frontend-plugin-api\";\nimport { pagerDutyEntityCard, pagerDutyEntitySmallCard } from \"../alpha/entity-cards\";\nimport { pagerDutyApi } from \"../alpha/api\";\nimport {
|
|
1
|
+
{"version":3,"file":"plugin.esm.js","sources":["../../src/alpha/plugin.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createFrontendPlugin } from \"@backstage/frontend-plugin-api\";\nimport { pagerDutyEntityCard, pagerDutyEntitySmallCard } from \"../alpha/entity-cards\";\nimport { pagerDutyApi } from \"../alpha/api\";\nimport {\n pagerDutyPage,\n pagerDutyServiceMappingSubPage,\n pagerDutyCustomFieldsSubPage,\n pagerDutyConfigurationSubPage,\n} from \"../alpha/pages\";\nimport { convertLegacyRouteRefs } from \"@backstage/core-compat-api\";\nimport { rootRouteRef } from \"../routes\";\n\n/** @alpha */\nexport const pagerDutyPlugin = createFrontendPlugin({\n pluginId: 'pagerduty',\n info: { packageJson: () => import('../../package.json')},\n extensions: [\n pagerDutyEntityCard,\n pagerDutyEntitySmallCard,\n pagerDutyApi,\n pagerDutyPage,\n pagerDutyServiceMappingSubPage,\n pagerDutyCustomFieldsSubPage,\n pagerDutyConfigurationSubPage,\n ],\n routes: convertLegacyRouteRefs({\n root: rootRouteRef\n })\n});\n"],"names":[],"mappings":";;;;;;;AA6BO,MAAM,kBAAkB,oBAAA,CAAqB;AAAA,EAClD,QAAA,EAAU,WAAA;AAAA,EACV,MAAM,EAAE,WAAA,EAAa,MAAM,OAAO,wBAAoB,CAAA,EAAC;AAAA,EACvD,UAAA,EAAY;AAAA,IACV,mBAAA;AAAA,IACA,wBAAA;AAAA,IACA,YAAA;AAAA,IACA,aAAA;AAAA,IACA,8BAAA;AAAA,IACA,4BAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA,QAAQ,sBAAA,CAAuB;AAAA,IAC7B,IAAA,EAAM;AAAA,GACP;AACH,CAAC;;;;"}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import * as _backstage_plugin_catalog_react_alpha from '@backstage/plugin-catalog-react/alpha';
|
|
1
2
|
import * as _backstage_catalog_model from '@backstage/catalog-model';
|
|
2
3
|
import * as react from 'react';
|
|
3
|
-
import * as
|
|
4
|
+
import * as _backstage_filter_predicates from '@backstage/filter-predicates';
|
|
4
5
|
import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
|
|
5
6
|
|
|
6
7
|
/** @alpha */
|
|
@@ -21,15 +22,15 @@ declare const pagerDutyPlugin: _backstage_frontend_plugin_api.OverridableFronten
|
|
|
21
22
|
readOnly: boolean | undefined;
|
|
22
23
|
disableChangeEvents: boolean | undefined;
|
|
23
24
|
disableOnCall: boolean | undefined;
|
|
24
|
-
filter:
|
|
25
|
-
type: "content" | "
|
|
25
|
+
filter: _backstage_filter_predicates.FilterPredicate | undefined;
|
|
26
|
+
type: "content" | "info" | undefined;
|
|
26
27
|
};
|
|
27
28
|
configInput: {
|
|
28
29
|
readOnly?: boolean | undefined;
|
|
29
30
|
disableChangeEvents?: boolean | undefined;
|
|
30
31
|
disableOnCall?: boolean | undefined;
|
|
31
|
-
filter?:
|
|
32
|
-
type?: "content" | "
|
|
32
|
+
filter?: _backstage_filter_predicates.FilterPredicate | undefined;
|
|
33
|
+
type?: "content" | "info" | undefined | undefined;
|
|
33
34
|
};
|
|
34
35
|
output: _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
35
36
|
optional: true;
|
|
@@ -43,7 +44,7 @@ declare const pagerDutyPlugin: _backstage_frontend_plugin_api.OverridableFronten
|
|
|
43
44
|
name: "EntityPagerDutyCard";
|
|
44
45
|
params: {
|
|
45
46
|
loader: () => Promise<JSX.Element>;
|
|
46
|
-
filter?: string |
|
|
47
|
+
filter?: string | _backstage_filter_predicates.FilterPredicate | ((entity: _backstage_catalog_model.Entity) => boolean);
|
|
47
48
|
type?: _backstage_plugin_catalog_react_alpha.EntityCardType;
|
|
48
49
|
};
|
|
49
50
|
}>;
|
|
@@ -52,15 +53,15 @@ declare const pagerDutyPlugin: _backstage_frontend_plugin_api.OverridableFronten
|
|
|
52
53
|
readOnly: boolean | undefined;
|
|
53
54
|
disableOnCall: boolean | undefined;
|
|
54
55
|
disableInsights: boolean | undefined;
|
|
55
|
-
filter:
|
|
56
|
-
type: "content" | "
|
|
56
|
+
filter: _backstage_filter_predicates.FilterPredicate | undefined;
|
|
57
|
+
type: "content" | "info" | undefined;
|
|
57
58
|
};
|
|
58
59
|
configInput: {
|
|
59
60
|
readOnly?: boolean | undefined;
|
|
60
61
|
disableOnCall?: boolean | undefined;
|
|
61
62
|
disableInsights?: boolean | undefined;
|
|
62
|
-
filter?:
|
|
63
|
-
type?: "content" | "
|
|
63
|
+
filter?: _backstage_filter_predicates.FilterPredicate | undefined;
|
|
64
|
+
type?: "content" | "info" | undefined | undefined;
|
|
64
65
|
};
|
|
65
66
|
output: _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
66
67
|
optional: true;
|
|
@@ -74,43 +75,121 @@ declare const pagerDutyPlugin: _backstage_frontend_plugin_api.OverridableFronten
|
|
|
74
75
|
name: "EntityPagerDutySmallCard";
|
|
75
76
|
params: {
|
|
76
77
|
loader: () => Promise<JSX.Element>;
|
|
77
|
-
filter?: string |
|
|
78
|
+
filter?: string | _backstage_filter_predicates.FilterPredicate | ((entity: _backstage_catalog_model.Entity) => boolean);
|
|
78
79
|
type?: _backstage_plugin_catalog_react_alpha.EntityCardType;
|
|
79
80
|
};
|
|
80
81
|
}>;
|
|
81
|
-
"
|
|
82
|
-
kind: "
|
|
83
|
-
name:
|
|
84
|
-
config: {
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
"page:pagerduty": _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
|
|
83
|
+
kind: "page";
|
|
84
|
+
name: undefined;
|
|
85
|
+
config: {
|
|
86
|
+
path: string | undefined;
|
|
87
|
+
title: string | undefined;
|
|
88
|
+
};
|
|
89
|
+
configInput: {
|
|
90
|
+
path?: string | undefined;
|
|
91
|
+
title?: string | undefined;
|
|
92
|
+
};
|
|
93
|
+
output: _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
|
|
94
|
+
optional: true;
|
|
95
|
+
}> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.title", {
|
|
96
|
+
optional: true;
|
|
97
|
+
}> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.IconElement, "core.icon", {
|
|
98
|
+
optional: true;
|
|
99
|
+
}>;
|
|
100
|
+
inputs: {
|
|
101
|
+
pages: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
|
|
102
|
+
optional: true;
|
|
103
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.title", {
|
|
104
|
+
optional: true;
|
|
105
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.IconElement, "core.icon", {
|
|
106
|
+
optional: true;
|
|
107
|
+
}>, {
|
|
108
|
+
singleton: false;
|
|
109
|
+
optional: false;
|
|
110
|
+
internal: false;
|
|
111
|
+
}>;
|
|
112
|
+
};
|
|
113
|
+
params: {
|
|
114
|
+
path: string;
|
|
115
|
+
title?: string;
|
|
116
|
+
icon?: _backstage_frontend_plugin_api.IconElement;
|
|
117
|
+
loader?: () => Promise<react.JSX.Element>;
|
|
118
|
+
routeRef?: _backstage_frontend_plugin_api.RouteRef;
|
|
119
|
+
noHeader?: boolean;
|
|
120
|
+
};
|
|
121
|
+
}>;
|
|
122
|
+
"sub-page:pagerduty/configuration": _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
|
|
123
|
+
kind: "sub-page";
|
|
124
|
+
name: "configuration";
|
|
125
|
+
config: {
|
|
126
|
+
path: string | undefined;
|
|
127
|
+
title: string | undefined;
|
|
128
|
+
};
|
|
129
|
+
configInput: {
|
|
130
|
+
path?: string | undefined;
|
|
131
|
+
title?: string | undefined;
|
|
132
|
+
};
|
|
133
|
+
output: _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
|
|
134
|
+
optional: true;
|
|
135
|
+
}> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.title", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.IconElement, "core.icon", {
|
|
136
|
+
optional: true;
|
|
137
|
+
}>;
|
|
138
|
+
inputs: {};
|
|
139
|
+
params: {
|
|
140
|
+
path: string;
|
|
87
141
|
title: string;
|
|
88
|
-
icon
|
|
89
|
-
|
|
90
|
-
|
|
142
|
+
icon?: _backstage_frontend_plugin_api.IconElement;
|
|
143
|
+
loader: () => Promise<JSX.Element>;
|
|
144
|
+
routeRef?: _backstage_frontend_plugin_api.RouteRef;
|
|
145
|
+
};
|
|
146
|
+
}>;
|
|
147
|
+
"sub-page:pagerduty/custom-fields": _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
|
|
148
|
+
kind: "sub-page";
|
|
149
|
+
name: "custom-fields";
|
|
150
|
+
config: {
|
|
151
|
+
path: string | undefined;
|
|
152
|
+
title: string | undefined;
|
|
153
|
+
};
|
|
154
|
+
configInput: {
|
|
155
|
+
path?: string | undefined;
|
|
156
|
+
title?: string | undefined;
|
|
157
|
+
};
|
|
158
|
+
output: _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
|
|
159
|
+
optional: true;
|
|
160
|
+
}> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.title", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.IconElement, "core.icon", {
|
|
161
|
+
optional: true;
|
|
162
|
+
}>;
|
|
91
163
|
inputs: {};
|
|
92
164
|
params: {
|
|
165
|
+
path: string;
|
|
93
166
|
title: string;
|
|
94
|
-
icon
|
|
95
|
-
|
|
167
|
+
icon?: _backstage_frontend_plugin_api.IconElement;
|
|
168
|
+
loader: () => Promise<JSX.Element>;
|
|
169
|
+
routeRef?: _backstage_frontend_plugin_api.RouteRef;
|
|
96
170
|
};
|
|
97
171
|
}>;
|
|
98
|
-
"page:pagerduty": _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
|
|
99
|
-
kind: "page";
|
|
100
|
-
name:
|
|
172
|
+
"sub-page:pagerduty/service-mapping": _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
|
|
173
|
+
kind: "sub-page";
|
|
174
|
+
name: "service-mapping";
|
|
101
175
|
config: {
|
|
102
176
|
path: string | undefined;
|
|
177
|
+
title: string | undefined;
|
|
103
178
|
};
|
|
104
179
|
configInput: {
|
|
105
180
|
path?: string | undefined;
|
|
181
|
+
title?: string | undefined;
|
|
106
182
|
};
|
|
107
183
|
output: _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
|
|
108
184
|
optional: true;
|
|
185
|
+
}> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.title", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.IconElement, "core.icon", {
|
|
186
|
+
optional: true;
|
|
109
187
|
}>;
|
|
110
188
|
inputs: {};
|
|
111
189
|
params: {
|
|
112
|
-
defaultPath?: [Error: `Use the 'path' param instead`];
|
|
113
190
|
path: string;
|
|
191
|
+
title: string;
|
|
192
|
+
icon?: _backstage_frontend_plugin_api.IconElement;
|
|
114
193
|
loader: () => Promise<JSX.Element>;
|
|
115
194
|
routeRef?: _backstage_frontend_plugin_api.RouteRef;
|
|
116
195
|
};
|
package/dist/api/client.esm.js
CHANGED
|
@@ -9,6 +9,22 @@ class ForbiddenError extends Error {
|
|
|
9
9
|
const pagerDutyApiRef = createApiRef({
|
|
10
10
|
id: "plugin.pagerduty.api"
|
|
11
11
|
});
|
|
12
|
+
function parseCustomFieldError(error, fallbackMessage) {
|
|
13
|
+
if (error instanceof Error) {
|
|
14
|
+
const msg = error.message;
|
|
15
|
+
if (msg.includes("already been taken")) {
|
|
16
|
+
return { status: "error", data: null, error: "A custom field with this name already exists" };
|
|
17
|
+
}
|
|
18
|
+
if (msg.toLowerCase().includes("entity path already exists")) {
|
|
19
|
+
return { status: "error", data: null, error: "A custom field with this entity path already exists" };
|
|
20
|
+
}
|
|
21
|
+
if (msg.toLowerCase().includes("limit reached")) {
|
|
22
|
+
return { status: "error", data: null, error: "Custom field limit reached. Maximum number of custom fields has been exceeded." };
|
|
23
|
+
}
|
|
24
|
+
return { status: "error", data: null, error: msg };
|
|
25
|
+
}
|
|
26
|
+
return { status: "error", data: null, error: fallbackMessage };
|
|
27
|
+
}
|
|
12
28
|
class PagerDutyClient {
|
|
13
29
|
constructor(config) {
|
|
14
30
|
this.config = config;
|
|
@@ -302,6 +318,126 @@ class PagerDutyClient {
|
|
|
302
318
|
const response = await this.findByUrl(url);
|
|
303
319
|
return response.accounts;
|
|
304
320
|
}
|
|
321
|
+
async createCustomField(request, account) {
|
|
322
|
+
const body = JSON.stringify(request);
|
|
323
|
+
const options = {
|
|
324
|
+
method: "POST",
|
|
325
|
+
headers: {
|
|
326
|
+
"Content-Type": "application/json; charset=UTF-8",
|
|
327
|
+
Accept: "application/json, text/plain, */*"
|
|
328
|
+
},
|
|
329
|
+
body
|
|
330
|
+
};
|
|
331
|
+
let url = `${await this.config.discoveryApi.getBaseUrl(
|
|
332
|
+
"pagerduty"
|
|
333
|
+
)}/custom-fields`;
|
|
334
|
+
if (account) {
|
|
335
|
+
url = url.concat(`?account=${account}`);
|
|
336
|
+
}
|
|
337
|
+
try {
|
|
338
|
+
const response = await this.request(url, options);
|
|
339
|
+
const result = await response.json();
|
|
340
|
+
return { status: "ok", data: result.customField, error: null };
|
|
341
|
+
} catch (error) {
|
|
342
|
+
return parseCustomFieldError(error, "Failed to create custom field");
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
async getCustomFields(account) {
|
|
346
|
+
let url = `${await this.config.discoveryApi.getBaseUrl(
|
|
347
|
+
"pagerduty"
|
|
348
|
+
)}/custom-fields`;
|
|
349
|
+
if (account) {
|
|
350
|
+
url = url.concat(`?account=${account}`);
|
|
351
|
+
}
|
|
352
|
+
return await this.findByUrl(url);
|
|
353
|
+
}
|
|
354
|
+
async getSyncLogs(account, options) {
|
|
355
|
+
const params = new URLSearchParams();
|
|
356
|
+
if (account) params.set("account", account);
|
|
357
|
+
if (options?.limit) params.set("limit", String(options.limit));
|
|
358
|
+
if (options?.offset !== void 0) params.set("offset", String(options.offset));
|
|
359
|
+
if (options?.search) params.set("search", options.search);
|
|
360
|
+
if (options?.severity) params.set("severity", options.severity);
|
|
361
|
+
if (options?.customFieldName) params.set("customFieldName", options.customFieldName);
|
|
362
|
+
if (options?.entityPath) params.set("entityPath", options.entityPath);
|
|
363
|
+
if (options?.serviceName) params.set("serviceName", options.serviceName);
|
|
364
|
+
const query = params.toString() ? `?${params.toString()}` : "";
|
|
365
|
+
const url = `${await this.config.discoveryApi.getBaseUrl(
|
|
366
|
+
"pagerduty"
|
|
367
|
+
)}/custom-fields/sync-logs${query}`;
|
|
368
|
+
return await this.findByUrl(url);
|
|
369
|
+
}
|
|
370
|
+
async updateCustomField(id, request, account) {
|
|
371
|
+
const body = JSON.stringify(request);
|
|
372
|
+
const options = {
|
|
373
|
+
method: "PUT",
|
|
374
|
+
headers: {
|
|
375
|
+
"Content-Type": "application/json; charset=UTF-8",
|
|
376
|
+
Accept: "application/json, text/plain, */*"
|
|
377
|
+
},
|
|
378
|
+
body
|
|
379
|
+
};
|
|
380
|
+
let url = `${await this.config.discoveryApi.getBaseUrl(
|
|
381
|
+
"pagerduty"
|
|
382
|
+
)}/custom-fields/${id}`;
|
|
383
|
+
if (account) {
|
|
384
|
+
url = url.concat(`?account=${account}`);
|
|
385
|
+
}
|
|
386
|
+
try {
|
|
387
|
+
const response = await this.request(url, options);
|
|
388
|
+
const result = await response.json();
|
|
389
|
+
return { status: "ok", data: result.customField, error: null };
|
|
390
|
+
} catch (error) {
|
|
391
|
+
return parseCustomFieldError(error, "Failed to update custom field");
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
async setCustomFieldEnabled(id, enabled, account) {
|
|
395
|
+
const options = {
|
|
396
|
+
method: "PATCH",
|
|
397
|
+
headers: {
|
|
398
|
+
"Content-Type": "application/json; charset=UTF-8",
|
|
399
|
+
Accept: "application/json, text/plain, */*"
|
|
400
|
+
},
|
|
401
|
+
body: JSON.stringify({ enabled })
|
|
402
|
+
};
|
|
403
|
+
let url = `${await this.config.discoveryApi.getBaseUrl(
|
|
404
|
+
"pagerduty"
|
|
405
|
+
)}/custom-fields/${id}/enabled`;
|
|
406
|
+
if (account) {
|
|
407
|
+
url = url.concat(`?account=${account}`);
|
|
408
|
+
}
|
|
409
|
+
try {
|
|
410
|
+
const response = await this.request(url, options);
|
|
411
|
+
const result = await response.json();
|
|
412
|
+
return { status: "ok", data: result.customField, error: null };
|
|
413
|
+
} catch (error) {
|
|
414
|
+
return parseCustomFieldError(
|
|
415
|
+
error,
|
|
416
|
+
`Failed to ${enabled ? "enable" : "disable"} custom field`
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
async deleteCustomField(id, account) {
|
|
421
|
+
const options = {
|
|
422
|
+
method: "DELETE",
|
|
423
|
+
headers: {
|
|
424
|
+
Accept: "application/json, text/plain, */*"
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
let url = `${await this.config.discoveryApi.getBaseUrl(
|
|
428
|
+
"pagerduty"
|
|
429
|
+
)}/custom-fields/${id}`;
|
|
430
|
+
if (account) {
|
|
431
|
+
url = url.concat(`?account=${account}`);
|
|
432
|
+
}
|
|
433
|
+
try {
|
|
434
|
+
await this.request(url, options);
|
|
435
|
+
return { status: "ok", data: void 0, error: null };
|
|
436
|
+
} catch (error) {
|
|
437
|
+
const result = parseCustomFieldError(error, "Failed to delete custom field");
|
|
438
|
+
return { status: "error", data: null, error: result.error };
|
|
439
|
+
}
|
|
440
|
+
}
|
|
305
441
|
async findByUrl(url) {
|
|
306
442
|
const options = {
|
|
307
443
|
method: "GET",
|